49 if ( Gia_ObjIsAnd(pObj) )
51 Gia_ManCorrSpecReduce_rec( pNew,
p, Gia_ObjFanin0(pObj), f, nPrefix );
52 Gia_ManCorrSpecReduce_rec( pNew,
p, Gia_ObjFanin1(pObj), f, nPrefix );
53 return Gia_ManHashAnd( pNew, Gia_ObjFanin0CopyF(
p, f, pObj), Gia_ObjFanin1CopyF(
p, f, pObj) );
58 return Gia_ObjCopyF(
p, f, pObj);
60 assert( f && Gia_ObjIsRo(
p, pObj) );
61 pObj = Gia_ObjRoToRi(
p, pObj );
62 Gia_ManCorrSpecReduce_rec( pNew,
p, Gia_ObjFanin0(pObj), f-1, nPrefix );
63 return Gia_ObjFanin0CopyF(
p, f-1, pObj );
81 if ( ~Gia_ObjCopyF(
p, f, pObj) )
83 if ( f >= nPrefix && (pRepr = Gia_ObjReprObj(
p, Gia_ObjId(
p, pObj))) )
85 Gia_ManCorrSpecReduce_rec( pNew,
p, pRepr, f, nPrefix );
86 iLitNew = Abc_LitNotCond( Gia_ObjCopyF(
p, f, pRepr), Gia_ObjPhase(pRepr) ^ Gia_ObjPhase(pObj) );
87 Gia_ObjSetCopyF(
p, f, pObj, iLitNew );
90 assert( Gia_ObjIsCand(pObj) );
91 iLitNew = Gia_ManCorrSpecReal( pNew,
p, pObj, f, nPrefix );
92 Gia_ObjSetCopyF(
p, f, pObj, iLitNew );
111 int f, i, iPrev, iObj, iPrevNew, iObjNew;
113 assert( Gia_ManRegNum(
p) > 0 );
115 Vec_IntFill( &
p->vCopies, (nFrames+fScorr)*Gia_ManObjNum(
p), -1 );
118 pNew->
pName = Abc_UtilStrsav(
p->pName );
119 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
121 Gia_ObjSetCopyF(
p, 0, Gia_ManConst0(
p), 0 );
123 Gia_ObjSetCopyF(
p, 0, pObj, Gia_ManAppendCi(pNew) );
125 if ( (pRepr = Gia_ObjReprObj(
p, Gia_ObjId(
p, pObj))) )
126 Gia_ObjSetCopyF(
p, 0, pObj, Gia_ObjCopyF(
p, 0, pRepr) );
127 for ( f = 0; f < nFrames+fScorr; f++ )
129 Gia_ObjSetCopyF(
p, f, Gia_ManConst0(
p), 0 );
131 Gia_ObjSetCopyF(
p, f, pObj, Gia_ManAppendCi(pNew) );
133 *pvOutputs = Vec_IntAlloc( 1000 );
134 vXorLits = Vec_IntAlloc( 1000 );
139 if ( Gia_ObjIsConst(
p, i ) )
141 iObjNew = Gia_ManCorrSpecReal( pNew,
p, pObj, nFrames, 0 );
142 iObjNew = Abc_LitNotCond( iObjNew, Gia_ObjPhase(pObj) );
145 Vec_IntPush( *pvOutputs, 0 );
146 Vec_IntPush( *pvOutputs, i );
147 Vec_IntPush( vXorLits, iObjNew );
150 else if ( Gia_ObjIsHead(
p, i ) )
155 iPrevNew = Gia_ManCorrSpecReal( pNew,
p, Gia_ManObj(
p, iPrev), nFrames, 0 );
156 iObjNew = Gia_ManCorrSpecReal( pNew,
p, Gia_ManObj(
p, iObj), nFrames, 0 );
157 iPrevNew = Abc_LitNotCond( iPrevNew, Gia_ObjPhase(pObj) ^ Gia_ObjPhase(Gia_ManObj(
p, iPrev)) );
158 iObjNew = Abc_LitNotCond( iObjNew, Gia_ObjPhase(pObj) ^ Gia_ObjPhase(Gia_ManObj(
p, iObj)) );
159 if ( iPrevNew != iObjNew && iPrevNew != 0 && iObjNew != 1 )
161 Vec_IntPush( *pvOutputs, iPrev );
162 Vec_IntPush( *pvOutputs, iObj );
163 Vec_IntPush( vXorLits,
Gia_ManHashAnd(pNew, iPrevNew, Abc_LitNot(iObjNew)) );
168 iPrevNew = Gia_ManCorrSpecReal( pNew,
p, Gia_ManObj(
p, iPrev), nFrames, 0 );
169 iObjNew = Gia_ManCorrSpecReal( pNew,
p, Gia_ManObj(
p, iObj), nFrames, 0 );
170 iPrevNew = Abc_LitNotCond( iPrevNew, Gia_ObjPhase(pObj) ^ Gia_ObjPhase(Gia_ManObj(
p, iPrev)) );
171 iObjNew = Abc_LitNotCond( iObjNew, Gia_ObjPhase(pObj) ^ Gia_ObjPhase(Gia_ManObj(
p, iObj)) );
172 if ( iPrevNew != iObjNew && iPrevNew != 0 && iObjNew != 1 )
174 Vec_IntPush( *pvOutputs, iPrev );
175 Vec_IntPush( *pvOutputs, iObj );
176 Vec_IntPush( vXorLits,
Gia_ManHashAnd(pNew, iPrevNew, Abc_LitNot(iObjNew)) );
185 pRepr = Gia_ObjReprObj(
p, Gia_ObjId(
p,pObj) );
188 iPrevNew = Gia_ObjIsConst(
p, i)? 0 : Gia_ManCorrSpecReal( pNew,
p, pRepr, nFrames, 0 );
189 iObjNew = Gia_ManCorrSpecReal( pNew,
p, pObj, nFrames, 0 );
190 iObjNew = Abc_LitNotCond( iObjNew, Gia_ObjPhase(pRepr) ^ Gia_ObjPhase(pObj) );
191 if ( iPrevNew != iObjNew )
193 Vec_IntPush( *pvOutputs, Gia_ObjId(
p, pRepr) );
194 Vec_IntPush( *pvOutputs, Gia_ObjId(
p, pObj) );
200 Gia_ManAppendCo( pNew, iObjNew );
201 Vec_IntFree( vXorLits );
203 Vec_IntErase( &
p->vCopies );
228 int f, i, iPrevNew, iObjNew;
229 assert( (!fScorr && nFrames > 1) || (fScorr && nFrames > 0) || nPrefix );
230 assert( Gia_ManRegNum(
p) > 0 );
232 Vec_IntFill( &
p->vCopies, (nFrames+nPrefix+fScorr)*Gia_ManObjNum(
p), -1 );
235 pNew->
pName = Abc_UtilStrsav(
p->pName );
236 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
240 Gia_ManAppendCi(pNew);
241 Gia_ObjSetCopyF(
p, 0, pObj, 0 );
243 for ( f = 0; f < nFrames+nPrefix+fScorr; f++ )
245 Gia_ObjSetCopyF(
p, f, Gia_ManConst0(
p), 0 );
247 Gia_ObjSetCopyF(
p, f, pObj, Gia_ManAppendCi(pNew) );
249 *pvOutputs = Vec_IntAlloc( 1000 );
250 vXorLits = Vec_IntAlloc( 1000 );
251 for ( f = nPrefix; f < nFrames+nPrefix; f++ )
255 pRepr = Gia_ObjReprObj(
p, Gia_ObjId(
p,pObj) );
258 iPrevNew = Gia_ObjIsConst(
p, i)? 0 : Gia_ManCorrSpecReal( pNew,
p, pRepr, f, nPrefix );
259 iObjNew = Gia_ManCorrSpecReal( pNew,
p, pObj, f, nPrefix );
260 iObjNew = Abc_LitNotCond( iObjNew, Gia_ObjPhase(pRepr) ^ Gia_ObjPhase(pObj) );
261 if ( iPrevNew != iObjNew )
263 Vec_IntPush( *pvOutputs, Gia_ObjId(
p, pRepr) );
264 Vec_IntPush( *pvOutputs, Gia_ObjId(
p, pObj) );
270 Gia_ManAppendCo( pNew, iObjNew );
271 Vec_IntFree( vXorLits );
273 Vec_IntErase( &
p->vCopies );
296 nWords = Vec_PtrReadWordsSimInfo( vInfo );
297 assert( nFlops <= Vec_PtrSize(vInfo) );
298 for ( k = 0; k < nFlops; k++ )
300 pInfo = (
unsigned *)Vec_PtrEntry( vInfo, k );
301 for ( w = 0; w <
nWords; w++ )
304 for ( k = nFlops; k < Vec_PtrSize(vInfo); k++ )
306 pInfo = (
unsigned *)Vec_PtrEntry( vInfo, k );
307 for ( w = 0; w <
nWords; w++ )
326 unsigned * pInfoObj, * pInfoRepr;
328 nWords = Vec_PtrReadWordsSimInfo( vInfo );
332 pRepr = Gia_ObjReprObj(
p, Gia_ObjId(
p,pObj) );
333 if ( pRepr == NULL || Gia_ObjFailed(
p, Gia_ObjId(
p,pObj)) )
335 pInfoObj = (
unsigned *)Vec_PtrEntry( vInfo, i );
336 for ( w = 0; w <
nWords; w++ )
337 assert( pInfoObj[w] == 0 );
339 if ( Gia_ObjIsConst0(pRepr) )
341 assert( Gia_ObjIsRo(
p, pRepr) );
344 pInfoRepr = (
unsigned *)Vec_PtrEntry( vInfo, Gia_ObjCioId(pRepr) - Gia_ManPiNum(
p) );
345 for ( w = 0; w <
nWords; w++ )
346 pInfoObj[w] = pInfoRepr[w];
367 vPairs = Vec_IntAlloc( 100 );
371 pRepr = Gia_ObjReprObj(
p, Gia_ObjId(
p,pObj) );
372 if ( pRepr == NULL || Gia_ObjIsConst0(pRepr) || Gia_ObjFailed(
p, Gia_ObjId(
p,pObj)) )
375 assert( Gia_ObjIsRo(
p, pRepr) );
378 Vec_IntPush( vPairs, Gia_ObjCioId(pRepr) - Gia_ManPiNum(
p) );
379 Vec_IntPush( vPairs, i );
397 unsigned * pInfoObj, * pInfoRepr;
398 int w, i, iObj, iRepr,
nWords;
399 nWords = Vec_PtrReadWordsSimInfo( vInfo );
402 iObj = Vec_IntEntry( vPairs, ++i );
403 pInfoObj = (
unsigned *)Vec_PtrEntry( vInfo, iObj );
404 pInfoRepr = (
unsigned *)Vec_PtrEntry( vInfo, iRepr );
405 for ( w = 0; w <
nWords; w++ )
407 assert( pInfoObj[w] == 0 );
408 pInfoObj[w] = pInfoRepr[w];
426 unsigned * pInfo, * pPres;
428 for ( i = 0; i < nLits; i++ )
430 pInfo = (
unsigned *)Vec_PtrEntry(vInfo, Abc_Lit2Var(pLits[i]));
431 pPres = (
unsigned *)Vec_PtrEntry(vPres, Abc_Lit2Var(pLits[i]));
432 if ( Abc_InfoHasBit( pPres, iBit ) &&
433 Abc_InfoHasBit( pInfo, iBit ) == Abc_LitIsCompl(pLits[i]) )
436 for ( i = 0; i < nLits; i++ )
438 pInfo = (
unsigned *)Vec_PtrEntry(vInfo, Abc_Lit2Var(pLits[i]));
439 pPres = (
unsigned *)Vec_PtrEntry(vPres, Abc_Lit2Var(pLits[i]));
440 Abc_InfoSetBit( pPres, iBit );
441 if ( Abc_InfoHasBit( pInfo, iBit ) == Abc_LitIsCompl(pLits[i]) )
442 Abc_InfoXorBit( pInfo, iBit );
462 int nWords = Vec_PtrReadWordsSimInfo(vInfo);
464 int k, nSize, kMax = 0;
465 vPat = Vec_IntAlloc( 100 );
466 vPres = Vec_PtrAllocSimInfo( Vec_PtrSize(vInfo),
nWords );
467 Vec_PtrCleanSimInfo( vPres, 0,
nWords );
468 while ( iStart < Vec_IntSize(vCexStore) )
473 nSize = Vec_IntEntry( vCexStore, iStart++ );
477 Vec_IntClear( vPat );
478 for ( k = 0; k < nSize; k++ )
479 Vec_IntPush( vPat, Vec_IntEntry( vCexStore, iStart++ ) );
481 for ( k = 1; k < nBits; k++ )
484 kMax = Abc_MaxInt( kMax, k );
488 Vec_PtrFree( vPres );
507 int nBits = 32 * Vec_PtrReadWordsSimInfo(vInfo);
508 int k, iLit, nLits, Out, iBit = 1;
509 while ( iStart < Vec_IntSize(vCexStore) )
513 Out = Vec_IntEntry( vCexStore, iStart++ );
516 nLits = Vec_IntEntry( vCexStore, iStart++ );
520 for ( k = 0; k < nLits; k++ )
522 iLit = Vec_IntEntry( vCexStore, iStart++ );
523 pInfo = (
unsigned *)Vec_PtrEntry( vInfo, Abc_Lit2Var(iLit) );
524 if ( Abc_InfoHasBit( pInfo, iBit ) == Abc_LitIsCompl(iLit) )
525 Abc_InfoXorBit( pInfo, iBit );
527 if ( ++iBit == nBits )
549 int RetValue = 0, iStart = 0;
554 vSimInfo = Vec_PtrAllocSimInfo( Gia_ManRegNum(pSim->
pAig) + Gia_ManPiNum(pSim->
pAig) * nFrames, pSim->
pPars->
nWords );
555 while ( iStart < Vec_IntSize(vCexStore) )
566 assert( iStart == Vec_IntSize(vCexStore) );
567 Vec_PtrFree( vSimInfo );
568 Vec_IntFree( vPairs );
586 int RetValue = 0, iStart = 0;
589 vSimInfo = Vec_PtrAllocSimInfo( Gia_ManCiNum(pSim->
pAig), pSim->
pPars->
nWords );
590 while ( iStart < Vec_IntSize(vCexStore) )
596 assert( iStart == Vec_IntSize(vCexStore) );
597 Vec_PtrFree( vSimInfo );
614 int i, status, iRepr, iObj;
616 assert( 2 * Vec_StrSize(vStatus) == Vec_IntSize(vOutputs) );
619 iRepr = Vec_IntEntry( vOutputs, 2*i );
620 iObj = Vec_IntEntry( vOutputs, 2*i+1 );
625 if ( Gia_ObjHasSameRepr(
p, iRepr, iObj) )
665 if ( (pRepr = Gia_ObjReprObj(
p, Gia_ObjId(
p, pObj))) )
668 pObj->
Value = Abc_LitNotCond( pRepr->
Value, Gia_ObjPhaseReal(pRepr) ^ Gia_ObjPhaseReal(pObj) );
673 assert( Gia_ObjIsAnd(pObj) );
697 pNew->
pName = Abc_UtilStrsav(
p->pName );
698 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
700 Gia_ManConst0(
p)->Value = 0;
702 pObj->
Value = Gia_ManAppendCi(pNew);
707 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
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++ )
731 if ( Gia_ObjIsNone(
p, i) )
733 else if ( Gia_ObjIsConst(
p, i) )
735 else if ( Gia_ObjIsHead(
p, i) )
738 CounterX -= Gia_ManCoNum(
p);
739 nLits = Gia_ManCiNum(
p) + Gia_ManAndNum(
p) - Counter - CounterX;
741 Abc_Print( 1,
"BMC : " );
743 Abc_Print( 1,
"%3d : ", iIter );
744 Abc_Print( 1,
"c =%8d cl =%7d lit =%8d ", Counter0, Counter, nLits );
750 else if ( Entry == 0 )
752 else if ( Entry == -1 )
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 );
761 int i, CounterX = 0, Counter0 = 0, Counter = 0;
762 for ( i = 1; i < Gia_ManObjNum(
p); i++ )
764 if ( Gia_ObjIsNone(
p, i) )
766 else if ( Gia_ObjIsConst(
p, i) )
768 else if ( Gia_ObjIsHead(
p, i) )
771 CounterX -= Gia_ManCoNum(
p);
772 return Gia_ManCiNum(
p) + Gia_ManAndNum(
p) - Counter - CounterX;
795 int fChanges, RetValue, i;
806 pParsSat->nBTLimit = pPars->
nBTLimit;
807 pParsSat->fVerbose = pPars->
fVerbose;
814 if ( Gia_ManPoNum(pSrm) == 0 )
817 Vec_IntFree( vOutputs );
820 pParsSat->nBTLimit *= 10;
826 if ( Vec_IntSize(vCexStore) )
835 Vec_IntFree( vCexStore );
836 Vec_StrFree( vStatus );
838 Vec_IntFree( vOutputs );
857 int i, Iter, iObj, iRepr, fPrev, Total, Count0, Count1;
858 assert( Vec_StrSize(vStatus) * 2 == Vec_IntSize(vEquivs) );
863 if ( Gia_ObjHasRepr(
p, i) )
867 for ( i = 0; i < Vec_StrSize(vStatus); i++ )
869 iRepr = Vec_IntEntry(vEquivs, 2*i);
870 iObj = Vec_IntEntry(vEquivs, 2*i+1);
871 assert( iRepr == Gia_ObjRepr(
p, iObj) );
872 if ( Vec_StrEntry(vStatus, i) != 1 )
874 Gia_ManObj(
p, iObj)->fMark1 = 1;
878 for ( Iter = 0; Iter < 100; Iter++ )
883 if ( Gia_ObjIsCi(pObj) )
885 assert( Gia_ObjIsAnd(pObj) || Gia_ObjIsCo(pObj) );
887 if ( Gia_ObjIsAnd(pObj) )
888 pObj->
fMark1 |= Gia_ObjFanin0(pObj)->fMark1 | Gia_ObjFanin1(pObj)->fMark1;
890 pObj->
fMark1 |= Gia_ObjFanin0(pObj)->fMark1;
897 fChanges += fPrev ^ pObjRo->
fMark1;
905 if ( pObj->
fMark1 && Gia_ObjHasRepr(
p, i) )
909 printf(
"%5d -> %5d (%3d) ", Count0, Count1, Iter );
926 int nIterMax = 100000;
928 int fRunBmcFirst = 1;
936 int r, RetValue, nPrev[4] = {0};
937 abctime clkTotal = Abc_Clock();
938 abctime clkSat = 0, clkSim = 0, clkSrm = 0;
939 abctime clk2, clk = Abc_Clock();
940 if ( Gia_ManRegNum(pAig) == 0 )
942 Abc_Print( 1,
"Cec_ManLatchCorrespondence(): Not a sequential AIG.\n" );
956 if ( pAig->
pReprs == NULL )
963 pParsSat->nBTLimit = pPars->
nBTLimit;
964 pParsSat->fVerbose = pPars->
fVerbose;
967 pParsSat->nBTLimit = Abc_MinInt( pParsSat->nBTLimit, 1000 );
970 Abc_Print( 1,
"Obj = %7d. And = %7d. Conf = %5d. Fr = %d. Lcorr = %d. Ring = %d. CSat = %d.\n",
971 Gia_ManObjNum(pAig), Gia_ManAndNum(pAig),
980 ((int (*)(
void *))pPars->
pFunc)( pPars->
pData );
981 ((int (*)(
void *))pPars->
pFunc)( pPars->
pData );
985 Abc_Print( 1,
"Stopped signal correspondence after BMC.\n" );
990 for ( r = 0; r < nIterMax; r++ )
995 Abc_Print( 1,
"Stopped signal correspondence after %d refiment iterations.\n", r );
1002 assert( Gia_ManRegNum(pSrm) == 0 && Gia_ManPiNum(pSrm) == Gia_ManRegNum(pAig)+(pPars->
nFrames+!pPars->
fLatchCorr)*Gia_ManPiNum(pAig) );
1003 clkSrm += Abc_Clock() - clk2;
1004 if ( Gia_ManCoNum(pSrm) == 0 )
1006 Vec_IntFree( vOutputs );
1018 clkSat += Abc_Clock() - clk2;
1019 if ( Vec_IntSize(vCexStore) == 0 )
1021 Vec_IntFree( vCexStore );
1022 Vec_StrFree( vStatus );
1023 Vec_IntFree( vOutputs );
1031 Vec_IntFree( vCexStore );
1032 clkSim += Abc_Clock() - clk2;
1036 Vec_StrFree( vStatus );
1037 Vec_IntFree( vOutputs );
1040 ((int (*)(
void *))pPars->
pFunc)( pPars->
pData );
1042 if ( pPars->
fStopWhenGone && Gia_ManPoNum(pAig) == 1 && !Gia_ObjIsConst( pAig, Gia_ObjFaninId0p(pAig, Gia_ManPo(pAig, 0)) ) )
1044 printf(
"Iterative refinement is stopped after iteration %d\n", r );
1045 printf(
"because the property output is no longer a candidate constant.\n" );
1052 if ( r > 4 && nPrev[0] - nCur <= 4*pPars->nLimitMax )
1054 printf(
"Iterative refinement is stopped after iteration %d\n", r );
1055 printf(
"because refinement does not proceed quickly.\n" );
1061 nPrev[0] = nPrev[1];
1062 nPrev[1] = nPrev[2];
1063 nPrev[2] = nPrev[3];
1070 if ( r == nIterMax )
1071 Abc_Print( 1,
"The refinement was not finished. The result may be incorrect.\n" );
1076 clkTotal = Abc_Clock() - clkTotal;
1080 ABC_PRTP(
"Srm ", clkSrm, clkTotal );
1081 ABC_PRTP(
"Sat ", clkSat, clkTotal );
1082 ABC_PRTP(
"Sim ", clkSim, clkTotal );
1083 ABC_PRTP(
"Other", clkTotal-clkSat-clkSrm-clkSim, clkTotal );
1084 Abc_PrintTime( 1,
"TOTAL", clkTotal );
1103 unsigned * pInitState;
1109 for ( f = 0; f < nFrames; f++ )
1111 Gia_ManConst0(pAig)->fMark1 = 0;
1115 pObj->
fMark1 = (Gia_ObjFanin0(pObj)->fMark1 ^ Gia_ObjFaninC0(pObj)) &
1116 (Gia_ObjFanin1(pObj)->fMark1 ^ Gia_ObjFaninC1(pObj));
1118 pObj->
fMark1 = (Gia_ObjFanin0(pObj)->fMark1 ^ Gia_ObjFaninC0(pObj));
1122 pInitState =
ABC_CALLOC(
unsigned, Abc_BitWordNum(Gia_ManRegNum(pAig)) );
1126 Abc_InfoSetBit( pInitState, i );
1149 assert(
p->vNamesIn != NULL );
1152 if ( Gia_ObjIsConst(
p, Gia_ObjId(
p, pObj)) )
1153 Abc_Print( 1,
"Original flop %s is proved equivalent to constant.\n", Vec_PtrEntry(
p->vNamesIn, Gia_ObjCioId(pObj)) );
1154 else if ( (pRepr = Gia_ObjReprObj(
p, Gia_ObjId(
p, pObj))) )
1156 if ( Gia_ObjIsCi(pRepr) )
1157 Abc_Print( 1,
"Original flop %s is proved equivalent to flop %s.\n",
1158 Vec_PtrEntry(
p->vNamesIn, Gia_ObjCioId(pObj) ),
1159 Vec_PtrEntry(
p->vNamesIn, Gia_ObjCioId(pRepr) ) );
1161 Abc_Print( 1,
"Original flop %s is proved equivalent to internal node %d.\n",
1162 Vec_PtrEntry(
p->vNamesIn, Gia_ObjCioId(pObj) ), Gia_ObjId(
p, pRepr) );
1182 unsigned * pInitState;
1189 if ( RetValue == 0 )
1236 Abc_Print( 1,
"NBeg = %d. NEnd = %d. (Gain = %6.2f %%). RBeg = %d. REnd = %d. (Gain = %6.2f %%).\n",
1237 Gia_ManAndNum(pAig), Gia_ManAndNum(pNew),
1238 100.0*(Gia_ManAndNum(pAig)-Gia_ManAndNum(pNew))/(Gia_ManAndNum(pAig)?Gia_ManAndNum(pAig):1),
1239 Gia_ManRegNum(pAig), Gia_ManRegNum(pNew),
1240 100.0*(Gia_ManRegNum(pAig)-Gia_ManRegNum(pNew))/(Gia_ManRegNum(pAig)?Gia_ManRegNum(pAig):1) );
1242 if ( pPars->
nPrefix && (Gia_ManAndNum(pNew) < Gia_ManAndNum(pAig) || Gia_ManRegNum(pNew) < Gia_ManRegNum(pAig)) )
1243 Abc_Print( 1,
"The reduced AIG was produced using %d-th invariants and will not verify.\n", pPars->
nPrefix );
1248 Abc_Print( 1,
"Flop output names are not available. Use command \"&get -n\".\n" );
1255 char * pName;
int i;
1259 Vec_PtrShrink( pNew->
vNamesIn, Gia_ManCiNum(pNew) );
1263 char * pName;
int i;
1267 Vec_PtrShrink( pNew->
vNamesOut, Gia_ManCoNum(pNew) );
1287 Vec_Wec_t * vSuppsR = Vec_WecStart( Gia_ManRegNum(
p) );
1288 Vec_Wec_t * vSupps = Vec_WecStart( Gia_ManObjNum(
p) );
1290 Vec_IntPush( Vec_WecEntry(vSupps, Gia_ObjId(
p, pObj)), i );
1292 Vec_IntTwoMerge2( Vec_WecEntry(vSupps, Gia_ObjFaninId0(pObj, Id)),
1293 Vec_WecEntry(vSupps, Gia_ObjFaninId1(pObj, Id)),
1294 Vec_WecEntry(vSupps, Id) );
1296 Vec_IntAppend( Vec_WecEntry(vSuppsR, i), Vec_WecEntry(vSupps, Gia_ObjFaninId0p(
p, pObj)) );
1297 Vec_WecFree( vSupps );
1299 Abc_PrintTime( 1,
"Support computation", Abc_Clock() - clk );
1304 Vec_Int_t * vRes = NULL, * vTemp;
int i, k, Spot, Temp, nItems = 0;
1306 Vec_Int_t * vNexts = Vec_IntStartFull( Gia_ManRegNum(
p) );
1307 Vec_Int_t * vAvail = Vec_IntStart( Gia_ManRegNum(
p) );
1308 Vec_Int_t * vHeads = Vec_IntAlloc( 10 );
1310 if ( Vec_IntSize(vTemp) > 2 )
1312 if ( (Spot = Vec_IntFind(vTemp, i)) >= 0 )
1313 Vec_IntDrop( vTemp, Spot );
1314 if ( Vec_IntSize(vTemp) != 1 )
1316 Vec_IntWriteEntry( vNexts, i, Vec_IntEntry(vTemp, 0) );
1317 Vec_IntWriteEntry( vAvail, Vec_IntEntry(vTemp, 0), 1 );
1320 if ( Spot >= 0 && Vec_IntEntry(vAvail, i) == 0 )
1321 Vec_IntPush( vHeads, i );
1324 for ( k = 0, Temp = Spot; Vec_IntEntry(vNexts, Temp) >= 0; k++, Temp = Vec_IntEntry(vNexts, Temp) ) {
1325 if ( Gia_ObjUpdateTravIdCurrentId(
p, Temp) )
1327 Vec_IntWriteEntry( vAvail, Temp, 1 );
1333 vRes = Vec_IntAlloc( 100 );
1335 for ( k = 0, Temp = Spot; Vec_IntEntry(vNexts, Temp) >= 0; k++, Temp = Vec_IntEntry(vNexts, Temp) ) {
1336 if ( Gia_ObjUpdateTravIdCurrentId(
p, Temp) )
1338 if ( k % nFlopIncFreq == 0 )
1339 Vec_IntPush( vRes, Temp );
1342 while ( Vec_IntEntry(vNexts, Spot) >= 0 )
1344 int Next = Vec_IntEntry(vNexts, Spot);
1345 Vec_IntWriteEntry( vNexts, Spot, -1 );
1349 if ( fVerbose && vRes )
1350 printf(
"Detected %d sequence%s containing %d flops.\n", nItems, nItems > 1 ?
"s":
"", Vec_IntSize(vRes) );
1351 Vec_IntFree( vNexts );
1352 Vec_IntFree( vAvail );
1353 Vec_IntFree( vHeads );
1354 Vec_WecFree( vSupps );
1361 Vec_Int_t * vExtras = Vec_IntAlloc( Vec_IntSize(vStops) );
1363 pNew->
pName = Abc_UtilStrsav(
p->pName );
1364 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
1366 Gia_ManConst0(
p)->Value = 0;
1368 pObj->
Value = Gia_ManAppendCi(pNew);
1370 Vec_IntPush( vExtras, Gia_ManAppendCi(pNew) );
1372 pObj->
Value = Gia_ManAppendCi(pNew);
1375 int Lit = Gia_ManCi(
p, Gia_ManPiNum(
p)+Stop)->Value;
1376 Gia_ManCi(
p, Gia_ManPiNum(
p)+Stop)->Value = Vec_IntEntry(vExtras, i);
1377 Vec_IntWriteEntry( vExtras, i, Lit );
1380 pObj->
Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1382 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1384 Gia_ManAppendCo( pNew, Stop );
1386 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1388 Vec_IntFree( vExtras );
1395 assert( Gia_ObjIsAnd(pObj) );
1398 pObj->
Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1405 pNew->
pName = Abc_UtilStrsav(
p->pName );
1406 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
1408 Gia_ManConst0(
p)->Value = 0;
1410 if ( i < Gia_ManPiNum(
p) - Vec_IntSize(vStops) )
1411 pObj->
Value = Gia_ManAppendCi(pNew);
1413 pObj->
Value = Gia_ManAppendCi(pNew);
1415 if ( i >= Gia_ManPoNum(
p) - Vec_IntSize(vStops) )
1418 if ( i >= Gia_ManPiNum(
p) - Vec_IntSize(vStops) )
1419 pObj->
Value = Gia_ObjFanin0Copy( Gia_ManPo(
p, i - Gia_ManPiNum(
p) + Gia_ManPoNum(
p)) );
1421 if ( i < Gia_ManPoNum(
p) - Vec_IntSize(vStops) )
1426 if ( i < Gia_ManPoNum(
p) - Vec_IntSize(vStops) )
1427 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1429 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
1436 if ( vStops == NULL )
1441 Vec_IntFree( vStops );
#define ABC_PRTP(a, t, T)
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
struct Vec_Str_t_ Vec_Str_t
int Cec_ManSimClassesPrepare(Cec_ManSim_t *p, int LevelMax)
int Cec_ManSimClassesRefine(Cec_ManSim_t *p)
int Cec_ManSimClassRemoveOne(Cec_ManSim_t *p, int i)
int Cec_ManResimulateCounterExamplesComb(Cec_ManSim_t *pSim, Vec_Int_t *vCexStore)
void Cec_ManStartSimInfo(Vec_Ptr_t *vInfo, int nFlops)
int Cec_ManResimulateCounterExamples(Cec_ManSim_t *pSim, Vec_Int_t *vCexStore, int nFrames)
int Cec_ManLoadCounterExamples(Vec_Ptr_t *vInfo, Vec_Int_t *vCexStore, int iStart)
Gia_Man_t * Gia_ManDupStopsAdd(Gia_Man_t *p, Vec_Int_t *vStops)
Gia_Man_t * Gia_ManCorrReduce(Gia_Man_t *p)
int Cec_ManLoadCounterExamplesTry(Vec_Ptr_t *vInfo, Vec_Ptr_t *vPres, int iBit, int *pLits, int nLits)
Gia_Man_t * Gia_ManDupStopsRem(Gia_Man_t *p, Vec_Int_t *vStops)
unsigned * Cec_ManComputeInitState(Gia_Man_t *pAig, int nFrames)
void Cec_ManRefinedClassPrintStats(Gia_Man_t *p, Vec_Str_t *vStatus, int iIter, abctime Time)
MACRO DEFINITIONS ///.
int Cec_ManLSCorrespondenceClasses(Gia_Man_t *pAig, Cec_ParCor_t *pPars)
void Cec_ManPrintFlopEquivs(Gia_Man_t *p)
int Cec_ManLSCorrAnalyzeDependence(Gia_Man_t *p, Vec_Int_t *vEquivs, Vec_Str_t *vStatus)
Vec_Int_t * Gia_ManFindStopFlops(Gia_Man_t *p, int nFlopIncFreq, int fVerbose)
void Gia_ManCorrReduce_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Gia_Man_t * Gia_ManCorrSpecReduceInit(Gia_Man_t *p, int nFrames, int nPrefix, int fScorr, Vec_Int_t **pvOutputs, int fRings)
Vec_Wec_t * Gia_ManCreateRegSupps(Gia_Man_t *p, int fVerbose)
int Cec_ManLoadCounterExamples2(Vec_Ptr_t *vInfo, Vec_Int_t *vCexStore, int iStart)
void Gia_ManCorrPerformRemapping(Vec_Int_t *vPairs, Vec_Ptr_t *vInfo)
Gia_Man_t * Gia_ManDupStopsTest(Gia_Man_t *p)
Vec_Int_t * Gia_ManCorrCreateRemapping(Gia_Man_t *p)
void Cec_ManLSCorrespondenceBmc(Gia_Man_t *pAig, Cec_ParCor_t *pPars, int nPrefs)
int Cec_ManCountLits(Gia_Man_t *p)
Gia_Man_t * Cec_ManLSCorrespondence(Gia_Man_t *pAig, Cec_ParCor_t *pPars)
void Gia_ManCorrRemapSimInfo(Gia_Man_t *p, Vec_Ptr_t *vInfo)
int Gia_ManCheckRefinements(Gia_Man_t *p, Vec_Str_t *vStatus, Vec_Int_t *vOutputs, Cec_ManSim_t *pSim, int fRings)
void Gia_ManDupStopsRem_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Gia_Man_t * Gia_ManCorrSpecReduce(Gia_Man_t *p, int nFrames, int fScorr, Vec_Int_t **pvOutputs, int fRings)
void Cec_ManSimStop(Cec_ManSim_t *p)
Cec_ManSim_t * Cec_ManSimStart(Gia_Man_t *pAig, Cec_ParSim_t *pPars)
struct Cec_ManSim_t_ Cec_ManSim_t
int Cec_ManSeqResimulate(Cec_ManSim_t *p, Vec_Ptr_t *vInfo)
Vec_Int_t * Cec_ManSatSolveMiter(Gia_Man_t *pAig, Cec_ParSat_t *pPars, Vec_Str_t **pvStatus)
void Cec_ManSatSetDefaultParams(Cec_ParSat_t *p)
DECLARATIONS ///.
void Cec_ManSimSetDefaultParams(Cec_ParSim_t *p)
typedefABC_NAMESPACE_HEADER_START struct Cec_ParSat_t_ Cec_ParSat_t
INCLUDES ///.
struct Cec_ParSim_t_ Cec_ParSim_t
struct Cec_ParCor_t_ Cec_ParCor_t
void Gia_ManStop(Gia_Man_t *p)
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
#define Gia_ManForEachRo(p, pObj, i)
#define Gia_ManForEachPo(p, pObj, i)
Gia_Man_t * Gia_ManDupFlip(Gia_Man_t *p, int *pInitState)
#define Gia_ManForEachAnd(p, pObj, i)
void Gia_ManCreateValueRefs(Gia_Man_t *p)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
void Gia_ManHashAlloc(Gia_Man_t *p)
#define Gia_ClassForEachObj1(p, i, iObj)
Vec_Int_t * Tas_ManSolveMiterNc(Gia_Man_t *pGia, int nConfs, Vec_Str_t **pvStatus, int fVerbose)
#define Gia_ManForEachPi(p, pObj, i)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
struct Gia_Obj_t_ Gia_Obj_t
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
void Gia_ManFillValue(Gia_Man_t *p)
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachObj1(p, pObj, i)
Vec_Int_t * Cbs_ManSolveMiterNc(Gia_Man_t *pGia, int nConfs, Vec_Str_t **pvStatus, int f0Proved, int fVerbose)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Gia_Man_t * Gia_ManEquivToChoices(Gia_Man_t *p, int nSnapshots)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
void Gia_ManIncrementTravId(Gia_Man_t *p)
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
#define Gia_ManForEachCo(p, pObj, i)
#define Gia_ManForEachCi(p, pObj, i)
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
void Gia_ManSetPhase(Gia_Man_t *p)
void Gia_ManHashStop(Gia_Man_t *p)
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
#define Gia_ManForEachRi(p, pObj, i)
Gia_Man_t * Gia_ManSeqCleanup(Gia_Man_t *p)
void Gia_ManCleanMark1(Gia_Man_t *p)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_StrForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.