97 int Lits[2], nLitsTot, RetValue, i;
99 nLitsTot = 2 *
p->pCnf->nVars;
100 pObj = Aig_ManCo(
p->pAig, 0);
101 for ( i = 0; i <
p->nPref +
p->nFrames; i++ )
103 Lits[0] = i * nLitsTot + toLitCond(
p->pCnf->pVarNums[pObj->
Id], 0 );
104 RetValue =
sat_solver_solve(
p->pSatBmc, Lits, Lits + 1, (ABC_INT64_T)
p->nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
129 pObj = Aig_ManCo(
p->pAig, 0);
130 for ( i = 0; i <=
p->nFrames; i++ )
131 pLits[i] = i * 2 *
p->pCnf->nVars + toLitCond(
p->pCnf->pVarNums[pObj->
Id], i !=
p->nFrames );
133 RetValue =
sat_solver_solve(
p->pSatMain, pLits, pLits +
p->nFrames + 1, (ABC_INT64_T)
p->nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
156 int Lits[2], RetValue;
157 pObj = Aig_ManCo(
p->pAig, 0);
158 Lits[0] = toLitCond(
p->pCnf->pVarNums[pObj->
Id], 0 );
159 RetValue =
sat_solver_solve(
p->pSatMain, Lits, Lits + 1, (ABC_INT64_T)
p->nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
180 for ( j = 16, m = 0x0000FFFF; j; j >>= 1, m ^= m << j )
182 for ( k = 0; k < 32; k = ((k | j) + 1) & ~j )
184 t = (a[k] ^ (a[k|j] >> j)) & m;
205 unsigned * pSims[16], uWord;
206 int nSeries, i, k, j;
207 int nWordsForSim = pSimMan->
nWordsTotal -
p->nSimWordsPref;
210 assert( nWordsForSim % 8 == 0 );
212 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
213 pSims[i] = Fra_ObjSim( pSimMan, pCut->
pLeaves[i] ) +
p->nSimWordsPref;
215 memset( pScores, 0,
sizeof(
int) * 16 );
216 nSeries = nWordsForSim / 8;
217 for ( i = 0; i < nSeries; i++ )
219 memset( Matrix, 0,
sizeof(
unsigned) * 32 );
220 for ( k = 0; k < 8; k++ )
221 for ( j = 0; j < (int)pCut->
nLeaves; j++ )
222 Matrix[31-(k*4+j)] = pSims[j][i*8+k];
224 for ( k = 0; k < 32; k++ )
225 for ( j = 0, uWord = Matrix[k]; j < 8; j++, uWord >>= 4 )
226 pScores[uWord & 0xF]++;
230 for ( i = 0; i < 16; i++ )
250 unsigned * pSims[16], uWord;
252 int nWordsForSim = pSimMan->
nWordsTotal -
p->nSimWordsPref;
255 assert( nWordsForSim % 8 == 0 );
257 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
258 pSims[i] = Fra_ObjSim( pSimMan, pCut->
pLeaves[i] ) +
p->nSimWordsPref;
260 memset( pScores, 0,
sizeof(
int) * 16 );
261 for ( i = 0; i < nWordsForSim; i++ )
262 for ( k = 0; k < 32; k++ )
265 for ( b = 0; b < (int)pCut->
nLeaves; b++ )
266 if ( pSims[b][i] & (1 << k) )
272 for ( i = 0; i < 16; i++ )
293 unsigned * pSims[16], uWord;
294 int iMint, i, j, k, b, nMints, nSeries;
295 int nWordsForSim = pSimMan->
nWordsTotal -
p->nSimWordsPref;
299 assert( nWordsForSim % 8 == 0 );
301 for ( i = 0; i < (int)pCut->
nFanins; i++ )
302 pSims[i] = Fra_ObjSim( pSimMan, pCut->
pFanins[i] ) +
p->nSimWordsPref;
305 memset( pScores, 0,
sizeof(
int) * nMints );
310 nSeries = nWordsForSim / 8;
311 for ( i = 0; i < nSeries; i++ )
313 memset( Matrix, 0,
sizeof(
unsigned) * 32 );
314 for ( k = 0; k < 8; k++ )
315 for ( j = 0; j < (int)pCut->
nFanins; j++ )
316 Matrix[31-(k*4+j)] = pSims[j][i*8+k];
318 for ( k = 0; k < 32; k++ )
319 for ( j = 0, uWord = Matrix[k]; j < 8; j++, uWord >>= 4 )
320 pScores[uWord & 0xF]++;
326 for ( i = 0; i < nWordsForSim; i++ )
327 for ( k = 0; k < 32; k++ )
330 for ( b = 0; b < (int)pCut->
nFanins; b++ )
331 if ( pSims[b][i] & (1 << k) )
352 int * pCostCount, nClauCount, Cost, CostMax, i, c;
353 assert( Vec_IntSize(
p->vClauses) >
p->nClausesMax );
355 CostMax =
p->nSimWords * 32 + 1;
357 memset( pCostCount, 0,
sizeof(
int) * CostMax );
363 pCostCount[ Cost ]++;
365 assert( pCostCount[0] == 0 );
368 for ( c = CostMax - 1; c > 0; c-- )
370 assert( pCostCount[c] >= 0 );
371 nClauCount += pCostCount[c];
372 if ( nClauCount >=
p->nClausesMax )
379 if ( Cost >= c && nClauCount < p->nClausesMax )
384 Vec_IntWriteEntry(
p->vCosts, i, -1 );
387 p->nClauses = nClauCount;
389printf(
"Selected %d clauses. Cost range: [%d < %d < %d]\n", nClauCount, 1, c, CostMax );
408 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
409 Vec_IntPush(
p->vLits, toLitCond(
p->pCnf->pVarNums[pCut->
pLeaves[i]], (iMint&(1<<i)) ) );
410 Vec_IntPush(
p->vClauses, Vec_IntSize(
p->vLits) );
411 Vec_IntPush(
p->vCosts, Cost );
428 for ( i = 0; i < (int)pCut->
nFanins; i++ )
429 Vec_IntPush(
p->vLits, toLitCond(
p->pCnf->pVarNums[pCut->
pFanins[i]], (iMint&(1<<i)) ) );
430 Vec_IntPush(
p->vClauses, Vec_IntSize(
p->vLits) );
431 Vec_IntPush(
p->vCosts, Cost );
449 pSims = Fra_ObjSim(pSeq, pObj->
Id);
450 for ( i = pSeq->
nWordsPref; i < pSeq->nWordsTotal; i++ )
469 unsigned * pSimL, * pSimR;
471 pSimL = Fra_ObjSim(pSeq, pObj1->
Id);
472 pSimR = Fra_ObjSim(pSeq, pObj2->
Id);
473 for ( k = pSeq->
nWordsPref; k < pSeq->nWordsTotal; k++ )
474 if ( pSimL[k] & ~pSimR[k] )
492 unsigned * pSimL, * pSimR;
494 pSimL = Fra_ObjSim(pSeq, pObj1->
Id);
495 pSimR = Fra_ObjSim(pSeq, pObj2->
Id);
496 for ( k = pSeq->
nWordsPref; k < pSeq->nWordsTotal; k++ )
497 if ( pSimL[k] & pSimR[k] )
516 unsigned * pSims1, * pSims2;
517 int CostMax, i, k, nCountConst, nCountImps;
519 nCountConst = nCountImps = 0;
520 CostMax =
p->nSimWords * 32;
539 pSims1 = Fra_ObjSim( pSeq, pObj1->
Id );
542 Vec_IntPush(
p->vLits, toLitCond(
p->pCnf->pVarNums[pObj1->
Id], 1 ) );
543 Vec_IntPush(
p->vClauses, Vec_IntSize(
p->vLits) );
544 Vec_IntPush(
p->vCosts, CostMax );
550 pSims2 = Fra_ObjSim( pSeq, pObj2->
Id );
553 Vec_IntPush(
p->vLits, toLitCond(
p->pCnf->pVarNums[pObj1->
Id], 1 ) );
554 Vec_IntPush(
p->vLits, toLitCond(
p->pCnf->pVarNums[pObj2->
Id], 0 ) );
555 Vec_IntPush(
p->vClauses, Vec_IntSize(
p->vLits) );
556 Vec_IntPush(
p->vCosts, CostMax );
562 Vec_IntPush(
p->vLits, toLitCond(
p->pCnf->pVarNums[pObj2->
Id], 1 ) );
563 Vec_IntPush(
p->vLits, toLitCond(
p->pCnf->pVarNums[pObj1->
Id], 0 ) );
564 Vec_IntPush(
p->vClauses, Vec_IntSize(
p->vLits) );
565 Vec_IntPush(
p->vCosts, CostMax );
571 Vec_IntPush(
p->vLits, toLitCond(
p->pCnf->pVarNums[pObj1->
Id], 1 ) );
572 Vec_IntPush(
p->vLits, toLitCond(
p->pCnf->pVarNums[pObj2->
Id], 1 ) );
573 Vec_IntPush(
p->vClauses, Vec_IntSize(
p->vLits) );
574 Vec_IntPush(
p->vCosts, CostMax );
579 if ( nCountConst + nCountImps >
p->nClausesMax / 2 )
584 printf(
"Collected %d register constants and %d one-hotness implications.\n", nCountConst, nCountImps );
585 p->nOneHots = nCountConst + nCountImps;
586 p->nOneHotsProven = 0;
608 int Scores[16], uScores, i, k, j, nCuts = 0;
618 printf(
"Property failed after sequential simulation!\n" );
624ABC_PRT(
"Sim-seq", Abc_Clock() - clk );
634ABC_PRT(
"Lat-cla", Abc_Clock() - clk );
645ABC_PRT(
"Cuts ", Abc_Clock() - clk );
663ABC_PRT(
"Infoseq", Abc_Clock() - clk );
674ABC_PRT(
"Sim-cmb", Abc_Clock() - clk );
685 uScores &= ~pCut->uTruth; pCut->
uTruth = 0;
689 for ( j = 0; j < (1<<pCut->
nLeaves); j++ )
690 if ( uScores & (1 << j) )
699ABC_PRT(
"Infocmb", Abc_Clock() - clk );
703 printf(
"Node = %5d. Non-triv cuts = %7d. Clauses = %6d. Clause per cut = %6.2f.\n",
704 Aig_ManNodeNum(
p->pAig), nCuts, Vec_IntSize(
p->vClauses), 1.0*Vec_IntSize(
p->vClauses)/nCuts );
706 if ( Vec_IntSize(
p->vClauses) >
p->nClausesMax )
709 p->nClauses = Vec_IntSize(
p->vClauses );
731 int i, k, j, nCuts = 0;
733 int ScoresSeq[1<<12], ScoresComb[1<<12];
743 printf(
"Property failed after sequential simulation!\n" );
787 if ( pObj->
Level > (
unsigned)
p->nLevels )
796 for ( j = 0; j < (1<<pCut->
nFanins); j++ )
797 if ( ScoresComb[j] != 0 && ScoresSeq[j] == 0 )
807 p->pAig->pManCuts = NULL;
811 printf(
"Node = %5d. Cuts = %7d. Clauses = %6d. Clause/cut = %6.2f.\n",
812 Aig_ManNodeNum(
p->pAig), nCuts, Vec_IntSize(
p->vClauses), 1.0*Vec_IntSize(
p->vClauses)/nCuts );
813 ABC_PRT(
"Processing sim-info to find candidate clauses (unoptimized)", Abc_Clock() - clk );
818 p->nClauses = Vec_IntSize(
p->vClauses );
819 if ( Vec_IntSize(
p->vClausesProven ) > 0 )
821 int RetValue, k, Beg;
827 if (
p->pSatMain == NULL )
829 printf(
"Error: Main solver is unsat.\n" );
835 pStart = Vec_IntArray(
p->vLitsProven);
838 assert( End - Beg <= p->nLutSize );
843 printf(
"Error: Solver is UNSAT after adding assumption clauses.\n" );
848 assert( End == Vec_IntSize(
p->vLitsProven) );
852 pStart = Vec_IntArray(
p->vLits);
855 assert( Vec_IntEntry(
p->vCosts, i ) >= 0 );
856 assert( End - Beg <= p->nLutSize );
858 for ( k = Beg; k < End; k++ )
859 pStart[k] = lit_neg( pStart[k] );
860 RetValue =
sat_solver_solve(
p->pSatMain, pStart + Beg, pStart + End, (ABC_INT64_T)
p->nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
861 for ( k = Beg; k < End; k++ )
862 pStart[k] = lit_neg( pStart[k] );
866 Vec_IntWriteEntry(
p->vCosts, i, -1 );
871 assert( End == Vec_IntSize(
p->vLits) );
873 printf(
"Already proved clauses filtered out %d candidate clauses (out of %d).\n",
874 Vec_IntSize(
p->vClauses) -
p->nClauses, Vec_IntSize(
p->vClauses) );
878 if (
p->nClauses >
p->nClausesMax )
899 int * pStart, nLitsTot, RetValue, Beg, End, Counter, i, k, f;
910 nLitsTot =
p->nPref * 2 *
p->pCnf->nVars;
911 for ( i = 0; i < Vec_IntSize(
p->vLits); i++ )
912 p->vLits->pArray[i] += nLitsTot;
915 nLitsTot = 2 *
p->pCnf->nVars;
916 pStart = Vec_IntArray(
p->vLits);
917 for ( f = 0; f <
p->nFrames; f++ )
922 if ( Vec_IntEntry(
p->vCosts, i ) == -1 )
927 assert( Vec_IntEntry(
p->vCosts, i ) > 0 );
928 assert( End - Beg <= p->nLutSize );
930 for ( k = Beg; k < End; k++ )
931 pStart[k] = lit_neg( pStart[k] );
932 RetValue =
sat_solver_solve(
p->pSatBmc, pStart + Beg, pStart + End, (ABC_INT64_T)
p->nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
933 for ( k = Beg; k < End; k++ )
934 pStart[k] = lit_neg( pStart[k] );
939 Vec_IntWriteEntry(
p->vCosts, i, -1 );
956 if (
p->pSatBmc->qtail !=
p->pSatBmc->qhead )
960 assert(
p->pSatBmc->qtail ==
p->pSatBmc->qhead );
964 for ( i = 0; i < Vec_IntSize(
p->vLits); i++ )
965 p->vLits->pArray[i] += nLitsTot;
969 nLitsTot = (
p->nPref +
p->nFrames) * nLitsTot;
970 for ( i = 0; i < Vec_IntSize(
p->vLits); i++ )
971 p->vLits->pArray[i] -= nLitsTot;
993 assert(
p->pCnf->nVars <= Vec_PtrSize(
p->vCexes) );
994 Vec_PtrCleanSimInfo(
p->vCexes, 0,
p->nCexesAlloc/32 );
1011 assert(
p->nCexes ==
p->nCexesAlloc );
1012 Vec_PtrReallocSimInfo(
p->vCexes );
1013 Vec_PtrCleanSimInfo(
p->vCexes,
p->nCexesAlloc/32, 2 *
p->nCexesAlloc/32 );
1014 p->nCexesAlloc *= 2;
1031 if (
p->nCexes ==
p->nCexesAlloc )
1033 assert(
p->nCexes <
p->nCexesAlloc );
1034 for ( i = 0; i <
p->pCnf->nVars; i++ )
1036 if ( pModel[i] ==
l_True )
1038 assert( Abc_InfoHasBit( (
unsigned *)Vec_PtrEntry(
p->vCexes, i),
p->nCexes ) == 0 );
1039 Abc_InfoSetBit( (
unsigned *)Vec_PtrEntry(
p->vCexes, i),
p->nCexes );
1058 unsigned * pSims[16], uWord;
1060 for ( i = 0; i < nLits; i++ )
1062 iVar = lit_var(pLits[i]) -
p->nFrames *
p->pCnf->nVars;
1063 assert( iVar > 0 && iVar < p->pCnf->nVars );
1064 pSims[i] = (
unsigned *)Vec_PtrEntry(
p->vCexes, iVar );
1067 for ( w = 0; w <
nWords; w++ )
1069 uWord = ~(unsigned)0;
1070 for ( i = 0; i < nLits; i++ )
1071 uWord &= (lit_sign(pLits[i])? pSims[i][w] : ~pSims[i][w]);
1075 if (
p->nCexes % 32 )
1077 uWord = ~(unsigned)0;
1078 for ( i = 0; i < nLits; i++ )
1079 uWord &= (lit_sign(pLits[i])? pSims[i][w] : ~pSims[i][w]);
1080 if ( uWord & Abc_InfoMask(
p->nCexes % 32 ) )
1101 int * pStart, nLitsTot, RetValue, Beg, End, Counter, i, k, f, fFlag;
1107 if (
p->pSatMain == NULL )
1109 printf(
"Error: Main solver is unsat.\n" );
1141 nLitsTot = 2 *
p->pCnf->nVars;
1142 pStart = Vec_IntArray(
p->vLitsProven);
1143 for ( f = 0; f <
p->nFrames; f++ )
1148 assert( End - Beg <= p->nLutSize );
1151 if ( RetValue == 0 )
1153 printf(
"Error: Solver is UNSAT after adding assumption clauses.\n" );
1159 for ( i = 0; i < Vec_IntSize(
p->vLitsProven); i++ )
1160 p->vLitsProven->pArray[i] += nLitsTot;
1163 nLitsTot = (
p->nFrames) * nLitsTot;
1164 for ( i = 0; i < Vec_IntSize(
p->vLitsProven); i++ )
1165 p->vLitsProven->pArray[i] -= nLitsTot;
1187 nLitsTot = 2 *
p->pCnf->nVars;
1188 pStart = Vec_IntArray(
p->vLits);
1189 for ( f = 0; f <
p->nFrames; f++ )
1194 if ( Vec_IntEntry(
p->vCosts, i ) == -1 )
1199 assert( Vec_IntEntry(
p->vCosts, i ) > 0 );
1200 assert( End - Beg <= p->nLutSize );
1203 if ( RetValue == 0 )
1205 printf(
"Error: Solver is UNSAT after adding assumption clauses.\n" );
1211 for ( i = 0; i < Vec_IntSize(
p->vLits); i++ )
1212 p->vLits->pArray[i] += nLitsTot;
1216 if (
p->pSatMain->qtail !=
p->pSatMain->qhead )
1220 assert(
p->pSatMain->qtail ==
p->pSatMain->qhead );
1229 printf(
" Property holds. " );
1234 printf(
" Property fails. " );
1261 if (
p->pSatMain->qtail !=
p->pSatMain->qhead )
1265 assert(
p->pSatMain->qtail ==
p->pSatMain->qhead );
1274 if ( Vec_IntEntry(
p->vCosts, i ) == -1 )
1279 assert( Vec_IntEntry(
p->vCosts, i ) > 0 );
1280 assert( End - Beg <= p->nLutSize );
1288 Vec_IntWriteEntry(
p->vCosts, i, -1 );
1298 for ( k = Beg; k < End; k++ )
1299 pStart[k] = lit_neg( pStart[k] );
1300 RetValue =
sat_solver_solve(
p->pSatMain, pStart + Beg, pStart + End, (ABC_INT64_T)
p->nBTLimit, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
1301 for ( k = Beg; k < End; k++ )
1302 pStart[k] = lit_neg( pStart[k] );
1314 Vec_IntWriteEntry(
p->vCosts, i, -1 );
1334 if (
p->pSatMain->qtail !=
p->pSatMain->qhead )
1338 assert(
p->pSatMain->qtail ==
p->pSatMain->qhead );
1343 nLitsTot =
p->nFrames * nLitsTot;
1344 for ( i = 0; i < Vec_IntSize(
p->vLits); i++ )
1345 p->vLits->pArray[i] -= nLitsTot;
1365Clu_Man_t *
Fra_ClausAlloc(
Aig_Man_t * pAig,
int nFrames,
int nPref,
int nClausesMax,
int nLutSize,
int nLevels,
int nCutsMax,
int nBatches,
int fStepUp,
int fTarget,
int fVerbose,
int fVeryVerbose )
1371 p->nFrames = nFrames;
1373 p->nClausesMax = nClausesMax;
1374 p->nLutSize = nLutSize;
1375 p->nLevels = nLevels;
1376 p->nCutsMax = nCutsMax;
1377 p->nBatches = nBatches;
1378 p->fStepUp = fStepUp;
1379 p->fTarget = fTarget;
1380 p->fVerbose = fVerbose;
1381 p->fVeryVerbose = fVeryVerbose;
1384 p->nSimWordsPref =
p->nPref*
p->nSimWords/
p->nSimFrames;
1386 p->vLits = Vec_IntAlloc( 1<<14 );
1387 p->vClauses = Vec_IntAlloc( 1<<12 );
1388 p->vCosts = Vec_IntAlloc( 1<<12 );
1390 p->vLitsProven = Vec_IntAlloc( 1<<14 );
1391 p->vClausesProven= Vec_IntAlloc( 1<<12 );
1393 p->nCexesAlloc = 1024;
1394 p->vCexes = Vec_PtrAllocSimInfo( Aig_ManObjNumMax(
p->pAig)+1,
p->nCexesAlloc/32 );
1395 Vec_PtrCleanSimInfo(
p->vCexes, 0,
p->nCexesAlloc/32 );
1412 if (
p->vCexes ) Vec_PtrFree(
p->vCexes );
1413 if (
p->vLits ) Vec_IntFree(
p->vLits );
1414 if (
p->vClauses ) Vec_IntFree(
p->vClauses );
1415 if (
p->vLitsProven ) Vec_IntFree(
p->vLitsProven );
1416 if (
p->vClausesProven ) Vec_IntFree(
p->vClausesProven );
1417 if (
p->vCosts ) Vec_IntFree(
p->vCosts );
1439 int Beg, End, Counter, i, k;
1442 pStart = Vec_IntArray(
p->vLits );
1445 if ( Vec_IntEntry(
p->vCosts, i ) == -1 )
1450 assert( Vec_IntEntry(
p->vCosts, i ) > 0 );
1451 assert( End - Beg <= p->nLutSize );
1452 for ( k = Beg; k < End; k++ )
1453 Vec_IntPush(
p->vLitsProven, pStart[k] );
1454 Vec_IntPush(
p->vClausesProven, Vec_IntSize(
p->vLitsProven) );
1458 if ( i < p->nOneHots )
1459 p->nOneHotsProven++;
1462 printf(
"Added to storage %d proved clauses (including %d one-hot clauses)\n", Counter,
p->nOneHotsProven );
1464 Vec_IntClear(
p->vClauses );
1465 Vec_IntClear(
p->vLits );
1466 Vec_IntClear(
p->vCosts );
1469 p->fNothingNew = (int)(Counter == 0);
1485 int Counters[9] = {0};
1489 pStart = Vec_IntArray(
p->vLitsProven );
1492 if ( End - Beg >= 8 )
1495 Counters[End - Beg]++;
1499 printf(
"SUMMARY: Total proved clauses = %d. ", Vec_IntSize(
p->vClausesProven) );
1500 printf(
"Clause per lit: " );
1501 for ( i = 0; i < 8; i++ )
1503 printf(
"%d=%d ", i, Counters[i] );
1505 printf(
">7=%d ", Counters[8] );
1523 int NodeId = pVar2Id[ lit_var(Lit) ];
1526 return Aig_NotCond( pLiteral, lit_sign(Lit) );
1546 int * pStart, * pVar2Id;
1550 memset( pVar2Id, 0xFF,
sizeof(
int) *
p->pCnf->nVars );
1551 for ( i = 0; i < Aig_ManObjNumMax(
p->pAig); i++ )
1552 if (
p->pCnf->pVarNums[i] >= 0 )
1554 assert(
p->pCnf->pVarNums[i] <
p->pCnf->nVars );
1555 pVar2Id[
p->pCnf->pVarNums[i] ] = i;
1561 pStart = Vec_IntArray(
p->vLitsProven );
1565 for ( k = Beg + 1; k < End; k++ )
1568 pClause =
Aig_Or( pNew, pClause, pLiteral );
1576 printf(
"Care one-hotness clauses will be written into file \"%s\".\n", pName );
1594 unsigned * pSims[16];
1596 for ( i = 0; i < nLits; i++ )
1598 iVar = lit_var(pLits[i]);
1599 pSims[i] = Fra_ObjSim( pSim, pVar2Id[iVar] );
1603 pResult[w] = ~(unsigned)0;
1604 for ( i = 0; i < nLits; i++ )
1605 pResult[w] &= (lit_sign(pLits[i])? pSims[i][w] : ~pSims[i][w]);
1622 int nCombSimWords = (1<<11);
1624 unsigned * pResultTot, * pResultOne;
1625 int nCovered, Beg, End, i, w;
1626 int * pStart, * pVar2Id;
1634 memset( pVar2Id, 0,
sizeof(
int) *
p->pCnf->nVars );
1635 for ( i = 0; i < Aig_ManObjNumMax(
p->pAig); i++ )
1636 if (
p->pCnf->pVarNums[i] >= 0 )
1638 assert(
p->pCnf->pVarNums[i] <
p->pCnf->nVars );
1639 pVar2Id[
p->pCnf->pVarNums[i] ] = i;
1642 assert( Aig_ManCoNum(
p->pAig) > 2 );
1643 pResultOne = Fra_ObjSim( pComb, Aig_ManCo(
p->pAig, 0)->Id );
1644 pResultTot = Fra_ObjSim( pComb, Aig_ManCo(
p->pAig, 1)->Id );
1646 for ( w = 0; w < nCombSimWords; w++ )
1650 pStart = Vec_IntArray(
p->vLitsProven );
1655 for ( w = 0; w < nCombSimWords; w++ )
1656 pResultTot[w] |= pResultOne[w];
1660 for ( w = 0; w < nCombSimWords; w++ )
1661 nCovered += Aig_WordCountOnes( pResultTot[w] );
1665 printf(
"Care states ratio = %f. ", 1.0 * (nCombSimWords * 32 - nCovered) / (nCombSimWords * 32) );
1666 printf(
"(%d out of %d patterns) ", nCombSimWords * 32 - nCovered, nCombSimWords * 32 );
1667 ABC_PRT(
"Time", Abc_Clock() - clk );
1682int Fra_Claus(
Aig_Man_t * pAig,
int nFrames,
int nPref,
int nClausesMax,
int nLutSize,
int nLevels,
int nCutsMax,
int nBatches,
int fStepUp,
int fBmc,
int fRefs,
int fTarget,
int fVerbose,
int fVeryVerbose )
1685 abctime clk, clkTotal = Abc_Clock(), clkInd;
1686 int b, Iter, Counter, nPrefOld;
1687 int nClausesBeg = 0;
1690 p =
Fra_ClausAlloc( pAig, nFrames, nPref, nClausesMax, nLutSize, nLevels, nCutsMax, nBatches, fStepUp, fTarget, fVerbose, fVeryVerbose );
1693 printf(
"PARAMETERS: Frames = %d. Pref = %d. Clauses max = %d. Cut size = %d.\n", nFrames, nPref, nClausesMax, nLutSize );
1694 printf(
"Level max = %d. Cuts max = %d. Batches = %d. Increment cut size = %s.\n", nLevels, nCutsMax, nBatches, fStepUp?
"yes":
"no" );
1698 assert( !
p->fTarget || Aig_ManCoNum(pAig) - Aig_ManRegNum(pAig) == 1 );
1715 if (
p->pSatBmc == NULL )
1717 printf(
"Error: BMC solver is unsat.\n" );
1723 printf(
"Problem fails the base case after %d frame expansion.\n",
p->nPref +
p->nFrames );
1735 if (
p->pSatMain == NULL )
1737 printf(
"Error: Main solver is unsat.\n" );
1743 for ( b = 0; b <
p->nBatches; b++ )
1746 printf(
"*** BATCH %d: ", b+1 );
1747 if ( b &&
p->nLutSize < 12 && (!
p->fFiltering ||
p->fNothingNew ||
p->fStepUp) )
1749 printf(
"Using %d-cuts.\n",
p->nLutSize );
1754 printf(
"Problem is inductive without strengthening.\n" );
1765 nPrefOld =
p->nPref;
p->nPref = 0;
p->nSimWordsPref = 0;
1768 p->nPref = nPrefOld;
1769 p->nSimWordsPref =
p->nPref*
p->nSimWords/
p->nSimFrames;
1770 nClausesBeg =
p->nClauses;
1780 p->nClauses -= Counter;
1783 printf(
"BMC disproved %d clauses. ", Counter );
1784 ABC_PRT(
"Time", Abc_Clock() - clk );
1790 clkInd = clk = Abc_Clock();
1792 for ( Iter = 0; Counter > 0; Iter++ )
1795 printf(
"Iter %3d : Begin = %5d. ", Iter,
p->nClauses );
1798 p->nClauses -= Counter;
1801 printf(
"End = %5d. Exs = %5d. ",
p->nClauses,
p->nCexes );
1803 ABC_PRT(
"Time", Abc_Clock() - clk );
1812 if ( Counter == -1 )
1813 printf(
"Fra_Claus(): Internal error. " );
1814 else if (
p->fFail )
1815 printf(
"Property FAILS during refinement. " );
1817 printf(
"Property HOLDS inductively after strengthening. " );
1818 ABC_PRT(
"Time ", Abc_Clock() - clkTotal );
1824 printf(
"Finished proving inductive clauses. " );
1825 ABC_PRT(
"Time ", Abc_Clock() - clkTotal );
#define ABC_ALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Aig_ManCutStop(Aig_ManCut_t *p)
void Aig_ManStop(Aig_Man_t *p)
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
struct Aig_Obj_t_ Aig_Obj_t
#define Aig_ObjForEachCut(p, pObj, pCut, i)
struct Aig_Cut_t_ Aig_Cut_t
Aig_Man_t * Aig_ManDupWithoutPos(Aig_Man_t *p)
#define Aig_ManForEachNode(p, pObj, i)
Aig_ManCut_t * Aig_ComputeCuts(Aig_Man_t *pAig, int nCutsMax, int nLeafMax, int fTruth, int fVerbose)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
int Aig_ManCleanup(Aig_Man_t *p)
struct Aig_ManCut_t_ Aig_ManCut_t
#define Aig_ManForEachLoSeq(p, pObj, i)
struct Aig_MmFixed_t_ Aig_MmFixed_t
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
unsigned Aig_ManRandom(int fReset)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
#define sat_solver_addclause
Cnf_Dat_t * Cnf_DeriveSimple(Aig_Man_t *p, int nOutputs)
struct Cnf_Dat_t_ Cnf_Dat_t
void Cnf_DataFree(Cnf_Dat_t *p)
struct Dar_Cut_t_ Dar_Cut_t
#define Dar_ObjForEachCut(pObj, pCut, i)
Aig_MmFixed_t * Dar_ManComputeCuts(Aig_Man_t *pAig, int nCutsMax, int fSkipTtMin, int fVerbose)
Clu_Man_t * Fra_ClausAlloc(Aig_Man_t *pAig, int nFrames, int nPref, int nClausesMax, int nLutSize, int nLevels, int nCutsMax, int nBatches, int fStepUp, int fTarget, int fVerbose, int fVeryVerbose)
void Fra_ClausEstimateCoverageOne(Fra_Sml_t *pSim, int *pLits, int nLits, int *pVar2Id, unsigned *pResult)
Aig_Obj_t * Fra_ClausGetLiteral(Clu_Man_t *p, int *pVar2Id, int Lit)
int Fra_ClausCollectLatchClauses(Clu_Man_t *p, Fra_Sml_t *pSeq)
int Fra_ClausBmcClauses(Clu_Man_t *p)
int Fra_ClausRunSat(Clu_Man_t *p)
void Fra_ClausAddToStorage(Clu_Man_t *p)
void Fra_ClausRecordClause(Clu_Man_t *p, Dar_Cut_t *pCut, int iMint, int Cost)
int Fra_Claus(Aig_Man_t *pAig, int nFrames, int nPref, int nClausesMax, int nLutSize, int nLevels, int nCutsMax, int nBatches, int fStepUp, int fBmc, int fRefs, int fTarget, int fVerbose, int fVeryVerbose)
void Fra_ClausPrintIndClauses(Clu_Man_t *p)
void Fra_ClausEstimateCoverage(Clu_Man_t *p)
void Fra_ClausSimInfoRecord(Clu_Man_t *p, int *pModel)
int Fra_ClausProcessClausesCut(Clu_Man_t *p, Fra_Sml_t *pSimMan, Dar_Cut_t *pCut, int *pScores)
int Fra_ClausRunSat0(Clu_Man_t *p)
int Fra_ClausProcessClauses2(Clu_Man_t *p, int fRefs)
typedefABC_NAMESPACE_IMPL_START struct Clu_Man_t_ Clu_Man_t
DECLARATIONS ///.
int Fra_ClausSmlNodesAreImpC(Fra_Sml_t *pSeq, Aig_Obj_t *pObj1, Aig_Obj_t *pObj2)
void Fra_ClausSimInfoRealloc(Clu_Man_t *p)
int Fra_ClausRunBmc(Clu_Man_t *p)
FUNCTION DEFINITIONS ///.
int Fra_ClausSmlNodeIsConst(Fra_Sml_t *pSeq, Aig_Obj_t *pObj)
void Fra_ClausRecordClause2(Clu_Man_t *p, Aig_Cut_t *pCut, int iMint, int Cost)
int Fra_ClausInductiveClauses(Clu_Man_t *p)
int Fra_ClausSelectClauses(Clu_Man_t *p)
void Fra_ClausProcessClausesCut3(Clu_Man_t *p, Fra_Sml_t *pSimMan, Aig_Cut_t *pCut, int *pScores)
void transpose32a(unsigned a[32])
int Fra_ClausProcessClausesCut2(Clu_Man_t *p, Fra_Sml_t *pSimMan, Dar_Cut_t *pCut, int *pScores)
void Fra_ClausFree(Clu_Man_t *p)
void Fra_ClausSimInfoClean(Clu_Man_t *p)
int Fra_ClausSimInfoCheck(Clu_Man_t *p, int *pLits, int nLits)
void Fra_ClausWriteIndClauses(Clu_Man_t *p)
int Fra_ClausProcessClauses(Clu_Man_t *p, int fRefs)
int Fra_ClausSmlNodesAreImp(Fra_Sml_t *pSeq, Aig_Obj_t *pObj1, Aig_Obj_t *pObj2)
void Fra_SmlStop(Fra_Sml_t *p)
struct Fra_Sml_t_ Fra_Sml_t
Fra_Sml_t * Fra_SmlSimulateComb(Aig_Man_t *pAig, int nWords, int fCheckMiter)
int Fra_InvariantVerify(Aig_Man_t *p, int nFrames, Vec_Int_t *vClauses, Vec_Int_t *vLits)
DECLARATIONS ///.
Fra_Sml_t * Fra_SmlSimulateSeq(Aig_Man_t *pAig, int nPref, int nFrames, int nWords, int fCheckMiter)
void Ioa_WriteAiger(Aig_Man_t *pMan, char *pFileName, int fWriteSymbols, int fCompact)
char * Ioa_FileNameGenericAppend(char *pBase, char *pSuffix)
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
int sat_solver_simplify(sat_solver *s)
void sat_solver_delete(sat_solver *s)
Vec_Int_t * vClausesProven
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.