Commit a564e2ab by Alan Mishchenko

Sweeper internal verification and new switch for &cfraig.

parent a509fa8e
...@@ -1194,7 +1194,7 @@ extern int Gia_SweeperCheckEquiv( Gia_Man_t * p, int ProbeId1, i ...@@ -1194,7 +1194,7 @@ extern int Gia_SweeperCheckEquiv( Gia_Man_t * p, int ProbeId1, i
extern Gia_Man_t * Gia_SweeperExtractUserLogic( Gia_Man_t * p, Vec_Int_t * vProbeIds, Vec_Ptr_t * vInNames, Vec_Ptr_t * vOutNames ); extern Gia_Man_t * Gia_SweeperExtractUserLogic( Gia_Man_t * p, Vec_Int_t * vProbeIds, Vec_Ptr_t * vInNames, Vec_Ptr_t * vOutNames );
extern Gia_Man_t * Gia_SweeperCleanup( Gia_Man_t * p, char * pCommLime ); extern Gia_Man_t * Gia_SweeperCleanup( Gia_Man_t * p, char * pCommLime );
extern Vec_Int_t * Gia_SweeperGraft( Gia_Man_t * pDst, Vec_Int_t * vProbes, Gia_Man_t * pSrc ); extern Vec_Int_t * Gia_SweeperGraft( Gia_Man_t * pDst, Vec_Int_t * vProbes, Gia_Man_t * pSrc );
extern int Gia_SweeperFraig( Gia_Man_t * p, Vec_Int_t * vProbeIds, char * pCommLime, int nWords, int nConfs, int fVerbose ); extern int Gia_SweeperFraig( Gia_Man_t * p, Vec_Int_t * vProbeIds, char * pCommLime, int nWords, int nConfs, int fVerify, int fVerbose );
extern int Gia_SweeperRun( Gia_Man_t * p, Vec_Int_t * vProbeIds, char * pCommLime, int fVerbose ); extern int Gia_SweeperRun( Gia_Man_t * p, Vec_Int_t * vProbeIds, char * pCommLime, int fVerbose );
/*=== giaSwitch.c ============================================================*/ /*=== giaSwitch.c ============================================================*/
extern float Gia_ManEvaluateSwitching( Gia_Man_t * p ); extern float Gia_ManEvaluateSwitching( Gia_Man_t * p );
......
...@@ -979,7 +979,7 @@ Vec_Int_t * Gia_SweeperGraft( Gia_Man_t * pDst, Vec_Int_t * vProbes, Gia_Man_t * ...@@ -979,7 +979,7 @@ Vec_Int_t * Gia_SweeperGraft( Gia_Man_t * pDst, Vec_Int_t * vProbes, Gia_Man_t *
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Gia_Man_t * Gia_SweeperSweep( Gia_Man_t * p, Vec_Int_t * vProbeOuts, int nWords, int nConfs, int fVerbose ) Gia_Man_t * Gia_SweeperSweep( Gia_Man_t * p, Vec_Int_t * vProbeOuts, int nWords, int nConfs, int fVerify, int fVerbose )
{ {
Vec_Int_t * vProbeConds; Vec_Int_t * vProbeConds;
Gia_Man_t * pGiaCond, * pGiaOuts, * pGiaRes; Gia_Man_t * pGiaCond, * pGiaOuts, * pGiaRes;
...@@ -987,6 +987,7 @@ Gia_Man_t * Gia_SweeperSweep( Gia_Man_t * p, Vec_Int_t * vProbeOuts, int nWords, ...@@ -987,6 +987,7 @@ Gia_Man_t * Gia_SweeperSweep( Gia_Man_t * p, Vec_Int_t * vProbeOuts, int nWords,
Ssc_ManSetDefaultParams( pPars ); Ssc_ManSetDefaultParams( pPars );
pPars->nWords = nWords; pPars->nWords = nWords;
pPars->nBTLimit = nConfs; pPars->nBTLimit = nConfs;
pPars->fVerify = fVerify;
pPars->fVerbose = fVerbose; pPars->fVerbose = fVerbose;
// sweeper is running // sweeper is running
assert( Gia_SweeperIsRunning(p) ); assert( Gia_SweeperIsRunning(p) );
...@@ -1025,7 +1026,7 @@ Gia_Man_t * Gia_SweeperSweep( Gia_Man_t * p, Vec_Int_t * vProbeOuts, int nWords, ...@@ -1025,7 +1026,7 @@ Gia_Man_t * Gia_SweeperSweep( Gia_Man_t * p, Vec_Int_t * vProbeOuts, int nWords,
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Gia_SweeperFraig( Gia_Man_t * p, Vec_Int_t * vProbeIds, char * pCommLime, int nWords, int nConfs, int fVerbose ) int Gia_SweeperFraig( Gia_Man_t * p, Vec_Int_t * vProbeIds, char * pCommLime, int nWords, int nConfs, int fVerify, int fVerbose )
{ {
Gia_Man_t * pNew; Gia_Man_t * pNew;
Vec_Int_t * vLits; Vec_Int_t * vLits;
...@@ -1033,7 +1034,7 @@ int Gia_SweeperFraig( Gia_Man_t * p, Vec_Int_t * vProbeIds, char * pCommLime, in ...@@ -1033,7 +1034,7 @@ int Gia_SweeperFraig( Gia_Man_t * p, Vec_Int_t * vProbeIds, char * pCommLime, in
// sweeper is running // sweeper is running
assert( Gia_SweeperIsRunning(p) ); assert( Gia_SweeperIsRunning(p) );
// sweep the logic // sweep the logic
pNew = Gia_SweeperSweep( p, vProbeIds, nWords, nConfs, fVerbose ); pNew = Gia_SweeperSweep( p, vProbeIds, nWords, nConfs, fVerify, fVerbose );
if ( pNew == NULL ) if ( pNew == NULL )
return 0; return 0;
// execute command line // execute command line
...@@ -1131,7 +1132,7 @@ Gia_Man_t * Gia_SweeperFraigTest( Gia_Man_t * pInit, int nWords, int nConfs, int ...@@ -1131,7 +1132,7 @@ Gia_Man_t * Gia_SweeperFraigTest( Gia_Man_t * pInit, int nWords, int nConfs, int
else // this is a constraint else // this is a constraint
Gia_SweeperCondPush( p, Gia_SweeperProbeCreate( p, Gia_ObjFaninLit0p(p, pObj) ) ); Gia_SweeperCondPush( p, Gia_SweeperProbeCreate( p, Gia_ObjFaninLit0p(p, pObj) ) );
// perform the sweeping // perform the sweeping
pGia = Gia_SweeperSweep( p, vOuts, nWords, nConfs, fVerbose ); pGia = Gia_SweeperSweep( p, vOuts, nWords, nConfs, fVerbose, 0 );
// pGia = Gia_ManDup( p ); // pGia = Gia_ManDup( p );
Vec_IntFree( vOuts ); Vec_IntFree( vOuts );
// sop the sweeper // sop the sweeper
......
...@@ -28733,7 +28733,7 @@ int Abc_CommandAbc9CFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -28733,7 +28733,7 @@ int Abc_CommandAbc9CFraig( Abc_Frame_t * pAbc, int argc, char ** argv )
Ssc_Pars_t Pars, * pPars = &Pars; Ssc_Pars_t Pars, * pPars = &Pars;
Ssc_ManSetDefaultParams( pPars ); Ssc_ManSetDefaultParams( pPars );
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "WCavh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "WCacvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -28762,6 +28762,9 @@ int Abc_CommandAbc9CFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -28762,6 +28762,9 @@ int Abc_CommandAbc9CFraig( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'a': case 'a':
pPars->fAppend ^= 1; pPars->fAppend ^= 1;
break; break;
case 'c':
pPars->fVerify ^= 1;
break;
case 'v': case 'v':
pPars->fVerbose ^= 1; pPars->fVerbose ^= 1;
break; break;
...@@ -28779,13 +28782,14 @@ int Abc_CommandAbc9CFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -28779,13 +28782,14 @@ int Abc_CommandAbc9CFraig( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: &cfraig [-WC <num>] [-avh]\n" ); Abc_Print( -2, "usage: &cfraig [-WC <num>] [-acvh]\n" );
Abc_Print( -2, "\t performs combinational SAT sweeping under constraints\n" ); Abc_Print( -2, "\t performs combinational SAT sweeping under constraints\n" );
Abc_Print( -2, "\t which are present in the AIG or set manually using \"constr\"\n" ); Abc_Print( -2, "\t which are present in the AIG or set manually using \"constr\"\n" );
Abc_Print( -2, "\t (constraints are listed as last POs and true when they are 0)\n" ); Abc_Print( -2, "\t (constraints are listed as last POs and true when they are 0)\n" );
Abc_Print( -2, "\t-W num : the number of simulation words [default = %d]\n", pPars->nWords ); Abc_Print( -2, "\t-W num : the number of simulation words [default = %d]\n", pPars->nWords );
Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit );
Abc_Print( -2, "\t-a : toggle appending constraints to the result [default = %s]\n", pPars->fAppend? "yes": "no" ); Abc_Print( -2, "\t-a : toggle appending constraints to the result [default = %s]\n", pPars->fAppend? "yes": "no" );
Abc_Print( -2, "\t-c : toggle performing internal verification [default = %s]\n", pPars->fVerify? "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" );
Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-h : print the command usage\n");
return 1; return 1;
...@@ -49,6 +49,7 @@ struct Ssc_Pars_t_ ...@@ -49,6 +49,7 @@ struct Ssc_Pars_t_
int nCallsRecycle; // calls to perform before recycling SAT solver int nCallsRecycle; // calls to perform before recycling SAT solver
int fAppend; // append constraints to the resulting AIG int fAppend; // append constraints to the resulting AIG
int fVerbose; // verbose stats int fVerbose; // verbose stats
int fVerify; // enable internal verification
}; };
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
...@@ -261,7 +261,7 @@ int Ssc_PerformVerification( Gia_Man_t * p0, Gia_Man_t * p1, Gia_Man_t * pC ) ...@@ -261,7 +261,7 @@ int Ssc_PerformVerification( Gia_Man_t * p0, Gia_Man_t * p1, Gia_Man_t * pC )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Gia_Man_t * Ssc_PerformSweeping( Gia_Man_t * pAig, Gia_Man_t * pCare, Ssc_Pars_t * pPars ) Gia_Man_t * Ssc_PerformSweepingInt( Gia_Man_t * pAig, Gia_Man_t * pCare, Ssc_Pars_t * pPars )
{ {
Ssc_Man_t * p; Ssc_Man_t * p;
Gia_Man_t * pResult, * pTemp; Gia_Man_t * pResult, * pTemp;
...@@ -410,6 +410,13 @@ p->timeSimSat += Abc_Clock() - clk; ...@@ -410,6 +410,13 @@ p->timeSimSat += Abc_Clock() - clk;
} }
return pResult; return pResult;
} }
Gia_Man_t * Ssc_PerformSweeping( Gia_Man_t * pAig, Gia_Man_t * pCare, Ssc_Pars_t * pPars )
{
Gia_Man_t * pResult = Ssc_PerformSweepingInt( pAig, pCare, pPars );
if ( pPars->fVerify )
Ssc_PerformVerification( pAig, pResult, pCare );
return pResult;
}
Gia_Man_t * Ssc_PerformSweepingConstr( Gia_Man_t * p, Ssc_Pars_t * pPars ) Gia_Man_t * Ssc_PerformSweepingConstr( Gia_Man_t * p, Ssc_Pars_t * pPars )
{ {
Gia_Man_t * pAig, * pCare, * pResult; Gia_Man_t * pAig, * pCare, * pResult;
...@@ -443,7 +450,6 @@ Gia_Man_t * Ssc_PerformSweepingConstr( Gia_Man_t * p, Ssc_Pars_t * pPars ) ...@@ -443,7 +450,6 @@ Gia_Man_t * Ssc_PerformSweepingConstr( Gia_Man_t * p, Ssc_Pars_t * pPars )
pAig = Gia_ManDupLevelized( pResult = pAig ); pAig = Gia_ManDupLevelized( pResult = pAig );
Gia_ManStop( pResult ); Gia_ManStop( pResult );
pResult = Ssc_PerformSweeping( pAig, pCare, pPars ); pResult = Ssc_PerformSweeping( pAig, pCare, pPars );
Ssc_PerformVerification( pAig, pResult, pCare );
if ( pPars->fAppend ) if ( pPars->fAppend )
{ {
Gia_ManDupAppendShare( pResult, pCare ); Gia_ManDupAppendShare( pResult, pCare );
......
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