79 sprintf(buf,
"property: safe<%d>\nbug-free-depth: %d\n", prop_no, depth);
92static inline int Saig_ManBmcSimInfoNot(
int Value )
101static inline int Saig_ManBmcSimInfoAnd(
int Value0,
int Value1 )
110static inline int Saig_ManBmcSimInfoGet(
unsigned * pInfo,
Aig_Obj_t * pObj )
112 return 3 & (pInfo[Aig_ObjId(pObj) >> 4] >> ((Aig_ObjId(pObj) & 15) << 1));
115static inline void Saig_ManBmcSimInfoSet(
unsigned * pInfo,
Aig_Obj_t * pObj,
int Value )
118 Value ^= Saig_ManBmcSimInfoGet( pInfo, pObj );
119 pInfo[Aig_ObjId(pObj) >> 4] ^= (Value << ((Aig_ObjId(pObj) & 15) << 1));
122static inline int Saig_ManBmcSimInfoClear(
unsigned * pInfo,
Aig_Obj_t * pObj )
124 int Value = Saig_ManBmcSimInfoGet( pInfo, pObj );
125 pInfo[Aig_ObjId(pObj) >> 4] ^= (Value << ((Aig_ObjId(pObj) & 15) << 1));
145 return Saig_ManRegNum(
p);
147 if ( !Aig_ObjIsConst1(Aig_ObjFanin0(pObj)) )
148 Counter += (Saig_ManBmcSimInfoGet(pInfo, pObj) !=
SAIG_TER_UND);
168 pInfo =
ABC_CALLOC(
unsigned, Abc_BitWordNum(2 * Aig_ManObjNumMax(
p)) );
169 Saig_ManBmcSimInfoSet( pInfo, Aig_ManConst1(
p),
SAIG_TER_ONE );
180 Saig_ManBmcSimInfoSet( pInfo, pObj, Saig_ManBmcSimInfoGet(pPrev, pObjLi) );
184 Val0 = Saig_ManBmcSimInfoGet( pInfo, Aig_ObjFanin0(pObj) );
185 Val1 = Saig_ManBmcSimInfoGet( pInfo, Aig_ObjFanin1(pObj) );
186 if ( Aig_ObjFaninC0(pObj) )
187 Val0 = Saig_ManBmcSimInfoNot( Val0 );
188 if ( Aig_ObjFaninC1(pObj) )
189 Val1 = Saig_ManBmcSimInfoNot( Val1 );
190 Saig_ManBmcSimInfoSet( pInfo, pObj, Saig_ManBmcSimInfoAnd(Val0, Val1) );
194 Val0 = Saig_ManBmcSimInfoGet( pInfo, Aig_ObjFanin0(pObj) );
195 if ( Aig_ObjFaninC0(pObj) )
196 Val0 = Saig_ManBmcSimInfoNot( Val0 );
197 Saig_ManBmcSimInfoSet( pInfo, pObj, Val0 );
216 unsigned * pInfo = NULL;
217 int i, TerPrev =
ABC_INFINITY, TerCur, CountIncrease = 0;
218 vInfos = Vec_PtrAlloc( 100 );
219 for ( i = 0; i < 1000 && CountIncrease < 5 && TerPrev > 0; i++ )
222 if ( TerCur >= TerPrev )
226 Vec_PtrPush( vInfos, pInfo );
250 Abc_Print( 1,
"\n" );
251 Vec_PtrFreeFree( vInfos );
269 int Value = Saig_ManBmcSimInfoClear( pInfo, pObj );
274 if ( Saig_ObjIsPi(
p, pObj) || (f == 0 && Saig_ObjIsLo(
p, pObj)) || Aig_ObjIsConst1(pObj) )
276 if ( Saig_ObjIsLi(
p, pObj) )
278 if ( Saig_ObjIsLo(
p, pObj) )
280 assert( Aig_ObjIsNode(pObj) );
287 int i, * pCounters =
ABC_CALLOC(
int, iFrame + 1 );
288 unsigned * pInfo = (
unsigned *)Vec_PtrEntry(vInfos, iFrame);
291 for ( i = 0; i <= iFrame; i++ )
292 Abc_Print( 1,
"%d=%d ", i, pCounters[i] );
293 Abc_Print( 1,
"\n" );
314 Counter += (Saig_ManBmcSimInfoGet(pInfo, pObj) !=
SAIG_TER_UND);
320 unsigned * pInfo = NULL;
322 vInfos = Vec_PtrAlloc( 100 );
326 Abc_Print( 1,
"Frame %5d\n", i );
328 Vec_PtrPush( vInfos, pInfo );
330 if ( nPoBin < Saig_ManPoNum(
p) )
333 Abc_Print( 1,
"Detected terminary PO in frame %d.\n", i );
341 Vec_PtrFreeFree( vInfos );
360 assert( !Aig_IsComplement(pObj) );
361 if ( Aig_ObjIsTravIdCurrent(
p, pObj) )
363 Aig_ObjSetTravIdCurrent(
p, pObj);
364 if ( Aig_ObjIsNode(pObj) )
369 Vec_PtrPush( vNodes, pObj );
388 vNodes = Vec_PtrAlloc( 100 );
411 Aig_ObjSetTravIdCurrent(
p, Aig_ManConst1(
p) );
413 vRoots = Vec_PtrAlloc( 1000 );
416 Aig_ObjSetTravIdCurrent(
p, pObjPo );
417 Vec_PtrPush( vRoots, pObjPo );
420 vSects = Vec_PtrAlloc( 20 );
421 while ( Vec_PtrSize(vRoots) > 0 )
424 Vec_PtrPush( vSects, vCone );
426 Vec_PtrClear( vRoots );
429 if ( !Saig_ObjIsLo(
p, pObj) )
431 pObjPo = Saig_ObjLoToLi(
p, pObj );
432 if ( Aig_ObjIsTravIdCurrent(
p, pObjPo) )
434 Aig_ObjSetTravIdCurrent(
p, pObjPo );
435 Vec_PtrPush( vRoots, pObjPo );
438 Vec_PtrFree( vRoots );
460 Abc_Print( 1,
"%d=%d ", i, Vec_PtrSize(vOne) );
461 Abc_Print( 1,
"\n" );
462 Vec_VecFree( vSects );
481 if ( Aig_IsComplement(pObj) || Aig_ObjIsCi(pObj) )
483 Vec_PtrPushUnique( vSuper, Aig_Regular(pObj) );
506 vSuper = Vec_PtrAlloc( 10 );
507 pObj = Aig_ManCo(
p, iPo );
508 pObj = Aig_ObjChild0( pObj );
509 if ( !Aig_IsComplement(pObj) )
511 Vec_PtrPush( vSuper, pObj );
514 pObj = Aig_Regular( pObj );
515 if ( !Aig_ObjIsNode(pObj) )
517 Vec_PtrPush( vSuper, pObj );
542 assert( !Aig_IsComplement(pObj) );
543 Counter += (Aig_ObjRefs(pObj) > 1);
564 Abc_Print( 1,
"Supergates: " );
569 Vec_PtrFree( vSuper );
571 Abc_Print( 1,
"\n" );
588 char * pSopSizes, ** pSops;
591 int i, k, b, iFan, iTruth, * pData;
592 pFile = fopen( pFileName,
"w" );
595 Abc_Print( 1,
"Cannot open file %s\n", pFileName );
598 fprintf( pFile,
".model test\n" );
599 fprintf( pFile,
".inputs" );
601 fprintf( pFile,
" n%d", Aig_ObjId(pObj) );
602 fprintf( pFile,
"\n" );
603 fprintf( pFile,
".outputs" );
605 fprintf( pFile,
" n%d", Aig_ObjId(pObj) );
606 fprintf( pFile,
"\n" );
607 fprintf( pFile,
".names" );
608 fprintf( pFile,
" n%d\n", Aig_ObjId(Aig_ManConst1(
p)) );
609 fprintf( pFile,
" 1\n" );
614 if ( Vec_IntEntry(vMapping, i) == 0 )
616 pData = Vec_IntEntryP( vMapping, Vec_IntEntry(vMapping, i) );
617 fprintf( pFile,
".names" );
618 for ( iFan = 0; iFan < 4; iFan++ )
619 if ( pData[iFan+1] >= 0 )
620 fprintf( pFile,
" n%d", pData[iFan+1] );
623 fprintf( pFile,
" n%d\n", i );
625 iTruth = pData[0] & 0xffff;
626 for ( k = 0; k < pSopSizes[iTruth]; k++ )
628 int Lit = pSops[iTruth][k];
629 for ( b = 3; b >= 0; b-- )
633 else if ( Lit % 3 == 1 )
639 for ( b = 0; b < iFan; b++ )
640 fprintf( pFile,
"%c", Vals[b] );
641 fprintf( pFile,
" 1\n" );
650 fprintf( pFile,
".names" );
651 fprintf( pFile,
" n%d", Aig_ObjId(Aig_ObjFanin0(pObj)) );
652 fprintf( pFile,
" n%d\n", Aig_ObjId(pObj) );
653 fprintf( pFile,
"%d 1\n", !Aig_ObjFaninC0(pObj) );
655 fprintf( pFile,
".end\n" );
675 Vec_IntFree( vMapping );
694 int i, iFan, * pData;
695 vRefs = Vec_IntStart( Aig_ManObjNumMax(
p) );
697 Vec_IntAddToEntry( vRefs, Aig_ObjFaninId0(pObj), 1 );
700 if ( Vec_IntEntry(vMap, i) == 0 )
702 pData = Vec_IntEntryP( vMap, Vec_IntEntry(vMap, i) );
703 for ( iFan = 0; iFan < 4; iFan++ )
704 if ( pData[iFan+1] >= 0 )
705 Vec_IntAddToEntry( vRefs, pData[iFan+1], 1 );
736 p->vId2Num = Vec_IntStartFull( Aig_ManObjNumMax(pAig) );
737 Vec_IntWriteEntry(
p->vId2Num, Aig_ObjId(Aig_ManConst1(pAig)),
p->nObjNums++ );
739 Vec_IntWriteEntry(
p->vId2Num, Aig_ObjId(pObj),
p->nObjNums++ );
741 if ( Vec_IntEntry(
p->vMapping, Aig_ObjId(pObj)) > 0 )
742 Vec_IntWriteEntry(
p->vId2Num, Aig_ObjId(pObj),
p->nObjNums++ );
744 Vec_IntWriteEntry(
p->vId2Num, Aig_ObjId(pObj),
p->nObjNums++ );
745 p->vId2Var = Vec_PtrAlloc( 100 );
746 p->vTerInfo = Vec_PtrAlloc( 100 );
747 p->vVisited = Vec_WecAlloc( 100 );
759 else if ( fUseGlucose )
763 for ( i = 0; i < 1000; i++ )
773 p->nWordNum = Abc_BitWordNum( 2 * Aig_ManObjNumMax(pAig) );
775 p->vData = Vec_IntAlloc( 5 * 10000 );
776 p->vHash = Hsh_IntManStart(
p->vData, 5, 10000 );
777 p->vId2Lit = Vec_IntAlloc( 10000 );
782 for ( i = 0; i < Saig_ManPoNum(pAig); i++ )
783 p->pTime4Outs[i] = nTimeOutOne * CLOCKS_PER_SEC / 1000 + 1;
801 if (
p->pPars->fVerbose )
803 int nUsedVars =
p->pSat ? sat_solver_count_usedvars(
p->pSat) : 0;
804 Abc_Print( 1,
"LStart(P) = %d LDelta(Q) = %d LRatio(R) = %d ReduceDB = %d Vars = %d Used = %d (%.2f %%)\n",
805 p->pSat ?
p->pSat->nLearntStart : 0,
806 p->pSat ?
p->pSat->nLearntDelta : 0,
807 p->pSat ?
p->pSat->nLearntRatio : 0,
808 p->pSat ?
p->pSat->nDBreduces : 0,
812 Abc_Print( 1,
"Buffs = %d. Dups = %d. Hash hits = %d. Hash misses = %d. UniProps = %d.\n",
813 p->nBufNum,
p->nDupNum,
p->nHashHit,
p->nHashMiss,
p->nUniProps );
818 assert(
p->pAig->vSeqModelVec == NULL );
819 p->pAig->vSeqModelVec =
p->vCexes;
823 Vec_WecFree(
p->vVisited );
824 Vec_IntFree(
p->vMapping );
825 Vec_IntFree(
p->vMapRefs );
827 Vec_IntFree(
p->vId2Num );
829 Vec_PtrFreeFree(
p->vTerInfo );
834 Vec_IntFree(
p->vData );
835 Hsh_IntManStop(
p->vHash );
836 Vec_IntFree(
p->vId2Lit );
857 if ( Vec_IntEntry(
p->vMapping, Aig_ObjId(pObj)) == 0 )
859 return Vec_IntEntryP(
p->vMapping, Vec_IntEntry(
p->vMapping, Aig_ObjId(pObj)) );
877 assert( !Aig_ObjIsNode(pObj) || Saig_ManBmcMapping(
p, pObj) );
878 ObjNum = Vec_IntEntry(
p->vId2Num, Aig_ObjId(pObj) );
880 vFrame = (
Vec_Int_t *)Vec_PtrEntry(
p->vId2Var, iFrame );
882 return Vec_IntEntry( vFrame, ObjNum );
900 assert( !Aig_ObjIsNode(pObj) || Saig_ManBmcMapping(
p, pObj) );
901 ObjNum = Vec_IntEntry(
p->vId2Num, Aig_ObjId(pObj) );
902 vFrame = (
Vec_Int_t *)Vec_PtrEntry(
p->vId2Var, iFrame );
903 Vec_IntWriteEntry( vFrame, ObjNum, iLit );
925static inline int Saig_ManBmcCof0(
int t,
int v )
927 static int s_Truth[4] = { 0xAAAA, 0xCCCC, 0xF0F0, 0xFF00 };
928 return 0xffff & ((t & ~s_Truth[v]) | ((t & ~s_Truth[v]) << (1<<v)));
930static inline int Saig_ManBmcCof1(
int t,
int v )
932 static int s_Truth[4] = { 0xAAAA, 0xCCCC, 0xF0F0, 0xFF00 };
933 return 0xffff & ((t & s_Truth[v]) | ((t & s_Truth[v]) >> (1<<v)));
935static inline int Saig_ManBmcCofEqual(
int t,
int v )
937 assert( v >= 0 && v <= 3 );
939 return ((t & 0xAAAA) >> 1) == (t & 0x5555);
941 return ((t & 0xCCCC) >> 2) == (t & 0x3333);
943 return ((t & 0xF0F0) >> 4) == (t & 0x0F0F);
945 return ((t & 0xFF00) >> 8) == (t & 0x00FF);
960static inline int Saig_ManBmcReduceTruth(
int uTruth,
int Lits[] )
963 for ( v = 0; v < 4; v++ )
966 uTruth = Saig_ManBmcCof0(uTruth, v);
969 else if ( Lits[v] == 1 )
971 uTruth = Saig_ManBmcCof1(uTruth, v);
974 for ( v = 0; v < 4; v++ )
976 assert( Saig_ManBmcCofEqual(uTruth, v) );
977 else if ( Saig_ManBmcCofEqual(uTruth, v) )
993static inline void Saig_ManBmcAddClauses(
Gia_ManBmc_t *
p,
int uTruth,
int Lits[],
int iLitOut )
995 int i, k, b, CutLit, nClaLits, ClaLits[5];
996 assert( uTruth > 0 && uTruth < 0xffff );
998 for ( i = 0; i < 2; i++ )
1001 uTruth = 0xffff & ~uTruth;
1003 for ( k = 0; k <
p->pSopSizes[uTruth]; k++ )
1006 ClaLits[nClaLits++] = i ? lit_neg(iLitOut) : iLitOut;
1007 CutLit =
p->pSops[uTruth][k];
1008 for ( b = 3; b >= 0; b-- )
1010 if ( CutLit % 3 == 0 )
1013 ClaLits[nClaLits++] = Lits[b];
1015 else if ( CutLit % 3 == 1 )
1018 ClaLits[nClaLits++] = lit_neg(Lits[b]);
1020 CutLit = CutLit / 3;
1027 else if (
p->pSat3 )
1055 int * pMapping, i, iLit, Lits[5], uTruth;
1056 iLit = Saig_ManBmcLiteral(
p, pObj, iFrame );
1060 if ( Aig_ObjIsCi(pObj) )
1062 if ( Saig_ObjIsPi(
p->pAig, pObj) )
1063 iLit = toLit(
p->nSatVars++ );
1066 return Saig_ManBmcSetLiteral(
p, pObj, iFrame, iLit );
1068 if ( Aig_ObjIsCo(pObj) )
1071 if ( Aig_ObjFaninC0(pObj) )
1072 iLit = lit_neg(iLit);
1073 return Saig_ManBmcSetLiteral(
p, pObj, iFrame, iLit );
1075 assert( Aig_ObjIsNode(pObj) );
1076 pMapping = Saig_ManBmcMapping(
p, pObj );
1077 for ( i = 0; i < 4; i++ )
1078 if ( pMapping[i+1] == -1 )
1082 uTruth = 0xffff & (unsigned)pMapping[0];
1084 uTruth = Saig_ManBmcReduceTruth( uTruth, Lits );
1085 if ( uTruth == 0 || uTruth == 0xffff )
1087 iLit = (uTruth == 0xffff);
1088 return Saig_ManBmcSetLiteral(
p, pObj, iFrame, iLit );
1092 assert( uTruth != 0 && uTruth != 0xffff );
1093 if ( uTruth == 0xAAAA || uTruth == 0x5555 )
1095 iLit = Abc_LitNotCond( Lits[0], uTruth == 0x5555 );
1101 int fCompl = (uTruth & 1);
1102 Lits[4] = (uTruth & 1) ? 0xffff & ~uTruth : uTruth;
1103 iEntry = Vec_IntSize(
p->vData) / 5;
1104 assert( iEntry * 5 == Vec_IntSize(
p->vData) );
1105 for ( i = 0; i < 5; i++ )
1106 Vec_IntPush(
p->vData, Lits[i] );
1107 iRes = Hsh_IntManAdd(
p->vHash, iEntry );
1108 if ( iRes == iEntry )
1110 iLit = toLit(
p->nSatVars++ );
1111 Saig_ManBmcAddClauses(
p, Lits[4], Lits, iLit );
1112 assert( iEntry == Vec_IntSize(
p->vId2Lit) );
1113 Vec_IntPush(
p->vId2Lit, iLit );
1118 iLit = Vec_IntEntry(
p->vId2Lit, iRes );
1119 Vec_IntShrink(
p->vData, Vec_IntSize(
p->vData) - 5 );
1122 iLit = Abc_LitNotCond( iLit, fCompl );
1124 return Saig_ManBmcSetLiteral(
p, pObj, iFrame, iLit );
1141 if ( Saig_ManBmcLiteral(
p, pObj, iFrame ) != ~0 )
1143 if ( Aig_ObjIsTravIdCurrent(
p->pAig, pObj) )
1145 Aig_ObjSetTravIdCurrent(
p->pAig, pObj);
1146 if ( Aig_ObjIsCi(pObj) )
1148 if ( Saig_ObjIsLo(
p->pAig, pObj) )
1149 Vec_IntPush( vVisit, Saig_ObjLoToLi(
p->pAig, pObj)->Id );
1152 if ( Aig_ObjIsCo(pObj) )
1160 assert( Aig_ObjIsNode(pObj) );
1161 pMapping = Saig_ManBmcMapping(
p, pObj );
1162 for ( i = 0; i < 4; i++ )
1163 if ( pMapping[i+1] != -1 )
1181 unsigned * pInfo = (
unsigned *)Vec_PtrEntry(
p->vTerInfo, iFrame );
1182 int Val0, Val1, Value = Saig_ManBmcSimInfoGet( pInfo, pObj );
1214 if ( Aig_ObjIsCo(pObj) )
1217 if ( Aig_ObjFaninC0(pObj) )
1218 Value = Saig_ManBmcSimInfoNot( Value );
1220 else if ( Saig_ObjIsLo(
p->pAig, pObj) )
1225 else if ( Aig_ObjIsNode(pObj) )
1229 if ( Aig_ObjFaninC0(pObj) )
1230 Val0 = Saig_ManBmcSimInfoNot( Val0 );
1231 if ( Aig_ObjFaninC1(pObj) )
1232 Val1 = Saig_ManBmcSimInfoNot( Val1 );
1233 Value = Saig_ManBmcSimInfoAnd( Val0, Val1 );
1236 Saig_ManBmcSimInfoSet( pInfo, pObj, Value );
1239 Saig_ManBmcSetLiteral(
p, pObj, iFrame, (
int)(Value ==
SAIG_TER_ONE) );
1265 Vec_WecClear(
p->vVisited );
1266 vVisit = Vec_WecPushLevel(
p->vVisited );
1267 Vec_IntPush( vVisit, Aig_ObjId(pObj) );
1268 for ( f = iFrame; f >= 0; f-- )
1271 vVisit2 = Vec_WecPushLevel(
p->vVisited );
1272 vVisit = Vec_WecEntry(
p->vVisited, Vec_WecSize(
p->vVisited)-2 );
1275 if ( Vec_IntSize(vVisit2) == 0 )
1281 Lit = Saig_ManBmcLiteral(
p, pObj, iFrame );
1285 else if (
p->pSat3 )
1310 int Diff = Aig_ObjRefs(*pp1) - Aig_ObjRefs(*pp2);
1315 Diff = Aig_ObjId(*pp1) - Aig_ObjId(*pp2);
1340 p->nConfLimitJump = 0;
1344 p->nPisAbstract = 0;
1346 p->fDropSatOuts = 0;
1347 p->nLearnedStart = 10000;
1348 p->nLearnedDelta = 2000;
1349 p->nLearnedPerce = 80;
1355 p->timeLastSolved = 0;
1373 if ( nTimeToStopNG && nTimeToStopGap )
1374 nTimeToStop = nTimeToStopNG < nTimeToStopGap ? nTimeToStopNG : nTimeToStopGap;
1375 else if ( nTimeToStopNG )
1376 nTimeToStop = nTimeToStopNG;
1377 else if ( nTimeToStopGap )
1378 nTimeToStop = nTimeToStopGap;
1396 Abc_Cex_t * pCex =
Abc_CexMakeTriv( Aig_ManRegNum(
p->pAig), Saig_ManPiNum(
p->pAig), Saig_ManPoNum(
p->pAig), f*Saig_ManPoNum(
p->pAig)+i );
1397 int j, k, iBit = Saig_ManRegNum(
p->pAig);
1398 for ( j = 0; j <= f; j++, iBit += Saig_ManPiNum(
p->pAig) )
1401 int iLit = Saig_ManBmcLiteral(
p, pObjPi, j );
1405 Abc_InfoSetBit( pCex->pData, iBit + k );
1407 else if (
p->pSat3 )
1410 Abc_InfoSetBit( pCex->pData, iBit + k );
1414 if ( iLit != ~0 && sat_solver_var_value(
p->pSat, lit_var(iLit)) )
1415 Abc_InfoSetBit( pCex->pData, iBit + k );
1441 else if (
p->pSat3 )
1447 return sat_solver_solve(
p->pSat, &Lit, &Lit + 1, (ABC_INT64_T)
p->pPars->nConfLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
1466 FILE * pLogFile = NULL;
1468 int RetValue = -1, fFirst = 1, nJumpFrame = 0, fUnfinished = 0;
1469 int nOutDigits = Abc_Base10Log( Saig_ManPoNum(pAig) );
1470 int i, f, k, Lit, status;
1471 abctime clk, clk2, clkSatRun, clkOther = 0, clkTotal = Abc_Clock();
1472 abctime nTimeUnsat = 0, nTimeSat = 0, nTimeUndec = 0, clkOne = 0;
1473 abctime nTimeToStopNG, nTimeToStop;
1480 nTimeToStopNG = pPars->
nTimeOut ? pPars->
nTimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0;
1487 p->pSat->nLearntStart =
p->pPars->nLearnedStart;
1488 p->pSat->nLearntDelta =
p->pPars->nLearnedDelta;
1489 p->pSat->nLearntRatio =
p->pPars->nLearnedPerce;
1490 p->pSat->nLearntMax =
p->pSat->nLearntStart;
1491 p->pSat->fNoRestarts =
p->pPars->fNoRestarts;
1492 p->pSat->RunId =
p->pPars->RunId;
1493 p->pSat->pFuncStop =
p->pPars->pFuncStop;
1495 else if (
p->pSat3 )
1506 p->vCexes = Vec_PtrStart( Saig_ManPoNum(pAig) );
1509 Abc_Print( 1,
"Running \"bmc3\". PI/PO/Reg = %d/%d/%d. And =%7d. Lev =%6d. ObjNums =%6d.\n",
1510 Saig_ManPiNum(pAig), Saig_ManPoNum(pAig), Saig_ManRegNum(pAig),
1512 Abc_Print( 1,
"Params: FramesMax = %d. Start = %d. ConfLimit = %d. TimeOut = %d. SolveAll = %d.\n",
1521 else if (
p->pSat3 )
1524 sat_solver_set_runtime_limit(
p->pSat, nTimeToStop );
1532 if ( !pPars->
nFramesJump && Aig_ManRegNum(pAig) < 30 && f == (1 << Aig_ManRegNum(pAig)) )
1534 Abc_Print( 1,
"Stopping BMC because all 2^%d reachable states are visited.\n", Aig_ManRegNum(pAig) );
1535 if (
p->pPars->fUseBridge )
1537 if ( !(
p->vCexes && Vec_PtrEntry(
p->vCexes, i)) && !(
p->pTime4Outs &&
p->pTime4Outs[i] == 0) )
1545 Abc_Print( 1,
"Stopping BMC because all targets are disproved or timed out.\n" );
1550 if ( (RetValue == -1 || pPars->
fSolveAll) && pPars->
nStart == 0 && !nJumpFrame )
1553 Vec_PtrPush(
p->vId2Var, Vec_IntStartFull(
p->nObjNums) );
1554 Vec_PtrPush(
p->vTerInfo, (pInfo =
ABC_CALLOC(
unsigned,
p->nWordNum)) );
1566 Saig_ManBmcSetLiteral(
p, Aig_ManConst1(pAig), f, 1 );
1567 Saig_ManBmcSimInfoSet( pInfo, Aig_ManConst1(pAig),
SAIG_TER_ONE );
1574 Saig_ManBmcSetLiteral(
p, pObj, 0, 0 );
1578 if ( (pPars->
nStart && f < pPars->nStart) || (nJumpFrame && f < nJumpFrame) )
1585 if ( i >= Saig_ManPoNum(pAig) )
1590 Abc_Print( 1,
"Reached gap timeout (%d seconds).\n", pPars->
nTimeOutGap );
1593 if ( nTimeToStop && Abc_Clock() > nTimeToStop )
1596 Abc_Print( 1,
"Reached timeout (%d seconds).\n", pPars->
nTimeOut );
1600 if (
p->vCexes && Vec_PtrEntry(
p->vCexes, i) )
1603 if (
p->pTime4Outs &&
p->pTime4Outs[i] == 0 )
1608clkOther += Abc_Clock() - clk2;
1615 if ( i >= Saig_ManPoNum(pAig) )
1620 Abc_Print( 1,
"Reached gap timeout (%d seconds).\n", pPars->
nTimeOutGap );
1623 if ( nTimeToStop && Abc_Clock() > nTimeToStop )
1626 Abc_Print( 1,
"Reached timeout (%d seconds).\n", pPars->
nTimeOut );
1629 if (
p->pPars->pFuncStop &&
p->pPars->pFuncStop(
p->pPars->RunId) )
1632 Abc_Print( 1,
"Bmc3 got callbacks.\n" );
1636 if (
p->vCexes && Vec_PtrEntry(
p->vCexes, i) )
1639 if (
p->pTime4Outs &&
p->pTime4Outs[i] == 0 )
1644clkOther += Abc_Clock() - clk2;
1647 if (
p->pSat ) sat_solver_compress(
p->pSat );
1648 if (
p->pTime4Outs )
1650 assert(
p->pTime4Outs[i] > 0 );
1651 clkOne = Abc_Clock();
1654 else if (
p->pSat3 )
1657 sat_solver_set_runtime_limit(
p->pSat,
p->pTime4Outs[i] + Abc_Clock() );
1661clkSatRun = Abc_Clock() - clk2;
1663 fprintf( pLogFile,
"Frame %5d Output %5d Time(ms) %8d %8d\n", f, i,
1664 Lit < 2 ? 0 : (
int)(clkSatRun * 1000 / CLOCKS_PER_SEC),
1665 Lit < 2 ? 0 : Abc_MaxInt(0, Abc_MinInt(pPars->
nTimeOutOne, pPars->
nTimeOutOne - (
int)((
p->pTime4Outs[i] - clkSatRun) * 1000 / CLOCKS_PER_SEC))) );
1666 if (
p->pTime4Outs )
1668 abctime timeSince = Abc_Clock() - clkOne;
1669 assert(
p->pTime4Outs[i] > 0 );
1670 p->pTime4Outs[i] = (
p->pTime4Outs[i] > timeSince) ?
p->pTime4Outs[i] - timeSince : 0;
1671 if (
p->pTime4Outs[i] == 0 && status !=
l_True )
1676nTimeUnsat += clkSatRun;
1680 Lit = lit_neg( Lit );
1683 else if (
p->pSat3 )
1691 for ( k = 0; k < veci_size(&
p->pSat->unit_lits); k++ )
1693 Lit = veci_begin(&
p->pSat->unit_lits)[k];
1697 veci_resize(&
p->pSat->unit_lits, 0);
1699 sat_solver_compress(
p->pSat );
1702 if (
p->pPars->fUseBridge )
1705 else if ( status ==
l_True )
1707nTimeSat += clkSatRun;
1714 Abc_Print( 1,
"%4d %s : ", f, fUnfinished ?
"-" :
"+" );
1715 Abc_Print( 1,
"Var =%8.0f. ", (
double)
p->nSatVars );
1722 Abc_Print( 1,
"%4.0f MB", 4.25*(f+1)*
p->nObjNums /(1<<20) );
1724 Abc_Print( 1,
"%9.2f sec ", (
float)(Abc_Clock() - clkTotal)/(
float)(CLOCKS_PER_SEC) );
1730 Abc_Print( 1,
"\n" );
1739 Abc_Print( 1,
"Output %*d was asserted in frame %2d (solved %*d out of %*d outputs).\n",
1740 nOutDigits, i, f, nOutDigits, pPars->
nFailOuts, nOutDigits, Saig_ManPoNum(pAig) );
1741 if (
p->vCexes == NULL )
1742 p->vCexes = Vec_PtrStart( Saig_ManPoNum(pAig) );
1745 if (
p->pPars->fUseBridge )
1752 Vec_PtrWriteEntry(
p->vCexes, i,
Abc_CexDup(pCexNew, Saig_ManRegNum(pAig)) );
1756 Abc_Print( 1,
"Quitting due to callback on fail.\n" );
1766 else if (
p->pSat3 )
1769 sat_solver_set_runtime_limit(
p->pSat, nTimeToStop );
1776 if ( k >= Saig_ManPoNum(pAig) )
1779 if (
p->vCexes && Vec_PtrEntry(
p->vCexes, k) )
1788 else if (
p->pSat3 )
1795 if ( sat_solver_var_value(
p->pSat, lit_var(Lit)) == Abc_LitIsCompl(Lit) )
1801 Abc_Print( 1,
"Output %*d was asserted in frame %2d (solved %*d out of %*d outputs).\n",
1802 nOutDigits, k, f, nOutDigits, pPars->
nFailOuts, nOutDigits, Saig_ManPoNum(pAig) );
1804 if (
p->pPars->fUseBridge )
1812 pCexDup =
Abc_CexDup(pCexNew, Saig_ManRegNum(pAig));
1814 Vec_PtrWriteEntry(
p->vCexes, k, pCexDup );
1821nTimeUndec += clkSatRun;
1830 if (
p->pTime4Outs == NULL )
1841 Abc_Print( 1,
"%4d %s : ", f, fUnfinished ?
"-" :
"+" );
1842 Abc_Print( 1,
"Var =%8.0f. ", (
double)
p->nSatVars );
1850 Abc_Print( 1,
"CEX =%5d. ", pPars->
nFailOuts );
1852 Abc_Print( 1,
"T/O =%4d. ", pPars->
nDropOuts );
1855 Abc_Print( 1,
"%4.0f MB", 4.0*(f+1)*
p->nObjNums /(1<<20) );
1858 Abc_Print( 1,
"%9.2f sec ", 1.0*(Abc_Clock() - clkTotal)/CLOCKS_PER_SEC );
1864 Abc_Print( 1,
"\n" );
1869 if ( nJumpFrame && pPars->
nStart == 0 )
1871 else if ( RetValue == -1 && pPars->
nStart == 0 )
1877 Abc_Print( 1,
"Runtime: " );
1878 Abc_Print( 1,
"CNF = %.1f sec (%.1f %%) ", 1.0*clkOther/CLOCKS_PER_SEC, 100.0*clkOther/(Abc_Clock() - clkTotal) );
1879 Abc_Print( 1,
"UNSAT = %.1f sec (%.1f %%) ", 1.0*nTimeUnsat/CLOCKS_PER_SEC, 100.0*nTimeUnsat/(Abc_Clock() - clkTotal) );
1880 Abc_Print( 1,
"SAT = %.1f sec (%.1f %%) ", 1.0*nTimeSat/CLOCKS_PER_SEC, 100.0*nTimeSat/(Abc_Clock() - clkTotal) );
1881 Abc_Print( 1,
"UNDEC = %.1f sec (%.1f %%)", 1.0*nTimeUndec/CLOCKS_PER_SEC, 100.0*nTimeUndec/(Abc_Clock() - clkTotal) );
1882 Abc_Print( 1,
"\n" );
int bmcg_sat_solver_conflictnum(bmcg_sat_solver *s)
abctime bmcg_sat_solver_set_runtime_limit(bmcg_sat_solver *s, abctime Limit)
int bmcg_sat_solver_learntnum(bmcg_sat_solver *s)
int bmcg_sat_solver_varnum(bmcg_sat_solver *s)
int bmcg_sat_solver_addvar(bmcg_sat_solver *s)
bmcg_sat_solver * bmcg_sat_solver_start()
MACRO DEFINITIONS ///.
int bmcg_sat_solver_solve(bmcg_sat_solver *s, int *plits, int nlits)
int bmcg_sat_solver_addclause(bmcg_sat_solver *s, int *plits, int nlits)
void bmcg_sat_solver_set_conflict_budget(bmcg_sat_solver *s, int Limit)
int bmcg_sat_solver_read_cex_varvalue(bmcg_sat_solver *s, int ivar)
int bmcg_sat_solver_clausenum(bmcg_sat_solver *s)
void bmcg_sat_solver_stop(bmcg_sat_solver *s)
#define ABC_ALLOC(type, num)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
int Aig_ManLevelNum(Aig_Man_t *p)
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
struct Aig_Obj_t_ Aig_Obj_t
#define Aig_ManForEachNode(p, pObj, i)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
#define Aig_ManForEachCo(p, pObj, i)
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
unsigned Aig_ManRandom(int fReset)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Gia_ManBmc_t * Saig_Bmc3ManStart(Aig_Man_t *pAig, int nTimeOutOne, int nConfLimit, int fUseSatoko, int fUseGlucose)
int Saig_ManBmcCreateCnf(Gia_ManBmc_t *p, Aig_Obj_t *pObj, int iFrame)
Abc_Cex_t * Saig_ManGenerateCex(Gia_ManBmc_t *p, int f, int i)
void Saig_ParBmcSetDefaultParams(Saig_ParBmc_t *p)
int Saig_ManBmcTerSimCount01Po(Aig_Man_t *p, unsigned *pInfo)
int Saig_ManBmcCountRefed(Aig_Man_t *p, Vec_Ptr_t *vSuper)
void Saig_ManBmcWriteBlif(Aig_Man_t *p, Vec_Int_t *vMapping, char *pFileName)
abctime Saig_ManBmcTimeToStop(Saig_ParBmc_t *pPars, abctime nTimeToStopNG)
void Saig_ManBmcMappingTest(Aig_Man_t *p)
Vec_Ptr_t * Saig_ManBmcTerSimPo(Aig_Man_t *p)
void Saig_ManBmcTerSimTest(Aig_Man_t *p)
int Saig_ManBmcScalable(Aig_Man_t *pAig, Saig_ParBmc_t *pPars)
int Gia_ManToBridgeResult(FILE *pFile, int Result, Abc_Cex_t *pCex, int iPoProved)
DECLARATIONS ///.
int Saig_ManBmcCreateCnf_rec(Gia_ManBmc_t *p, Aig_Obj_t *pObj, int iFrame)
void Saig_ManBmcSupergateTest(Aig_Man_t *p)
void Saig_ManBmcCountNonternary(Aig_Man_t *p, Vec_Ptr_t *vInfos, int iFrame)
int Saig_ManBmcCountNonternary_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vInfos, unsigned *pInfo, int f, int *pCounter)
void Gia_ManReportProgress(FILE *pFile, int prop_no, int depth)
typedefABC_NAMESPACE_IMPL_START struct Gia_ManBmc_t_ Gia_ManBmc_t
DECLARATIONS ///.
Vec_Ptr_t * Saig_ManBmcSupergate(Aig_Man_t *p, int iPo)
void Saig_ManBmcSupergate_rec(Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
#define SAIG_TER_NON
FUNCTION DEFINITIONS ///.
int Saig_ManBmcRunTerSim_rec(Gia_ManBmc_t *p, Aig_Obj_t *pObj, int iFrame)
Vec_Ptr_t * Saig_ManBmcDfsNodes(Aig_Man_t *p, Vec_Ptr_t *vRoots)
Vec_Vec_t * Saig_ManBmcSections(Aig_Man_t *p)
void Saig_ManBmcSectionsTest(Aig_Man_t *p)
unsigned * Saig_ManBmcTerSimOne(Aig_Man_t *p, unsigned *pPrev)
int Saig_ManCallSolver(Gia_ManBmc_t *p, int Lit)
void Saig_ManBmcTerSimTestPo(Aig_Man_t *p)
Vec_Ptr_t * Saig_ManBmcTerSim(Aig_Man_t *p)
int Saig_ManBmcTerSimCount01(Aig_Man_t *p, unsigned *pInfo)
void Saig_ManBmcCreateCnf_iter(Gia_ManBmc_t *p, Aig_Obj_t *pObj, int iFrame, Vec_Int_t *vVisit)
int Aig_NodeCompareRefsIncrease(Aig_Obj_t **pp1, Aig_Obj_t **pp2)
Vec_Int_t * Saig_ManBmcComputeMappingRefs(Aig_Man_t *p, Vec_Int_t *vMap)
void Saig_ManBmcDfs_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
void Saig_Bmc3ManStop(Gia_ManBmc_t *p)
struct Saig_ParBmc_t_ Saig_ParBmc_t
#define sat_solver_addclause
Vec_Int_t * Cnf_DeriveMappingArray(Aig_Man_t *pAig)
FUNCTION DECLARATIONS ///.
void Cnf_ReadMsops(char **ppSopSizes, char ***ppSops)
FUNCTION DEFINITIONS ///.
unsigned Dar_CutSortVars(unsigned uTruth, int *pVars)
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
#define Saig_ManForEachLi(p, pObj, i)
#define Saig_ManForEachPo(p, pObj, i)
#define Saig_ManForEachLo(p, pObj, i)
#define Saig_ManForEachPi(p, pObj, i)
sat_solver * sat_solver_new(void)
void sat_solver_setnvars(sat_solver *s, int n)
int sat_solver_nvars(sat_solver *s)
void sat_solver_delete(sat_solver *s)
double sat_solver_memory(sat_solver *s)
int satoko_varnum(satoko_t *)
void satoko_set_stop_func(satoko_t *s, int(*fnct)(int))
void satoko_setnvars(satoko_t *, int)
int satoko_conflictnum(satoko_t *)
struct satoko_opts satoko_opts_t
abctime satoko_set_runtime_limit(satoko_t *, abctime)
int satoko_solve_assumptions_limit(satoko_t *s, int *plits, int nlits, int nconflim)
void satoko_set_runid(satoko_t *, int)
void satoko_default_opts(satoko_opts_t *)
int satoko_add_clause(satoko_t *, int *, int)
struct solver_t_ satoko_t
int satoko_clausenum(satoko_t *)
int satoko_learntnum(satoko_t *)
int satoko_read_cex_varvalue(satoko_t *, int)
void satoko_destroy(satoko_t *)
satoko_t * satoko_create(void)
void satoko_configure(satoko_t *, satoko_opts_t *)
int(* pFuncOnFail)(int, Abc_Cex_t *)
int Gia_ManToBridgeProgress(FILE *pFile, int Size, unsigned char *pBuffer)
void Abc_CexFreeP(Abc_Cex_t **p)
Abc_Cex_t * Abc_CexDup(Abc_Cex_t *p, int nRegsNew)
Abc_Cex_t * Abc_CexMakeTriv(int nRegs, int nTruePis, int nTruePos, int iFrameOut)
void Abc_CexFree(Abc_Cex_t *p)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
struct Hsh_IntMan_t_ Hsh_IntMan_t
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
#define Vec_VecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
#define Vec_WecForEachLevelReverse(vGlob, vVec, i)
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.