Commit b94b7852 by Alan Mishchenko

Bug fix in &fftest when used for ECO.

parent a1fa224d
...@@ -672,7 +672,7 @@ void Gia_ManPrintResults( Gia_Man_t * p, sat_solver * pSat, int nIter, abctime c ...@@ -672,7 +672,7 @@ void Gia_ManPrintResults( Gia_Man_t * p, sat_solver * pSat, int nIter, abctime c
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Gia_ManFaultAddOne( Gia_Man_t * pM, Cnf_Dat_t * pCnf, sat_solver * pSat, Vec_Int_t * vLits, int nFuncVars ) int Gia_ManFaultAddOne( Gia_Man_t * pM, Cnf_Dat_t * pCnf, sat_solver * pSat, Vec_Int_t * vLits, int nFuncVars )
{ {
Gia_Man_t * pC; Gia_Man_t * pC;
Cnf_Dat_t * pCnf2; Cnf_Dat_t * pCnf2;
...@@ -688,13 +688,21 @@ void Gia_ManFaultAddOne( Gia_Man_t * pM, Cnf_Dat_t * pCnf, sat_solver * pSat, Ve ...@@ -688,13 +688,21 @@ void Gia_ManFaultAddOne( Gia_Man_t * pM, Cnf_Dat_t * pCnf, sat_solver * pSat, Ve
// add timeframe clauses // add timeframe clauses
for ( i = 0; i < pCnf2->nClauses; i++ ) for ( i = 0; i < pCnf2->nClauses; i++ )
if ( !sat_solver_addclause( pSat, pCnf2->pClauses[i], pCnf2->pClauses[i+1] ) ) if ( !sat_solver_addclause( pSat, pCnf2->pClauses[i], pCnf2->pClauses[i+1] ) )
assert( 0 ); {
Cnf_DataFree( pCnf2 );
Gia_ManStop( pC );
return 0;
}
// add constraint clauses // add constraint clauses
Gia_ManForEachPo( pC, pObj, i ) Gia_ManForEachPo( pC, pObj, i )
{ {
Lit = Abc_Var2Lit( pCnf2->pVarNums[Gia_ObjId(pC, pObj)], 1 ); Lit = Abc_Var2Lit( pCnf2->pVarNums[Gia_ObjId(pC, pObj)], 1 );
if ( !sat_solver_addclause( pSat, &Lit, &Lit+1 ) ) if ( !sat_solver_addclause( pSat, &Lit, &Lit+1 ) )
assert( 0 ); {
Cnf_DataFree( pCnf2 );
Gia_ManStop( pC );
return 0;
}
} }
// add connection clauses // add connection clauses
Gia_ManForEachPi( pM, pObj, i ) Gia_ManForEachPi( pM, pObj, i )
...@@ -702,6 +710,7 @@ void Gia_ManFaultAddOne( Gia_Man_t * pM, Cnf_Dat_t * pCnf, sat_solver * pSat, Ve ...@@ -702,6 +710,7 @@ void Gia_ManFaultAddOne( Gia_Man_t * pM, Cnf_Dat_t * pCnf, sat_solver * pSat, Ve
sat_solver_add_buffer( pSat, pCnf->pVarNums[Gia_ObjId(pM, pObj)], pCnf2->pVarNums[Gia_ObjId(pC, Gia_ManPi(pC, i))], 0 ); sat_solver_add_buffer( pSat, pCnf->pVarNums[Gia_ObjId(pM, pObj)], pCnf2->pVarNums[Gia_ObjId(pC, Gia_ManPi(pC, i))], 0 );
Cnf_DataFree( pCnf2 ); Cnf_DataFree( pCnf2 );
Gia_ManStop( pC ); Gia_ManStop( pC );
return 1;
} }
...@@ -987,7 +996,13 @@ int Gia_ManFaultPrepare( Gia_Man_t * p, Gia_Man_t * pG, Bmc_ParFf_t * pPars, int ...@@ -987,7 +996,13 @@ int Gia_ManFaultPrepare( Gia_Man_t * p, Gia_Man_t * pG, Bmc_ParFf_t * pPars, int
Vec_IntClear( vLits ); Vec_IntClear( vLits );
for ( i = 0; i < nFuncVars; i++ ) for ( i = 0; i < nFuncVars; i++ )
Vec_IntPush( vLits, Vec_IntEntry(vTests, Iter*nFuncVars + i) ); Vec_IntPush( vLits, Vec_IntEntry(vTests, Iter*nFuncVars + i) );
Gia_ManFaultAddOne( pM, pCnf, pSat, vLits, nFuncVars ); if ( !Gia_ManFaultAddOne( pM, pCnf, pSat, vLits, nFuncVars ) )
{
if ( pPars->fVerbose )
printf( "\n" );
printf( "The problem is UNSAT after adding %d tests.\n", Iter );
return 0;
}
if ( pPars->fVerbose ) if ( pPars->fVerbose )
{ {
printf( "Iter%6d : ", Iter ); printf( "Iter%6d : ", Iter );
...@@ -1021,7 +1036,13 @@ int Gia_ManFaultPrepare( Gia_Man_t * p, Gia_Man_t * pG, Bmc_ParFf_t * pPars, int ...@@ -1021,7 +1036,13 @@ int Gia_ManFaultPrepare( Gia_Man_t * p, Gia_Man_t * pG, Bmc_ParFf_t * pPars, int
// initialize simple pattern // initialize simple pattern
Vec_IntFill( vLits, nFuncVars, Iter ); Vec_IntFill( vLits, nFuncVars, Iter );
Vec_IntAppend( vTests, vLits ); Vec_IntAppend( vTests, vLits );
Gia_ManFaultAddOne( pM, pCnf, pSat, vLits, nFuncVars ); if ( !Gia_ManFaultAddOne( pM, pCnf, pSat, vLits, nFuncVars ) )
{
if ( pPars->fVerbose )
printf( "\n" );
printf( "The problem is UNSAT after adding %d tests.\n", Iter );
return 0;
}
} }
} }
...@@ -1172,7 +1193,13 @@ void Gia_ManFaultTest( Gia_Man_t * p, Gia_Man_t * pG, Bmc_ParFf_t * pPars ) ...@@ -1172,7 +1193,13 @@ void Gia_ManFaultTest( Gia_Man_t * p, Gia_Man_t * pG, Bmc_ParFf_t * pPars )
Vec_IntPush( vLits, sat_solver_var_value(pSat, pCnf->pVarNums[Gia_ObjId(pM, pObj)]) ); Vec_IntPush( vLits, sat_solver_var_value(pSat, pCnf->pVarNums[Gia_ObjId(pM, pObj)]) );
Vec_IntAppend( vTests, vLits ); Vec_IntAppend( vTests, vLits );
// add constraint // add constraint
Gia_ManFaultAddOne( pM, pCnf, pSat, vLits, nFuncVars ); if ( !Gia_ManFaultAddOne( pM, pCnf, pSat, vLits, nFuncVars ) )
{
if ( pPars->fVerbose )
printf( "\n" );
printf( "The problem is UNSAT after adding %d tests.\n", Iter );
break;
}
} }
finish: finish:
// print results // print results
...@@ -1189,7 +1216,7 @@ finish: ...@@ -1189,7 +1216,7 @@ finish:
} }
// compute untestable faults // compute untestable faults
if ( p != pG || pPars->fDumpUntest ) if ( Iter && (p != pG || pPars->fDumpUntest) )
{ {
abctime clkTotal = Abc_Clock(); abctime clkTotal = Abc_Clock();
// restart the SAT solver // restart the SAT solver
...@@ -1259,7 +1286,11 @@ finish: ...@@ -1259,7 +1286,11 @@ finish:
Vec_IntClear( vLits ); Vec_IntClear( vLits );
for ( i = 0; i < nFuncVars; i++ ) for ( i = 0; i < nFuncVars; i++ )
Vec_IntPush( vLits, Vec_IntEntry(vTests, Iter2*nFuncVars + i) ); Vec_IntPush( vLits, Vec_IntEntry(vTests, Iter2*nFuncVars + i) );
Gia_ManFaultAddOne( pM, pCnf, pSat, vLits, nFuncVars ); if ( !Gia_ManFaultAddOne( pM, pCnf, pSat, vLits, nFuncVars ) )
{
printf( "The problem is UNSAT after adding %d tests.\n", Iter2 );
goto finish;
}
} }
assert( Iter2 == Iter ); assert( Iter2 == Iter );
if ( pPars->fVerbose ) if ( pPars->fVerbose )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment