48static inline int Min_ManCiNum(
Min_Man_t *
p ) {
return p->nCis; }
49static inline int Min_ManCoNum(
Min_Man_t *
p ) {
return p->nCos; }
50static inline int Min_ManObjNum(
Min_Man_t *
p ) {
return Vec_IntSize(&
p->vFans) >> 1; }
51static inline int Min_ManAndNum(
Min_Man_t *
p ) {
return Min_ManObjNum(
p) -
p->nCis -
p->nCos - 1; }
53static inline int Min_ManCi(
Min_Man_t *
p,
int i ) {
return 1 + i; }
54static inline int Min_ManCo(
Min_Man_t *
p,
int i ) {
return Min_ManObjNum(
p) - Min_ManCoNum(
p) + i; }
56static inline int Min_ObjIsCi(
Min_Man_t *
p,
int i ) {
return i > 0 && i <= Min_ManCiNum(
p); }
57static inline int Min_ObjIsNode(
Min_Man_t *
p,
int i ) {
return i > Min_ManCiNum(
p) && i < Min_ManObjNum(
p) - Min_ManCoNum(
p); }
58static inline int Min_ObjIsAnd(
Min_Man_t *
p,
int i ) {
return Min_ObjIsNode(
p, i) && Vec_IntEntry(&
p->vFans, 2*i) < Vec_IntEntry(&
p->vFans, 2*i+1); }
59static inline int Min_ObjIsXor(
Min_Man_t *
p,
int i ) {
return Min_ObjIsNode(
p, i) && Vec_IntEntry(&
p->vFans, 2*i) > Vec_IntEntry(&
p->vFans, 2*i+1); }
60static inline int Min_ObjIsBuf(
Min_Man_t *
p,
int i ) {
return Min_ObjIsNode(
p, i) && Vec_IntEntry(&
p->vFans, 2*i) ==Vec_IntEntry(&
p->vFans, 2*i+1); }
61static inline int Min_ObjIsCo(
Min_Man_t *
p,
int i ) {
return i >= Min_ManObjNum(
p) - Min_ManCoNum(
p) && i < Min_ManObjNum(
p); }
63static inline int Min_ObjLit(
Min_Man_t *
p,
int i,
int n ) {
return Vec_IntEntry(&
p->vFans, i + i + n); }
64static inline int Min_ObjLit0(
Min_Man_t *
p,
int i ) {
return Vec_IntEntry(&
p->vFans, i + i + 0); }
65static inline int Min_ObjLit1(
Min_Man_t *
p,
int i ) {
return Vec_IntEntry(&
p->vFans, i + i + 1); }
66static inline int Min_ObjCioId(
Min_Man_t *
p,
int i ) {
assert( i && !Min_ObjIsNode(
p, i) );
return Min_ObjLit1(
p, i); }
68static inline int Min_ObjFan0(
Min_Man_t *
p,
int i ) {
return Abc_Lit2Var( Min_ObjLit0(
p, i) ); }
69static inline int Min_ObjFan1(
Min_Man_t *
p,
int i ) {
return Abc_Lit2Var( Min_ObjLit1(
p, i) ); }
71static inline int Min_ObjFanC0(
Min_Man_t *
p,
int i ) {
return Abc_LitIsCompl( Min_ObjLit0(
p, i) ); }
72static inline int Min_ObjFanC1(
Min_Man_t *
p,
int i ) {
return Abc_LitIsCompl( Min_ObjLit1(
p, i) ); }
74static inline char Min_ObjValN(
Min_Man_t *
p,
int i ) {
return Vec_StrEntry(&
p->vValsN, i); }
75static inline void Min_ObjSetValN(
Min_Man_t *
p,
int i,
char v ){ Vec_StrWriteEntry(&
p->vValsN, i, v); }
77static inline char Min_LitValL(
Min_Man_t *
p,
int i ) {
return Vec_StrEntry(&
p->vValsL, i); }
78static inline void Min_LitSetValL(
Min_Man_t *
p,
int i,
char v ){
assert(v==0 || v==1); Vec_StrWriteEntry(&
p->vValsL, i, v); Vec_StrWriteEntry(&
p->vValsL, i^1, (
char)!v); Vec_IntPush(&
p->vVis, Abc_Lit2Var(i)); }
79static inline void Min_ObjCleanValL(
Min_Man_t *
p,
int i ) { ((
short *)Vec_StrArray(&
p->vValsL))[i] = 0x0202; }
80static inline void Min_ObjMarkValL(
Min_Man_t *
p,
int i ) { ((
short *)Vec_StrArray(&
p->vValsL))[i] |= 0x0404; }
81static inline void Min_ObjMark2ValL(
Min_Man_t *
p,
int i ) { ((
short *)Vec_StrArray(&
p->vValsL))[i] |= 0x0808; }
82static inline void Min_ObjUnmark2ValL(
Min_Man_t *
p,
int i ) { ((
short *)Vec_StrArray(&
p->vValsL))[i] &= 0xF7F7; }
84static inline int Min_LitIsCi(
Min_Man_t *
p,
int v ) {
return v > 1 && v <
p->FirstAndLit; }
85static inline int Min_LitIsNode(
Min_Man_t *
p,
int v ) {
return v >=
p->FirstAndLit && v <
p->FirstCoLit; }
86static inline int Min_LitIsCo(
Min_Man_t *
p,
int v ) {
return v >=
p->FirstCoLit; }
88static inline int Min_LitIsAnd(
int v,
int v0,
int v1 ) {
return Abc_LitIsCompl(v) ^ (v0 < v1); }
89static inline int Min_LitIsXor(
int v,
int v0,
int v1 ) {
return Abc_LitIsCompl(v) ^ (v0 > v1); }
90static inline int Min_LitIsBuf(
int v,
int v0,
int v1 ) {
return v0 == v1; }
92static inline int Min_LitFan(
Min_Man_t *
p,
int v ) {
return Vec_IntEntry(&
p->vFans, v); }
93static inline int Min_LitFanC(
Min_Man_t *
p,
int v ) {
return Abc_LitIsCompl( Min_LitFan(
p, v) ); }
95static inline void Min_ManStartValsN(
Min_Man_t *
p ) { Vec_StrGrow(&
p->vValsN, Vec_IntCap(&
p->vFans)/2); Vec_StrFill(&
p->vValsN, Min_ManObjNum(
p), 2); }
96static inline void Min_ManStartValsL(
Min_Man_t *
p ) { Vec_StrGrow(&
p->vValsL, Vec_IntCap(&
p->vFans)); Vec_StrFill(&
p->vValsL, Vec_IntSize(&
p->vFans), 2); }
97static inline int Min_ManCheckCleanValsL(
Min_Man_t *
p ) {
int i;
char c;
Vec_StrForEachEntry( &
p->vValsL, c, i )
if ( c != 2 )
return 0;
return 1; }
98static inline void Min_ManCleanVisitedValL(
Min_Man_t *
p ) {
int i, iObj;
Vec_IntForEachEntry(&
p->vVis, iObj, i) Min_ObjCleanValL(
p, iObj); Vec_IntClear(&
p->vVis); }
101#define Min_ManForEachObj( p, i ) \
102 for ( i = 0; i < Min_ManObjNum(p); i++ )
103#define Min_ManForEachCi( p, i ) \
104 for ( i = 1; i <= Min_ManCiNum(p); i++ )
105#define Min_ManForEachCo( p, i ) \
106 for ( i = Min_ManObjNum(p) - Min_ManCoNum(p); i < Min_ManObjNum(p); i++ )
107#define Min_ManForEachAnd( p, i ) \
108 for ( i = 1 + Min_ManCiNum(p); i < Min_ManObjNum(p) - Min_ManCoNum(p); i++ )
126static inline Min_Man_t * Min_ManStart(
int nObjMax )
129 Vec_IntGrow( &
p->vFans, nObjMax );
130 Vec_IntPushTwo( &
p->vFans, -1, -1 );
133static inline void Min_ManStop(
Min_Man_t *
p )
135 Vec_IntErase( &
p->vFans );
136 Vec_StrErase( &
p->vValsN );
137 Vec_StrErase( &
p->vValsL );
138 Vec_IntErase( &
p->vVis );
139 Vec_IntErase( &
p->vPat );
154static inline int Min_ManAppendObj(
Min_Man_t *
p,
int iLit0,
int iLit1 )
156 int iLit = Vec_IntSize(&
p->vFans);
157 Vec_IntPushTwo( &
p->vFans, iLit0, iLit1 );
160static inline int Min_ManAppendCi(
Min_Man_t *
p )
163 p->FirstAndLit = Vec_IntSize(&
p->vFans) + 2;
164 return Min_ManAppendObj(
p, 0,
p->nCis-1 );
166static inline int Min_ManAppendCo(
Min_Man_t *
p,
int iLit0 )
169 if (
p->FirstCoLit == 0 )
170 p->FirstCoLit = Vec_IntSize(&
p->vFans);
171 return Min_ManAppendObj(
p, iLit0,
p->nCos-1 );
187 Gia_Obj_t * pObj = Gia_ManObj(
p, iObj);
int iLit0, iLit1;
190 assert( Gia_ObjIsAnd(pObj) );
193 iLit0 = Gia_ObjFanin0Copy(pObj);
194 iLit1 = Gia_ObjFanin1Copy(pObj);
195 pObj->
Value = Min_ManAppendObj( pNew, Abc_MinInt(iLit0, iLit1), Abc_MaxInt(iLit0, iLit1) );
200 Min_Man_t * pNew = Min_ManStart( Gia_ManObjNum(
p) );
202 Gia_ManConst0(
p)->Value = 0;
204 pObj->
Value = Min_ManAppendCi( pNew );
208 pObj->
Value = Min_ManAppendObj( pNew, Gia_ObjFaninLit0(pObj, i), Gia_ObjFaninLit1(pObj, i) );
210 pObj->
Value = Min_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
217 Min_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
234static inline char Min_XsimNot(
char Val )
240static inline char Min_XsimXor(
char Val0,
char Val1 )
242 if ( Val0 < 2 && Val1 < 2 )
246static inline char Min_XsimAnd(
char Val0,
char Val1 )
248 if ( Val0 == 0 || Val1 == 0 )
250 if ( Val0 == 1 && Val1 == 1 )
270 char Val = Min_LitValL(
p, iLit);
271 if ( Val == 2 && Min_LitIsNode(
p, iLit) )
273 int iLit0 = Min_LitFan(
p, iLit);
274 int iLit1 = Min_LitFan(
p, iLit^1);
277 assert( Val0 < 3 && Val1 < 3 );
278 if ( Min_LitIsXor(iLit, iLit0, iLit1) )
279 Val = Min_XsimXor( Val0, Val1 );
281 Val = Min_XsimAnd( Val0, Val1 );
284 Val ^= Abc_LitIsCompl(iLit);
285 Min_LitSetValL(
p, iLit, Val );
288 Vec_IntPush( &
p->vVis, Abc_Lit2Var(iLit) );
289 Min_ObjMark2ValL(
p, Abc_Lit2Var(iLit) );
295 int i, Entry;
char Res;
296 if ( iLit < 2 )
return 1;
297 assert( !Min_LitIsCo(
p, iLit) );
299 assert( Vec_IntSize(&
p->vVis) == 0 );
301 Min_LitSetValL(
p, Entry, 1 );
303 Min_ManCleanVisitedValL(
p );
309 int i, iObj, iTemp;
char Res;
310 Vec_IntClear( &
p->vPat );
311 if ( iLit < 2 )
return;
312 assert( !Min_LitIsCo(
p, iLit) );
314 assert( Vec_IntSize(&
p->vVis) == 0 );
316 Min_LitSetValL(
p, iTemp, 1 );
319 Min_ObjMarkValL(
p, Abc_Lit2Var(iLit) );
322 int iLit = Abc_Var2Lit( iObj, 0 );
323 int Value = 7 & Min_LitValL(
p, iLit);
326 if ( Min_LitIsCi(
p, iLit) )
327 Vec_IntPush( &
p->vPat, Abc_LitNotCond(iLit, !(Value&1)) );
330 int iLit0 = Min_LitFan(
p, iLit);
331 int iLit1 = Min_LitFan(
p, iLit^1);
332 char Val0 = Min_LitValL(
p, iLit0 );
333 char Val1 = Min_LitValL(
p, iLit1 );
336 assert( (Val0&1) && (Val1&1) );
337 Min_ObjMarkValL(
p, Abc_Lit2Var(iLit0) );
338 Min_ObjMarkValL(
p, Abc_Lit2Var(iLit1) );
342 int Zero0 = !(Val0&3);
343 int Zero1 = !(Val1&3);
345 if ( Zero0 && !Zero1 )
346 Min_ObjMarkValL(
p, Abc_Lit2Var(iLit0) );
347 else if ( !Zero0 && Zero1 )
348 Min_ObjMarkValL(
p, Abc_Lit2Var(iLit1) );
349 else if ( Val0 == 4 && Val1 != 4 )
350 Min_ObjMarkValL(
p, Abc_Lit2Var(iLit0) );
351 else if ( Val1 == 4 && Val0 != 4 )
352 Min_ObjMarkValL(
p, Abc_Lit2Var(iLit1) );
354 Min_ObjMarkValL(
p, Abc_Lit2Var(iLit0) );
356 Min_ObjMarkValL(
p, Abc_Lit2Var(iLit1) );
360 Min_ObjCleanValL(
p, Abc_Lit2Var(iLit) );
362 Vec_IntClear( &
p->vVis );
365 assert( Vec_IntSize(&
p->vPat) <= Vec_IntSize(vLits) );
379static inline char Min_LitIsImplied1(
Min_Man_t *
p,
int iLit )
382 int iLit0 = Min_LitFan(
p, iLit);
383 int iLit1 = Min_LitFan(
p, iLit^1);
384 char Val0 = Min_LitValL(
p, iLit0);
385 char Val1 = Min_LitValL(
p, iLit1);
386 assert( Min_LitIsNode(
p, iLit) );
387 assert( Min_LitValL(
p, iLit) == 2 );
388 if ( Min_LitIsXor(iLit, iLit0, iLit1) )
389 Val = Min_XsimXor( Val0, Val1 );
391 Val = Min_XsimAnd( Val0, Val1 );
394 Val ^= Abc_LitIsCompl(iLit);
395 Min_LitSetValL(
p, iLit, Val );
399static inline char Min_LitIsImplied2(
Min_Man_t *
p,
int iLit )
402 int iLit0 = Min_LitFan(
p, iLit);
403 int iLit1 = Min_LitFan(
p, iLit^1);
404 char Val0 = Min_LitValL(
p, iLit0);
405 char Val1 = Min_LitValL(
p, iLit1);
406 assert( Min_LitIsNode(
p, iLit) );
407 assert( Min_LitValL(
p, iLit) == 2 );
408 if ( Val0 == 2 && Min_LitIsNode(
p, iLit0) ) {
409 Val0 = Min_LitIsImplied1(
p, iLit0);
410 Val1 = Min_LitValL(
p, iLit1);
412 if ( Val1 == 2 && Min_LitIsNode(
p, iLit1) )
413 Val1 = Min_LitIsImplied1(
p, iLit1);
414 if ( Min_LitIsXor(iLit, iLit0, iLit1) )
415 Val = Min_XsimXor( Val0, Val1 );
417 Val = Min_XsimAnd( Val0, Val1 );
420 Val ^= Abc_LitIsCompl(iLit);
421 Min_LitSetValL(
p, iLit, Val );
425static inline char Min_LitIsImplied3(
Min_Man_t *
p,
int iLit )
428 int iLit0 = Min_LitFan(
p, iLit);
429 int iLit1 = Min_LitFan(
p, iLit^1);
430 char Val0 = Min_LitValL(
p, iLit0);
431 char Val1 = Min_LitValL(
p, iLit1);
432 assert( Min_LitIsNode(
p, iLit) );
433 assert( Min_LitValL(
p, iLit) == 2 );
434 if ( Val0 == 2 && Min_LitIsNode(
p, iLit0) ) {
435 Val0 = Min_LitIsImplied2(
p, iLit0);
436 Val1 = Min_LitValL(
p, iLit1);
438 if ( Val1 == 2 && Min_LitIsNode(
p, iLit1) )
439 Val1 = Min_LitIsImplied2(
p, iLit1);
440 if ( Min_LitIsXor(iLit, iLit0, iLit1) )
441 Val = Min_XsimXor( Val0, Val1 );
443 Val = Min_XsimAnd( Val0, Val1 );
446 Val ^= Abc_LitIsCompl(iLit);
447 Min_LitSetValL(
p, iLit, Val );
451static inline char Min_LitIsImplied4(
Min_Man_t *
p,
int iLit )
454 int iLit0 = Min_LitFan(
p, iLit);
455 int iLit1 = Min_LitFan(
p, iLit^1);
456 char Val0 = Min_LitValL(
p, iLit0);
457 char Val1 = Min_LitValL(
p, iLit1);
458 assert( Min_LitIsNode(
p, iLit) );
459 assert( Min_LitValL(
p, iLit) == 2 );
460 if ( Val0 == 2 && Min_LitIsNode(
p, iLit0) ) {
461 Val0 = Min_LitIsImplied3(
p, iLit0);
462 Val1 = Min_LitValL(
p, iLit1);
464 if ( Val1 == 2 && Min_LitIsNode(
p, iLit1) )
465 Val1 = Min_LitIsImplied3(
p, iLit1);
466 if ( Min_LitIsXor(iLit, iLit0, iLit1) )
467 Val = Min_XsimXor( Val0, Val1 );
469 Val = Min_XsimAnd( Val0, Val1 );
472 Val ^= Abc_LitIsCompl(iLit);
473 Min_LitSetValL(
p, iLit, Val );
477static inline char Min_LitIsImplied5(
Min_Man_t *
p,
int iLit )
480 int iLit0 = Min_LitFan(
p, iLit);
481 int iLit1 = Min_LitFan(
p, iLit^1);
482 char Val0 = Min_LitValL(
p, iLit0);
483 char Val1 = Min_LitValL(
p, iLit1);
484 assert( Min_LitIsNode(
p, iLit) );
485 assert( Min_LitValL(
p, iLit) == 2 );
486 if ( Val0 == 2 && Min_LitIsNode(
p, iLit0) ) {
487 Val0 = Min_LitIsImplied4(
p, iLit0);
488 Val1 = Min_LitValL(
p, iLit1);
490 if ( Val1 == 2 && Min_LitIsNode(
p, iLit1) )
491 Val1 = Min_LitIsImplied4(
p, iLit1);
492 if ( Min_LitIsXor(iLit, iLit0, iLit1) )
493 Val = Min_XsimXor( Val0, Val1 );
495 Val = Min_XsimAnd( Val0, Val1 );
498 Val ^= Abc_LitIsCompl(iLit);
499 Min_LitSetValL(
p, iLit, Val );
508 int iLit0 = Min_LitFan(
p, iLit);
509 int iLit1 = Min_LitFan(
p, iLit^1);
510 char Val0 = Min_LitValL(
p, iLit0);
511 char Val1 = Min_LitValL(
p, iLit1);
513 assert( Min_LitIsNode(
p, iLit) );
514 assert( Min_LitValL(
p, iLit) == 2 );
515 if ( Depth > 1 && Val0 == 2 && Min_LitIsNode(
p, iLit0) )
518 Val1 = Min_LitValL(
p, iLit1);
520 if ( Depth > 1 && Val1 == 2 && Min_LitIsNode(
p, iLit1) )
523 Val0 = Min_LitValL(
p, iLit0);
525 if ( Min_LitIsXor(iLit, iLit0, iLit1) )
526 Val = Min_XsimXor( Val0, Val1 );
528 Val = Min_XsimAnd( Val0, Val1 );
531 Val ^= Abc_LitIsCompl(iLit);
532 Min_LitSetValL(
p, iLit, Val );
538 int Res = 1, LitValue = !Abc_LitIsCompl(iLit);
539 int Val = (int)Min_LitValL(
p, iLit);
541 return Val == LitValue;
543 if ( Min_LitIsCi(
p, iLit) )
544 Vec_IntPush( &
p->vPat, iLit );
547 int iLit0 = Min_LitFan(
p, iLit);
548 int iLit1 = Min_LitFan(
p, iLit^1);
549 char Val0 = Min_LitValL(
p, iLit0);
550 char Val1 = Min_LitValL(
p, iLit1);
551 if ( Min_LitIsXor(iLit, iLit0, iLit1) )
553 if ( Val0 < 2 && Val1 < 2 )
554 Res = LitValue == (Val0 ^ Val1);
563 assert( !Res || LitValue == Min_XsimXor(Min_LitValL(
p, iLit0), Min_LitValL(
p, iLit1)) );
567 if ( Val0 == 0 || Val1 == 0 )
569 else if ( Val0 == 1 && Val1 == 1 )
571 else if ( Val0 == 1 )
573 else if ( Val1 == 1 )
577 assert( !Res || 1 == Min_XsimAnd(Min_LitValL(
p, iLit0), Min_LitValL(
p, iLit1)) );
594 if ( Val0 == 2 && Min_LitIsNode(
p, iLit0) )
596 Val0 = Min_LitIsImplied3(
p, iLit0);
597 Val1 = Min_LitValL(
p, iLit1);
599 if ( Val1 == 2 && Min_LitIsNode(
p, iLit1) )
601 Val1 = Min_LitIsImplied3(
p, iLit1);
602 Val0 = Min_LitValL(
p, iLit0);
604 if ( Val0 == 0 || Val1 == 0 )
606 else if ( Val0 == 1 && Val1 == 1 )
608 else if ( Val0 == 1 )
610 else if ( Val1 == 1 )
619 assert( !Res || 0 == Min_XsimAnd(Min_LitValL(
p, iLit0), Min_LitValL(
p, iLit1)) );
623 Min_LitSetValL(
p, iLit, 1 );
629 Vec_IntClear( &
p->vPat );
630 if ( iLit < 2 )
return 1;
631 assert( !Min_LitIsCo(
p, iLit) );
633 assert( Vec_IntSize(&
p->vVis) == 0 );
636 Min_ManCleanVisitedValL(
p );
640 printf(
"Verification FAILED for literal %d.\n", iLit );
665 int t, iObj, Count = 0, CountPos = 0, CountPosSat = 0, nRuns[2] = {0}, nCountCexes[2] = {0};
666 Vec_Int_t * vPats = Vec_IntAlloc( 1000 );
667 Vec_Int_t * vPatBest = Vec_IntAlloc( Min_ManCiNum(
p) );
671 int nCexesGenSim0 = 0;
672 int nCexesGenSim = 0;
673 int nCexesGenSat = 0;
674 if ( vCoErrs && Vec_IntEntry(vCoErrs, Min_ObjCioId(
p, iObj)) >= nCexesStop )
677 for ( t = 0; t < nCexes; t++ )
683 assert( Vec_IntSize(&
p->vPat) > 0 );
685 Vec_IntClear( vPatBest );
687 Vec_IntAppend( vPatBest, &
p->vPat );
709 Before = Hsh_VecSize( pHash );
710 Vec_IntSort( vPatBest, 0 );
711 Hsh_VecManAdd( pHash, vPatBest );
712 After = Hsh_VecSize( pHash );
713 if ( Before != After )
715 Vec_IntPush( vPats, Min_ObjCioId(
p, iObj) );
716 Vec_IntPush( vPats, Vec_IntSize(vPatBest) );
717 Vec_IntAppend( vPats, vPatBest );
721 if ( nCexesGenSim0 > nCexesGenSim*10 )
723 printf(
"**** Skipping output %d (out of %d)\n", Min_ObjCioId(
p, iObj), Min_ManCoNum(
p) );
727 if ( nCexesGenSim == nCexesStop )
736 nCountCexes[0] += nCexesGenSim;
737 nCountCexes[1] += nCexesGenSat;
738 Count += nCexesGenSim + nCexesGenSat;
741 if ( nCexesGenSim0 == 0 && t == nCexes )
742 printf(
"#### Output %d (out of %d)\n", Min_ObjCioId(
p, iObj), Min_ManCoNum(
p) );
748 printf(
"Got %d unique CEXes using %d sim (%d) and %d SAT (%d) runs (ave size %.1f). PO = %d ErrPO = %d SatPO = %d ",
749 Count, nRuns[0], nCountCexes[0], nRuns[1], nCountCexes[1],
750 1.0*Vec_IntSize(vPats)/Abc_MaxInt(1, Count)-2, Min_ManCoNum(
p), CountPos, CountPosSat );
752 Abc_PrintTime( 0,
"Time", Abc_Clock() - clk );
753 Hsh_VecManStop( pHash );
754 Vec_IntFree( vPatBest );
779 Min_ManStartValsL( pNew );
783 Vec_IntFree( vPats );
788 Vec_Int_t * vCoErrs = Vec_IntStartNatural( Gia_ManCoNum(
p) );
790 Vec_IntFree( vCoErrs );
808 if ( Gia_ObjUpdateTravIdCurrentId(
p, iObj) )
810 pObj = Gia_ManObj(
p, iObj );
811 if ( Gia_ObjIsAnd(pObj) )
816 else if ( Gia_ObjIsCi(pObj) )
817 Vec_IntPush( vMap, iObj );
822 if ( Gia_ObjIsCi(pObj) || Gia_ObjUpdateTravIdCurrent(
p, pObj) )
824 assert( Gia_ObjIsAnd(pObj) );
827 pObj->
Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
833 Vec_IntClear( vMap );
835 for ( i = 0; i < nOuts; i++ )
838 pNew->
pName = Abc_UtilStrsav(
p->pName );
839 Gia_ManConst0(
p)->Value = 0;
841 pObj->
Value = Gia_ManAppendCi( pNew );
843 for ( i = 0; i < nOuts; i++ )
845 for ( i = 0; i < nOuts; i++ )
846 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManCo(
p, pOuts[i])) );
864 Vec_Int_t * vLevel = NULL, * vLevel0 = Vec_WecEntry(vCexes, iItem);
int i;
865 assert( iFirst <= iItem && iItem < iLimit );
867 if ( Vec_IntSize(vLevel) > 0 )
869 assert( iFirst <= i && iItem <= i );
870 Vec_IntClear( vLevel0 );
877 Vec_Int_t * vLevel;
int i, nCommon, nDiff = 0;
880 if ( Vec_IntSize(vLevel) == 0 )
882 Vec_IntAppend(vLevel, vCex);
885 nCommon = Vec_IntTwoCountCommon( vLevel, vCex );
886 if ( nCommon == Vec_IntSize(vLevel) )
888 if ( nCommon == Vec_IntSize(vCex) )
898 nTotal += Vec_IntSize(vLevel) > 0;
903 int fUseSynthesis = 1;
904 abctime clkSim = Abc_Clock(), clkSat = Abc_Clock();
905 Vec_Int_t * vOuts = vOuts0 ? vOuts0 : Vec_IntStartNatural( Gia_ManCoNum(
p) );
907 Vec_Wec_t * vCexes = Vec_WecStart( Vec_IntSize(vOuts) * nMinCexes );
908 Vec_Int_t * vPatBest = Vec_IntAlloc( 100 );
910 Gia_Obj_t * pObj;
int i, iObj, nOuts = 0, nSimOuts = 0, nSatOuts = 0;
911 vStats[0] = Vec_IntAlloc( Vec_IntSize(vOuts) );
912 vStats[1] = Vec_IntAlloc( Vec_IntSize(vOuts) );
913 vStats[2] = Vec_IntAlloc( Vec_IntSize(vOuts) );
914 Min_ManStartValsL( pNew );
920 if ( fUseSim && Min_ObjLit0(pNew, iObj) >= 2 )
922 while ( nAllCalls++ < nMaxTries )
926 Vec_IntClearAppend( vLits, &pNew->vPat );
927 Vec_IntClearAppend( vPatBest, &pNew->vPat );
931 for ( i = 0; i < 20; i++ )
934 if ( Vec_IntSize(vPatBest) > Vec_IntSize(&pNew->vPat) )
935 Vec_IntClearAppend( vPatBest, &pNew->vPat );
939 assert( Vec_IntSize(vPatBest) > 0 );
940 Vec_IntSort( vPatBest, 0 );
941 nCurrCexes +=
Min_ManAccumulate( vCexes, nOuts*nMinCexes, (nOuts+1)*nMinCexes, vPatBest );
944 if ( nCurrCexes == nMinCexes || nGoodCalls > 10*nCurrCexes )
949 assert( nCurrCexes <= nMinCexes );
951 Vec_IntPush( vStats[0], nAllCalls );
952 Vec_IntPush( vStats[1], nGoodCalls );
953 Vec_IntPush( vStats[2], nCurrCexes );
956 assert( Vec_IntSize(vOuts) == nOuts );
957 assert( Vec_IntSize(vOuts) == Vec_IntSize(vStats[0]) );
958 assert( Vec_IntSize(vOuts) == Vec_IntSize(vStats[1]) );
959 assert( Vec_IntSize(vOuts) == Vec_IntSize(vStats[2]) );
960 clkSim = Abc_Clock() - clkSim;
965 if ( Vec_IntEntry(vStats[2], i) >= nMinCexes || Vec_IntEntry(vStats[1], i) > 10*Vec_IntEntry(vStats[2], i) )
968 assert( Gia_ObjIsCo(pObj) );
969 if ( Gia_ObjFaninId0p(
p, pObj) == 0 ) {
971 printf(
"Output %d is driven by constant %d.\n", Gia_ObjCioId(pObj), Gia_ObjFaninC0(pObj) );
975 int iObj = Min_ManCo(pNew, i);
976 int Index = Gia_ObjCioId(pObj);
982 int Lit = Abc_Var2Lit( 1, 0 );
985 int nCurrCexes = Vec_IntEntry(vStats[2], i);
991 if ( Min_ObjLit0(pNew, iObj) >= 2 )
993 while ( nAllCalls++ < 100 )
995 int v, iVar = pCnf->
nVars - Gia_ManPiNum(pCon), nVars = Gia_ManPiNum(pCon);
997 sat_solver_randomize( pSat, iVar, nVars );
1002 Vec_IntClear( vLits );
1003 for ( v = 0; v < nVars; v++ )
1004 Vec_IntPush( vLits, Abc_Var2Lit(Vec_IntEntry(vMap, v), !sat_solver_var_value(pSat, iVar + v)) );
1006 Vec_IntClearAppend( vPatBest, &pNew->vPat );
1010 for ( v = 0; v < 20; v++ )
1013 if ( Vec_IntSize(vPatBest) > Vec_IntSize(&pNew->vPat) )
1014 Vec_IntClearAppend( vPatBest, &pNew->vPat );
1018 Vec_IntSort( vPatBest, 0 );
1019 nCurrCexes +=
Min_ManAccumulate( vCexes, i*nMinCexes, (i+1)*nMinCexes, vPatBest );
1020 if ( nCurrCexes == nMinCexes || nAllCalls > 10*nCurrCexes )
1025 Vec_IntWriteEntry( vStats[0], i, nAllCalls*nMaxTries );
1026 Vec_IntWriteEntry( vStats[1], i, nAllCalls*nMaxTries );
1027 Vec_IntWriteEntry( vStats[2], i, nCurrCexes );
1032 Vec_IntFree( vMap );
1035 printf(
"SAT solving for output %3d (cexes = %5d) : ", i, nCurrCexes );
1036 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
1040 clkSat = Abc_Clock() - clkSat - clkSim;
1042 printf(
"Used simulation for %d and SAT for %d outputs (out of %d).\n", nSimOuts, nSatOuts, nOuts );
1044 Abc_PrintTime( 1,
"Simulation time ", clkSim );
1046 Abc_PrintTime( 1,
"SAT solving time ", clkSat );
1048 if ( vOuts != vOuts0 )
1049 Vec_IntFreeP( &vOuts );
1050 Min_ManStop( pNew );
1051 Vec_IntFree( vPatBest );
1052 Vec_IntFree( vLits );
1073 word * pInfo = Vec_WrdEntryP( vSimsPi,
nWords * Abc_Lit2Var(Lit-2) );
1074 word * pCare = pInfo + Vec_WrdSize(vSimsPi);
1075 if ( Abc_InfoHasBit( (
unsigned *)pCare, iPat ) &&
1076 Abc_InfoHasBit( (
unsigned *)pInfo, iPat ) == Abc_LitIsCompl(Lit) )
1081 word * pInfo = Vec_WrdEntryP( vSimsPi,
nWords * Abc_Lit2Var(Lit-2) );
1082 word * pCare = pInfo + Vec_WrdSize(vSimsPi);
1083 Abc_InfoSetBit( (
unsigned *)pCare, iPat );
1084 if ( Abc_InfoHasBit( (
unsigned *)pInfo, iPat ) == Abc_LitIsCompl(Lit) )
1085 Abc_InfoXorBit( (
unsigned *)pInfo, iPat );
1092 for ( iPat = iPat0 + 1; iPat != iPat0; iPat = (iPat + 1) %
nTotal )
1099 Vec_Ptr_t * vRes = Vec_PtrAlloc( Vec_WecSize(vCexes) );
1100 int i, c, nOuts = Vec_WecSize(vCexes)/nMinCexes;
1101 for ( i = 0; i < nMinCexes; i++ )
1102 for ( c = 0; c < nOuts; c++ )
1104 Vec_Int_t * vLevel = Vec_WecEntry( vCexes, c*nMinCexes+i );
1105 if ( Vec_IntSize(vLevel) )
1106 Vec_PtrPush( vRes, vLevel );
1122 vOrder = Vec_IntStartNatural( Vec_WecSize(vCexes)/nMinCexes );
1123 assert( Vec_IntSize(vOrder) == Vec_IntSize(vScores) );
1124 assert( Vec_WecSize(vCexes)%nMinCexes == 0 );
1130 printf(
"Packing: " );
1131 for ( w = nWords0 ? nWords0 : 1; nWords0 ? w <= nWords0 : fFailed > 0; w++ )
1133 int i, iPatUsed, iPat = 0;
1135 Vec_WrdFreeP( &vSimsPi );
1136 vSimsPi = fRandom ? Vec_WrdStartRandom(2 * Gia_ManCiNum(
p) * w) : Vec_WrdStart(2 * Gia_ManCiNum(
p) * w);
1137 Vec_WrdShrink( vSimsPi, Vec_WrdSize(vSimsPi)/2 );
1138 Abc_TtClear( Vec_WrdLimit(vSimsPi), Vec_WrdSize(vSimsPi) );
1146 if ( Vec_IntSize(vLevel) == 0 )
1149 fFailed += iPatUsed == iPat;
1150 iPat = (iPatUsed + 1) % (64*(w-1) - 1);
1158 printf(
"W = %d (F = %d) ", w, fFailed );
1162 printf(
"Total = %d\n",
nTotal );
1165 nBits = Abc_TtCountOnesVec( Vec_WrdLimit(vSimsPi), Vec_WrdSize(vSimsPi) );
1166 printf(
"Bit-packing is using %d words and %d bits. Density =%8.4f %%. ",
1167 Vec_WrdSize(vSimsPi)/Gia_ManCiNum(
p), nBits, 100.0*nBits/64/Vec_WrdSize(vSimsPi) );
1168 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
1170 Vec_IntFreeP( &vOrder );
1171 Vec_PtrFreeP( &vReload );
1188 Vec_Int_t * vCounts = Vec_IntAlloc( nOuts );
1189 int i,
nWords = Vec_WrdSize(vErrors)/nOuts;
1191 for ( i = 0; i < nOuts; i++ )
1192 Vec_IntPush( vCounts, Abc_TtCountOnesVec(Vec_WrdEntryP(vErrors,
nWords * i),
nWords) );
1198 int nWordsIn = Vec_WrdSize(vErrors) / nOuts;
1199 int nWordsOut = Abc_Bit6WordNum(nOuts);
1200 Vec_Wrd_t * vSims1 = Vec_WrdStart( 64*nWordsIn*nWordsOut );
1201 Vec_Wrd_t * vSims2 = Vec_WrdStart( 64*nWordsIn*nWordsOut );
1202 assert( Vec_WrdSize(vErrors) == nWordsIn * nOuts );
1203 Abc_TtCopy( Vec_WrdArray(vSims1), Vec_WrdArray(vErrors), Vec_WrdSize(vErrors), 0 );
1205 Vec_WrdFree( vSims1 );
1210 int nWords = Vec_WrdSize(vErrors)/nOuts;
1213 Vec_WrdFree( vErrors2 );
1217#define ERR_REPT_SIZE 32
1220 int nOuts = Vec_IntSize(vOutErrs);
1221 int nPats = Vec_IntSize(vPatErrs);
1224 int i, Errs, nErrors1 = 0, nErrors2 = 0;
1235 assert( nErrors1 == nErrors2 );
1238 printf(
"Errors =%6d ", nErrors1 );
1239 printf(
"ErrPOs =%5d (Ave = %5.2f) ", nOuts-ErrOuts[0], 1.0*nErrors1/Abc_MaxInt(1, nOuts-ErrOuts[0]) );
1240 printf(
"Patterns =%5d (Ave = %5.2f) ", nPats, 1.0*nErrors1/nPats );
1241 printf(
"Density =%8.4f %%\n", 100.0*nErrors1/nPats/Abc_MaxInt(1, nOuts-ErrOuts[0]) );
1243 printf(
"Outputs: " );
1246 printf(
"%s%d=%d ", i ==
ERR_REPT_SIZE?
">" :
"", i, ErrOuts[i] );
1249 printf(
"Patterns: " );
1252 printf(
"%s%d=%d ", i ==
ERR_REPT_SIZE?
">" :
"", i, ErrPats[i] );
1260 Vec_IntFree( vPatErrs );
1261 Vec_IntFree( vCoErrs );
1271 Vec_IntPush( vRes, i );
1272 if ( Vec_IntSize(vRes) == 0 )
1273 Vec_IntFreeP( &vRes );
1278 int i, iObj,
nWords = Vec_WrdSize(vSimsPi)/Vec_IntSize(vMap);
1282 assert( Vec_WrdSize(vSimsPi)%Vec_IntSize(vMap) == 0 );
1283 Vec_WrdShrink( vSimsNew, Vec_WrdSize(vSimsNew)/2 );
1286 Abc_TtCopy( Vec_WrdArray(vSimsNew) + (iObj-1)*
nWords, Vec_WrdArray(vSimsPi) + i*
nWords,
nWords, 0 );
1287 Abc_TtCopy( Vec_WrdLimit(vSimsNew) + (iObj-1)*
nWords, Vec_WrdLimit(vSimsPi) + i*
nWords,
nWords, 0 );
1293 Vec_Int_t * vStats[3] = {0};
int i, iObj;
1297 if ( Vec_IntSum(vStats[2]) == 0 )
1299 for ( i = 0; i < 3; i++ )
1300 Vec_IntFree( vStats[i] );
1301 Vec_IntFree( vMap );
1303 Vec_WecFree( vCexes );
1315 printf(
"Unsolved = %4d ", Vec_IntSize(vOuts) );
1319 printf(
"%4d : ", i );
1320 printf(
"Out = %5d ", Vec_IntEntry(vMap, i) );
1321 printf(
"SimAll =%8d ", Vec_IntEntry(vStats[0], i) );
1322 printf(
"SimGood =%8d ", Vec_IntEntry(vStats[1], i) );
1323 printf(
"PatsAll =%8d ", Vec_IntEntry(vStats[2], i) );
1324 printf(
"Count = %5d ", Vec_IntEntry(vCounts, i) );
1330 for ( i = 0; i < 3; i++ )
1331 Vec_IntFree( vStats[i] );
1332 Vec_IntFree( vCounts );
1333 Vec_WrdFree( vSimsPo );
1334 Vec_WecFree( vCexes );
1338 Vec_WrdFree( vSimsPo );
1339 Vec_IntFree( vMap );
1348 abctime clkSweep = Abc_Clock() - clk;
1349 int nArgs = fVerbose ? printf(
"Generating patterns: Conf = %d (%d). Tries = %d. Pats = %d. Sim = %d. SAT = %d.\n",
1350 nConf, nConf2, nMaxTries, nMinCexes, fUseSim, fUseSat ) : 0;
1352 Vec_Wrd_t * vSimsPi = vOuts ?
Gia_ManCollectSims( pSwp, 0, vOuts, nMaxTries, nMinCexes, fUseSim, fUseSat, fVerbose, fVeryVerbose ) : NULL;
1353 if ( vOuts == NULL )
1354 printf(
"There is no satisfiable outputs.\n" );
1356 Abc_PrintTime( 1,
"Sweep time", clkSweep );
1358 Abc_PrintTime( 1,
"Total time", Abc_Clock() - clk );
1359 Vec_IntFreeP( &vOuts );
1367 Vec_WrdFreeP( &vSimsPi );
1384 FILE * pFile = fopen( pFileName,
"wb" );
1385 if ( pFile == NULL ) {
1386 printf(
"Cannot open output file name \"%s\".\n", pFileName );
1389 int fFakeIns = 0, fFakeOuts = 0;
1390 if (
p->vNamesIn == NULL )
1392 if (
p->vNamesOut == NULL )
1396 char * pLine =
ABC_CALLOC(
char, Gia_ManCiNum(
p)+3 );
1397 int i, k, c, iLit, nOuts[2] = {0}, nCexes = Vec_WecSize(vCexes) / Gia_ManCoNum(
p);
1398 fprintf( pFile,
"# Satisfying assignments for the primary outputs generated by ABC on %s\n",
Gia_TimeStamp() );
1399 fprintf( pFile,
".model %s\n",
p->pName );
1400 fprintf( pFile,
".inputs" );
1402 fprintf( pFile,
" %s", Gia_ObjCiName(
p, i) );
1403 fprintf( pFile,
"\n.outputs" );
1405 fprintf( pFile,
" %s", Gia_ObjCoName(
p, i) );
1406 fprintf( pFile,
"\n" );
1408 if ( Gia_ObjFaninLit0p(
p, pObj) == 0 ) {
1409 fprintf( pFile,
".names %s\n", Gia_ObjCoName(
p, i) );
1412 else if ( Gia_ObjFaninLit0p(
p, pObj) == 1 ) {
1413 fprintf( pFile,
".names %s\n 1\n", Gia_ObjCiName(
p, i) );
1417 fprintf( pFile,
".names" );
1419 fprintf( pFile,
" %s", Gia_ObjCiName(
p, c) );
1420 fprintf( pFile,
" %s\n", Gia_ObjCoName(
p, i) );
1421 for ( c = 0; c < nCexes; c++ ) {
1422 Vec_Int_t * vPat = Vec_WecEntry( vCexes, i*nCexes+c );
1423 memset(pLine,
'-', Gia_ManCiNum(
p) );
1425 pLine[Abc_Lit2Var(iLit)-1] =
'1' - Abc_LitIsCompl(iLit);
1426 fprintf( pFile,
"%s 1\n", pLine );
1431 fprintf( pFile,
".end\n\n" );
1433 printf(
"Information about %d sat, %d unsat, and %d undecided primary outputs was written into BLIF file \"%s\".\n",
1434 nOuts[1], nOuts[0], Gia_ManCoNum(
p)-nOuts[1]-nOuts[0], pFileName );
1437 if ( fFakeIns ) Vec_PtrFreeFree(
p->vNamesIn ),
p->vNamesIn = NULL;
1438 if ( fFakeOuts ) Vec_PtrFreeFree(
p->vNamesOut ),
p->vNamesOut = NULL;
1442 FILE * pFile = fopen( pFileName,
"wb" );
1443 if ( pFile == NULL ) {
1444 printf(
"Cannot open output file name \"%s\".\n", pFileName );
1448 char * pLine =
ABC_CALLOC(
char, Gia_ManCiNum(
p)+3 );
1449 int i, k, c, iLit, nOuts[2] = {0}, nCexes = Vec_WecSize(vCexes) / Gia_ManCoNum(
p);
1451 if ( Gia_ObjFaninLit0p(
p, Gia_ManCo(
p, i)) == 0 ) {
1452 fprintf( pFile,
"%d : unsat\n", i );
1455 else if ( fShort ) {
1456 for ( c = 0; c < nCexes; c++ ) {
1457 Vec_Int_t * vPat = Vec_WecEntry( vCexes, i*nCexes+c );
1458 fprintf( pFile,
"%d :", i );
1459 if ( Vec_IntSize(vPat) == 0 )
1460 fprintf( pFile,
" not available" );
1463 fprintf( pFile,
" %d", iLit );
1464 fprintf( pFile,
"\n" );
1469 for ( c = 0; c < nCexes; c++ ) {
1470 Vec_Int_t * vPat = Vec_WecEntry( vCexes, i*nCexes+c );
1471 memset(pLine,
'-', Gia_ManCiNum(
p) );
1473 pLine[Abc_Lit2Var(iLit)-1] =
'1' - Abc_LitIsCompl(iLit);
1474 fprintf( pFile,
"%d : %s\n", i, pLine );
1479 printf(
"Information about %d sat, %d unsat, and %d undecided primary outputs was written into file \"%s\".\n",
1480 nOuts[1], nOuts[0], Gia_ManCoNum(
p)-nOuts[1]-nOuts[0], pFileName );
1484void Gia_GenerateCexes(
char * pFileName,
Gia_Man_t *
p,
int nMaxTries,
int nMinCexes,
int fUseSim,
int fUseSat,
int fShort,
int fBlif,
int fVerbose,
int fVeryVerbose )
1489 assert( Vec_WecSize(vCexes) == Gia_ManCoNum(
p) * nMinCexes );
1494 for ( i = 0; i < 3; i++ )
1495 Vec_IntFreeP( &vStats[i] );
1496 Vec_WecFree( vCexes );
#define ABC_SWAP(Type, a, b)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
unsigned Abc_Random(int fReset)
void Abc_MergeSortCost2Reverse(int *pInput, int nSize, int *pCost)
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
int nTotal
DECLARATIONS ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
struct Vec_Str_t_ Vec_Str_t
#define sat_solver_addclause
Gia_Man_t * Cec4_ManSimulateTest4(Gia_Man_t *p, int nBTLimit, int nBTLimitPo, int fVerbose)
struct Cnf_Dat_t_ Cnf_Dat_t
void Cnf_DataFree(Cnf_Dat_t *p)
ABC_NAMESPACE_IMPL_START void Extra_BitMatrixTransposeP(Vec_Wrd_t *vSimsIn, int nWordsIn, Vec_Wrd_t *vSimsOut, int nWordsOut)
DECLARATIONS ///.
void Patt_ManProfileErrors(Vec_Int_t *vOutErrs, Vec_Int_t *vPatErrs)
int Min_ManBitPackOne(Vec_Wrd_t *vSimsPi, int iPat0, int nWords, Vec_Int_t *vLits)
Vec_Int_t * Min_ManGetUnsolved(Gia_Man_t *p)
Min_Man_t * Min_ManFromGia(Gia_Man_t *p, Vec_Int_t *vOuts)
typedefABC_NAMESPACE_IMPL_START struct Min_Man_t_ Min_Man_t
DECLARATIONS ///.
Vec_Ptr_t * Min_ReloadCexes(Vec_Wec_t *vCexes, int nMinCexes)
int Min_ManBitPackTry(Vec_Wrd_t *vSimsPi, int nWords, int iPat, Vec_Int_t *vLits)
char Min_LitVerify(Min_Man_t *p, int iLit, Vec_Int_t *vLits)
void Min_ManTest3(Gia_Man_t *p, Vec_Int_t *vCoErrs)
void Min_LitMinimize(Min_Man_t *p, int iLit, Vec_Int_t *vLits)
Vec_Int_t * Patt_ManOutputErrorCoverage(Vec_Wrd_t *vErrors, int nOuts)
int Min_LitJustify_rec(Min_Man_t *p, int iLit)
Vec_Wrd_t * Min_ManRemapSims(int nInputs, Vec_Int_t *vMap, Vec_Wrd_t *vSimsPi)
void Gia_ManDupCones2_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
void Gia_ManDupCones2CollectPis_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vMap)
Vec_Wrd_t * Min_ManCollect(Gia_Man_t *p, int nConf, int nConf2, int nMaxTries, int nMinCexes, int fUseSim, int fUseSat, int fVerbose, int fVeryVerbose)
Vec_Wrd_t * Gia_ManCollectSims(Gia_Man_t *pSwp, int nWords, Vec_Int_t *vOuts, int nMaxTries, int nMinCexes, int fUseSim, int fUseSat, int fVerbose, int fVeryVerbose)
void Gia_GenerateCexes(char *pFileName, Gia_Man_t *p, int nMaxTries, int nMinCexes, int fUseSim, int fUseSat, int fShort, int fBlif, int fVerbose, int fVeryVerbose)
int Min_ManAccumulate(Vec_Wec_t *vCexes, int iFirst, int iLimit, Vec_Int_t *vCex)
char Min_LitIsImplied_rec(Min_Man_t *p, int iLit, int Depth)
int Min_LitJustify(Min_Man_t *p, int iLit)
Gia_Man_t * Gia_ManDupCones2(Gia_Man_t *p, int *pOuts, int nOuts, Vec_Int_t *vMap)
void Min_ManFromGia_rec(Min_Man_t *pNew, Gia_Man_t *p, int iObj)
void Min_ManTest2(Gia_Man_t *p)
void Gia_GenerateCexesDumpBlif(char *pFileName, Gia_Man_t *p, Vec_Wec_t *vCexes)
Vec_Int_t * Patt_ManPatternErrorCoverage(Vec_Wrd_t *vErrors, int nOuts)
#define Min_ManForEachCo(p, i)
void Gia_GenerateCexesDumpFile(char *pFileName, Gia_Man_t *p, Vec_Wec_t *vCexes, int fShort)
int Patt_ManProfileErrorsOne(Vec_Wrd_t *vErrors, int nOuts)
Vec_Wrd_t * Patt_ManTransposeErrors(Vec_Wrd_t *vErrors, int nOuts)
Vec_Wrd_t * Min_ManBitPack(Gia_Man_t *p, int nWords0, Vec_Wec_t *vCexes, int fRandom, int nMinCexes, Vec_Int_t *vScores, int fVerbose)
char Min_LitVerify_rec(Min_Man_t *p, int iLit)
Vec_Wec_t * Min_ManComputeCexes(Gia_Man_t *p, Vec_Int_t *vOuts0, int nMaxTries, int nMinCexes, Vec_Int_t *vStats[3], int fUseSim, int fUseSat, int fVerbose)
int Min_ManCountSize(Vec_Wec_t *vCexes, int iFirst, int iLimit)
int Min_ManRemoveItem(Vec_Wec_t *vCexes, int iItem, int iFirst, int iLimit)
void Min_ManTest4(Gia_Man_t *p)
Vec_Int_t * Min_TargGenerateCexes(Min_Man_t *p, Vec_Int_t *vCoErrs, int nCexes, int nCexesStop, int *pnComputed, int fVerbose)
void Gia_ManStop(Gia_Man_t *p)
Vec_Wrd_t * Gia_ManSimPatSimOut(Gia_Man_t *pGia, Vec_Wrd_t *vSimsPi, int fOuts)
Gia_Man_t * Gia_ManDupMuxes(Gia_Man_t *p, int Limit)
#define Gia_ManForEachAnd(p, pObj, i)
#define Gia_ManForEachCoVec(vVec, p, pObj, i)
void Gia_ManStopP(Gia_Man_t **p)
#define Gia_ManForEachCoDriverId(p, DriverId, i)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
struct Gia_Obj_t_ Gia_Obj_t
void Gia_ManFillValue(Gia_Man_t *p)
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Gia_Man_t * Gia_ManAigSyn2(Gia_Man_t *p, int fOldAlgo, int fCoarsen, int fCutMin, int nRelaxRatio, int fDelayMin, int fVerbose, int fVeryVerbose)
void Gia_ManIncrementTravId(Gia_Man_t *p)
#define Gia_ManForEachCo(p, pObj, i)
#define Gia_ManForEachCi(p, pObj, i)
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Vec_Ptr_t * Gia_GetFakeNames(int nNames, int fCaps)
void * Mf_ManGenerateCnf(Gia_Man_t *pGia, int nLutSize, int fCnfObjIds, int fAddOrCla, int fMapping, int fVerbose)
unsigned __int64 word
DECLARATIONS ///.
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
void sat_solver_delete(sat_solver *s)
struct Hsh_VecMan_t_ Hsh_VecMan_t
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryReverse(vVec, pEntry, i)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
#define Vec_StrForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_WecForEachLevelReverseStartStop(vGlob, vVec, i, LevelStart, LevelStop)
#define Vec_WecForEachLevelStartStop(vGlob, vVec, i, LevelStart, LevelStop)
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.