Commit 18b47dfb by Yen-Sheng Ho

%pdra: added an option -u for checking comb. unsat

parent da0f4ef3
...@@ -177,6 +177,7 @@ struct Wlc_Par_t_ ...@@ -177,6 +177,7 @@ struct Wlc_Par_t_
int fPdra; // Use pdr -nct int fPdra; // Use pdr -nct
int fProofRefine; // Use proof-based refinement int fProofRefine; // Use proof-based refinement
int fHybrid; // Use a hybrid of CBR and PBR int fHybrid; // Use a hybrid of CBR and PBR
int fCheckCombUnsat; // Check if ABS becomes comb. unsat
int fVerbose; // verbose output int fVerbose; // verbose output
int fPdrVerbose; // verbose output int fPdrVerbose; // verbose output
}; };
......
...@@ -33,6 +33,7 @@ ABC_NAMESPACE_IMPL_START ...@@ -33,6 +33,7 @@ ABC_NAMESPACE_IMPL_START
extern Vec_Vec_t * IPdr_ManSaveClauses( Pdr_Man_t * p, int fDropLast ); extern Vec_Vec_t * IPdr_ManSaveClauses( Pdr_Man_t * p, int fDropLast );
extern int IPdr_ManRestore( Pdr_Man_t * p, Vec_Vec_t * vClauses, Vec_Int_t * vMap ); extern int IPdr_ManRestore( Pdr_Man_t * p, Vec_Vec_t * vClauses, Vec_Int_t * vMap );
extern int IPdr_ManSolveInt( Pdr_Man_t * p, int fCheckClauses, int fPushClauses ); extern int IPdr_ManSolveInt( Pdr_Man_t * p, int fCheckClauses, int fPushClauses );
extern int IPdr_ManCheckCombUnsat( Pdr_Man_t * p );
typedef struct Int_Pair_t_ Int_Pair_t; typedef struct Int_Pair_t_ Int_Pair_t;
struct Int_Pair_t_ struct Int_Pair_t_
...@@ -1111,20 +1112,49 @@ int Wlc_NtkPdrAbs( Wlc_Ntk_t * p, Wlc_Par_t * pPars ) ...@@ -1111,20 +1112,49 @@ int Wlc_NtkPdrAbs( Wlc_Ntk_t * p, Wlc_Par_t * pPars )
Gia_ManPrintStats( pGia, NULL ); Gia_ManPrintStats( pGia, NULL );
} }
Wlc_NtkFree( pAbs ); Wlc_NtkFree( pAbs );
// Gia_AigerWrite( pGia, "abs.aig", 0, 0 );
// try to prove abstracted GIA by converting it to AIG and calling PDR // try to prove abstracted GIA by converting it to AIG and calling PDR
pAig = Gia_ManToAigSimple( pGia ); pAig = Gia_ManToAigSimple( pGia );
pPdr = Pdr_ManStart( pAig, pPdrPars, NULL );
clk2 = Abc_Clock();
if ( vClauses && pPars->fCheckCombUnsat )
{
clk2 = Abc_Clock();
Pdr_Man_t * pPdr2;
pPdrPars->fVerbose = 0;
pPdr2 = Pdr_ManStart( pAig, pPdrPars, NULL );
RetValue = IPdr_ManCheckCombUnsat( pPdr2 );
Pdr_ManStop( pPdr2 );
pPdrPars->fVerbose = pPars->fPdrVerbose;
tPdr += Abc_Clock() - clk2;
if ( RetValue == 1 )
{
if ( pPars->fVerbose )
Abc_PrintTime( 1, "ABS becomes combinationally UNSAT. Time", Abc_Clock() - clk2 );
Gia_ManStop( pGia );
Vec_IntFree( vPisNew );
Aig_ManStop( pAig );
break;
}
if ( pPars->fVerbose )
Abc_PrintTime( 1, "Check comb. unsat failed. Time", Abc_Clock() - clk2 );
}
clk2 = Abc_Clock();
pPdr = Pdr_ManStart( pAig, pPdrPars, NULL );
if ( vClauses ) { if ( vClauses ) {
assert( Vec_VecSize( vClauses) >= 2 ); assert( Vec_VecSize( vClauses) >= 2 );
IPdr_ManRestore( pPdr, vClauses, vMap ); IPdr_ManRestore( pPdr, vClauses, vMap );
} }
Vec_IntFreeP( &vMap ); Vec_IntFreeP( &vMap );
RetValue = IPdr_ManSolveInt( pPdr, pPars->fCheckClauses, pPars->fPushClauses ); if ( !vClauses || RetValue != 1 )
RetValue = IPdr_ManSolveInt( pPdr, pPars->fCheckClauses, pPars->fPushClauses );
pPdr->tTotal += Abc_Clock() - clk2; pPdr->tTotal += Abc_Clock() - clk2;
tPdr += pPdr->tTotal; tPdr += pPdr->tTotal;
......
...@@ -462,7 +462,7 @@ int Abc_CommandPdrAbs( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -462,7 +462,7 @@ int Abc_CommandPdrAbs( Abc_Frame_t * pAbc, int argc, char ** argv )
int c; int c;
Wlc_ManSetDefaultParams( pPars ); Wlc_ManSetDefaultParams( pPars );
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "AMXFILabrcpmxvwh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "AMXFILabrcpmuxvwh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -553,6 +553,9 @@ int Abc_CommandPdrAbs( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -553,6 +553,9 @@ int Abc_CommandPdrAbs( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'm': case 'm':
pPars->fMFFC ^= 1; pPars->fMFFC ^= 1;
break; break;
case 'u':
pPars->fCheckCombUnsat ^= 1;
break;
case 'v': case 'v':
pPars->fVerbose ^= 1; pPars->fVerbose ^= 1;
break; break;
...@@ -573,7 +576,7 @@ int Abc_CommandPdrAbs( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -573,7 +576,7 @@ int Abc_CommandPdrAbs( Abc_Frame_t * pAbc, int argc, char ** argv )
Wlc_NtkPdrAbs( pNtk, pPars ); Wlc_NtkPdrAbs( pNtk, pPars );
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: %%pdra [-AMXFIL num] [-abrcpmxvwh]\n" ); Abc_Print( -2, "usage: %%pdra [-AMXFIL num] [-abrcpmxuvwh]\n" );
Abc_Print( -2, "\t abstraction for word-level networks\n" ); Abc_Print( -2, "\t abstraction for word-level networks\n" );
Abc_Print( -2, "\t-A num : minimum bit-width of an adder/subtractor to abstract [default = %d]\n", pPars->nBitsAdd ); Abc_Print( -2, "\t-A num : minimum bit-width of an adder/subtractor to abstract [default = %d]\n", pPars->nBitsAdd );
Abc_Print( -2, "\t-M num : minimum bit-width of a multiplier to abstract [default = %d]\n", pPars->nBitsMul ); Abc_Print( -2, "\t-M num : minimum bit-width of a multiplier to abstract [default = %d]\n", pPars->nBitsMul );
...@@ -586,6 +589,7 @@ usage: ...@@ -586,6 +589,7 @@ usage:
Abc_Print( -2, "\t-b : toggle using proof-based refinement [default = %s]\n", pPars->fProofRefine? "yes": "no" ); Abc_Print( -2, "\t-b : toggle using proof-based refinement [default = %s]\n", pPars->fProofRefine? "yes": "no" );
Abc_Print( -2, "\t-r : toggle using both cex-based and proof-based refinement [default = %s]\n", pPars->fHybrid? "yes": "no" ); Abc_Print( -2, "\t-r : toggle using both cex-based and proof-based refinement [default = %s]\n", pPars->fHybrid? "yes": "no" );
Abc_Print( -2, "\t-c : toggle checking clauses in the reloaded trace [default = %s]\n", pPars->fCheckClauses? "yes": "no" ); Abc_Print( -2, "\t-c : toggle checking clauses in the reloaded trace [default = %s]\n", pPars->fCheckClauses? "yes": "no" );
Abc_Print( -2, "\t-u : toggle checking combinationally unsat [default = %s]\n", pPars->fCheckCombUnsat? "yes": "no" );
Abc_Print( -2, "\t-p : toggle pushing clauses in the reloaded trace [default = %s]\n", pPars->fPushClauses? "yes": "no" ); Abc_Print( -2, "\t-p : toggle pushing clauses in the reloaded trace [default = %s]\n", pPars->fPushClauses? "yes": "no" );
Abc_Print( -2, "\t-m : toggle refining the whole MFFC of a PPI [default = %s]\n", pPars->fMFFC? "yes": "no" ); Abc_Print( -2, "\t-m : toggle refining the whole MFFC of a PPI [default = %s]\n", pPars->fMFFC? "yes": "no" );
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" );
......
...@@ -121,6 +121,7 @@ void Wlc_ManSetDefaultParams( Wlc_Par_t * pPars ) ...@@ -121,6 +121,7 @@ void Wlc_ManSetDefaultParams( Wlc_Par_t * pPars )
pPars->fPdra = 0; // Use pdr -nct pPars->fPdra = 0; // Use pdr -nct
pPars->fProofRefine = 0; // Use proof-based refinement pPars->fProofRefine = 0; // Use proof-based refinement
pPars->fHybrid = 1; // Use a hybrid of CBR and PBR pPars->fHybrid = 1; // Use a hybrid of CBR and PBR
pPars->fCheckCombUnsat = 0; // Check if ABS becomes comb. unsat
pPars->fVerbose = 0; // verbose output` pPars->fVerbose = 0; // verbose output`
pPars->fPdrVerbose = 0; // show verbose PDR output pPars->fPdrVerbose = 0; // show verbose PDR output
} }
......
...@@ -738,6 +738,19 @@ int IPdr_ManSolve( Aig_Man_t * pAig, Pdr_Par_t * pPars ) ...@@ -738,6 +738,19 @@ int IPdr_ManSolve( Aig_Man_t * pAig, Pdr_Par_t * pPars )
return RetValue; return RetValue;
} }
int IPdr_ManCheckCombUnsat( Pdr_Man_t * p )
{
int iFrame, RetValue = -1;
Pdr_ManCreateSolver( p, (iFrame = 0) );
Pdr_ManCreateSolver( p, (iFrame = 1) );
p->nFrames = iFrame;
p->iUseFrame = Abc_MaxInt(iFrame, 1);
RetValue = Pdr_ManCheckCube( p, iFrame, NULL, NULL, p->pPars->nConfLimit, 0, 1 );
return RetValue;
}
/**Function************************************************************* /**Function*************************************************************
......
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