New switch 'satclp -r' to reverse variable order.

This commit is contained in:
Alan Mishchenko 2015-10-07 17:35:36 -07:00
parent b19d09f04c
commit a2692b70fb
4 changed files with 31 additions and 22 deletions

View File

@ -596,7 +596,7 @@ extern ABC_DLL int Abc_NtkCheckUniqueCoNames( Abc_Ntk_t * pNtk );
extern ABC_DLL int Abc_NtkCheckUniqueCioNames( Abc_Ntk_t * pNtk );
/*=== abcCollapse.c ==========================================================*/
extern ABC_DLL Abc_Ntk_t * Abc_NtkCollapse( Abc_Ntk_t * pNtk, int fBddSizeMax, int fDualRail, int fReorder, int fVerbose );
extern ABC_DLL Abc_Ntk_t * Abc_NtkCollapseSat( Abc_Ntk_t * pNtk, int nCubeLim, int nBTLimit, int fCanon, int fVerbose );
extern ABC_DLL Abc_Ntk_t * Abc_NtkCollapseSat( Abc_Ntk_t * pNtk, int nCubeLim, int nBTLimit, int fCanon, int fReverse, int fVerbose );
/*=== abcCut.c ==========================================================*/
extern ABC_DLL void * Abc_NodeGetCutsRecursive( void * p, Abc_Obj_t * pObj, int fDag, int fTree );
extern ABC_DLL void * Abc_NodeGetCuts( void * p, Abc_Obj_t * pObj, int fDag, int fTree );

View File

@ -3103,12 +3103,13 @@ int Abc_CommandSatClp( Abc_Frame_t * pAbc, int argc, char ** argv )
int nCubeLim = 1000;
int nBTLimit = 1000000;
int fCanon = 0;
int fReverse = 0;
int fVerbose = 0;
int c;
// set defaults
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "CLcvh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "CLcrvh" ) ) != EOF )
{
switch ( c )
{
@ -3137,6 +3138,9 @@ int Abc_CommandSatClp( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'c':
fCanon ^= 1;
break;
case 'r':
fReverse ^= 1;
break;
case 'v':
fVerbose ^= 1;
break;
@ -3161,11 +3165,11 @@ int Abc_CommandSatClp( Abc_Frame_t * pAbc, int argc, char ** argv )
// get the new network
if ( Abc_NtkIsStrash(pNtk) )
pNtkRes = Abc_NtkCollapseSat( pNtk, nCubeLim, nBTLimit, fCanon, fVerbose );
pNtkRes = Abc_NtkCollapseSat( pNtk, nCubeLim, nBTLimit, fCanon, fReverse, fVerbose );
else
{
pNtk = Abc_NtkStrash( pNtk, 0, 0, 0 );
pNtkRes = Abc_NtkCollapseSat( pNtk, nCubeLim, nBTLimit, fCanon, fVerbose );
pNtkRes = Abc_NtkCollapseSat( pNtk, nCubeLim, nBTLimit, fCanon, fReverse, fVerbose );
Abc_NtkDelete( pNtk );
}
if ( pNtkRes == NULL )
@ -3178,11 +3182,12 @@ int Abc_CommandSatClp( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
Abc_Print( -2, "usage: satclp [-CL num] [-cvh]\n" );
Abc_Print( -2, "usage: satclp [-CL num] [-crvh]\n" );
Abc_Print( -2, "\t performs SAT based collapsing\n" );
Abc_Print( -2, "\t-C num : the limit on the SOP size of one output [default = %d]\n", nCubeLim );
Abc_Print( -2, "\t-L num : the limit on the number of conflicts in one SAT call [default = %d]\n", nBTLimit );
Abc_Print( -2, "\t-c : toggles using canonical ISOP computation [default = %s]\n", fCanon? "yes": "no" );
Abc_Print( -2, "\t-r : toggles using reverse veriable ordering [default = %s]\n", fReverse? "yes": "no" );
Abc_Print( -2, "\t-v : toggles printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
@ -37807,7 +37812,7 @@ usage:
***********************************************************************/
int Abc_CommandAbc9SatClp( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern Vec_Str_t * Bmc_CollapseOne( Gia_Man_t * p, int nCubeLim, int nBTLimit, int fCanon, int fVerbose );
extern Vec_Str_t * Bmc_CollapseOne( Gia_Man_t * p, int nCubeLim, int nBTLimit, int fCanon, int fReverse, int fVerbose );
int nCubeLim = 1000;
int nBTLimit = 1000000;
int fCanon = 0;
@ -37859,7 +37864,7 @@ int Abc_CommandAbc9SatClp( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Abc_CommandAbc9SatClp(): There is no AIG.\n" );
return 0;
}
vSop = Bmc_CollapseOne( pAbc->pGia, nCubeLim, nBTLimit, fCanon, fVerbose );
vSop = Bmc_CollapseOne( pAbc->pGia, nCubeLim, nBTLimit, fCanon, 0, fVerbose );
Vec_StrFree( vSop );
return 0;

View File

@ -290,16 +290,16 @@ Gia_Man_t * Abc_NtkClpOneGia( Abc_Ntk_t * pNtk, int iCo, Vec_Int_t * vSupp )
Gia_ManStop( pTemp );
return pNew;
}
Vec_Str_t * Abc_NtkClpOne( Abc_Ntk_t * pNtk, int iCo, int nCubeLim, int nBTLimit, int fVerbose, int fCanon, Vec_Int_t ** pvSupp )
Vec_Str_t * Abc_NtkClpOne( Abc_Ntk_t * pNtk, int iCo, int nCubeLim, int nBTLimit, int fVerbose, int fCanon, int fReverse, Vec_Int_t ** pvSupp )
{
extern Vec_Int_t * Abc_NtkNodeSupportInt( Abc_Ntk_t * pNtk, int iCo );
extern Vec_Str_t * Bmc_CollapseOne( Gia_Man_t * p, int nCubeLim, int nBTLimit, int fCanon, int fVerbose );
extern Vec_Str_t * Bmc_CollapseOne( Gia_Man_t * p, int nCubeLim, int nBTLimit, int fCanon, int fReverse, int fVerbose );
Vec_Int_t * vSupp = Abc_NtkNodeSupportInt( pNtk, iCo );
Gia_Man_t * pGia = Abc_NtkClpOneGia( pNtk, iCo, vSupp );
Vec_Str_t * vSop;
if ( fVerbose )
printf( "Output %d:\n", iCo );
vSop = Bmc_CollapseOne( pGia, nCubeLim, nBTLimit, fCanon, fVerbose );
vSop = Bmc_CollapseOne( pGia, nCubeLim, nBTLimit, fCanon, fReverse, fVerbose );
Gia_ManStop( pGia );
*pvSupp = vSupp;
if ( vSop == NULL )
@ -320,14 +320,14 @@ Vec_Str_t * Abc_NtkClpOne( Abc_Ntk_t * pNtk, int iCo, int nCubeLim, int nBTLimit
SeeAlso []
***********************************************************************/
Abc_Obj_t * Abc_NtkFromSopsOne( Abc_Ntk_t * pNtkNew, Abc_Ntk_t * pNtk, int iCo, int nCubeLim, int nBTLimit, int fCanon, int fVerbose )
Abc_Obj_t * Abc_NtkFromSopsOne( Abc_Ntk_t * pNtkNew, Abc_Ntk_t * pNtk, int iCo, int nCubeLim, int nBTLimit, int fCanon, int fReverse, int fVerbose )
{
Abc_Obj_t * pNodeNew;
Vec_Int_t * vSupp;
Vec_Str_t * vSop;
int i, iCi;
// compute SOP of the node
vSop = Abc_NtkClpOne( pNtk, iCo, nCubeLim, nBTLimit, fVerbose, fCanon, &vSupp );
vSop = Abc_NtkClpOne( pNtk, iCo, nCubeLim, nBTLimit, fVerbose, fCanon, fReverse, &vSupp );
if ( vSop == NULL )
return NULL;
// create a new node
@ -341,7 +341,7 @@ Abc_Obj_t * Abc_NtkFromSopsOne( Abc_Ntk_t * pNtkNew, Abc_Ntk_t * pNtk, int iCo,
Vec_StrFree( vSop );
return pNodeNew;
}
Abc_Ntk_t * Abc_NtkFromSops( Abc_Ntk_t * pNtk, int nCubeLim, int nBTLimit, int fCanon, int fVerbose )
Abc_Ntk_t * Abc_NtkFromSops( Abc_Ntk_t * pNtk, int nCubeLim, int nBTLimit, int fCanon, int fReverse, int fVerbose )
{
ProgressBar * pProgress;
Abc_Ntk_t * pNtkNew;
@ -381,7 +381,7 @@ Abc_Ntk_t * Abc_NtkFromSops( Abc_Ntk_t * pNtk, int nCubeLim, int nBTLimit, int f
Abc_ObjAddFanin( pNode->pCopy, pNodeNew );
continue;
}
pNodeNew = Abc_NtkFromSopsOne( pNtkNew, pNtk, i, nCubeLim, nBTLimit, fCanon, fVerbose );
pNodeNew = Abc_NtkFromSopsOne( pNtkNew, pNtk, i, nCubeLim, nBTLimit, fCanon, fReverse, fVerbose );
if ( pNodeNew == NULL )
{
Abc_NtkDelete( pNtkNew );
@ -394,12 +394,12 @@ Abc_Ntk_t * Abc_NtkFromSops( Abc_Ntk_t * pNtk, int nCubeLim, int nBTLimit, int f
Extra_ProgressBarStop( pProgress );
return pNtkNew;
}
Abc_Ntk_t * Abc_NtkCollapseSat( Abc_Ntk_t * pNtk, int nCubeLim, int nBTLimit, int fCanon, int fVerbose )
Abc_Ntk_t * Abc_NtkCollapseSat( Abc_Ntk_t * pNtk, int nCubeLim, int nBTLimit, int fCanon, int fReverse, int fVerbose )
{
Abc_Ntk_t * pNtkNew;
assert( Abc_NtkIsStrash(pNtk) );
// create the new network
pNtkNew = Abc_NtkFromSops( pNtk, nCubeLim, nBTLimit, fCanon, fVerbose );
pNtkNew = Abc_NtkFromSops( pNtk, nCubeLim, nBTLimit, fCanon, fReverse, fVerbose );
if ( pNtkNew == NULL )
return NULL;
if ( pNtk->pExdc )

View File

@ -190,7 +190,7 @@ int Bmc_ComputeCanonical( sat_solver * pSat, Vec_Int_t * vLits, Vec_Int_t * vTem
SeeAlso []
***********************************************************************/
Vec_Str_t * Bmc_CollapseOneInt( Gia_Man_t * p, int nCubeLim, int nBTLimit, int fCanon, int fVerbose, int fCompl )
Vec_Str_t * Bmc_CollapseOneInt( Gia_Man_t * p, int nCubeLim, int nBTLimit, int fCanon, int fReverse, int fVerbose, int fCompl )
{
int fPrintMinterm = 0;
int nVars = Gia_ManCiNum(p);
@ -212,8 +212,12 @@ Vec_Str_t * Bmc_CollapseOneInt( Gia_Man_t * p, int nCubeLim, int nBTLimit, int f
// collect CI variables
int iCiVarBeg = pCnf->nVars - nVars;// - 1;
for ( n = 0; n < nVars; n++ )
Vec_IntPush( vVars, iCiVarBeg + n );
if ( fReverse )
for ( n = nVars - 1; n >= 0; n-- )
Vec_IntPush( vVars, iCiVarBeg + n );
else
for ( n = 0; n < nVars; n++ )
Vec_IntPush( vVars, iCiVarBeg + n );
// start with all negative literals
Vec_IntForEachEntry( vVars, iVar, n )
@ -338,16 +342,16 @@ cleanup:
Cnf_DataFree( pCnf );
return vSop;
}
Vec_Str_t * Bmc_CollapseOne( Gia_Man_t * p, int nCubeLim, int nBTLimit, int fCanon, int fVerbose )
Vec_Str_t * Bmc_CollapseOne( Gia_Man_t * p, int nCubeLim, int nBTLimit, int fCanon, int fReverse, int fVerbose )
{
Vec_Str_t * vSopOn, * vSopOff;
int nCubesOn = ABC_INFINITY;
int nCubesOff = ABC_INFINITY;
vSopOn = Bmc_CollapseOneInt( p, nCubeLim, nBTLimit, fCanon, fVerbose, 0 );
vSopOn = Bmc_CollapseOneInt( p, nCubeLim, nBTLimit, fCanon, fReverse, fVerbose, 0 );
if ( vSopOn )
nCubesOn = Vec_StrCountEntry(vSopOn,'\n');
Gia_ObjFlipFaninC0( Gia_ManPo(p, 0) );
vSopOff = Bmc_CollapseOneInt( p, Abc_MinInt(nCubeLim, nCubesOn), nBTLimit, fCanon, fVerbose, 1 );
vSopOff = Bmc_CollapseOneInt( p, Abc_MinInt(nCubeLim, nCubesOn), nBTLimit, fCanon, fReverse, fVerbose, 1 );
Gia_ObjFlipFaninC0( Gia_ManPo(p, 0) );
if ( vSopOff )
nCubesOff = Vec_StrCountEntry(vSopOff,'\n');