abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cecInt.h File Reference
#include "sat/bsat/satSolver.h"
#include "misc/bar/bar.h"
#include "aig/gia/gia.h"
#include "cec.h"

Go to the source code of this file.

Data Structures

struct  Cec_ManPat_t_
 
struct  Cec_ManSat_t_
 
struct  Cec_ManSim_t_
 
struct  Cec_ManFra_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Cec_ManPat_t_ 
Cec_ManPat_t
 INCLUDES ///. More...
 
typedef struct Cec_ManSat_t_ Cec_ManSat_t
 
typedef struct Cec_ManSim_t_ Cec_ManSim_t
 
typedef struct Cec_ManFra_t_ Cec_ManFra_t
 

Functions

void Cec_ManRefinedClassPrintStats (Gia_Man_t *p, Vec_Str_t *vStatus, int iIter, abctime Time)
 MACRO DEFINITIONS ///. More...
 
int Cec_ManSimClassRemoveOne (Cec_ManSim_t *p, int i)
 
int Cec_ManSimClassesPrepare (Cec_ManSim_t *p, int LevelMax)
 
int Cec_ManSimClassesRefine (Cec_ManSim_t *p)
 
int Cec_ManSimSimulateRound (Cec_ManSim_t *p, Vec_Ptr_t *vInfoCis, Vec_Ptr_t *vInfoCos)
 
int * Cec_ManDetectIsomorphism (Gia_Man_t *p)
 
Cec_ManSat_tCec_ManSatCreate (Gia_Man_t *pAig, Cec_ParSat_t *pPars)
 DECLARATIONS ///. More...
 
void Cec_ManSatPrintStats (Cec_ManSat_t *p)
 
void Cec_ManSatStop (Cec_ManSat_t *p)
 
Cec_ManPat_tCec_ManPatStart ()
 
void Cec_ManPatPrintStats (Cec_ManPat_t *p)
 
void Cec_ManPatStop (Cec_ManPat_t *p)
 
Cec_ManSim_tCec_ManSimStart (Gia_Man_t *pAig, Cec_ParSim_t *pPars)
 
void Cec_ManSimStop (Cec_ManSim_t *p)
 
Cec_ManFra_tCec_ManFraStart (Gia_Man_t *pAig, Cec_ParFra_t *pPars)
 
void Cec_ManFraStop (Cec_ManFra_t *p)
 
void Cec_ManPatSavePattern (Cec_ManPat_t *pPat, Cec_ManSat_t *p, Gia_Obj_t *pObj)
 
void Cec_ManPatSavePatternCSat (Cec_ManPat_t *pMan, Vec_Int_t *vPat)
 
Vec_Ptr_tCec_ManPatCollectPatterns (Cec_ManPat_t *pMan, int nInputs, int nWords)
 
Vec_Ptr_tCec_ManPatPackPatterns (Vec_Int_t *vCexStore, int nInputs, int nRegs, int nWordsInit)
 
int Cec_ManSeqResimulate (Cec_ManSim_t *p, Vec_Ptr_t *vInfo)
 
int Cec_ManSeqResimulateInfo (Gia_Man_t *pAig, Vec_Ptr_t *vSimInfo, Abc_Cex_t *pBestState, int fCheckMiter)
 
void Cec_ManSeqDeriveInfoInitRandom (Vec_Ptr_t *vInfo, Gia_Man_t *pAig, Abc_Cex_t *pCex)
 
int Cec_ManCountNonConstOutputs (Gia_Man_t *pAig)
 
int Cec_ManCheckNonTrivialCands (Gia_Man_t *pAig)
 
int Cec_ObjSatVarValue (Cec_ManSat_t *p, Gia_Obj_t *pObj)
 FUNCTION DEFINITIONS ///. More...
 
void Cec_ManSatSolve (Cec_ManPat_t *pPat, Gia_Man_t *pAig, Cec_ParSat_t *pPars)
 
void Cec_ManSatSolveCSat (Cec_ManPat_t *pPat, Gia_Man_t *pAig, Cec_ParSat_t *pPars)
 
Vec_Str_tCec_ManSatSolveSeq (Vec_Ptr_t *vPatts, Gia_Man_t *pAig, Cec_ParSat_t *pPars, int nRegs, int *pnPats)
 
Vec_Int_tCec_ManSatSolveMiter (Gia_Man_t *pAig, Cec_ParSat_t *pPars, Vec_Str_t **pvStatus)
 
int Cec_ManSatCheckNode (Cec_ManSat_t *p, Gia_Obj_t *pObj)
 
int Cec_ManSatCheckNodeTwo (Cec_ManSat_t *p, Gia_Obj_t *pObj1, Gia_Obj_t *pObj2)
 
void Cec_ManSavePattern (Cec_ManSat_t *p, Gia_Obj_t *pObj1, Gia_Obj_t *pObj2)
 
Vec_Int_tCec_ManSatReadCex (Cec_ManSat_t *p)
 
Gia_Man_tCec_ManFraSpecReduction (Cec_ManFra_t *p)
 DECLARATIONS ///. More...
 
int Cec_ManFraClassesUpdate (Cec_ManFra_t *p, Cec_ManSim_t *pSim, Cec_ManPat_t *pPat, Gia_Man_t *pNew)
 

Typedef Documentation

typedef struct Cec_ManFra_t_ Cec_ManFra_t

Definition at line 145 of file cecInt.h.

typedef typedefABC_NAMESPACE_HEADER_START struct Cec_ManPat_t_ Cec_ManPat_t

INCLUDES ///.

CFile****************************************************************

FileName [cecInt.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Combinational equivalence checking.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
cecInt.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 48 of file cecInt.h.

typedef struct Cec_ManSat_t_ Cec_ManSat_t

Definition at line 74 of file cecInt.h.

typedef struct Cec_ManSim_t_ Cec_ManSim_t

Definition at line 111 of file cecInt.h.

Function Documentation

int Cec_ManCheckNonTrivialCands ( Gia_Man_t pAig)

Function*************************************************************

Synopsis [Returns the number of POs that are not const0 cands.]

Description []

SideEffects []

SeeAlso []

Definition at line 295 of file cecSeq.c.

296 {
297  Gia_Obj_t * pObj;
298  int i, RetValue = 0;
299  if ( pAig->pReprs == NULL )
300  return 0;
301  // label internal nodes driving POs
302  Gia_ManForEachPo( pAig, pObj, i )
303  Gia_ObjFanin0(pObj)->fMark0 = 1;
304  // check if there are non-labled equivs
305  Gia_ManForEachObj( pAig, pObj, i )
306  if ( Gia_ObjIsCand(pObj) && !pObj->fMark0 && Gia_ObjRepr(pAig, i) != GIA_VOID )
307  {
308  RetValue = 1;
309  break;
310  }
311  // clean internal nodes driving POs
312  Gia_ManForEachPo( pAig, pObj, i )
313  Gia_ObjFanin0(pObj)->fMark0 = 0;
314  return RetValue;
315 }
static int Gia_ObjIsCand(Gia_Obj_t *pObj)
Definition: gia.h:429
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
if(last==0)
Definition: sparse_int.h:34
#define GIA_VOID
Definition: gia.h:45
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
int Cec_ManCountNonConstOutputs ( Gia_Man_t pAig)

Function*************************************************************

Synopsis [Returns the number of POs that are not const0 cands.]

Description []

SideEffects []

SeeAlso []

Definition at line 272 of file cecSeq.c.

273 {
274  Gia_Obj_t * pObj;
275  int i, Counter = 0;
276  if ( pAig->pReprs == NULL )
277  return -1;
278  Gia_ManForEachPo( pAig, pObj, i )
279  if ( !Gia_ObjIsConst( pAig, Gia_ObjFaninId0p(pAig, pObj) ) )
280  Counter++;
281  return Counter;
282 }
Definition: gia.h:75
static int Gia_ObjIsConst(Gia_Man_t *p, int Id)
Definition: gia.h:915
if(last==0)
Definition: sparse_int.h:34
static int Counter
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
int* Cec_ManDetectIsomorphism ( Gia_Man_t p)

Function*************************************************************

Synopsis [Finds node correspondences in the miter.]

Description [Assumes that the colors are assigned.]

SideEffects []

SeeAlso []

Definition at line 297 of file cecIso.c.

298 {
299  int nWords = 2;
300  Gia_Obj_t * pObj;
301  Vec_Int_t * vNodesA, * vNodesB;
302  unsigned * pStore, Counter;
303  int i, * pIso, * pTable, nTableSize;
304  // start equivalence classes
305  pIso = ABC_CALLOC( int, Gia_ManObjNum(p) );
306  Gia_ManForEachObj( p, pObj, i )
307  {
308  if ( Gia_ObjIsCo(pObj) )
309  {
310  assert( Gia_ObjColors(p, i) == 0 );
311  continue;
312  }
313  assert( Gia_ObjColors(p, i) );
314  if ( Gia_ObjColors(p, i) == 3 )
315  pIso[i] = i;
316  }
317  // start simulation info
318  pStore = ABC_ALLOC( unsigned, Gia_ManObjNum(p) * nWords );
319  // simulate and create table
320  nTableSize = Abc_PrimeCudd( 100 + Gia_ManObjNum(p)/2 );
321  pTable = ABC_CALLOC( int, nTableSize );
322  Gia_ManCleanValue( p );
323  Gia_ManForEachObj1( p, pObj, i )
324  {
325  if ( Gia_ObjIsCo(pObj) )
326  continue;
327  if ( pIso[i] == 0 ) // simulate
328  Gia_ManIsoSimulate( pObj, i, pStore, nWords );
329  else if ( pIso[i] < i ) // copy
330  Gia_ManIsoCopy( i, pIso[i], pStore, nWords );
331  else // generate
332  Gia_ManIsoRandom( i, pStore, nWords );
333  if ( pIso[i] == 0 )
334  Gia_ManIsoTableAdd( p, i, pStore, nWords, pTable, nTableSize );
335  }
336  // create equivalence classes
337  vNodesA = Vec_IntAlloc( 100 );
338  vNodesB = Vec_IntAlloc( 100 );
339  for ( i = 0; i < nTableSize; i++ )
340  if ( Gia_ManIsoExtractClasses( p, pTable[i], pStore, nWords, vNodesA, vNodesB ) )
341  Gia_ManIsoMatchNodes( pIso, pStore, nWords, vNodesA, vNodesB );
342  Vec_IntFree( vNodesA );
343  Vec_IntFree( vNodesB );
344  // collect info
345  Counter = 0;
346  Gia_ManForEachObj1( p, pObj, i )
347  {
348  Counter += (pIso[i] && pIso[i] < i);
349 /*
350  if ( pIso[i] && pIso[i] < i )
351  {
352  if ( (Gia_ObjIsHead(p,pIso[i]) && Gia_ObjRepr(p,i)==pIso[i]) ||
353  (Gia_ObjIsClass(p,pIso[i]) && Gia_ObjRepr(p,i)==Gia_ObjRepr(p,pIso[i])) )
354  Abc_Print( 1, "1" );
355  else
356  Abc_Print( 1, "0" );
357  }
358 */
359  }
360  Abc_Print( 1, "Computed %d pairs of structurally equivalent nodes.\n", Counter );
361 // p->pIso = pIso;
362 // Cec_ManTransformClasses( p );
363 
364  ABC_FREE( pTable );
365  ABC_FREE( pStore );
366  return pIso;
367 }
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
static void Gia_ManIsoMatchNodes(int *pIso, unsigned *pStore, int nWords, Vec_Int_t *vNodesA, Vec_Int_t *vNodesB)
Definition: cecIso.c:239
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Gia_ManCleanValue(Gia_Man_t *p)
Definition: giaUtil.c:310
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nWords
Definition: abcNpn.c:127
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Gia_ManIsoCopy(int IdDest, int IdSour, unsigned *pStore, int nWords)
Definition: cecIso.c:84
static void Gia_ManIsoSimulate(Gia_Obj_t *pObj, int Id, unsigned *pStore, int nWords)
FUNCTION DEFINITIONS ///.
Definition: cecIso.c:47
static int Counter
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Gia_ObjColors(Gia_Man_t *p, int Id)
Definition: gia.h:904
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static int Gia_ManIsoExtractClasses(Gia_Man_t *p, int Bin, unsigned *pStore, int nWords, Vec_Int_t *vNodesA, Vec_Int_t *vNodesB)
Definition: cecIso.c:206
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static void Gia_ManIsoRandom(int Id, unsigned *pStore, int nWords)
Definition: cecIso.c:126
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static void Gia_ManIsoTableAdd(Gia_Man_t *p, int Id, unsigned *pStore, int nWords, int *pTable, int nTableSize)
Definition: cecIso.c:170
int Cec_ManFraClassesUpdate ( Cec_ManFra_t p,
Cec_ManSim_t pSim,
Cec_ManPat_t pPat,
Gia_Man_t pNew 
)

Function*************************************************************

Synopsis [Updates equivalence classes using the patterns.]

Description []

SideEffects []

SeeAlso []

Definition at line 188 of file cecSweep.c.

189 {
190  Vec_Ptr_t * vInfo;
191  Gia_Obj_t * pObj, * pObjOld, * pReprOld;
192  int i, k, iRepr, iNode;
193  abctime clk;
194 clk = Abc_Clock();
195  vInfo = Cec_ManPatCollectPatterns( pPat, Gia_ManCiNum(p->pAig), pSim->nWords );
196 p->timePat += Abc_Clock() - clk;
197 clk = Abc_Clock();
198  if ( vInfo != NULL )
199  {
201  for ( i = 0; i < pPat->nSeries; i++ )
202  {
203  Cec_ManFraCreateInfo( pSim, pSim->vCiSimInfo, vInfo, i );
204  if ( Cec_ManSimSimulateRound( pSim, pSim->vCiSimInfo, pSim->vCoSimInfo ) )
205  {
206  Vec_PtrFree( vInfo );
207  return 1;
208  }
209  }
210  Vec_PtrFree( vInfo );
211  }
212 p->timeSim += Abc_Clock() - clk;
213  assert( Vec_IntSize(p->vXorNodes) == 2*Gia_ManCoNum(pNew) );
214  // mark the transitive fanout of failed nodes
215  if ( p->pPars->nDepthMax != 1 )
216  {
217  Gia_ManCleanMark0( p->pAig );
218  Gia_ManCleanMark1( p->pAig );
219  Gia_ManForEachCo( pNew, pObj, k )
220  {
221  iRepr = Vec_IntEntry( p->vXorNodes, 2*k );
222  iNode = Vec_IntEntry( p->vXorNodes, 2*k+1 );
223  if ( pObj->fMark0 == 0 && pObj->fMark1 == 1 ) // proved
224  continue;
225 // Gia_ManObj(p->pAig, iRepr)->fMark0 = 1;
226  Gia_ManObj(p->pAig, iNode)->fMark0 = 1;
227  }
228  // mark the nodes reachable through the failed nodes
229  Gia_ManForEachAnd( p->pAig, pObjOld, k )
230  pObjOld->fMark0 |= (Gia_ObjFanin0(pObjOld)->fMark0 | Gia_ObjFanin1(pObjOld)->fMark0);
231  // unmark the disproved nodes
232  Gia_ManForEachCo( pNew, pObj, k )
233  {
234  iRepr = Vec_IntEntry( p->vXorNodes, 2*k );
235  iNode = Vec_IntEntry( p->vXorNodes, 2*k+1 );
236  if ( pObj->fMark0 == 0 && pObj->fMark1 == 1 ) // proved
237  continue;
238  pObjOld = Gia_ManObj(p->pAig, iNode);
239  assert( pObjOld->fMark0 == 1 );
240  if ( Gia_ObjFanin0(pObjOld)->fMark0 == 0 && Gia_ObjFanin1(pObjOld)->fMark0 == 0 )
241  pObjOld->fMark1 = 1;
242  }
243  // clean marks
244  Gia_ManForEachAnd( p->pAig, pObjOld, k )
245  if ( pObjOld->fMark1 )
246  {
247  pObjOld->fMark0 = 0;
248  pObjOld->fMark1 = 0;
249  }
250  }
251  // set the results
252  p->nAllProved = p->nAllDisproved = p->nAllFailed = 0;
253  Gia_ManForEachCo( pNew, pObj, k )
254  {
255  iRepr = Vec_IntEntry( p->vXorNodes, 2*k );
256  iNode = Vec_IntEntry( p->vXorNodes, 2*k+1 );
257  pReprOld = Gia_ManObj(p->pAig, iRepr);
258  pObjOld = Gia_ManObj(p->pAig, iNode);
259  if ( pObj->fMark1 )
260  { // proved
261  assert( pObj->fMark0 == 0 );
262  assert( !Gia_ObjProved(p->pAig, iNode) );
263  if ( pReprOld->fMark0 == 0 && pObjOld->fMark0 == 0 )
264 // if ( pObjOld->fMark0 == 0 )
265  {
266  assert( iRepr == Gia_ObjRepr(p->pAig, iNode) );
267  Gia_ObjSetProved( p->pAig, iNode );
268  p->nAllProved++;
269  }
270  }
271  else if ( pObj->fMark0 )
272  { // disproved
273  assert( pObj->fMark1 == 0 );
274  if ( pReprOld->fMark0 == 0 && pObjOld->fMark0 == 0 )
275 // if ( pObjOld->fMark0 == 0 )
276  {
277  if ( iRepr == Gia_ObjRepr(p->pAig, iNode) )
278  Abc_Print( 1, "Cec_ManFraClassesUpdate(): Error! Node is not refined!\n" );
279  p->nAllDisproved++;
280  }
281  }
282  else
283  { // failed
284  assert( pObj->fMark0 == 0 );
285  assert( pObj->fMark1 == 0 );
286  assert( !Gia_ObjFailed(p->pAig, iNode) );
287  assert( !Gia_ObjProved(p->pAig, iNode) );
288  Gia_ObjSetFailed( p->pAig, iNode );
289  p->nAllFailed++;
290  }
291  }
292  return 0;
293 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
abctime timeSim
Definition: cecInt.h:157
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
int Cec_ManSimSimulateRound(Cec_ManSim_t *p, Vec_Ptr_t *vInfoCis, Vec_Ptr_t *vInfoCos)
Definition: cecClass.c:652
void Cec_ManFraCreateInfo(Cec_ManSim_t *p, Vec_Ptr_t *vCiInfo, Vec_Ptr_t *vInfo, int nSeries)
Definition: cecSweep.c:163
int nAllFailed
Definition: cecInt.h:155
Vec_Int_t * vXorNodes
Definition: cecInt.h:152
unsigned fMark1
Definition: gia.h:84
static abctime Abc_Clock()
Definition: abc_global.h:279
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
void Gia_ManCleanMark1(Gia_Man_t *p)
Definition: giaUtil.c:272
int nAllDisproved
Definition: cecInt.h:154
void Gia_ManCreateValueRefs(Gia_Man_t *p)
Definition: giaUtil.c:687
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetProved(Gia_Man_t *p, int Id)
Definition: gia.h:897
int nWords
Definition: cecInt.h:117
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Ptr_t * vCiSimInfo
Definition: cecInt.h:127
if(last==0)
Definition: sparse_int.h:34
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
Vec_Ptr_t * Cec_ManPatCollectPatterns(Cec_ManPat_t *pMan, int nInputs, int nWords)
Definition: cecPat.c:455
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
unsigned fMark0
Definition: gia.h:79
int nDepthMax
Definition: cec.h:103
Gia_Man_t * pAig
Definition: cecInt.h:149
Vec_Ptr_t * vCoSimInfo
Definition: cecInt.h:128
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static int Gia_ObjFailed(Gia_Man_t *p, int Id)
Definition: gia.h:900
static int Gia_ObjProved(Gia_Man_t *p, int Id)
Definition: gia.h:896
#define assert(ex)
Definition: util_old.h:213
abctime timePat
Definition: cecInt.h:158
ABC_INT64_T abctime
Definition: abc_global.h:278
int nAllProved
Definition: cecInt.h:153
static void Gia_ObjSetFailed(Gia_Man_t *p, int Id)
Definition: gia.h:901
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Cec_ParFra_t * pPars
Definition: cecInt.h:150
Gia_Man_t* Cec_ManFraSpecReduction ( Cec_ManFra_t p)

DECLARATIONS ///.

CFile****************************************************************

FileName [cecSweep.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Combinational equivalence checking.]

Synopsis [SAT sweeping manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
cecSweep.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Performs limited speculative reduction.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file cecSweep.c.

46 {
47  Gia_Man_t * pNew, * pTemp;
48  Gia_Obj_t * pObj, * pRepr = NULL;
49  int iRes0, iRes1, iRepr, iNode, iMiter;
50  int i, fCompl, * piCopies, * pDepths;
51  Gia_ManSetPhase( p->pAig );
52  Vec_IntClear( p->vXorNodes );
53  if ( p->pPars->nLevelMax )
54  Gia_ManLevelNum( p->pAig );
55  pNew = Gia_ManStart( Gia_ManObjNum(p->pAig) );
56  pNew->pName = Abc_UtilStrsav( p->pAig->pName );
57  pNew->pSpec = Abc_UtilStrsav( p->pAig->pName );
58  Gia_ManHashAlloc( pNew );
59  piCopies = ABC_FALLOC( int, Gia_ManObjNum(p->pAig) );
60  pDepths = ABC_CALLOC( int, Gia_ManObjNum(p->pAig) );
61  piCopies[0] = 0;
62  Gia_ManForEachObj1( p->pAig, pObj, i )
63  {
64  if ( Gia_ObjIsCi(pObj) )
65  {
66  piCopies[i] = Gia_ManAppendCi( pNew );
67  continue;
68  }
69  if ( Gia_ObjIsCo(pObj) )
70  continue;
71  if ( piCopies[Gia_ObjFaninId0(pObj,i)] == -1 ||
72  piCopies[Gia_ObjFaninId1(pObj,i)] == -1 )
73  continue;
74  iRes0 = Abc_LitNotCond( piCopies[Gia_ObjFaninId0(pObj,i)], Gia_ObjFaninC0(pObj) );
75  iRes1 = Abc_LitNotCond( piCopies[Gia_ObjFaninId1(pObj,i)], Gia_ObjFaninC1(pObj) );
76  iNode = piCopies[i] = Gia_ManHashAnd( pNew, iRes0, iRes1 );
77  pDepths[i] = Abc_MaxInt( pDepths[Gia_ObjFaninId0(pObj,i)], pDepths[Gia_ObjFaninId1(pObj,i)] );
78  if ( Gia_ObjRepr(p->pAig, i) == GIA_VOID || Gia_ObjFailed(p->pAig, i) )
79  continue;
80  assert( Gia_ObjRepr(p->pAig, i) < i );
81  iRepr = piCopies[Gia_ObjRepr(p->pAig, i)];
82  if ( iRepr == -1 )
83  continue;
84  if ( Abc_LitRegular(iNode) == Abc_LitRegular(iRepr) )
85  continue;
86  if ( p->pPars->nLevelMax &&
87  (Gia_ObjLevelId(p->pAig, i) > p->pPars->nLevelMax ||
88  Gia_ObjLevelId(p->pAig, Abc_Lit2Var(iRepr)) > p->pPars->nLevelMax) )
89  continue;
90  if ( p->pPars->fDualOut )
91  {
92 // if ( i % 1000 == 0 && Gia_ObjRepr(p->pAig, i) )
93 // Gia_ManEquivPrintOne( p->pAig, Gia_ObjRepr(p->pAig, i), 0 );
94  if ( p->pPars->fColorDiff )
95  {
96  if ( !Gia_ObjDiffColors( p->pAig, Gia_ObjRepr(p->pAig, i), i ) )
97  continue;
98  }
99  else
100  {
101  if ( !Gia_ObjDiffColors2( p->pAig, Gia_ObjRepr(p->pAig, i), i ) )
102  continue;
103  }
104  }
105  pRepr = Gia_ManObj( p->pAig, Gia_ObjRepr(p->pAig, i) );
106  fCompl = Gia_ObjPhaseReal(pObj) ^ Gia_ObjPhaseReal(pRepr);
107  piCopies[i] = Abc_LitNotCond( iRepr, fCompl );
108  if ( Gia_ObjProved(p->pAig, i) )
109  continue;
110  // produce speculative miter
111  iMiter = Gia_ManHashXor( pNew, iNode, piCopies[i] );
112  Gia_ManAppendCo( pNew, iMiter );
113  Vec_IntPush( p->vXorNodes, Gia_ObjRepr(p->pAig, i) );
114  Vec_IntPush( p->vXorNodes, i );
115  // add to the depth of this node
116  pDepths[i] = 1 + Abc_MaxInt( pDepths[i], pDepths[Gia_ObjRepr(p->pAig, i)] );
117  if ( p->pPars->nDepthMax && pDepths[i] >= p->pPars->nDepthMax )
118  piCopies[i] = -1;
119  }
120  ABC_FREE( piCopies );
121  ABC_FREE( pDepths );
122  Gia_ManHashStop( pNew );
123  Gia_ManSetRegNum( pNew, 0 );
124  pNew = Gia_ManCleanup( pTemp = pNew );
125  Gia_ManStop( pTemp );
126  return pNew;
127 }
static int Gia_ObjLevelId(Gia_Man_t *p, int Id)
Definition: gia.h:500
static int Gia_ObjPhaseReal(Gia_Obj_t *pObj)
Definition: gia.h:416
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:658
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
Vec_Int_t * vXorNodes
Definition: cecInt.h:152
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Definition: gia.h:75
static int Gia_ObjDiffColors2(Gia_Man_t *p, int i, int j)
Definition: gia.h:909
int fDualOut
Definition: cec.h:107
char * pName
Definition: gia.h:97
int fColorDiff
Definition: cec.h:108
static int Gia_ObjDiffColors(Gia_Man_t *p, int i, int j)
Definition: gia.h:908
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define GIA_VOID
Definition: gia.h:45
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
int nDepthMax
Definition: cec.h:103
int nLevelMax
Definition: cec.h:102
Gia_Man_t * pAig
Definition: cecInt.h:149
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static int Gia_ObjFailed(Gia_Man_t *p, int Id)
Definition: gia.h:900
static int Gia_ObjProved(Gia_Man_t *p, int Id)
Definition: gia.h:896
static int Abc_LitRegular(int Lit)
Definition: abc_global.h:268
#define assert(ex)
Definition: util_old.h:213
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
#define ABC_FALLOC(type, num)
Definition: abc_global.h:231
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
Cec_ParFra_t * pPars
Definition: cecInt.h:150
Cec_ManFra_t* Cec_ManFraStart ( Gia_Man_t pAig,
Cec_ParFra_t pPars 
)

Function*************************************************************

Synopsis [Creates AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 262 of file cecMan.c.

263 {
264  Cec_ManFra_t * p;
265  p = ABC_ALLOC( Cec_ManFra_t, 1 );
266  memset( p, 0, sizeof(Cec_ManFra_t) );
267  p->pAig = pAig;
268  p->pPars = pPars;
269  p->vXorNodes = Vec_IntAlloc( 1000 );
270  return p;
271 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Vec_Int_t * vXorNodes
Definition: cecInt.h:152
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Gia_Man_t * pAig
Definition: cecInt.h:149
Cec_ParFra_t * pPars
Definition: cecInt.h:150
void Cec_ManFraStop ( Cec_ManFra_t p)

Function*************************************************************

Synopsis [Deletes AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 284 of file cecMan.c.

285 {
286  Vec_IntFree( p->vXorNodes );
287  ABC_FREE( p );
288 }
Vec_Int_t * vXorNodes
Definition: cecInt.h:152
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Ptr_t* Cec_ManPatCollectPatterns ( Cec_ManPat_t pMan,
int  nInputs,
int  nWordsInit 
)

Function*************************************************************

Synopsis [Packs patterns into array of simulation info.]

Description []

SideEffects []

SeeAlso []

Definition at line 455 of file cecPat.c.

456 {
457  Vec_Int_t * vPat = pMan->vPattern1;
458  Vec_Ptr_t * vInfo, * vPres;
459  int k, kMax = -1, nPatterns = 0;
460  int iStartOld = pMan->iStart;
461  int nWords = nWordsInit;
462  int nBits = 32 * nWords;
463  abctime clk = Abc_Clock();
464  vInfo = Vec_PtrAllocSimInfo( nInputs, nWords );
465  Gia_ManRandomInfo( vInfo, 0, 0, nWords );
466  vPres = Vec_PtrAllocSimInfo( nInputs, nWords );
467  Vec_PtrCleanSimInfo( vPres, 0, nWords );
468  while ( pMan->iStart < Vec_StrSize(pMan->vStorage) )
469  {
470  nPatterns++;
471  Cec_ManPatRestore( pMan, vPat );
472  for ( k = 1; k < nBits; k++, k += ((k % (32 * nWordsInit)) == 0) )
473  if ( Cec_ManPatCollectTry( vInfo, vPres, k, (int *)Vec_IntArray(vPat), Vec_IntSize(vPat) ) )
474  break;
475  kMax = Abc_MaxInt( kMax, k );
476  if ( k == nBits-1 )
477  {
478  Vec_PtrReallocSimInfo( vInfo );
479  Gia_ManRandomInfo( vInfo, 0, nWords, 2*nWords );
480  Vec_PtrReallocSimInfo( vPres );
481  Vec_PtrCleanSimInfo( vPres, nWords, 2*nWords );
482  nWords *= 2;
483  nBits *= 2;
484  }
485  }
486  Vec_PtrFree( vPres );
487  pMan->nSeries = Vec_PtrReadWordsSimInfo(vInfo) / nWordsInit;
488  pMan->timePack += Abc_Clock() - clk;
489  pMan->timeTotal += Abc_Clock() - clk;
490  pMan->iStart = iStartOld;
491  if ( pMan->fVerbose )
492  {
493  Abc_Print( 1, "Total = %5d. Max used = %5d. Full = %5d. Series = %d. ",
494  nPatterns, kMax, nWordsInit*32, pMan->nSeries );
495  ABC_PRT( "Time", Abc_Clock() - clk );
496  Cec_ManPatPrintStats( pMan );
497  }
498  return vInfo;
499 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Cec_ManPatRestore(Cec_ManPat_t *p, Vec_Int_t *vPat)
Definition: cecPat.c:113
void Gia_ManRandomInfo(Vec_Ptr_t *vInfo, int iInputStart, int iWordStart, int iWordStop)
Definition: giaUtil.c:80
static void Vec_PtrCleanSimInfo(Vec_Ptr_t *vInfo, int iWord, int nWords)
Definition: vecPtr.h:968
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int nWords
Definition: abcNpn.c:127
void Cec_ManPatPrintStats(Cec_ManPat_t *p)
Definition: cecMan.c:150
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
static int Vec_PtrReadWordsSimInfo(Vec_Ptr_t *p)
Definition: vecPtr.h:952
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
int Cec_ManPatCollectTry(Vec_Ptr_t *vInfo, Vec_Ptr_t *vPres, int iBit, int *pLits, int nLits)
Definition: cecPat.c:421
#define ABC_PRT(a, t)
Definition: abc_global.h:220
static void Vec_PtrReallocSimInfo(Vec_Ptr_t *vInfo)
Definition: vecPtr.h:1035
ABC_INT64_T abctime
Definition: abc_global.h:278
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Vec_Ptr_t* Cec_ManPatPackPatterns ( Vec_Int_t vCexStore,
int  nInputs,
int  nRegs,
int  nWordsInit 
)

Function*************************************************************

Synopsis [Packs patterns into array of simulation info.]

Description []

SideEffects []

SeeAlso []

Definition at line 513 of file cecPat.c.

514 {
515  Vec_Int_t * vPat;
516  Vec_Ptr_t * vInfo, * vPres;
517  int k, nSize, iStart, kMax = 0, nPatterns = 0;
518  int nWords = nWordsInit;
519  int nBits = 32 * nWords;
520 // int RetValue;
521  assert( nRegs <= nInputs );
522  vPat = Vec_IntAlloc( 100 );
523 
524  vInfo = Vec_PtrAllocSimInfo( nInputs, nWords );
525  Vec_PtrCleanSimInfo( vInfo, 0, nWords );
526  Gia_ManRandomInfo( vInfo, nRegs, 0, nWords );
527 
528  vPres = Vec_PtrAllocSimInfo( nInputs, nWords );
529  Vec_PtrCleanSimInfo( vPres, 0, nWords );
530  iStart = 0;
531  while ( iStart < Vec_IntSize(vCexStore) )
532  {
533  nPatterns++;
534  // skip the output number
535  iStart++;
536  // get the number of items
537  nSize = Vec_IntEntry( vCexStore, iStart++ );
538  if ( nSize <= 0 )
539  continue;
540  // extract pattern
541  Vec_IntClear( vPat );
542  for ( k = 0; k < nSize; k++ )
543  Vec_IntPush( vPat, Vec_IntEntry( vCexStore, iStart++ ) );
544  // add pattern to storage
545  for ( k = 1; k < nBits; k++, k += ((k % (32 * nWordsInit)) == 0) )
546  if ( Cec_ManPatCollectTry( vInfo, vPres, k, (int *)Vec_IntArray(vPat), Vec_IntSize(vPat) ) )
547  break;
548 
549 // k = kMax + 1;
550 // RetValue = Cec_ManPatCollectTry( vInfo, vPres, k, (int *)Vec_IntArray(vPat), Vec_IntSize(vPat) );
551 // assert( RetValue == 1 );
552 
553  kMax = Abc_MaxInt( kMax, k );
554  if ( k == nBits-1 )
555  {
556  Vec_PtrReallocSimInfo( vInfo );
557  Vec_PtrCleanSimInfo( vInfo, nWords, 2*nWords );
558  Gia_ManRandomInfo( vInfo, nRegs, nWords, 2*nWords );
559 
560  Vec_PtrReallocSimInfo( vPres );
561  Vec_PtrCleanSimInfo( vPres, nWords, 2*nWords );
562  nWords *= 2;
563  nBits *= 2;
564  }
565  }
566 // Abc_Print( 1, "packed %d patterns into %d vectors (out of %d)\n", nPatterns, kMax, nBits );
567  Vec_PtrFree( vPres );
568  Vec_IntFree( vPat );
569  return vInfo;
570 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Gia_ManRandomInfo(Vec_Ptr_t *vInfo, int iInputStart, int iWordStart, int iWordStop)
Definition: giaUtil.c:80
static void Vec_PtrCleanSimInfo(Vec_Ptr_t *vInfo, int iWord, int nWords)
Definition: vecPtr.h:968
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int nWords
Definition: abcNpn.c:127
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
int Cec_ManPatCollectTry(Vec_Ptr_t *vInfo, Vec_Ptr_t *vPres, int iBit, int *pLits, int nLits)
Definition: cecPat.c:421
static void Vec_PtrReallocSimInfo(Vec_Ptr_t *vInfo)
Definition: vecPtr.h:1035
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Cec_ManPatPrintStats ( Cec_ManPat_t p)

Function*************************************************************

Synopsis [Creates AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 150 of file cecMan.c.

151 {
152  Abc_Print( 1, "Latest: P = %8d. L = %10d. Lm = %10d. Ave = %6.1f. MEM =%6.2f MB\n",
153  p->nPats, p->nPatLits, p->nPatLitsMin, 1.0 * p->nPatLitsMin/p->nPats,
154  1.0*(Vec_StrSize(p->vStorage)-p->iStart)/(1<<20) );
155  Abc_Print( 1, "Total: P = %8d. L = %10d. Lm = %10d. Ave = %6.1f. MEM =%6.2f MB\n",
156  p->nPatsAll, p->nPatLitsAll, p->nPatLitsMinAll, 1.0 * p->nPatLitsMinAll/p->nPatsAll,
157  1.0*Vec_StrSize(p->vStorage)/(1<<20) );
158  Abc_PrintTimeP( 1, "Finding ", p->timeFind, p->timeTotal );
159  Abc_PrintTimeP( 1, "Shrinking", p->timeShrink, p->timeTotal );
160  Abc_PrintTimeP( 1, "Verifying", p->timeVerify, p->timeTotal );
161  Abc_PrintTimeP( 1, "Sorting ", p->timeSort, p->timeTotal );
162  Abc_PrintTimeP( 1, "Packing ", p->timePack, p->timeTotal );
163  Abc_PrintTime( 1, "TOTAL ", p->timeTotal );
164 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Abc_PrintTimeP(int level, const char *pStr, abctime time, abctime Time)
Definition: abc_global.h:372
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
void Cec_ManPatSavePattern ( Cec_ManPat_t pMan,
Cec_ManSat_t p,
Gia_Obj_t pObj 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 359 of file cecPat.c.

360 {
361  Vec_Int_t * vPat;
362  int nPatLits;
363  abctime clkTotal = Abc_Clock();
364 // abctime clk;
365  assert( Gia_ObjIsCo(pObj) );
366  pMan->nPats++;
367  pMan->nPatsAll++;
368  // compute values in the cone of influence
369 //clk = Abc_Clock();
371  nPatLits = Cec_ManPatComputePattern_rec( p, p->pAig, Gia_ObjFanin0(pObj) );
372  assert( (Gia_ObjFanin0(pObj)->fMark1 ^ Gia_ObjFaninC0(pObj)) == 1 );
373  pMan->nPatLits += nPatLits;
374  pMan->nPatLitsAll += nPatLits;
375 //pMan->timeFind += Abc_Clock() - clk;
376  // compute sensitizing path
377 //clk = Abc_Clock();
378  Vec_IntClear( pMan->vPattern1 );
380  Cec_ManPatComputePattern1_rec( p->pAig, Gia_ObjFanin0(pObj), pMan->vPattern1 );
381  // compute sensitizing path
382  Vec_IntClear( pMan->vPattern2 );
384  Cec_ManPatComputePattern2_rec( p->pAig, Gia_ObjFanin0(pObj), pMan->vPattern2 );
385  // compare patterns
386  vPat = Vec_IntSize(pMan->vPattern1) < Vec_IntSize(pMan->vPattern2) ? pMan->vPattern1 : pMan->vPattern2;
387  pMan->nPatLitsMin += Vec_IntSize(vPat);
388  pMan->nPatLitsMinAll += Vec_IntSize(vPat);
389 //pMan->timeShrink += Abc_Clock() - clk;
390  // verify pattern using ternary simulation
391 //clk = Abc_Clock();
392 // Cec_ManPatVerifyPattern( p->pAig, pObj, vPat );
393 //pMan->timeVerify += Abc_Clock() - clk;
394  // sort pattern
395 //clk = Abc_Clock();
396  Vec_IntSort( vPat, 0 );
397 //pMan->timeSort += Abc_Clock() - clk;
398  // save pattern
399  Cec_ManPatStore( pMan, vPat );
400  pMan->timeTotal += Abc_Clock() - clkTotal;
401 }
int Cec_ManPatComputePattern_rec(Cec_ManSat_t *pSat, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: cecPat.c:140
void Cec_ManPatComputePattern1_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vPat)
Definition: cecPat.c:170
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Gia_Man_t * pAig
Definition: cecInt.h:80
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Vec_IntSort(Vec_Int_t *p, int fReverse)
Definition: vecInt.h:1293
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
void Cec_ManPatComputePattern2_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vPat)
Definition: cecPat.c:208
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
static void Cec_ManPatStore(Cec_ManPat_t *p, Vec_Int_t *vPat)
Definition: cecPat.c:87
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
void Cec_ManPatSavePatternCSat ( Cec_ManPat_t pMan,
Vec_Int_t vPat 
)

Definition at line 402 of file cecPat.c.

403 {
404  // sort pattern
405  Vec_IntSort( vPat, 0 );
406  // save pattern
407  Cec_ManPatStore( pMan, vPat );
408 }
static void Vec_IntSort(Vec_Int_t *p, int fReverse)
Definition: vecInt.h:1293
static void Cec_ManPatStore(Cec_ManPat_t *p, Vec_Int_t *vPat)
Definition: cecPat.c:87
Cec_ManPat_t* Cec_ManPatStart ( )

Function*************************************************************

Synopsis [Creates AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 129 of file cecMan.c.

130 {
131  Cec_ManPat_t * p;
132  p = ABC_CALLOC( Cec_ManPat_t, 1 );
133  p->vStorage = Vec_StrAlloc( 1<<20 );
134  p->vPattern1 = Vec_IntAlloc( 1000 );
135  p->vPattern2 = Vec_IntAlloc( 1000 );
136  return p;
137 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
typedefABC_NAMESPACE_HEADER_START struct Cec_ManPat_t_ Cec_ManPat_t
INCLUDES ///.
Definition: cecInt.h:48
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
void Cec_ManPatStop ( Cec_ManPat_t p)

Function*************************************************************

Synopsis [Deletes AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 177 of file cecMan.c.

178 {
179  Vec_StrFree( p->vStorage );
180  Vec_IntFree( p->vPattern1 );
181  Vec_IntFree( p->vPattern2 );
182  ABC_FREE( p );
183 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
void Cec_ManRefinedClassPrintStats ( Gia_Man_t p,
Vec_Str_t vStatus,
int  iIter,
abctime  Time 
)

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

Function*************************************************************

Synopsis [Prints statistics during solving.]

Description []

SideEffects []

SeeAlso []

Definition at line 725 of file cecCorr.c.

726 {
727  int nLits, CounterX = 0, Counter0 = 0, Counter = 0;
728  int i, Entry, nProve = 0, nDispr = 0, nFail = 0;
729  for ( i = 1; i < Gia_ManObjNum(p); i++ )
730  {
731  if ( Gia_ObjIsNone(p, i) )
732  CounterX++;
733  else if ( Gia_ObjIsConst(p, i) )
734  Counter0++;
735  else if ( Gia_ObjIsHead(p, i) )
736  Counter++;
737  }
738  CounterX -= Gia_ManCoNum(p);
739  nLits = Gia_ManCiNum(p) + Gia_ManAndNum(p) - Counter - CounterX;
740  if ( iIter == -1 )
741  Abc_Print( 1, "BMC : " );
742  else
743  Abc_Print( 1, "%3d : ", iIter );
744  Abc_Print( 1, "c =%8d cl =%7d lit =%8d ", Counter0, Counter, nLits );
745  if ( vStatus )
746  Vec_StrForEachEntry( vStatus, Entry, i )
747  {
748  if ( Entry == 1 )
749  nProve++;
750  else if ( Entry == 0 )
751  nDispr++;
752  else if ( Entry == -1 )
753  nFail++;
754  }
755  Abc_Print( 1, "p =%6d d =%6d f =%6d ", nProve, nDispr, nFail );
756  Abc_Print( 1, "%c ", Gia_ObjIsConst( p, Gia_ObjFaninId0p(p, Gia_ManPo(p, 0)) ) ? '+' : '-' );
757  Abc_PrintTime( 1, "T", Time );
758 }
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
#define Vec_StrForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecStr.h:54
static int Gia_ObjIsHead(Gia_Man_t *p, int Id)
Definition: gia.h:916
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Gia_ObjIsConst(Gia_Man_t *p, int Id)
Definition: gia.h:915
static int Counter
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static int Gia_ObjIsNone(Gia_Man_t *p, int Id)
Definition: gia.h:917
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
int Cec_ManSatCheckNode ( Cec_ManSat_t p,
Gia_Obj_t pObj 
)

Function*************************************************************

Synopsis [Runs equivalence test for the two nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 470 of file cecSolve.c.

471 {
472  Gia_Obj_t * pObjR = Gia_Regular(pObj);
473  int nBTLimit = p->pPars->nBTLimit;
474  int Lit, RetValue, status, nConflicts;
475  abctime clk, clk2;
476 
477  if ( pObj == Gia_ManConst0(p->pAig) )
478  return 1;
479  if ( pObj == Gia_ManConst1(p->pAig) )
480  {
481  assert( 0 );
482  return 0;
483  }
484 
485  p->nCallsSince++; // experiment with this!!!
486  p->nSatTotal++;
487 
488  // check if SAT solver needs recycling
489  if ( p->pSat == NULL ||
490  (p->pPars->nSatVarMax &&
491  p->nSatVars > p->pPars->nSatVarMax &&
492  p->nCallsSince > p->pPars->nCallsRecycle) )
494 
495  // if the nodes do not have SAT variables, allocate them
496 clk2 = Abc_Clock();
497  Cec_CnfNodeAddToSolver( p, pObjR );
498 //ABC_PRT( "cnf", Abc_Clock() - clk2 );
499 //Abc_Print( 1, "%d \n", p->pSat->size );
500 
501 clk2 = Abc_Clock();
502 // Cec_SetActivityFactors( p, pObjR );
503 //ABC_PRT( "act", Abc_Clock() - clk2 );
504 
505  // propage unit clauses
506  if ( p->pSat->qtail != p->pSat->qhead )
507  {
508  status = sat_solver_simplify(p->pSat);
509  assert( status != 0 );
510  assert( p->pSat->qtail == p->pSat->qhead );
511  }
512 
513  // solve under assumptions
514  // A = 1; B = 0 OR A = 1; B = 1
515  Lit = toLitCond( Cec_ObjSatNum(p,pObjR), Gia_IsComplement(pObj) );
516  if ( p->pPars->fPolarFlip )
517  {
518  if ( pObjR->fPhase ) Lit = lit_neg( Lit );
519  }
520 //Sat_SolverWriteDimacs( p->pSat, "temp.cnf", pLits, pLits + 2, 1 );
521 clk = Abc_Clock();
522  nConflicts = p->pSat->stats.conflicts;
523 
524 clk2 = Abc_Clock();
525  RetValue = sat_solver_solve( p->pSat, &Lit, &Lit + 1,
526  (ABC_INT64_T)nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
527 //ABC_PRT( "sat", Abc_Clock() - clk2 );
528 
529  if ( RetValue == l_False )
530  {
531 p->timeSatUnsat += Abc_Clock() - clk;
532  Lit = lit_neg( Lit );
533  RetValue = sat_solver_addclause( p->pSat, &Lit, &Lit + 1 );
534  assert( RetValue );
535  p->nSatUnsat++;
536  p->nConfUnsat += p->pSat->stats.conflicts - nConflicts;
537 //Abc_Print( 1, "UNSAT after %d conflicts\n", p->pSat->stats.conflicts - nConflicts );
538  return 1;
539  }
540  else if ( RetValue == l_True )
541  {
542 p->timeSatSat += Abc_Clock() - clk;
543  p->nSatSat++;
544  p->nConfSat += p->pSat->stats.conflicts - nConflicts;
545 //Abc_Print( 1, "SAT after %d conflicts\n", p->pSat->stats.conflicts - nConflicts );
546  return 0;
547  }
548  else // if ( RetValue == l_Undef )
549  {
550 p->timeSatUndec += Abc_Clock() - clk;
551  p->nSatUndec++;
552  p->nConfUndec += p->pSat->stats.conflicts - nConflicts;
553 //Abc_Print( 1, "UNDEC after %d conflicts\n", p->pSat->stats.conflicts - nConflicts );
554  return -1;
555  }
556 }
int timeSatSat
Definition: cecInt.h:105
static ABC_NAMESPACE_IMPL_START int Cec_ObjSatNum(Cec_ManSat_t *p, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: cecSolve.c:30
int nConfUndec
Definition: cecInt.h:102
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
sat_solver * pSat
Definition: cecInt.h:83
int nConfUnsat
Definition: cecInt.h:100
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
Cec_ParSat_t * pPars
Definition: cecInt.h:78
int nSatUnsat
Definition: cecInt.h:94
Gia_Man_t * pAig
Definition: cecInt.h:80
#define l_True
Definition: SolverTypes.h:84
static abctime Abc_Clock()
Definition: abc_global.h:279
stats_t stats
Definition: satSolver.h:156
int nSatVars
Definition: cecInt.h:84
Definition: gia.h:75
static Gia_Obj_t * Gia_ManConst1(Gia_Man_t *p)
Definition: gia.h:401
void Cec_ManSatSolverRecycle(Cec_ManSat_t *p)
Definition: cecSolve.c:365
static lit lit_neg(lit l)
Definition: satVec.h:144
int nSatUndec
Definition: cecInt.h:96
static lit toLitCond(int v, int c)
Definition: satVec.h:143
int timeSatUnsat
Definition: cecInt.h:104
int nSatTotal
Definition: cecInt.h:97
int nConfSat
Definition: cecInt.h:101
int nCallsSince
Definition: cecInt.h:88
ABC_INT64_T conflicts
Definition: satVec.h:154
int timeSatUndec
Definition: cecInt.h:106
int sat_solver_simplify(sat_solver *s)
Definition: satSolver.c:1276
unsigned fPhase
Definition: gia.h:85
void Cec_CnfNodeAddToSolver(Cec_ManSat_t *p, Gia_Obj_t *pObj)
Definition: cecSolve.c:306
int nSatSat
Definition: cecInt.h:95
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define l_False
Definition: SolverTypes.h:85
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
int Cec_ManSatCheckNodeTwo ( Cec_ManSat_t p,
Gia_Obj_t pObj1,
Gia_Obj_t pObj2 
)

Function*************************************************************

Synopsis [Runs equivalence test for the two nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 569 of file cecSolve.c.

570 {
571  Gia_Obj_t * pObjR1 = Gia_Regular(pObj1);
572  Gia_Obj_t * pObjR2 = Gia_Regular(pObj2);
573  int nBTLimit = p->pPars->nBTLimit;
574  int Lits[2], RetValue, status, nConflicts;
575  abctime clk, clk2;
576 
577  if ( pObj1 == Gia_ManConst0(p->pAig) || pObj2 == Gia_ManConst0(p->pAig) || pObj1 == Gia_Not(pObj2) )
578  return 1;
579  if ( pObj1 == Gia_ManConst1(p->pAig) && (pObj2 == NULL || pObj2 == Gia_ManConst1(p->pAig)) )
580  {
581  assert( 0 );
582  return 0;
583  }
584 
585  p->nCallsSince++; // experiment with this!!!
586  p->nSatTotal++;
587 
588  // check if SAT solver needs recycling
589  if ( p->pSat == NULL ||
590  (p->pPars->nSatVarMax &&
591  p->nSatVars > p->pPars->nSatVarMax &&
592  p->nCallsSince > p->pPars->nCallsRecycle) )
594 
595  // if the nodes do not have SAT variables, allocate them
596 clk2 = Abc_Clock();
597  Cec_CnfNodeAddToSolver( p, pObjR1 );
598  Cec_CnfNodeAddToSolver( p, pObjR2 );
599 //ABC_PRT( "cnf", Abc_Clock() - clk2 );
600 //Abc_Print( 1, "%d \n", p->pSat->size );
601 
602 clk2 = Abc_Clock();
603 // Cec_SetActivityFactors( p, pObjR1 );
604 // Cec_SetActivityFactors( p, pObjR2 );
605 //ABC_PRT( "act", Abc_Clock() - clk2 );
606 
607  // propage unit clauses
608  if ( p->pSat->qtail != p->pSat->qhead )
609  {
610  status = sat_solver_simplify(p->pSat);
611  assert( status != 0 );
612  assert( p->pSat->qtail == p->pSat->qhead );
613  }
614 
615  // solve under assumptions
616  // A = 1; B = 0 OR A = 1; B = 1
617  Lits[0] = toLitCond( Cec_ObjSatNum(p,pObjR1), Gia_IsComplement(pObj1) );
618  Lits[1] = toLitCond( Cec_ObjSatNum(p,pObjR2), Gia_IsComplement(pObj2) );
619  if ( p->pPars->fPolarFlip )
620  {
621  if ( pObjR1->fPhase ) Lits[0] = lit_neg( Lits[0] );
622  if ( pObjR2->fPhase ) Lits[1] = lit_neg( Lits[1] );
623  }
624 //Sat_SolverWriteDimacs( p->pSat, "temp.cnf", pLits, pLits + 2, 1 );
625 clk = Abc_Clock();
626  nConflicts = p->pSat->stats.conflicts;
627 
628 clk2 = Abc_Clock();
629  RetValue = sat_solver_solve( p->pSat, Lits, Lits + 2,
630  (ABC_INT64_T)nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
631 //ABC_PRT( "sat", Abc_Clock() - clk2 );
632 
633  if ( RetValue == l_False )
634  {
635 p->timeSatUnsat += Abc_Clock() - clk;
636  Lits[0] = lit_neg( Lits[0] );
637  Lits[1] = lit_neg( Lits[1] );
638  RetValue = sat_solver_addclause( p->pSat, Lits, Lits + 2 );
639  assert( RetValue );
640  p->nSatUnsat++;
641  p->nConfUnsat += p->pSat->stats.conflicts - nConflicts;
642 //Abc_Print( 1, "UNSAT after %d conflicts\n", p->pSat->stats.conflicts - nConflicts );
643  return 1;
644  }
645  else if ( RetValue == l_True )
646  {
647 p->timeSatSat += Abc_Clock() - clk;
648  p->nSatSat++;
649  p->nConfSat += p->pSat->stats.conflicts - nConflicts;
650 //Abc_Print( 1, "SAT after %d conflicts\n", p->pSat->stats.conflicts - nConflicts );
651  return 0;
652  }
653  else // if ( RetValue == l_Undef )
654  {
655 p->timeSatUndec += Abc_Clock() - clk;
656  p->nSatUndec++;
657  p->nConfUndec += p->pSat->stats.conflicts - nConflicts;
658 //Abc_Print( 1, "UNDEC after %d conflicts\n", p->pSat->stats.conflicts - nConflicts );
659  return -1;
660  }
661 }
int timeSatSat
Definition: cecInt.h:105
static ABC_NAMESPACE_IMPL_START int Cec_ObjSatNum(Cec_ManSat_t *p, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: cecSolve.c:30
int nConfUndec
Definition: cecInt.h:102
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
sat_solver * pSat
Definition: cecInt.h:83
int nConfUnsat
Definition: cecInt.h:100
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
Cec_ParSat_t * pPars
Definition: cecInt.h:78
int nSatUnsat
Definition: cecInt.h:94
Gia_Man_t * pAig
Definition: cecInt.h:80
#define l_True
Definition: SolverTypes.h:84
static abctime Abc_Clock()
Definition: abc_global.h:279
stats_t stats
Definition: satSolver.h:156
int nSatVars
Definition: cecInt.h:84
Definition: gia.h:75
static Gia_Obj_t * Gia_ManConst1(Gia_Man_t *p)
Definition: gia.h:401
void Cec_ManSatSolverRecycle(Cec_ManSat_t *p)
Definition: cecSolve.c:365
static lit lit_neg(lit l)
Definition: satVec.h:144
static Gia_Obj_t * Gia_Not(Gia_Obj_t *p)
Definition: gia.h:378
int nSatUndec
Definition: cecInt.h:96
static lit toLitCond(int v, int c)
Definition: satVec.h:143
int timeSatUnsat
Definition: cecInt.h:104
int nSatTotal
Definition: cecInt.h:97
int nConfSat
Definition: cecInt.h:101
int nCallsSince
Definition: cecInt.h:88
ABC_INT64_T conflicts
Definition: satVec.h:154
int timeSatUndec
Definition: cecInt.h:106
int sat_solver_simplify(sat_solver *s)
Definition: satSolver.c:1276
unsigned fPhase
Definition: gia.h:85
void Cec_CnfNodeAddToSolver(Cec_ManSat_t *p, Gia_Obj_t *pObj)
Definition: cecSolve.c:306
int nSatSat
Definition: cecInt.h:95
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define l_False
Definition: SolverTypes.h:85
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
Cec_ManSat_t* Cec_ManSatCreate ( Gia_Man_t pAig,
Cec_ParSat_t pPars 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [cecMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Combinational equivalence checking.]

Synopsis [Manager procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
cecMan.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Creates the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file cecMan.c.

46 {
47  Cec_ManSat_t * p;
48  // create interpolation manager
49  p = ABC_ALLOC( Cec_ManSat_t, 1 );
50  memset( p, 0, sizeof(Cec_ManSat_t) );
51  p->pPars = pPars;
52  p->pAig = pAig;
53  // SAT solving
54  p->nSatVars = 1;
55  p->pSatVars = ABC_CALLOC( int, Gia_ManObjNum(pAig) );
56  p->vUsedNodes = Vec_PtrAlloc( 1000 );
57  p->vFanins = Vec_PtrAlloc( 100 );
58  p->vCex = Vec_IntAlloc( 100 );
59  p->vVisits = Vec_IntAlloc( 100 );
60  return p;
61 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Cec_ParSat_t * pPars
Definition: cecInt.h:78
Vec_Int_t * vVisits
Definition: cecInt.h:92
Gia_Man_t * pAig
Definition: cecInt.h:80
int * pSatVars
Definition: cecInt.h:85
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nSatVars
Definition: cecInt.h:84
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Ptr_t * vFanins
Definition: cecInt.h:89
Vec_Int_t * vCex
Definition: cecInt.h:91
Vec_Ptr_t * vUsedNodes
Definition: cecInt.h:86
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Cec_ManSatPrintStats ( Cec_ManSat_t p)

Function*************************************************************

Synopsis [Prints statistics of the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 74 of file cecMan.c.

75 {
76  Abc_Print( 1, "CO = %8d ", Gia_ManCoNum(p->pAig) );
77  Abc_Print( 1, "AND = %8d ", Gia_ManAndNum(p->pAig) );
78  Abc_Print( 1, "Conf = %5d ", p->pPars->nBTLimit );
79  Abc_Print( 1, "MinVar = %5d ", p->pPars->nSatVarMax );
80  Abc_Print( 1, "MinCalls = %5d\n", p->pPars->nCallsRecycle );
81  Abc_Print( 1, "Unsat calls %6d (%6.2f %%) Ave conf = %8.1f ",
82  p->nSatUnsat, p->nSatTotal? 100.0*p->nSatUnsat/p->nSatTotal : 0.0, p->nSatUnsat? 1.0*p->nConfUnsat/p->nSatUnsat :0.0 );
83  Abc_PrintTimeP( 1, "Time", p->timeSatUnsat, p->timeTotal );
84  Abc_Print( 1, "Sat calls %6d (%6.2f %%) Ave conf = %8.1f ",
85  p->nSatSat, p->nSatTotal? 100.0*p->nSatSat/p->nSatTotal : 0.0, p->nSatSat? 1.0*p->nConfSat/p->nSatSat : 0.0 );
86  Abc_PrintTimeP( 1, "Time", p->timeSatSat, p->timeTotal );
87  Abc_Print( 1, "Undef calls %6d (%6.2f %%) Ave conf = %8.1f ",
88  p->nSatUndec, p->nSatTotal? 100.0*p->nSatUndec/p->nSatTotal : 0.0, p->nSatUndec? 1.0*p->nConfUndec/p->nSatUndec : 0.0 );
89  Abc_PrintTimeP( 1, "Time", p->timeSatUndec, p->timeTotal );
90  Abc_PrintTime( 1, "Total time", p->timeTotal );
91 }
int timeSatSat
Definition: cecInt.h:105
int timeTotal
Definition: cecInt.h:107
int nConfUndec
Definition: cecInt.h:102
int nConfUnsat
Definition: cecInt.h:100
Cec_ParSat_t * pPars
Definition: cecInt.h:78
int nSatUnsat
Definition: cecInt.h:94
Gia_Man_t * pAig
Definition: cecInt.h:80
static void Abc_PrintTimeP(int level, const char *pStr, abctime time, abctime Time)
Definition: abc_global.h:372
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
int nSatUndec
Definition: cecInt.h:96
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int timeSatUnsat
Definition: cecInt.h:104
int nSatTotal
Definition: cecInt.h:97
int nConfSat
Definition: cecInt.h:101
int timeSatUndec
Definition: cecInt.h:106
int nSatSat
Definition: cecInt.h:95
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Vec_Int_t* Cec_ManSatReadCex ( Cec_ManSat_t pSat)

Function*************************************************************

Synopsis [Returns the pattern stored.]

Description []

SideEffects []

SeeAlso []

Definition at line 820 of file cecSolve.c.

821 {
822  return pSat->vCex;
823 }
Vec_Int_t * vCex
Definition: cecInt.h:91
void Cec_ManSatSolve ( Cec_ManPat_t pPat,
Gia_Man_t pAig,
Cec_ParSat_t pPars 
)

Function*************************************************************

Synopsis [Performs one round of solving for the POs of the AIG.]

Description [Labels the nodes that have been proved (pObj->fMark1) and returns the set of satisfying assignments.]

SideEffects []

SeeAlso []

Definition at line 676 of file cecSolve.c.

677 {
678  Bar_Progress_t * pProgress = NULL;
679  Cec_ManSat_t * p;
680  Gia_Obj_t * pObj;
681  int i, status;
682  abctime clk = Abc_Clock(), clk2;
683  // reset the manager
684  if ( pPat )
685  {
686  pPat->iStart = Vec_StrSize(pPat->vStorage);
687  pPat->nPats = 0;
688  pPat->nPatLits = 0;
689  pPat->nPatLitsMin = 0;
690  }
691  Gia_ManSetPhase( pAig );
692  Gia_ManLevelNum( pAig );
693  Gia_ManIncrementTravId( pAig );
694  p = Cec_ManSatCreate( pAig, pPars );
695  pProgress = Bar_ProgressStart( stdout, Gia_ManPoNum(pAig) );
696  Gia_ManForEachCo( pAig, pObj, i )
697  {
698  if ( Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
699  {
700  pObj->fMark0 = 0;
701  pObj->fMark1 = 1;
702  continue;
703  }
704  Bar_ProgressUpdate( pProgress, i, "SAT..." );
705 clk2 = Abc_Clock();
706  status = Cec_ManSatCheckNode( p, Gia_ObjChild0(pObj) );
707  pObj->fMark0 = (status == 0);
708  pObj->fMark1 = (status == 1);
709 /*
710  if ( status == -1 )
711  {
712  Gia_Man_t * pTemp = Gia_ManDupDfsCone( pAig, pObj );
713  Gia_AigerWrite( pTemp, "gia_hard.aig", 0, 0 );
714  Gia_ManStop( pTemp );
715  Abc_Print( 1, "Dumping hard cone into file \"%s\".\n", "gia_hard.aig" );
716  }
717 */
718  if ( status != 0 )
719  continue;
720  // save the pattern
721  if ( pPat )
722  {
723  abctime clk3 = Abc_Clock();
724  Cec_ManPatSavePattern( pPat, p, pObj );
725  pPat->timeTotalSave += Abc_Clock() - clk3;
726  }
727  // quit if one of them is solved
728  if ( pPars->fCheckMiter )
729  break;
730  }
731  p->timeTotal = Abc_Clock() - clk;
732  Bar_ProgressStop( pProgress );
733  if ( pPars->fVerbose )
735  Cec_ManSatStop( p );
736 }
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
int timeTotal
Definition: cecInt.h:107
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
void Cec_ManSatPrintStats(Cec_ManSat_t *p)
Definition: cecMan.c:74
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
unsigned fMark1
Definition: gia.h:84
static abctime Abc_Clock()
Definition: abc_global.h:279
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Bar_ProgressUpdate(Bar_Progress_t *p, int nItemsCur, char *pString)
Definition: bar.h:63
void Cec_ManPatSavePattern(Cec_ManPat_t *pPat, Cec_ManSat_t *p, Gia_Obj_t *pObj)
Definition: cecPat.c:359
int Cec_ManSatCheckNode(Cec_ManSat_t *p, Gia_Obj_t *pObj)
Definition: cecSolve.c:470
DECLARATIONS ///.
Definition: bar.c:36
void Cec_ManSatStop(Cec_ManSat_t *p)
Definition: cecMan.c:104
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
unsigned fMark0
Definition: gia.h:79
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
ABC_INT64_T abctime
Definition: abc_global.h:278
void Bar_ProgressStop(Bar_Progress_t *p)
Definition: bar.c:126
Cec_ManSat_t * Cec_ManSatCreate(Gia_Man_t *pAig, Cec_ParSat_t *pPars)
DECLARATIONS ///.
Definition: cecMan.c:45
Bar_Progress_t * Bar_ProgressStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
Definition: bar.c:66
void Cec_ManSatSolveCSat ( Cec_ManPat_t pPat,
Gia_Man_t pAig,
Cec_ParSat_t pPars 
)

Definition at line 765 of file cecSolve.c.

766 {
767  Vec_Str_t * vStatus;
768  Vec_Int_t * vPat = Vec_IntAlloc( 1000 );
769  Vec_Int_t * vCexStore = Cbs_ManSolveMiterNc( pAig, pPars->nBTLimit, &vStatus, 0 );
770  Gia_Obj_t * pObj;
771  int i, status, iStart = 0;
772  assert( Vec_StrSize(vStatus) == Gia_ManCoNum(pAig) );
773  // reset the manager
774  if ( pPat )
775  {
776  pPat->iStart = Vec_StrSize(pPat->vStorage);
777  pPat->nPats = 0;
778  pPat->nPatLits = 0;
779  pPat->nPatLitsMin = 0;
780  }
781  Gia_ManForEachCo( pAig, pObj, i )
782  {
783  status = (int)Vec_StrEntry(vStatus, i);
784  pObj->fMark0 = (status == 0);
785  pObj->fMark1 = (status == 1);
786  if ( Vec_IntSize(vCexStore) > 0 && status != 1 )
787  iStart = Cec_ManSatSolveExractPattern( vCexStore, iStart, vPat );
788  if ( status != 0 )
789  continue;
790  // save the pattern
791  if ( pPat && Vec_IntSize(vPat) > 0 )
792  {
793  abctime clk3 = Abc_Clock();
794  Cec_ManPatSavePatternCSat( pPat, vPat );
795  pPat->timeTotalSave += Abc_Clock() - clk3;
796  }
797  // quit if one of them is solved
798  if ( pPars->fCheckMiter )
799  break;
800  }
801  assert( iStart == Vec_IntSize(vCexStore) );
802  Vec_IntFree( vPat );
803  Vec_StrFree( vStatus );
804  Vec_IntFree( vCexStore );
805 }
void Cec_ManPatSavePatternCSat(Cec_ManPat_t *pMan, Vec_Int_t *vPat)
Definition: cecPat.c:402
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
unsigned fMark1
Definition: gia.h:84
static abctime Abc_Clock()
Definition: abc_global.h:279
Definition: gia.h:75
Vec_Int_t * Cbs_ManSolveMiterNc(Gia_Man_t *pGia, int nConfs, Vec_Str_t **pvStatus, int fVerbose)
Definition: giaCSat.c:998
int Cec_ManSatSolveExractPattern(Vec_Int_t *vCexStore, int iStart, Vec_Int_t *vPat)
Definition: cecSolve.c:750
static char Vec_StrEntry(Vec_Str_t *p, int i)
Definition: vecStr.h:336
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
unsigned fMark0
Definition: gia.h:79
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Vec_Int_t* Cec_ManSatSolveMiter ( Gia_Man_t pAig,
Cec_ParSat_t pPars,
Vec_Str_t **  pvStatus 
)

Function*************************************************************

Synopsis [Performs one round of solving for the POs of the AIG.]

Description [Labels the nodes that have been proved (pObj->fMark1) and returns the set of satisfying assignments.]

SideEffects []

SeeAlso []

Definition at line 1026 of file cecSolve.c.

1027 {
1028  Bar_Progress_t * pProgress = NULL;
1029  Vec_Int_t * vCexStore;
1030  Vec_Str_t * vStatus;
1031  Cec_ManSat_t * p;
1032  Gia_Obj_t * pObj;
1033  int i, status;
1034  abctime clk = Abc_Clock();
1035  // prepare AIG
1036  Gia_ManSetPhase( pAig );
1037  Gia_ManLevelNum( pAig );
1038  Gia_ManIncrementTravId( pAig );
1039  // create resulting data-structures
1040  vStatus = Vec_StrAlloc( Gia_ManPoNum(pAig) );
1041  vCexStore = Vec_IntAlloc( 10000 );
1042  // perform solving
1043  p = Cec_ManSatCreate( pAig, pPars );
1044  pProgress = Bar_ProgressStart( stdout, Gia_ManPoNum(pAig) );
1045  Gia_ManForEachCo( pAig, pObj, i )
1046  {
1047  Vec_IntClear( p->vCex );
1048  Bar_ProgressUpdate( pProgress, i, "SAT..." );
1049  if ( Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
1050  {
1051  if ( Gia_ObjFaninC0(pObj) )
1052  {
1053 // Abc_Print( 1, "Constant 1 output of SRM!!!\n" );
1054  Cec_ManSatAddToStore( vCexStore, p->vCex, i ); // trivial counter-example
1055  Vec_StrPush( vStatus, 0 );
1056  }
1057  else
1058  {
1059 // Abc_Print( 1, "Constant 0 output of SRM!!!\n" );
1060  Vec_StrPush( vStatus, 1 );
1061  }
1062  continue;
1063  }
1064  status = Cec_ManSatCheckNode( p, Gia_ObjChild0(pObj) );
1065  Vec_StrPush( vStatus, (char)status );
1066  if ( status == -1 )
1067  {
1068  Cec_ManSatAddToStore( vCexStore, NULL, i ); // timeout
1069  continue;
1070  }
1071  if ( status == 1 )
1072  continue;
1073  assert( status == 0 );
1074  // save the pattern
1075 // Gia_ManIncrementTravId( pAig );
1076 // Cec_ManSatSolveMiter_rec( p, pAig, Gia_ObjFanin0(pObj) );
1077  Cec_ManSavePattern( p, Gia_ObjFanin0(pObj), NULL );
1078 // Gia_SatVerifyPattern( pAig, pObj, p->vCex, p->vVisits );
1079  Cec_ManSatAddToStore( vCexStore, p->vCex, i );
1080  }
1081  p->timeTotal = Abc_Clock() - clk;
1082  Bar_ProgressStop( pProgress );
1083 // if ( pPars->fVerbose )
1084 // Cec_ManSatPrintStats( p );
1085  Cec_ManSatStop( p );
1086  *pvStatus = vStatus;
1087  return vCexStore;
1088 }
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
int timeTotal
Definition: cecInt.h:107
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
void Cec_ManSavePattern(Cec_ManSat_t *p, Gia_Obj_t *pObj1, Gia_Obj_t *pObj2)
Definition: cecSolve.c:1005
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Bar_ProgressUpdate(Bar_Progress_t *p, int nItemsCur, char *pString)
Definition: bar.h:63
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Int_t * vCex
Definition: cecInt.h:91
int Cec_ManSatCheckNode(Cec_ManSat_t *p, Gia_Obj_t *pObj)
Definition: cecSolve.c:470
DECLARATIONS ///.
Definition: bar.c:36
void Cec_ManSatAddToStore(Vec_Int_t *vCexStore, Vec_Int_t *vCex, int Out)
Definition: cecSolve.c:952
void Cec_ManSatStop(Cec_ManSat_t *p)
Definition: cecMan.c:104
#define assert(ex)
Definition: util_old.h:213
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
void Bar_ProgressStop(Bar_Progress_t *p)
Definition: bar.c:126
Cec_ManSat_t * Cec_ManSatCreate(Gia_Man_t *pAig, Cec_ParSat_t *pPars)
DECLARATIONS ///.
Definition: cecMan.c:45
Bar_Progress_t * Bar_ProgressStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
Definition: bar.c:66
Vec_Str_t* Cec_ManSatSolveSeq ( Vec_Ptr_t vPatts,
Gia_Man_t pAig,
Cec_ParSat_t pPars,
int  nRegs,
int *  pnPats 
)

Function*************************************************************

Synopsis [Performs one round of solving for the POs of the AIG.]

Description [Labels the nodes that have been proved (pObj->fMark1) and returns the set of satisfying assignments.]

SideEffects []

SeeAlso []

Definition at line 867 of file cecSolve.c.

868 {
869  Bar_Progress_t * pProgress = NULL;
870  Vec_Str_t * vStatus;
871  Cec_ManSat_t * p;
872  Gia_Obj_t * pObj;
873  int iPat = 0, nPatsInit, nPats;
874  int i, status;
875  abctime clk = Abc_Clock();
876  nPatsInit = nPats = 32 * Vec_PtrReadWordsSimInfo(vPatts);
877  Gia_ManSetPhase( pAig );
878  Gia_ManLevelNum( pAig );
879  Gia_ManIncrementTravId( pAig );
880  p = Cec_ManSatCreate( pAig, pPars );
881  vStatus = Vec_StrAlloc( Gia_ManPoNum(pAig) );
882  pProgress = Bar_ProgressStart( stdout, Gia_ManPoNum(pAig) );
883  Gia_ManForEachCo( pAig, pObj, i )
884  {
885  Bar_ProgressUpdate( pProgress, i, "SAT..." );
886  if ( Gia_ObjIsConst0(Gia_ObjFanin0(pObj)) )
887  {
888  if ( Gia_ObjFaninC0(pObj) )
889  {
890 // Abc_Print( 1, "Constant 1 output of SRM!!!\n" );
891  Vec_StrPush( vStatus, 0 );
892  }
893  else
894  {
895 // Abc_Print( 1, "Constant 0 output of SRM!!!\n" );
896  Vec_StrPush( vStatus, 1 );
897  }
898  continue;
899  }
900  status = Cec_ManSatCheckNode( p, Gia_ObjChild0(pObj) );
901 //Abc_Print( 1, "output %d status = %d\n", i, status );
902  Vec_StrPush( vStatus, (char)status );
903  if ( status != 0 )
904  continue;
905  // resize storage
906  if ( iPat == nPats )
907  {
908  int nWords = Vec_PtrReadWordsSimInfo(vPatts);
909  Vec_PtrReallocSimInfo( vPatts );
910  Vec_PtrCleanSimInfo( vPatts, nWords, 2*nWords );
911  nPats = 32 * Vec_PtrReadWordsSimInfo(vPatts);
912  }
913  if ( iPat % nPatsInit == 0 )
914  iPat++;
915  // save the pattern
916  Gia_ManIncrementTravId( pAig );
917 // Vec_IntClear( p->vCex );
918  Cec_ManSatSolveSeq_rec( p, pAig, Gia_ObjFanin0(pObj), vPatts, iPat++, nRegs );
919 // Gia_SatVerifyPattern( pAig, pObj, p->vCex, p->vVisits );
920 // Cec_ManSatAddToStore( p->vCexStore, p->vCex );
921 // if ( iPat == nPats )
922 // break;
923  // quit if one of them is solved
924 // if ( pPars->fFirstStop )
925 // break;
926 // if ( iPat == 32 * 15 * 16 - 1 )
927 // break;
928  }
929  p->timeTotal = Abc_Clock() - clk;
930  Bar_ProgressStop( pProgress );
931  if ( pPars->fVerbose )
933 // Abc_Print( 1, "Total number of cex literals = %d. (Ave = %d)\n", p->nCexLits, p->nCexLits/p->nSatSat );
934  Cec_ManSatStop( p );
935  if ( pnPats )
936  *pnPats = iPat-1;
937  return vStatus;
938 }
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
Definition: gia.h:457
int timeTotal
Definition: cecInt.h:107
void Cec_ManSatSolveSeq_rec(Cec_ManSat_t *pSat, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Ptr_t *vInfo, int iPat, int nRegs)
Definition: cecSolve.c:836
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
void Cec_ManSatPrintStats(Cec_ManSat_t *p)
Definition: cecMan.c:74
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static void Vec_PtrCleanSimInfo(Vec_Ptr_t *vInfo, int iWord, int nWords)
Definition: vecPtr.h:968
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
int nWords
Definition: abcNpn.c:127
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Bar_ProgressUpdate(Bar_Progress_t *p, int nItemsCur, char *pString)
Definition: bar.h:63
int Cec_ManSatCheckNode(Cec_ManSat_t *p, Gia_Obj_t *pObj)
Definition: cecSolve.c:470
DECLARATIONS ///.
Definition: bar.c:36
void Cec_ManSatStop(Cec_ManSat_t *p)
Definition: cecMan.c:104
static int Vec_PtrReadWordsSimInfo(Vec_Ptr_t *p)
Definition: vecPtr.h:952
static void Vec_PtrReallocSimInfo(Vec_Ptr_t *vInfo)
Definition: vecPtr.h:1035
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
ABC_INT64_T abctime
Definition: abc_global.h:278
void Bar_ProgressStop(Bar_Progress_t *p)
Definition: bar.c:126
Cec_ManSat_t * Cec_ManSatCreate(Gia_Man_t *pAig, Cec_ParSat_t *pPars)
DECLARATIONS ///.
Definition: cecMan.c:45
Bar_Progress_t * Bar_ProgressStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
Definition: bar.c:66
void Cec_ManSatStop ( Cec_ManSat_t p)

Function*************************************************************

Synopsis [Frees the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 104 of file cecMan.c.

105 {
106  if ( p->pSat )
107  sat_solver_delete( p->pSat );
108  Vec_IntFree( p->vCex );
109  Vec_IntFree( p->vVisits );
110  Vec_PtrFree( p->vUsedNodes );
111  Vec_PtrFree( p->vFanins );
112  ABC_FREE( p->pSatVars );
113  ABC_FREE( p );
114 }
sat_solver * pSat
Definition: cecInt.h:83
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
Vec_Int_t * vVisits
Definition: cecInt.h:92
int * pSatVars
Definition: cecInt.h:85
Vec_Ptr_t * vFanins
Definition: cecInt.h:89
Vec_Int_t * vCex
Definition: cecInt.h:91
Vec_Ptr_t * vUsedNodes
Definition: cecInt.h:86
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Cec_ManSavePattern ( Cec_ManSat_t p,
Gia_Obj_t pObj1,
Gia_Obj_t pObj2 
)

Function*************************************************************

Synopsis [Save patterns.]

Description []

SideEffects []

SeeAlso []

Definition at line 1005 of file cecSolve.c.

1006 {
1007  Vec_IntClear( p->vCex );
1009  Cec_ManSatSolveMiter_rec( p, p->pAig, Gia_Regular(pObj1) );
1010  if ( pObj2 )
1011  Cec_ManSatSolveMiter_rec( p, p->pAig, Gia_Regular(pObj2) );
1012 }
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
Definition: gia.h:377
Gia_Man_t * pAig
Definition: cecInt.h:80
Vec_Int_t * vCex
Definition: cecInt.h:91
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Cec_ManSatSolveMiter_rec(Cec_ManSat_t *pSat, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: cecSolve.c:978
void Cec_ManSeqDeriveInfoInitRandom ( Vec_Ptr_t vInfo,
Gia_Man_t pAig,
Abc_Cex_t pCex 
)

Function*************************************************************

Synopsis [Sets register values from the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 104 of file cecSeq.c.

105 {
106  unsigned * pInfo;
107  int k, w, nWords;
108  nWords = Vec_PtrReadWordsSimInfo( vInfo );
109  assert( pCex == NULL || Gia_ManRegNum(pAig) == pCex->nRegs );
110  assert( Gia_ManRegNum(pAig) <= Vec_PtrSize(vInfo) );
111  for ( k = 0; k < Gia_ManRegNum(pAig); k++ )
112  {
113  pInfo = (unsigned *)Vec_PtrEntry( vInfo, k );
114  for ( w = 0; w < nWords; w++ )
115  pInfo[w] = (pCex && Abc_InfoHasBit(pCex->pData, k))? ~0 : 0;
116  }
117 
118  for ( ; k < Vec_PtrSize(vInfo); k++ )
119  {
120  pInfo = (unsigned *)Vec_PtrEntry( vInfo, k );
121  for ( w = 0; w < nWords; w++ )
122  pInfo[w] = Gia_ManRandom( 0 );
123  }
124 }
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int nWords
Definition: abcNpn.c:127
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_PtrReadWordsSimInfo(Vec_Ptr_t *p)
Definition: vecPtr.h:952
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Cec_ManSeqResimulate ( Cec_ManSim_t p,
Vec_Ptr_t vInfo 
)

Function*************************************************************

Synopsis [Resimulates the classes using sequential simulation info.]

Description []

SideEffects []

SeeAlso []

Definition at line 137 of file cecSeq.c.

138 {
139  unsigned * pInfo0, * pInfo1;
140  int f, i, k, w;
141 // assert( Gia_ManRegNum(p->pAig) > 0 );
142  assert( Vec_PtrSize(vInfo) == Gia_ManRegNum(p->pAig) + Gia_ManPiNum(p->pAig) * p->pPars->nFrames );
143  for ( k = 0; k < Gia_ManRegNum(p->pAig); k++ )
144  {
145  pInfo0 = (unsigned *)Vec_PtrEntry( vInfo, k );
146  pInfo1 = (unsigned *)Vec_PtrEntry( p->vCoSimInfo, Gia_ManPoNum(p->pAig) + k );
147  for ( w = 0; w < p->nWords; w++ )
148  pInfo1[w] = pInfo0[w];
149  }
150  for ( f = 0; f < p->pPars->nFrames; f++ )
151  {
152  for ( i = 0; i < Gia_ManPiNum(p->pAig); i++ )
153  {
154  pInfo0 = (unsigned *)Vec_PtrEntry( vInfo, k++ );
155  pInfo1 = (unsigned *)Vec_PtrEntry( p->vCiSimInfo, i );
156  for ( w = 0; w < p->nWords; w++ )
157  pInfo1[w] = pInfo0[w];
158  }
159  for ( i = 0; i < Gia_ManRegNum(p->pAig); i++ )
160  {
161  pInfo0 = (unsigned *)Vec_PtrEntry( p->vCoSimInfo, Gia_ManPoNum(p->pAig) + i );
162  pInfo1 = (unsigned *)Vec_PtrEntry( p->vCiSimInfo, Gia_ManPiNum(p->pAig) + i );
163  for ( w = 0; w < p->nWords; w++ )
164  pInfo1[w] = pInfo0[w];
165  }
166  if ( Cec_ManSimSimulateRound( p, p->vCiSimInfo, p->vCoSimInfo ) )
167  return 1;
168  }
169  assert( k == Vec_PtrSize(vInfo) );
170  return 0;
171 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
int Cec_ManSimSimulateRound(Cec_ManSim_t *p, Vec_Ptr_t *vInfoCis, Vec_Ptr_t *vInfoCos)
Definition: cecClass.c:652
Gia_Man_t * pAig
Definition: cecInt.h:115
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int nWords
Definition: cecInt.h:117
Vec_Ptr_t * vCiSimInfo
Definition: cecInt.h:127
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
int nFrames
Definition: cec.h:62
Cec_ParSim_t * pPars
Definition: cecInt.h:116
Vec_Ptr_t * vCoSimInfo
Definition: cecInt.h:128
#define assert(ex)
Definition: util_old.h:213
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Cec_ManSeqResimulateInfo ( Gia_Man_t pAig,
Vec_Ptr_t vSimInfo,
Abc_Cex_t pBestState,
int  fCheckMiter 
)

Function*************************************************************

Synopsis [Resimulates information to refine equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 184 of file cecSeq.c.

185 {
186  Cec_ParSim_t ParsSim, * pParsSim = &ParsSim;
187  Cec_ManSim_t * pSim;
188  int RetValue;//, clkTotal = Abc_Clock();
189  assert( (Vec_PtrSize(vSimInfo) - Gia_ManRegNum(pAig)) % Gia_ManPiNum(pAig) == 0 );
190  Cec_ManSimSetDefaultParams( pParsSim );
191  pParsSim->nFrames = (Vec_PtrSize(vSimInfo) - Gia_ManRegNum(pAig)) / Gia_ManPiNum(pAig);
192  pParsSim->nWords = Vec_PtrReadWordsSimInfo( vSimInfo );
193  pParsSim->fCheckMiter = fCheckMiter;
194  Gia_ManCreateValueRefs( pAig );
195  pSim = Cec_ManSimStart( pAig, pParsSim );
196  if ( pBestState )
197  pSim->pBestState = pBestState;
198  RetValue = Cec_ManSeqResimulate( pSim, vSimInfo );
199  pSim->pBestState = NULL;
200  Cec_ManSimStop( pSim );
201  return RetValue;
202 }
void Cec_ManSimStop(Cec_ManSim_t *p)
Definition: cecMan.c:232
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int fCheckMiter
Definition: cec.h:67
Cec_ManSim_t * Cec_ManSimStart(Gia_Man_t *pAig, Cec_ParSim_t *pPars)
Definition: cecMan.c:198
void Cec_ManSimSetDefaultParams(Cec_ParSim_t *p)
Definition: cecCore.c:70
void Gia_ManCreateValueRefs(Gia_Man_t *p)
Definition: giaUtil.c:687
int Cec_ManSeqResimulate(Cec_ManSim_t *p, Vec_Ptr_t *vInfo)
Definition: cecSeq.c:137
static int Vec_PtrReadWordsSimInfo(Vec_Ptr_t *p)
Definition: vecPtr.h:952
int nFrames
Definition: cec.h:62
#define assert(ex)
Definition: util_old.h:213
Abc_Cex_t * pBestState
Definition: cecInt.h:134
int nWords
Definition: cec.h:61
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Cec_ManSimClassesPrepare ( Cec_ManSim_t p,
int  LevelMax 
)

Function*************************************************************

Synopsis [Returns 1 if the bug is found.]

Description []

SideEffects []

SeeAlso []

Definition at line 851 of file cecClass.c.

852 {
853  Gia_Obj_t * pObj;
854  int i;
855  assert( p->pAig->pReprs == NULL );
856  // allocate representation
858  p->pAig->pNexts = ABC_CALLOC( int, Gia_ManObjNum(p->pAig) );
859  // create references
861  // set starting representative of internal nodes to be constant 0
862  if ( p->pPars->fLatchCorr )
863  Gia_ManForEachObj( p->pAig, pObj, i )
864  Gia_ObjSetRepr( p->pAig, i, GIA_VOID );
865  else if ( LevelMax == -1 )
866  Gia_ManForEachObj( p->pAig, pObj, i )
867  Gia_ObjSetRepr( p->pAig, i, Gia_ObjIsAnd(pObj) ? 0 : GIA_VOID );
868  else
869  {
870  Gia_ManLevelNum( p->pAig );
871  Gia_ManForEachObj( p->pAig, pObj, i )
872  Gia_ObjSetRepr( p->pAig, i, (Gia_ObjIsAnd(pObj) && Gia_ObjLevel(p->pAig,pObj) <= LevelMax) ? 0 : GIA_VOID );
873  Vec_IntFreeP( &p->pAig->vLevels );
874  }
875  // if sequential simulation, set starting representative of ROs to be constant 0
876  if ( p->pPars->fSeqSimulate )
877  Gia_ManForEachRo( p->pAig, pObj, i )
878  if ( pObj->Value )
879  Gia_ObjSetRepr( p->pAig, Gia_ObjId(p->pAig, pObj), 0 );
880  // perform simulation
881  p->nWords = 1;
882  do {
883  if ( p->pPars->fVerbose )
885  for ( i = 0; i < 4; i++ )
886  {
888  if ( Cec_ManSimSimulateRound( p, p->vCiSimInfo, p->vCoSimInfo ) )
889  return 1;
890  }
891  p->nWords = 2 * p->nWords + 1;
892  }
893  while ( p->nWords <= p->pPars->nWords );
894  return 0;
895 }
int fVerbose
Definition: cec.h:73
int fLatchCorr
Definition: cec.h:70
int * pNexts
Definition: gia.h:122
void Cec_ManSimCreateInfo(Cec_ManSim_t *p, Vec_Ptr_t *vInfoCis, Vec_Ptr_t *vInfoCos)
Definition: cecClass.c:808
int Cec_ManSimSimulateRound(Cec_ManSim_t *p, Vec_Ptr_t *vInfoCis, Vec_Ptr_t *vInfoCos)
Definition: cecClass.c:652
Gia_Man_t * pAig
Definition: cecInt.h:115
int nWords
Definition: abcNpn.c:127
Definition: gia.h:75
void Gia_ManEquivPrintClasses(Gia_Man_t *p, int fVerbose, float Mem)
Definition: giaEquiv.c:304
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
void Gia_ManCreateValueRefs(Gia_Man_t *p)
Definition: giaUtil.c:687
static int Gia_ObjLevel(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:501
int nWords
Definition: cecInt.h:117
Vec_Ptr_t * vCiSimInfo
Definition: cecInt.h:127
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define GIA_VOID
Definition: gia.h:45
static float Cec_MemUsage(Cec_ManSim_t *p)
Definition: cecClass.c:33
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
Cec_ParSim_t * pPars
Definition: cecInt.h:116
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Vec_Ptr_t * vCoSimInfo
Definition: cecInt.h:128
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
int nWords
Definition: cec.h:61
Definition: gia.h:56
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Cec_ManSimClassesRefine ( Cec_ManSim_t p)

Function*************************************************************

Synopsis [Returns 1 if the bug is found.]

Description []

SideEffects []

SeeAlso []

Definition at line 908 of file cecClass.c.

909 {
910  int i;
912  p->nWords = p->pPars->nWords;
913  for ( i = 0; i < p->pPars->nRounds; i++ )
914  {
915  if ( (i % (p->pPars->nRounds / 5)) == 0 && p->pPars->fVerbose )
918  if ( Cec_ManSimSimulateRound( p, p->vCiSimInfo, p->vCoSimInfo ) )
919  return 1;
920  }
921  if ( p->pPars->fVerbose )
923  return 0;
924 }
int fVerbose
Definition: cec.h:73
void Cec_ManSimCreateInfo(Cec_ManSim_t *p, Vec_Ptr_t *vInfoCis, Vec_Ptr_t *vInfoCos)
Definition: cecClass.c:808
int Cec_ManSimSimulateRound(Cec_ManSim_t *p, Vec_Ptr_t *vInfoCis, Vec_Ptr_t *vInfoCos)
Definition: cecClass.c:652
Gia_Man_t * pAig
Definition: cecInt.h:115
void Gia_ManEquivPrintClasses(Gia_Man_t *p, int fVerbose, float Mem)
Definition: giaEquiv.c:304
void Gia_ManCreateValueRefs(Gia_Man_t *p)
Definition: giaUtil.c:687
int nWords
Definition: cecInt.h:117
Vec_Ptr_t * vCiSimInfo
Definition: cecInt.h:127
static float Cec_MemUsage(Cec_ManSim_t *p)
Definition: cecClass.c:33
Cec_ParSim_t * pPars
Definition: cecInt.h:116
Vec_Ptr_t * vCoSimInfo
Definition: cecInt.h:128
int nRounds
Definition: cec.h:63
int nWords
Definition: cec.h:61
int Cec_ManSimClassRemoveOne ( Cec_ManSim_t p,
int  i 
)

Function*************************************************************

Synopsis [Refines one equivalence class.]

Description []

SideEffects []

SeeAlso []

Definition at line 308 of file cecClass.c.

309 {
310  int iRepr, Ent;
311  if ( Gia_ObjIsConst(p->pAig, i) )
312  {
313  Gia_ObjSetRepr( p->pAig, i, GIA_VOID );
314  return 1;
315  }
316  if ( !Gia_ObjIsClass(p->pAig, i) )
317  return 0;
318  assert( Gia_ObjIsClass(p->pAig, i) );
319  iRepr = Gia_ObjRepr( p->pAig, i );
320  if ( iRepr == GIA_VOID )
321  iRepr = i;
322  // collect nodes
323  Vec_IntClear( p->vClassOld );
324  Vec_IntClear( p->vClassNew );
325  Gia_ClassForEachObj( p->pAig, iRepr, Ent )
326  {
327  if ( Ent == i )
328  Vec_IntPush( p->vClassNew, Ent );
329  else
330  Vec_IntPush( p->vClassOld, Ent );
331  }
332  assert( Vec_IntSize( p->vClassNew ) == 1 );
335  assert( !Gia_ObjIsClass(p->pAig, i) );
336  return 1;
337 }
static int Gia_ObjIsClass(Gia_Man_t *p, int Id)
Definition: gia.h:919
Gia_Man_t * pAig
Definition: cecInt.h:115
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static int Gia_ObjIsConst(Gia_Man_t *p, int Id)
Definition: gia.h:915
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
Vec_Int_t * vClassNew
Definition: cecInt.h:139
void Cec_ManSimClassCreate(Gia_Man_t *p, Vec_Int_t *vClass)
Definition: cecClass.c:234
#define Gia_ClassForEachObj(p, i, iObj)
Definition: gia.h:931
#define GIA_VOID
Definition: gia.h:45
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
Vec_Int_t * vClassOld
Definition: cecInt.h:138
int Cec_ManSimSimulateRound ( Cec_ManSim_t p,
Vec_Ptr_t vInfoCis,
Vec_Ptr_t vInfoCos 
)

Function*************************************************************

Synopsis [Simulates one round.]

Description [Returns the number of PO entry if failed; 0 otherwise.]

SideEffects []

SeeAlso []

Definition at line 652 of file cecClass.c.

653 {
654  Gia_Obj_t * pObj;
655  unsigned * pRes0, * pRes1, * pRes;
656  int i, k, w, Ent, iCiId = 0, iCoId = 0;
657  // prepare internal storage
658  if ( p->nWordsOld != p->nWords )
659  Cec_ManSimMemRelink( p );
660  p->nMemsMax = 0;
661  // allocate score counters
662  ABC_FREE( p->pScores );
663  if ( p->pBestState )
664  p->pScores = ABC_CALLOC( int, 32 * p->nWords );
665  // simulate nodes
666  Vec_IntClear( p->vRefinedC );
667  if ( Gia_ObjValue(Gia_ManConst0(p->pAig)) )
668  {
669  pRes = Cec_ManSimSimRef( p, 0 );
670  for ( w = 1; w <= p->nWords; w++ )
671  pRes[w] = 0;
672  }
673  Gia_ManForEachObj1( p->pAig, pObj, i )
674  {
675  if ( Gia_ObjIsCi(pObj) )
676  {
677  if ( Gia_ObjValue(pObj) == 0 )
678  {
679  iCiId++;
680  continue;
681  }
682  pRes = Cec_ManSimSimRef( p, i );
683  if ( vInfoCis )
684  {
685  pRes0 = (unsigned *)Vec_PtrEntry( vInfoCis, iCiId++ );
686  for ( w = 1; w <= p->nWords; w++ )
687  pRes[w] = pRes0[w-1];
688  }
689  else
690  {
691  for ( w = 1; w <= p->nWords; w++ )
692  pRes[w] = Gia_ManRandom( 0 );
693  }
694  // make sure the first pattern is always zero
695  pRes[1] ^= (pRes[1] & 1);
696  goto references;
697  }
698  if ( Gia_ObjIsCo(pObj) ) // co always has non-zero 1st fanin and zero 2nd fanin
699  {
700  pRes0 = Cec_ManSimSimDeref( p, Gia_ObjFaninId0(pObj,i) );
701  if ( vInfoCos )
702  {
703  pRes = (unsigned *)Vec_PtrEntry( vInfoCos, iCoId++ );
704  if ( Gia_ObjFaninC0(pObj) )
705  for ( w = 1; w <= p->nWords; w++ )
706  pRes[w-1] = ~pRes0[w];
707  else
708  for ( w = 1; w <= p->nWords; w++ )
709  pRes[w-1] = pRes0[w];
710  }
711  continue;
712  }
713  assert( Gia_ObjValue(pObj) );
714  pRes = Cec_ManSimSimRef( p, i );
715  pRes0 = Cec_ManSimSimDeref( p, Gia_ObjFaninId0(pObj,i) );
716  pRes1 = Cec_ManSimSimDeref( p, Gia_ObjFaninId1(pObj,i) );
717 
718 // Abc_Print( 1, "%d,%d ", Gia_ObjValue( Gia_ObjFanin0(pObj) ), Gia_ObjValue( Gia_ObjFanin1(pObj) ) );
719 
720  if ( Gia_ObjFaninC0(pObj) )
721  {
722  if ( Gia_ObjFaninC1(pObj) )
723  for ( w = 1; w <= p->nWords; w++ )
724  pRes[w] = ~(pRes0[w] | pRes1[w]);
725  else
726  for ( w = 1; w <= p->nWords; w++ )
727  pRes[w] = ~pRes0[w] & pRes1[w];
728  }
729  else
730  {
731  if ( Gia_ObjFaninC1(pObj) )
732  for ( w = 1; w <= p->nWords; w++ )
733  pRes[w] = pRes0[w] & ~pRes1[w];
734  else
735  for ( w = 1; w <= p->nWords; w++ )
736  pRes[w] = pRes0[w] & pRes1[w];
737  }
738 
739 references:
740  // if this node is candidate constant, collect it
741  if ( Gia_ObjIsConst(p->pAig, i) && !Cec_ManSimCompareConst(pRes + 1, p->nWords) )
742  {
743  pRes[0]++;
744  Vec_IntPush( p->vRefinedC, i );
745  if ( p->pBestState )
746  Cec_ManSimCompareConstScore( pRes + 1, p->nWords, p->pScores );
747  }
748  // if the node belongs to a class, save it
749  if ( Gia_ObjIsClass(p->pAig, i) )
750  pRes[0]++;
751  // if this is the last node of the class, process it
752  if ( Gia_ObjIsTail(p->pAig, i) )
753  {
754  Vec_IntClear( p->vClassTemp );
755  Gia_ClassForEachObj( p->pAig, Gia_ObjRepr(p->pAig, i), Ent )
756  Vec_IntPush( p->vClassTemp, Ent );
757  Cec_ManSimClassRefineOne( p, Gia_ObjRepr(p->pAig, i) );
758  Vec_IntForEachEntry( p->vClassTemp, Ent, k )
759  Cec_ManSimSimDeref( p, Ent );
760  }
761  }
762 
763  if ( p->pPars->fConstCorr )
764  {
765  Vec_IntForEachEntry( p->vRefinedC, i, k )
766  {
767  Gia_ObjSetRepr( p->pAig, i, GIA_VOID );
768  Cec_ManSimSimDeref( p, i );
769  }
770  Vec_IntClear( p->vRefinedC );
771  }
772 
773  if ( Vec_IntSize(p->vRefinedC) > 0 )
775  assert( vInfoCis == NULL || iCiId == Gia_ManCiNum(p->pAig) );
776  assert( vInfoCos == NULL || iCoId == Gia_ManCoNum(p->pAig) );
777  assert( p->nMems == 1 );
778  if ( p->nMems != 1 )
779  Abc_Print( 1, "Cec_ManSimSimulateRound(): Memory management error!\n" );
780  if ( p->pPars->fVeryVerbose )
782  if ( p->pBestState )
784 /*
785  if ( p->nMems > 1 ) {
786  for ( i = 1; i < p->nObjs; i++ )
787  if ( p->pSims[i] ) {
788  int x = 0;
789  }
790  }
791 */
792  return Cec_ManSimAnalyzeOutputs( p );
793 }
int fVeryVerbose
Definition: cec.h:72
static int Gia_ObjIsClass(Gia_Man_t *p, int Id)
Definition: gia.h:919
unsigned * Cec_ManSimSimRef(Cec_ManSim_t *p, int i)
Definition: cecClass.c:404
int * pScores
Definition: cecInt.h:136
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
unsigned * Cec_ManSimSimDeref(Cec_ManSim_t *p, int i)
Definition: cecClass.c:441
void Cec_ManSimMemRelink(Cec_ManSim_t *p)
Definition: cecClass.c:378
static int Gia_ObjValue(Gia_Obj_t *pObj)
Definition: gia.h:413
Gia_Man_t * pAig
Definition: cecInt.h:115
Definition: gia.h:75
void Gia_ManEquivPrintClasses(Gia_Man_t *p, int fVerbose, float Mem)
Definition: giaEquiv.c:304
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
int Cec_ManSimClassRefineOne(Cec_ManSim_t *p, int i)
Definition: cecClass.c:268
int nWords
Definition: cecInt.h:117
static int Gia_ObjIsConst(Gia_Man_t *p, int Id)
Definition: gia.h:915
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void Cec_ManSimFindBestPattern(Cec_ManSim_t *p)
Definition: cecClass.c:548
int nMemsMax
Definition: cecInt.h:123
int nWordsOld
Definition: cecInt.h:125
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define Gia_ClassForEachObj(p, i, iObj)
Definition: gia.h:931
int Cec_ManSimAnalyzeOutputs(Cec_ManSim_t *p)
Definition: cecClass.c:584
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
int Cec_ManSimCompareConst(unsigned *p, int nWords)
FUNCTION DEFINITIONS ///.
Definition: cecClass.c:50
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static int Gia_ObjIsTail(Gia_Man_t *p, int Id)
Definition: gia.h:918
#define GIA_VOID
Definition: gia.h:45
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static float Cec_MemUsage(Cec_ManSim_t *p)
Definition: cecClass.c:33
void Cec_ManSimCompareConstScore(unsigned *p, int nWords, int *pScores)
Definition: cecClass.c:170
#define ABC_FREE(obj)
Definition: abc_global.h:232
Cec_ParSim_t * pPars
Definition: cecInt.h:116
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Vec_Int_t * vRefinedC
Definition: cecInt.h:141
#define assert(ex)
Definition: util_old.h:213
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
Abc_Cex_t * pBestState
Definition: cecInt.h:134
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
Vec_Int_t * vClassTemp
Definition: cecInt.h:140
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
void Cec_ManSimProcessRefined(Cec_ManSim_t *p, Vec_Int_t *vRefined)
Definition: cecClass.c:467
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Cec_ManSim_t* Cec_ManSimStart ( Gia_Man_t pAig,
Cec_ParSim_t pPars 
)

Function*************************************************************

Synopsis [Creates AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 198 of file cecMan.c.

199 {
200  Cec_ManSim_t * p;
201  p = ABC_ALLOC( Cec_ManSim_t, 1 );
202  memset( p, 0, sizeof(Cec_ManSim_t) );
203  p->pAig = pAig;
204  p->pPars = pPars;
205  p->nWords = pPars->nWords;
206  p->pSimInfo = ABC_CALLOC( int, Gia_ManObjNum(pAig) );
207  p->vClassOld = Vec_IntAlloc( 1000 );
208  p->vClassNew = Vec_IntAlloc( 1000 );
209  p->vClassTemp = Vec_IntAlloc( 1000 );
210  p->vRefinedC = Vec_IntAlloc( 10000 );
212  if ( pPars->fCheckMiter || Gia_ManRegNum(p->pAig) )
213  {
215  Vec_PtrCleanSimInfo( p->vCoSimInfo, 0, pPars->nWords );
216  }
217  p->iOut = -1;
218  return p;
219 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrCleanSimInfo(Vec_Ptr_t *vInfo, int iWord, int nWords)
Definition: vecPtr.h:968
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Gia_Man_t * pAig
Definition: cecInt.h:115
int fCheckMiter
Definition: cec.h:67
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int nWords
Definition: cecInt.h:117
Vec_Ptr_t * vCiSimInfo
Definition: cecInt.h:127
Vec_Int_t * vClassNew
Definition: cecInt.h:139
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
int * pSimInfo
Definition: cecInt.h:119
Cec_ParSim_t * pPars
Definition: cecInt.h:116
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Vec_Ptr_t * vCoSimInfo
Definition: cecInt.h:128
Vec_Int_t * vRefinedC
Definition: cecInt.h:141
int nWords
Definition: cec.h:61
Vec_Int_t * vClassTemp
Definition: cecInt.h:140
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
Definition: vecPtr.h:929
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Vec_Int_t * vClassOld
Definition: cecInt.h:138
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Cec_ManSimStop ( Cec_ManSim_t p)

Function*************************************************************

Synopsis [Deletes AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 232 of file cecMan.c.

233 {
234  Vec_IntFree( p->vClassOld );
235  Vec_IntFree( p->vClassNew );
236  Vec_IntFree( p->vClassTemp );
237  Vec_IntFree( p->vRefinedC );
238  if ( p->vCiSimInfo )
239  Vec_PtrFree( p->vCiSimInfo );
240  if ( p->vCoSimInfo )
241  Vec_PtrFree( p->vCoSimInfo );
242  ABC_FREE( p->pScores );
243  ABC_FREE( p->pCexComb );
244  ABC_FREE( p->pCexes );
245  ABC_FREE( p->pMems );
246  ABC_FREE( p->pSimInfo );
247  ABC_FREE( p );
248 }
Abc_Cex_t * pCexComb
Definition: cecInt.h:133
int * pScores
Definition: cecInt.h:136
Vec_Ptr_t * vCiSimInfo
Definition: cecInt.h:127
void ** pCexes
Definition: cecInt.h:130
Vec_Int_t * vClassNew
Definition: cecInt.h:139
int * pSimInfo
Definition: cecInt.h:119
#define ABC_FREE(obj)
Definition: abc_global.h:232
Vec_Ptr_t * vCoSimInfo
Definition: cecInt.h:128
Vec_Int_t * vRefinedC
Definition: cecInt.h:141
Vec_Int_t * vClassTemp
Definition: cecInt.h:140
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
unsigned * pMems
Definition: cecInt.h:120
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Vec_Int_t * vClassOld
Definition: cecInt.h:138
int Cec_ObjSatVarValue ( Cec_ManSat_t p,
Gia_Obj_t pObj 
)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Returns value of the SAT variable.]

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file cecSolve.c.

49 {
50  return sat_solver_var_value( p->pSat, Cec_ObjSatNum(p, pObj) );
51 }
static ABC_NAMESPACE_IMPL_START int Cec_ObjSatNum(Cec_ManSat_t *p, Gia_Obj_t *pObj)
DECLARATIONS ///.
Definition: cecSolve.c:30
sat_solver * pSat
Definition: cecInt.h:83
static int sat_solver_var_value(sat_solver *s, int v)
Definition: satSolver.h:200