From b733b813d687825e78bc4f9e4dd562ec639a25fc Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Thu, 25 Oct 2012 22:50:29 -0700 Subject: Added switch '-q' to 'scorr' and '&scorr' to quit when PO is not a candidate constant. --- src/base/abci/abc.c | 16 ++++++++++++---- src/proof/cec/cec.h | 1 + src/proof/cec/cecCorr.c | 13 +++++++++++++ src/proof/ssw/ssw.h | 1 + src/proof/ssw/sswCore.c | 18 ++++++++++++++++++ 5 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index b49a9ea0..ed78f04e 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -16009,7 +16009,7 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) // set defaults Ssw_ManSetDefaultParams( pPars ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "PQFCLSIVMNcmplkofdsevwh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "PQFCLSIVMNcmplkofdseqvwh" ) ) != EOF ) { switch ( c ) { @@ -16153,6 +16153,9 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'e': pPars->fEquivDump ^= 1; break; + case 'q': + pPars->fStopWhenGone ^= 1; + break; case 'v': pPars->fVerbose ^= 1; break; @@ -16219,7 +16222,7 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - Abc_Print( -2, "usage: scorr [-PQFCLSIVMN ] [-cmplkodsevwh]\n" ); + Abc_Print( -2, "usage: scorr [-PQFCLSIVMN ] [-cmplkodseqvwh]\n" ); Abc_Print( -2, "\t performs sequential sweep using K-step induction\n" ); Abc_Print( -2, "\t-P num : max partition size (0 = no partitioning) [default = %d]\n", pPars->nPartSize ); Abc_Print( -2, "\t-Q num : partition overlap (0 = no overlap) [default = %d]\n", pPars->nOverSize ); @@ -16242,6 +16245,7 @@ usage: Abc_Print( -2, "\t-d : toggle dynamic addition of constraints [default = %s]\n", pPars->fDynamic? "yes": "no" ); Abc_Print( -2, "\t-s : toggle local simulation in the cone of influence [default = %s]\n", pPars->fLocalSim? "yes": "no" ); Abc_Print( -2, "\t-e : toggle dumping disproved internal equivalences [default = %s]\n", pPars->fEquivDump? "yes": "no" ); + Abc_Print( -2, "\t-q : toggle quitting when PO is not a constant candidate [default = %s]\n", pPars->fStopWhenGone? "yes": "no" ); Abc_Print( -2, "\t-w : toggle printout of flop equivalences [default = %s]\n", pPars->fFlopVerbose? "yes": "no" ); Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); @@ -25108,7 +25112,7 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) int c; Cec_ManCorSetDefaultParams( pPars ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "FCPkrecwvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "FCPkrecqwvh" ) ) != EOF ) { switch ( c ) { @@ -25157,6 +25161,9 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'c': pPars->fUseCSat ^= 1; break; + case 'q': + pPars->fStopWhenGone ^= 1; + break; case 'w': pPars->fVerboseFlops ^= 1; break; @@ -25182,7 +25189,7 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - Abc_Print( -2, "usage: &scorr [-FCP num] [-krecwvh]\n" ); + Abc_Print( -2, "usage: &scorr [-FCP num] [-krecqwvh]\n" ); Abc_Print( -2, "\t performs signal correpondence computation\n" ); Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); Abc_Print( -2, "\t-F num : the number of timeframes in inductive case [default = %d]\n", pPars->nFrames ); @@ -25191,6 +25198,7 @@ usage: Abc_Print( -2, "\t-r : toggle using implication rings during refinement [default = %s]\n", pPars->fUseRings? "yes": "no" ); Abc_Print( -2, "\t-e : toggle using equivalences as choices [default = %s]\n", pPars->fMakeChoices? "yes": "no" ); Abc_Print( -2, "\t-c : toggle using circuit-based SAT solver [default = %s]\n", pPars->fUseCSat? "yes": "no" ); + Abc_Print( -2, "\t-q : toggle quitting when PO is not a constant candidate [default = %s]\n", pPars->fStopWhenGone? "yes": "no" ); Abc_Print( -2, "\t-w : toggle printing verbose info about equivalent flops [default = %s]\n", pPars->fVerboseFlops? "yes": "no" ); Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); diff --git a/src/proof/cec/cec.h b/src/proof/cec/cec.h index 10b06c28..65d2e24e 100644 --- a/src/proof/cec/cec.h +++ b/src/proof/cec/cec.h @@ -144,6 +144,7 @@ struct Cec_ParCor_t_ int fUseCSat; // use circuit-based solver // int fFirstStop; // stop on the first sat output int fUseSmartCnf; // use smart CNF computation + int fStopWhenGone; // quit when PO is not a candidate constant int fVerboseFlops; // verbose stats int fVeryVerbose; // verbose stats int fVerbose; // verbose stats diff --git a/src/proof/cec/cecCorr.c b/src/proof/cec/cecCorr.c index f35cd952..f3a84d3a 100644 --- a/src/proof/cec/cecCorr.c +++ b/src/proof/cec/cecCorr.c @@ -753,6 +753,7 @@ void Cec_ManRefinedClassPrintStats( Gia_Man_t * p, Vec_Str_t * vStatus, int iIte nFail++; } Abc_Print( 1, "p =%6d d =%6d f =%6d ", nProve, nDispr, nFail ); + Abc_Print( 1, "%c ", Gia_ObjIsConst( p, Gia_ObjFaninId0p(p, Gia_ManPo(p, 0)) ) ? '+' : '-' ); Abc_PrintTime( 1, "T", Time ); } @@ -950,6 +951,14 @@ int Cec_ManLSCorrespondenceClasses( Gia_Man_t * pAig, Cec_ParCor_t * pPars ) //Gia_ManEquivPrintClasses( pAig, 1, 0 ); if ( pPars->pFunc ) ((int (*)(void *))pPars->pFunc)( pPars->pData ); + // quit if const is no longer there + if ( pPars->fStopWhenGone && Gia_ManPoNum(pAig) == 1 && !Gia_ObjIsConst( pAig, Gia_ObjFaninId0p(pAig, Gia_ManPo(pAig, 0)) ) ) + { + printf( "Iterative refinement is stopped after iteration %d\n", r ); + printf( "because the property output is no longer a candidate constant.\n" ); + Cec_ManSimStop( pSim ); + return 0; + } } if ( pPars->fVerbose ) Cec_ManRefinedClassPrintStats( pAig, NULL, r+1, clock() - clk ); @@ -1071,7 +1080,11 @@ Gia_Man_t * Cec_ManLSCorrespondence( Gia_Man_t * pAig, Cec_ParCor_t * pPars ) ABC_FREE( pAig->pReprs ); ABC_FREE( pAig->pNexts ); if ( pPars->nPrefix == 0 ) + { RetValue = Cec_ManLSCorrespondenceClasses( pAig, pPars ); + if ( RetValue == 0 ) + return Gia_ManDup( pAig ); + } else { // compute the cycles AIG diff --git a/src/proof/ssw/ssw.h b/src/proof/ssw/ssw.h index 35d41a35..df73c357 100644 --- a/src/proof/ssw/ssw.h +++ b/src/proof/ssw/ssw.h @@ -70,6 +70,7 @@ struct Ssw_Pars_t_ int fVerbose; // verbose stats int fFlopVerbose; // verbose printout of redundant flops int fEquivDump; // enables dumping equivalences + int fStopWhenGone; // stop when PO output is not a candidate constant // optimized latch correspondence int fLatchCorrOpt; // perform register correspondence (optimized) int nSatVarMax; // max number of SAT vars before recycling SAT solver (optimized latch corr only) diff --git a/src/proof/ssw/sswCore.c b/src/proof/ssw/sswCore.c index b27e7eaf..8a08b227 100644 --- a/src/proof/ssw/sswCore.c +++ b/src/proof/ssw/sswCore.c @@ -346,6 +346,24 @@ clk = clock(); } // if ( p->pPars->fDynamic && p->nSatCallsSat-nSatCallsSat < 100 ) // p->pPars->nBTLimit = 10000; + + if ( p->pPars->fStopWhenGone && Saig_ManPoNum(p->pAig) == 1 && !Ssw_ObjIsConst1Cand(p->pAig,Aig_ObjFanin0(Aig_ManCo(p->pAig,0))) ) + { + printf( "Iterative refinement is stopped after iteration %d\n", nIter ); + printf( "because the property output is no longer a candidate constant.\n" ); + // prepare to quite + p->nLitsEnd = p->nLitsBeg; + p->nNodesEnd = p->nNodesBeg; + p->nRegsEnd = p->nRegsBeg; + // cleanup + Ssw_SatStop( p->pMSat ); + p->pMSat = NULL; + Ssw_ManCleanup( p ); + // cleanup + Aig_ManSetPhase( p->pAig ); + Aig_ManCleanMarkB( p->pAig ); + return Aig_ManDupSimple( p->pAig ); + } } nSatProof = p->nSatProof; nSatCallsSat = p->nSatCallsSat; -- cgit v1.2.3