Commit 51fbf37c by Yen-Sheng Ho

%pdra: working on bmc3

parent 3bddf938
...@@ -87,6 +87,7 @@ typedef struct Bmc3_ThData_t_ ...@@ -87,6 +87,7 @@ typedef struct Bmc3_ThData_t_
Aig_Man_t * pAig; Aig_Man_t * pAig;
Abc_Cex_t ** ppCex; Abc_Cex_t ** ppCex;
int RunId; int RunId;
int fVerbose;
} Bmc3_ThData_t; } Bmc3_ThData_t;
// mutext to control access to shared variables // mutext to control access to shared variables
...@@ -1334,6 +1335,8 @@ void * Wla_Bmc3Thread ( void * pArg ) ...@@ -1334,6 +1335,8 @@ void * Wla_Bmc3Thread ( void * pArg )
Abc_Ntk_t * pAbcNtk = Abc_NtkFromAigPhase( pData->pAig ); Abc_Ntk_t * pAbcNtk = Abc_NtkFromAigPhase( pData->pAig );
Saig_ParBmc_t BmcPars, *pBmcPars = &BmcPars; Saig_ParBmc_t BmcPars, *pBmcPars = &BmcPars;
Saig_ParBmcSetDefaultParams( pBmcPars ); Saig_ParBmcSetDefaultParams( pBmcPars );
pBmcPars->pFuncStop = Wla_CallBackToStop;
pBmcPars->RunId = pData->RunId;
RetValue = Abc_NtkDarBmc3( pAbcNtk, pBmcPars, 0 ); RetValue = Abc_NtkDarBmc3( pAbcNtk, pBmcPars, 0 );
...@@ -1342,7 +1345,9 @@ void * Wla_Bmc3Thread ( void * pArg ) ...@@ -1342,7 +1345,9 @@ void * Wla_Bmc3Thread ( void * pArg )
assert( pAbcNtk->pSeqModel ); assert( pAbcNtk->pSeqModel );
*(pData->ppCex) = pAbcNtk->pSeqModel; *(pData->ppCex) = pAbcNtk->pSeqModel;
pAbcNtk->pSeqModel = NULL; pAbcNtk->pSeqModel = NULL;
Abc_Print( 1, "BMC3 found CEX. RunId=%d.\n", pData->RunId );
if ( pData->fVerbose )
Abc_Print( 1, "Bmc3 found CEX. RunId=%d.\n", pData->RunId );
status = pthread_mutex_lock(&g_mutex); assert( status == 0 ); status = pthread_mutex_lock(&g_mutex); assert( status == 0 );
++g_nRunIds; ++g_nRunIds;
...@@ -1350,7 +1355,8 @@ void * Wla_Bmc3Thread ( void * pArg ) ...@@ -1350,7 +1355,8 @@ void * Wla_Bmc3Thread ( void * pArg )
} }
else else
{ {
Abc_Print( 1, "BMC3 got cancelled. RunId=%d.\n", pData->RunId ); if ( pData->fVerbose )
Abc_Print( 1, "Bmc3 was cancelled. RunId=%d.\n", pData->RunId );
} }
// free memory // free memory
...@@ -1364,7 +1370,7 @@ void * Wla_Bmc3Thread ( void * pArg ) ...@@ -1364,7 +1370,7 @@ void * Wla_Bmc3Thread ( void * pArg )
return NULL; return NULL;
} }
void Wla_ManConcurrentBmc3( pthread_t * pThread, Aig_Man_t * pAig, Abc_Cex_t ** ppCex ) void Wla_ManConcurrentBmc3( pthread_t * pThread, Aig_Man_t * pAig, Abc_Cex_t ** ppCex, int fVerbose )
{ {
int status; int status;
...@@ -1373,6 +1379,7 @@ void Wla_ManConcurrentBmc3( pthread_t * pThread, Aig_Man_t * pAig, Abc_Cex_t ** ...@@ -1373,6 +1379,7 @@ void Wla_ManConcurrentBmc3( pthread_t * pThread, Aig_Man_t * pAig, Abc_Cex_t **
pData->pAig = pAig; pData->pAig = pAig;
pData->ppCex = ppCex; pData->ppCex = ppCex;
pData->RunId = g_nRunIds; pData->RunId = g_nRunIds;
pData->fVerbose = fVerbose;
status = pthread_create( pThread, NULL, Wla_Bmc3Thread, pData ); status = pthread_create( pThread, NULL, Wla_Bmc3Thread, pData );
assert( status == 0 ); assert( status == 0 );
...@@ -1410,7 +1417,7 @@ int Wla_ManSolve( Wla_Man_t * pWla, Aig_Man_t * pAig ) ...@@ -1410,7 +1417,7 @@ int Wla_ManSolve( Wla_Man_t * pWla, Aig_Man_t * pAig )
pWla->pPdrPars->pFuncStop = Wla_CallBackToStop; pWla->pPdrPars->pFuncStop = Wla_CallBackToStop;
pBmc3Thread = ABC_CALLOC( pthread_t, 1 ); pBmc3Thread = ABC_CALLOC( pthread_t, 1 );
Wla_ManConcurrentBmc3( pBmc3Thread, Aig_ManDupSimple( pAig ), &pBmcCex ); Wla_ManConcurrentBmc3( pBmc3Thread, Aig_ManDupSimple( pAig ), &pBmcCex, pWla->pPars->fVerbose );
} }
clk = Abc_Clock(); clk = Abc_Clock();
......
...@@ -73,6 +73,8 @@ struct Saig_ParBmc_t_ ...@@ -73,6 +73,8 @@ struct Saig_ParBmc_t_
int nDropOuts; // the number of dropped outputs int nDropOuts; // the number of dropped outputs
abctime timeLastSolved; // the time when the last output was solved abctime timeLastSolved; // the time when the last output was solved
int(*pFuncOnFail)(int,Abc_Cex_t*); // called for a failed output in MO mode int(*pFuncOnFail)(int,Abc_Cex_t*); // called for a failed output in MO mode
int RunId; // BMC id in this run
int(*pFuncStop)(int); // callback to terminate
}; };
......
...@@ -1533,6 +1533,12 @@ clkOther += Abc_Clock() - clk2; ...@@ -1533,6 +1533,12 @@ clkOther += Abc_Clock() - clk2;
Abc_Print( 1, "Reached timeout (%d seconds).\n", pPars->nTimeOut ); Abc_Print( 1, "Reached timeout (%d seconds).\n", pPars->nTimeOut );
goto finish; goto finish;
} }
if ( p->pPars->pFuncStop && p->pPars->pFuncStop(p->pPars->RunId) )
{
if ( !pPars->fSilent )
Abc_Print( 1, "Bmc3 got callbacks.\n" );
goto finish;
}
// skip solved outputs // skip solved outputs
if ( p->vCexes && Vec_PtrEntry(p->vCexes, i) ) if ( p->vCexes && Vec_PtrEntry(p->vCexes, i) )
continue; continue;
......
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