Commit fd0ff017 by Alan Mishchenko

Added 'gap timeout' to bmc3 and sim3.

parent 8866a1aa
...@@ -3273,7 +3273,7 @@ int Abc_NtkDarSeqSim( Abc_Ntk_t * pNtk, int nFrames, int nWords, int TimeOut, in ...@@ -3273,7 +3273,7 @@ int Abc_NtkDarSeqSim( Abc_Ntk_t * pNtk, int nFrames, int nWords, int TimeOut, in
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Abc_NtkDarSeqSim3( Abc_Ntk_t * pNtk, int nFrames, int nWords, int nBinSize, int nRounds, int nRestart, int nRandSeed, int TimeOut, int fSolveAll, int fVerbose, int fNotVerbose ) int Abc_NtkDarSeqSim3( Abc_Ntk_t * pNtk, int nFrames, int nWords, int nBinSize, int nRounds, int nRestart, int nRandSeed, int TimeOut, int TimeOutGap, int fSolveAll, int fVerbose, int fNotVerbose )
{ {
Aig_Man_t * pMan; Aig_Man_t * pMan;
int status, RetValue = -1; int status, RetValue = -1;
...@@ -3284,7 +3284,7 @@ int Abc_NtkDarSeqSim3( Abc_Ntk_t * pNtk, int nFrames, int nWords, int nBinSize, ...@@ -3284,7 +3284,7 @@ int Abc_NtkDarSeqSim3( Abc_Ntk_t * pNtk, int nFrames, int nWords, int nBinSize,
Abc_AigCleanup((Abc_Aig_t *)pNtk->pManFunc); Abc_AigCleanup((Abc_Aig_t *)pNtk->pManFunc);
} }
pMan = Abc_NtkToDar( pNtk, 0, 1 ); pMan = Abc_NtkToDar( pNtk, 0, 1 );
if ( Ssw_RarSimulate( pMan, nFrames, nWords, nBinSize, nRounds, nRestart, nRandSeed, TimeOut, fSolveAll, fVerbose, fNotVerbose ) == 0 ) if ( Ssw_RarSimulate( pMan, nFrames, nWords, nBinSize, nRounds, nRestart, nRandSeed, TimeOut, TimeOutGap, fSolveAll, fVerbose, fNotVerbose ) == 0 )
{ {
if ( pMan->pSeqModel ) if ( pMan->pSeqModel )
{ {
......
...@@ -118,7 +118,7 @@ extern int Ssw_SecGeneral( Aig_Man_t * pAig1, Aig_Man_t * pAig2, Ssw_P ...@@ -118,7 +118,7 @@ extern int Ssw_SecGeneral( Aig_Man_t * pAig1, Aig_Man_t * pAig2, Ssw_P
extern int Ssw_SecGeneralMiter( Aig_Man_t * pMiter, Ssw_Pars_t * pPars ); extern int Ssw_SecGeneralMiter( Aig_Man_t * pMiter, Ssw_Pars_t * pPars );
/*=== sswRarity.c ===================================================*/ /*=== sswRarity.c ===================================================*/
extern int Ssw_RarSignalFilter( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, int nRounds, int nRestart, int nRandSeed, int TimeOut, int fMiter, Abc_Cex_t * pCex, int fLatchOnly, int fVerbose ); extern int Ssw_RarSignalFilter( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, int nRounds, int nRestart, int nRandSeed, int TimeOut, int fMiter, Abc_Cex_t * pCex, int fLatchOnly, int fVerbose );
extern int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, int nRounds, int nRestart, int nRandSeed, int TimeOut, int fSolveAll, int fVerbose, int fNotVerbose ); extern int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, int nRounds, int nRestart, int nRandSeed, int TimeOut, int TimeOutGap, int fSolveAll, int fVerbose, int fNotVerbose );
/*=== sswSim.c ===================================================*/ /*=== sswSim.c ===================================================*/
extern Ssw_Sml_t * Ssw_SmlSimulateComb( Aig_Man_t * pAig, int nWords ); extern Ssw_Sml_t * Ssw_SmlSimulateComb( Aig_Man_t * pAig, int nWords );
extern Ssw_Sml_t * Ssw_SmlSimulateSeq( Aig_Man_t * pAig, int nPref, int nFrames, int nWords ); extern Ssw_Sml_t * Ssw_SmlSimulateSeq( Aig_Man_t * pAig, int nPref, int nFrames, int nWords );
......
...@@ -941,7 +941,7 @@ int Ssw_RarCheckTrivial( Aig_Man_t * pAig, int fVerbose ) ...@@ -941,7 +941,7 @@ int Ssw_RarCheckTrivial( Aig_Man_t * pAig, int fVerbose )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, int nRounds, int nRestart, int nRandSeed, int TimeOut, int fSolveAll, int fVerbose, int fNotVerbose ) int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, int nRounds, int nRestart, int nRandSeed, int TimeOut, int TimeOutGap, int fSolveAll, int fVerbose, int fNotVerbose )
{ {
int fTryBmc = 0; int fTryBmc = 0;
int fMiter = 1; int fMiter = 1;
...@@ -949,6 +949,7 @@ int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, in ...@@ -949,6 +949,7 @@ int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, in
int r, f = -1; int r, f = -1;
clock_t clk, clkTotal = clock(); clock_t clk, clkTotal = clock();
clock_t nTimeToStop = TimeOut ? TimeOut * CLOCKS_PER_SEC + clock(): 0; clock_t nTimeToStop = TimeOut ? TimeOut * CLOCKS_PER_SEC + clock(): 0;
clock_t timeLastSolved = 0;
int nNumRestart = 0; int nNumRestart = 0;
int nSavedSeed = nRandSeed; int nSavedSeed = nRandSeed;
int RetValue = -1; int RetValue = -1;
...@@ -1005,6 +1006,7 @@ int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, in ...@@ -1005,6 +1006,7 @@ int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, in
Abc_PrintTime( 1, "Time", clock() - clkTotal ); Abc_PrintTime( 1, "Time", clock() - clkTotal );
goto finish; goto finish;
} }
timeLastSolved = clock();
} }
// check timeout // check timeout
if ( TimeOut && clock() > nTimeToStop ) if ( TimeOut && clock() > nTimeToStop )
...@@ -1014,6 +1016,13 @@ int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, in ...@@ -1014,6 +1016,13 @@ int Ssw_RarSimulate( Aig_Man_t * pAig, int nFrames, int nWords, int nBinSize, in
Abc_Print( 1, "Reached timeout (%d sec).\n", TimeOut ); Abc_Print( 1, "Reached timeout (%d sec).\n", TimeOut );
goto finish; goto finish;
} }
if ( TimeOutGap && timeLastSolved && clock() > timeLastSolved + TimeOutGap * CLOCKS_PER_SEC )
{
if ( fVerbose && !fSolveAll ) Abc_Print( 1, "\n" );
Abc_Print( 1, "Simulated %d frames for %d rounds with %d restarts. ", nFrames, nNumRestart * nRestart + r, nNumRestart );
Abc_Print( 1, "Reached gap timeout (%d sec).\n", TimeOutGap );
goto finish;
}
// check if all outputs are solved by now // check if all outputs are solved by now
if ( fSolveAll && p->vCexes && Vec_PtrCountZero(p->vCexes) == 0 ) if ( fSolveAll && p->vCexes && Vec_PtrCountZero(p->vCexes) == 0 )
goto finish; goto finish;
...@@ -1070,14 +1079,14 @@ finish: ...@@ -1070,14 +1079,14 @@ finish:
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Ssw_RarSimulateGia( Gia_Man_t * p, int nFrames, int nWords, int nBinSize, int nRounds, int nRestart, int nRandSeed, int TimeOut, int fVerbose ) int Ssw_RarSimulateGia( Gia_Man_t * p, int nFrames, int nWords, int nBinSize, int nRounds, int nRestart, int nRandSeed, int TimeOut, int TimeOutGap, int fVerbose )
{ {
int fSolveAll = 0; int fSolveAll = 0;
int fNotVerbose = 0; int fNotVerbose = 0;
Aig_Man_t * pAig; Aig_Man_t * pAig;
int RetValue; int RetValue;
pAig = Gia_ManToAigSimple( p ); pAig = Gia_ManToAigSimple( p );
RetValue = Ssw_RarSimulate( pAig, nFrames, nWords, nBinSize, nRounds, nRestart, nRandSeed, TimeOut, fSolveAll, fVerbose, fNotVerbose ); RetValue = Ssw_RarSimulate( pAig, nFrames, nWords, nBinSize, nRounds, nRestart, nRandSeed, TimeOut, TimeOutGap, fSolveAll, fVerbose, fNotVerbose );
// save counter-example // save counter-example
Abc_CexFree( p->pCexSeq ); Abc_CexFree( p->pCexSeq );
p->pCexSeq = pAig->pSeqModel; pAig->pSeqModel = NULL; p->pCexSeq = pAig->pSeqModel; pAig->pSeqModel = NULL;
......
...@@ -48,6 +48,7 @@ struct Saig_ParBmc_t_ ...@@ -48,6 +48,7 @@ struct Saig_ParBmc_t_
int nConfLimitJump; // maximum number of conflicts after jumping int nConfLimitJump; // maximum number of conflicts after jumping
int nFramesJump; // the number of tiemframes to jump int nFramesJump; // the number of tiemframes to jump
int nTimeOut; // approximate timeout in seconds int nTimeOut; // approximate timeout in seconds
int nTimeOutGap; // approximate timeout in seconds since the last change
int nPisAbstract; // the number of PIs to abstract int nPisAbstract; // the number of PIs to abstract
int fSolveAll; // does not stop at the first SAT output int fSolveAll; // does not stop at the first SAT output
int fDropSatOuts; // replace sat outputs by constant 0 int fDropSatOuts; // replace sat outputs by constant 0
...@@ -57,6 +58,7 @@ struct Saig_ParBmc_t_ ...@@ -57,6 +58,7 @@ struct Saig_ParBmc_t_
int fNotVerbose; // skip line-by-line print-out int fNotVerbose; // skip line-by-line print-out
int iFrame; // explored up to this frame int iFrame; // explored up to this frame
int nFailOuts; // the number of failed outputs int nFailOuts; // the number of failed outputs
clock_t timeLastSolved; // the time when the last output was solved
}; };
......
...@@ -1301,6 +1301,7 @@ void Saig_ParBmcSetDefaultParams( Saig_ParBmc_t * p ) ...@@ -1301,6 +1301,7 @@ void Saig_ParBmcSetDefaultParams( Saig_ParBmc_t * p )
p->nConfLimitJump = 0; // maximum number of conflicts after jumping p->nConfLimitJump = 0; // maximum number of conflicts after jumping
p->nFramesJump = 0; // the number of tiemframes to jump p->nFramesJump = 0; // the number of tiemframes to jump
p->nTimeOut = 0; // approximate timeout in seconds p->nTimeOut = 0; // approximate timeout in seconds
p->nTimeOutGap = 0; // time since the last CEX found
p->nPisAbstract = 0; // the number of PIs to abstract p->nPisAbstract = 0; // the number of PIs to abstract
p->fSolveAll = 0; // stops on the first SAT instance p->fSolveAll = 0; // stops on the first SAT instance
p->fDropSatOuts = 0; // replace sat outputs by constant 0 p->fDropSatOuts = 0; // replace sat outputs by constant 0
...@@ -1308,6 +1309,7 @@ void Saig_ParBmcSetDefaultParams( Saig_ParBmc_t * p ) ...@@ -1308,6 +1309,7 @@ void Saig_ParBmcSetDefaultParams( Saig_ParBmc_t * p )
p->fNotVerbose = 0; // skip line-by-line print-out p->fNotVerbose = 0; // skip line-by-line print-out
p->iFrame = -1; // explored up to this frame p->iFrame = -1; // explored up to this frame
p->nFailOuts = 0; // the number of failed outputs p->nFailOuts = 0; // the number of failed outputs
p->timeLastSolved = 0; // time when the last one was solved
} }
/**Function************************************************************* /**Function*************************************************************
...@@ -1405,6 +1407,12 @@ int Saig_ManBmcScalable( Aig_Man_t * pAig, Saig_ParBmc_t * pPars ) ...@@ -1405,6 +1407,12 @@ int Saig_ManBmcScalable( Aig_Man_t * pAig, Saig_ParBmc_t * pPars )
Saig_Bmc3ManStop( p ); Saig_Bmc3ManStop( p );
return RetValue; return RetValue;
} }
if ( pPars->nTimeOutGap && pPars->timeLastSolved && clock() > pPars->timeLastSolved + pPars->nTimeOutGap * CLOCKS_PER_SEC )
{
printf( "Reached gap timeout (%d seconds).\n", pPars->nTimeOutGap );
Saig_Bmc3ManStop( p );
return RetValue;
}
// skip solved outputs // skip solved outputs
if ( p->vCexes && Vec_PtrEntry(p->vCexes, i) ) if ( p->vCexes && Vec_PtrEntry(p->vCexes, i) )
continue; continue;
...@@ -1433,6 +1441,7 @@ clkOther += clock() - clk2; ...@@ -1433,6 +1441,7 @@ clkOther += clock() - clk2;
p->vCexes = Vec_PtrStart( Saig_ManPoNum(pAig) ); p->vCexes = Vec_PtrStart( Saig_ManPoNum(pAig) );
Vec_PtrWriteEntry( p->vCexes, i, pCex ); Vec_PtrWriteEntry( p->vCexes, i, pCex );
RetValue = 0; RetValue = 0;
pPars->timeLastSolved = clock();
continue; continue;
} }
// solve th is output // solve th is output
...@@ -1507,6 +1516,7 @@ clkOther += clock() - clk2; ...@@ -1507,6 +1516,7 @@ clkOther += clock() - clk2;
p->vCexes = Vec_PtrStart( Saig_ManPoNum(pAig) ); p->vCexes = Vec_PtrStart( Saig_ManPoNum(pAig) );
Vec_PtrWriteEntry( p->vCexes, i, pCex ); Vec_PtrWriteEntry( p->vCexes, i, pCex );
RetValue = 0; RetValue = 0;
pPars->timeLastSolved = clock();
} }
else else
{ {
......
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