mirror of https://github.com/YosysHQ/abc.git
Integration of new SAT sweeper.
This commit is contained in:
parent
bcbc91c4d6
commit
876c2c353a
|
|
@ -32664,13 +32664,14 @@ usage:
|
|||
***********************************************************************/
|
||||
int Abc_CommandAbc9Fraig( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
{
|
||||
extern Gia_Man_t * Cec2_ManSimulateTest( Gia_Man_t * p, Cec_ParFra_t * pPars );
|
||||
Cec_ParFra_t ParsFra, * pPars = &ParsFra;
|
||||
Gia_Man_t * pTemp;
|
||||
int c;
|
||||
int c, fUseAlgo = 0;
|
||||
Cec_ManFraSetDefaultParams( pPars );
|
||||
pPars->fSatSweeping = 1;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "WRILDCrmdcwvh" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "WRILDCrmdcnwvh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
|
|
@ -32752,6 +32753,9 @@ int Abc_CommandAbc9Fraig( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
case 'c':
|
||||
pPars->fRunCSat ^= 1;
|
||||
break;
|
||||
case 'n':
|
||||
fUseAlgo ^= 1;
|
||||
break;
|
||||
case 'w':
|
||||
pPars->fVeryVerbose ^= 1;
|
||||
break;
|
||||
|
|
@ -32767,12 +32771,15 @@ int Abc_CommandAbc9Fraig( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
Abc_Print( -1, "Abc_CommandAbc9Fraig(): There is no AIG.\n" );
|
||||
return 1;
|
||||
}
|
||||
pTemp = Cec_ManSatSweeping( pAbc->pGia, pPars, 0 );
|
||||
if ( fUseAlgo )
|
||||
pTemp = Cec2_ManSimulateTest( pAbc->pGia, pPars );
|
||||
else
|
||||
pTemp = Cec_ManSatSweeping( pAbc->pGia, pPars, 0 );
|
||||
Abc_FrameUpdateGia( pAbc, pTemp );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
Abc_Print( -2, "usage: &fraig [-WRILDC <num>] [-rmdcwvh]\n" );
|
||||
Abc_Print( -2, "usage: &fraig [-WRILDC <num>] [-rmdcnwvh]\n" );
|
||||
Abc_Print( -2, "\t performs combinational SAT sweeping\n" );
|
||||
Abc_Print( -2, "\t-W num : the number of simulation words [default = %d]\n", pPars->nWords );
|
||||
Abc_Print( -2, "\t-R num : the number of simulation rounds [default = %d]\n", pPars->nRounds );
|
||||
|
|
@ -32784,6 +32791,7 @@ usage:
|
|||
Abc_Print( -2, "\t-m : toggle miter vs. any circuit [default = %s]\n", pPars->fCheckMiter? "miter": "circuit" );
|
||||
Abc_Print( -2, "\t-d : toggle using double output miters [default = %s]\n", pPars->fDualOut? "yes": "no" );
|
||||
Abc_Print( -2, "\t-c : toggle using circuit-based solver [default = %s]\n", pPars->fRunCSat? "yes": "no" );
|
||||
Abc_Print( -2, "\t-n : toggle using new implementation [default = %s]\n", fUseAlgo? "yes": "no" );
|
||||
Abc_Print( -2, "\t-w : toggle printing even more verbose information [default = %s]\n", pPars->fVeryVerbose? "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");
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "misc/util/utilTruth.h"
|
||||
#include "sat/satoko/satoko.h"
|
||||
#include "sat/satoko/solver.h"
|
||||
#include "cec.h"
|
||||
|
||||
ABC_NAMESPACE_IMPL_START
|
||||
|
||||
|
|
@ -35,6 +36,7 @@ struct Cec2_Par_t_
|
|||
{
|
||||
int nSimWords; // simulation words
|
||||
int nSimRounds; // simulation rounds
|
||||
int nItersMax; // max number of iterations
|
||||
int nConfLimit; // SAT solver conflict limit
|
||||
int fIsMiter; // this is a miter
|
||||
int fUseCones; // use logic cones
|
||||
|
|
@ -93,13 +95,14 @@ static inline void Cec2_ObjCleanSatId( Gia_Man_t * p, Gia_Obj_t * pObj )
|
|||
void Cec2_SetDefaultParams( Cec2_Par_t * p )
|
||||
{
|
||||
memset( p, 0, sizeof(Cec2_Par_t) );
|
||||
p->nSimWords = 8; // simulation words
|
||||
p->nSimWords = 12; // simulation words
|
||||
p->nSimRounds = 4; // simulation rounds
|
||||
p->nItersMax = 10; // max number of iterations
|
||||
p->nConfLimit = 1000; // conflict limit at a node
|
||||
p->fIsMiter = 0; // this is a miter
|
||||
p->fUseCones = 1; // use logic cones
|
||||
p->fUseCones = 0; // use logic cones
|
||||
p->fVeryVerbose = 0; // verbose stats
|
||||
p->fVerbose = 1; // verbose stats
|
||||
p->fVerbose = 0; // verbose stats
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -447,7 +450,7 @@ void Cec2_ManSimulateCis( Gia_Man_t * p )
|
|||
int i, Id;
|
||||
Gia_ManForEachCiId( p, Id, i )
|
||||
Cec2_ObjSimCi( p, Id );
|
||||
p->iPatsPi = 1;
|
||||
p->iPatsPi = 0;
|
||||
}
|
||||
Abc_Cex_t * Cec2_ManDeriveCex( Gia_Man_t * p, int iOut, int iPat )
|
||||
{
|
||||
|
|
@ -885,7 +888,7 @@ void Cec2_ManPrintStats( Gia_Man_t * p, Cec2_Par_t * pPars, Cec2_Man_t * pMan )
|
|||
printf( "F =%5d ", pMan ? pMan->nSatUndec : 0 );
|
||||
Gia_ManEquivPrintClasses( p, pPars->fVeryVerbose, 0 );
|
||||
}
|
||||
int Cec2_ManPerformSweeping( Gia_Man_t * p, Cec2_Par_t * pPars )
|
||||
int Cec2_ManPerformSweeping( Gia_Man_t * p, Cec2_Par_t * pPars, Gia_Man_t ** ppNew )
|
||||
{
|
||||
Cec2_Man_t * pMan = Cec2_ManCreate( p, pPars );
|
||||
Gia_Obj_t * pObj, * pRepr, * pObjNew;
|
||||
|
|
@ -923,7 +926,7 @@ int Cec2_ManPerformSweeping( Gia_Man_t * p, Cec2_Par_t * pPars )
|
|||
}
|
||||
// perform sweeping
|
||||
//pMan = Cec2_ManCreate( p, pPars );
|
||||
for ( Iter = 0; fDisproved; Iter++ )
|
||||
for ( Iter = 0; fDisproved && Iter < pPars->nItersMax; Iter++ )
|
||||
{
|
||||
fDisproved = 0;
|
||||
Cec2_ManSimulateCis( p );
|
||||
|
|
@ -960,7 +963,7 @@ int Cec2_ManPerformSweeping( Gia_Man_t * p, Cec2_Par_t * pPars )
|
|||
if ( Cec2_ManSweepNode(pMan, i) )
|
||||
continue;
|
||||
pObj->Value = ~0;
|
||||
//Vec_IntPushThree( pMan->vCexTriples, Gia_ObjId(p, pRepr), i, Abc_Var2Lit(p->iPatsPi, pObj->fPhase ^ pRepr->fPhase) );
|
||||
Vec_IntPushThree( pMan->vCexTriples, Gia_ObjId(p, pRepr), i, Abc_Var2Lit(p->iPatsPi, pObj->fPhase ^ pRepr->fPhase) );
|
||||
// mark nodes as disproved
|
||||
fDisproved = 1;
|
||||
//if ( Iter > 5 )
|
||||
|
|
@ -978,22 +981,41 @@ int Cec2_ManPerformSweeping( Gia_Man_t * p, Cec2_Par_t * pPars )
|
|||
}
|
||||
Cec2_ManPrintStats( p, pPars, pMan );
|
||||
}
|
||||
// finish the AIG, if it is not finished
|
||||
if ( ppNew )
|
||||
{
|
||||
Gia_ManForEachAnd( p, pObj, i )
|
||||
if ( !~pObj->Value )
|
||||
pObj->Value = Gia_ManHashAnd( pMan->pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
|
||||
Gia_ManForEachCo( p, pObj, i )
|
||||
pObj->Value = Gia_ManAppendCo( pMan->pNew, Gia_ObjFanin0Copy(pObj) );
|
||||
*ppNew = Gia_ManCleanup( pMan->pNew );
|
||||
(*ppNew)->pName = Abc_UtilStrsav( p->pName );
|
||||
(*ppNew)->pSpec = Abc_UtilStrsav( p->pSpec );
|
||||
}
|
||||
Cec2_ManDestroy( pMan );
|
||||
//Gia_ManEquivPrintClasses( p, 1, 0 );
|
||||
return p->pCexSeq ? 0 : 1;
|
||||
}
|
||||
void Cec2_ManSimulateTest( Gia_Man_t * p )
|
||||
Gia_Man_t * Cec2_ManSimulateTest( Gia_Man_t * p, Cec_ParFra_t * pPars0 )
|
||||
{
|
||||
Gia_Man_t * pNew = NULL;
|
||||
//abctime clk = Abc_Clock();
|
||||
Cec2_Par_t Pars, * pPars = &Pars;
|
||||
Cec2_SetDefaultParams( pPars );
|
||||
// set resource limits
|
||||
// pPars->nSimWords = pPars0->nWords; // simulation words
|
||||
// pPars->nSimRounds = pPars0->nRounds; // simulation rounds
|
||||
// pPars->nItersMax = pPars0->nItersMax; // max number of iterations
|
||||
pPars->nConfLimit = pPars0->nBTLimit; // conflict limit at a node
|
||||
pPars->fVerbose = pPars0->fVerbose;
|
||||
// Gia_ManComputeGiaEquivs( p, 100000, 0 );
|
||||
// Gia_ManEquivPrintClasses( p, 1, 0 );
|
||||
Cec2_ManPerformSweeping( p, pPars );
|
||||
Cec2_ManPerformSweeping( p, pPars, &pNew );
|
||||
//Abc_PrintTime( 1, "SAT sweeping time", Abc_Clock() - clk );
|
||||
return pNew;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Reference in New Issue