abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cecPat.c File Reference
#include "cecInt.h"

Go to the source code of this file.

Functions

static
ABC_NAMESPACE_IMPL_START void 
Cec_ManPatStoreNum (Cec_ManPat_t *p, int Num)
 DECLARATIONS ///. More...
 
static int Cec_ManPatRestoreNum (Cec_ManPat_t *p)
 
static void Cec_ManPatStore (Cec_ManPat_t *p, Vec_Int_t *vPat)
 
static void Cec_ManPatRestore (Cec_ManPat_t *p, Vec_Int_t *vPat)
 
int Cec_ManPatComputePattern_rec (Cec_ManSat_t *pSat, Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Cec_ManPatComputePattern1_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vPat)
 
void Cec_ManPatComputePattern2_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vPat)
 
int Cec_ManPatComputePattern3_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Cec_ManPatVerifyPattern (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vPat)
 
void Cec_ManPatComputePattern4_rec (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Cec_ManPatCleanMark0 (Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Cec_ManPatSavePattern (Cec_ManPat_t *pMan, Cec_ManSat_t *p, Gia_Obj_t *pObj)
 
void Cec_ManPatSavePatternCSat (Cec_ManPat_t *pMan, Vec_Int_t *vPat)
 
int Cec_ManPatCollectTry (Vec_Ptr_t *vInfo, Vec_Ptr_t *vPres, int iBit, int *pLits, int nLits)
 
Vec_Ptr_tCec_ManPatCollectPatterns (Cec_ManPat_t *pMan, int nInputs, int nWordsInit)
 
Vec_Ptr_tCec_ManPatPackPatterns (Vec_Int_t *vCexStore, int nInputs, int nRegs, int nWordsInit)
 

Function Documentation

void Cec_ManPatCleanMark0 ( Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 341 of file cecPat.c.

342 {
343  assert( Gia_ObjIsCo(pObj) );
346 }
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_ManPatComputePattern4_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: cecPat.c:317
#define assert(ex)
Definition: util_old.h:213
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
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
int Cec_ManPatCollectTry ( Vec_Ptr_t vInfo,
Vec_Ptr_t vPres,
int  iBit,
int *  pLits,
int  nLits 
)

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

Synopsis [Packs patterns into array of simulation info.]

Description []

SideEffects []

SeeAlso []

                               ` 

Definition at line 421 of file cecPat.c.

422 {
423  unsigned * pInfo, * pPres;
424  int i;
425  for ( i = 0; i < nLits; i++ )
426  {
427  pInfo = (unsigned *)Vec_PtrEntry(vInfo, Abc_Lit2Var(pLits[i]));
428  pPres = (unsigned *)Vec_PtrEntry(vPres, Abc_Lit2Var(pLits[i]));
429  if ( Abc_InfoHasBit( pPres, iBit ) &&
430  Abc_InfoHasBit( pInfo, iBit ) == Abc_LitIsCompl(pLits[i]) )
431  return 0;
432  }
433  for ( i = 0; i < nLits; i++ )
434  {
435  pInfo = (unsigned *)Vec_PtrEntry(vInfo, Abc_Lit2Var(pLits[i]));
436  pPres = (unsigned *)Vec_PtrEntry(vPres, Abc_Lit2Var(pLits[i]));
437  Abc_InfoSetBit( pPres, iBit );
438  if ( Abc_InfoHasBit( pInfo, iBit ) == Abc_LitIsCompl(pLits[i]) )
439  Abc_InfoXorBit( pInfo, iBit );
440  }
441  return 1;
442 }
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static void Abc_InfoXorBit(unsigned *p, int i)
Definition: abc_global.h:260
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
void Cec_ManPatComputePattern1_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vPat 
)

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

Synopsis [Derives satisfying assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 170 of file cecPat.c.

171 {
172  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
173  return;
174  Gia_ObjSetTravIdCurrent(p, pObj);
175  if ( Gia_ObjIsCi(pObj) )
176  {
177  Vec_IntPush( vPat, Abc_Var2Lit( Gia_ObjCioId(pObj), pObj->fMark1==0 ) );
178  return;
179  }
180  assert( Gia_ObjIsAnd(pObj) );
181  if ( pObj->fMark1 == 1 )
182  {
185  }
186  else
187  {
188  assert( (Gia_ObjFanin0(pObj)->fMark1 ^ Gia_ObjFaninC0(pObj)) == 0 ||
189  (Gia_ObjFanin1(pObj)->fMark1 ^ Gia_ObjFaninC1(pObj)) == 0 );
190  if ( (Gia_ObjFanin0(pObj)->fMark1 ^ Gia_ObjFaninC0(pObj)) == 0 )
192  else
194  }
195 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
void Cec_ManPatComputePattern1_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vPat)
Definition: cecPat.c:170
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
unsigned fMark1
Definition: gia.h:84
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
void Cec_ManPatComputePattern2_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vPat 
)

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

Synopsis [Derives satisfying assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 208 of file cecPat.c.

209 {
210  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
211  return;
212  Gia_ObjSetTravIdCurrent(p, pObj);
213  if ( Gia_ObjIsCi(pObj) )
214  {
215  Vec_IntPush( vPat, Abc_Var2Lit( Gia_ObjCioId(pObj), pObj->fMark1==0 ) );
216  return;
217  }
218  assert( Gia_ObjIsAnd(pObj) );
219  if ( pObj->fMark1 == 1 )
220  {
223  }
224  else
225  {
226  assert( (Gia_ObjFanin0(pObj)->fMark1 ^ Gia_ObjFaninC0(pObj)) == 0 ||
227  (Gia_ObjFanin1(pObj)->fMark1 ^ Gia_ObjFaninC1(pObj)) == 0 );
228  if ( (Gia_ObjFanin1(pObj)->fMark1 ^ Gia_ObjFaninC1(pObj)) == 0 )
230  else
232  }
233 }
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
unsigned fMark1
Definition: gia.h:84
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void Cec_ManPatComputePattern2_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vPat)
Definition: cecPat.c:208
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
int Cec_ManPatComputePattern3_rec ( Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis [Derives satisfying assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 246 of file cecPat.c.

247 {
248  int Value0, Value1, Value;
249  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
250  return (pObj->fMark1 << 1) | pObj->fMark0;
251  Gia_ObjSetTravIdCurrent(p, pObj);
252  if ( Gia_ObjIsCi(pObj) )
253  {
254  pObj->fMark0 = 1;
255  pObj->fMark1 = 1;
256  return GIA_UND;
257  }
258  assert( Gia_ObjIsAnd(pObj) );
259  Value0 = Cec_ManPatComputePattern3_rec( p, Gia_ObjFanin0(pObj) );
260  Value1 = Cec_ManPatComputePattern3_rec( p, Gia_ObjFanin1(pObj) );
261  Value = Gia_XsimAndCond( Value0, Gia_ObjFaninC0(pObj), Value1, Gia_ObjFaninC1(pObj) );
262  pObj->fMark0 = (Value & 1);
263  pObj->fMark1 = ((Value >> 1) & 1);
264  return Value;
265 }
#define GIA_UND
Definition: gia.h:749
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
unsigned fMark1
Definition: gia.h:84
static int Gia_XsimAndCond(int Value0, int fCompl0, int Value1, int fCompl1)
Definition: gia.h:759
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
int Cec_ManPatComputePattern3_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: cecPat.c:246
unsigned fMark0
Definition: gia.h:79
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
void Cec_ManPatComputePattern4_rec ( Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 317 of file cecPat.c.

318 {
319  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
320  return;
321  Gia_ObjSetTravIdCurrent(p, pObj);
322  pObj->fMark0 = 0;
323  if ( Gia_ObjIsCi(pObj) )
324  return;
325  assert( Gia_ObjIsAnd(pObj) );
328 }
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
unsigned fMark0
Definition: gia.h:79
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
void Cec_ManPatComputePattern4_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: cecPat.c:317
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
int Cec_ManPatComputePattern_rec ( Cec_ManSat_t pSat,
Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis [Derives satisfying assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 140 of file cecPat.c.

141 {
142  int Counter = 0;
143  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
144  return 0;
145  Gia_ObjSetTravIdCurrent(p, pObj);
146  if ( Gia_ObjIsCi(pObj) )
147  {
148  pObj->fMark1 = Cec_ObjSatVarValue( pSat, pObj );
149  return 1;
150  }
151  assert( Gia_ObjIsAnd(pObj) );
152  Counter += Cec_ManPatComputePattern_rec( pSat, p, Gia_ObjFanin0(pObj) );
153  Counter += Cec_ManPatComputePattern_rec( pSat, p, Gia_ObjFanin1(pObj) );
154  pObj->fMark1 = (Gia_ObjFanin0(pObj)->fMark1 ^ Gia_ObjFaninC0(pObj)) &
155  (Gia_ObjFanin1(pObj)->fMark1 ^ Gia_ObjFaninC1(pObj));
156  return Counter;
157 }
int Cec_ManPatComputePattern_rec(Cec_ManSat_t *pSat, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: cecPat.c:140
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
unsigned fMark1
Definition: gia.h:84
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static int Counter
int Cec_ObjSatVarValue(Cec_ManSat_t *p, Gia_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition: cecSolve.c:48
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
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
static void Cec_ManPatRestore ( Cec_ManPat_t p,
Vec_Int_t vPat 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 113 of file cecPat.c.

114 {
115  int i, Size, Number;
116  Vec_IntClear( vPat );
117  Size = Cec_ManPatRestoreNum( p );
118  Number = Cec_ManPatRestoreNum( p );
119  Vec_IntPush( vPat, Number );
120  for ( i = 1; i < Size; i++ )
121  {
122  Number += Cec_ManPatRestoreNum( p );
123  Vec_IntPush( vPat, Number );
124  }
125  assert( Vec_IntSize(vPat) == Size );
126 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
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
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Cec_ManPatRestoreNum(Cec_ManPat_t *p)
Definition: cecPat.c:68
static int Cec_ManPatRestoreNum ( Cec_ManPat_t p)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 68 of file cecPat.c.

69 {
70  int ch, i, x = 0;
71  for ( i = 0; (ch = Vec_StrEntry(p->vStorage, p->iStart++)) & 0x80; i++ )
72  x |= (ch & 0x7f) << (7 * i);
73  return x | (ch << (7 * i));
74 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static char Vec_StrEntry(Vec_Str_t *p, int i)
Definition: vecStr.h:336
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
static void Cec_ManPatStore ( Cec_ManPat_t p,
Vec_Int_t vPat 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 87 of file cecPat.c.

88 {
89  int i, Number, NumberPrev;
90  assert( Vec_IntSize(vPat) > 0 );
92  NumberPrev = Vec_IntEntry( vPat, 0 );
93  Cec_ManPatStoreNum( p, NumberPrev );
94  Vec_IntForEachEntryStart( vPat, Number, i, 1 )
95  {
96  assert( NumberPrev < Number );
97  Cec_ManPatStoreNum( p, Number - NumberPrev );
98  NumberPrev = Number;
99  }
100 }
static ABC_NAMESPACE_IMPL_START void Cec_ManPatStoreNum(Cec_ManPat_t *p, int Num)
DECLARATIONS ///.
Definition: cecPat.c:45
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
static ABC_NAMESPACE_IMPL_START void Cec_ManPatStoreNum ( Cec_ManPat_t p,
int  Num 
)
inlinestatic

DECLARATIONS ///.

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

FileName [cecPat.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Combinational equivalence checking.]

Synopsis [Simulation pattern manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file cecPat.c.

46 {
47  unsigned x = (unsigned)Num;
48  assert( Num >= 0 );
49  while ( x & ~0x7f )
50  {
51  Vec_StrPush( p->vStorage, (char)((x & 0x7f) | 0x80) );
52  x >>= 7;
53  }
54  Vec_StrPush( p->vStorage, (char)x );
55 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
#define assert(ex)
Definition: util_old.h:213
void Cec_ManPatVerifyPattern ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vPat 
)

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

Synopsis [Derives satisfying assignment.]

Description []

SideEffects []

SeeAlso []

Definition at line 278 of file cecPat.c.

279 {
280  Gia_Obj_t * pTemp;
281  int i, Value;
283  Vec_IntForEachEntry( vPat, Value, i )
284  {
285  pTemp = Gia_ManCi( p, Abc_Lit2Var(Value) );
286 // assert( Abc_LitIsCompl(Value) != (int)pTemp->fMark1 );
287  if ( pTemp->fMark1 )
288  {
289  pTemp->fMark0 = 0;
290  pTemp->fMark1 = 1;
291  }
292  else
293  {
294  pTemp->fMark0 = 1;
295  pTemp->fMark1 = 0;
296  }
297  Gia_ObjSetTravIdCurrent( p, pTemp );
298  }
299  Value = Cec_ManPatComputePattern3_rec( p, Gia_ObjFanin0(pObj) );
300  Value = Gia_XsimNotCond( Value, Gia_ObjFaninC0(pObj) );
301  if ( Value != GIA_ONE )
302  Abc_Print( 1, "Cec_ManPatVerifyPattern(): Verification failed.\n" );
303  assert( Value == GIA_ONE );
304 }
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_XsimNotCond(int Value, int fCompl)
Definition: gia.h:751
unsigned fMark1
Definition: gia.h:84
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
int Cec_ManPatComputePattern3_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: cecPat.c:246
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
unsigned fMark0
Definition: gia.h:79
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
#define GIA_ONE
Definition: gia.h:748