Commit 8c923ad4 by Jannis Harder

Add '-p' option to 'constr' to allow fully removing constraints

Invoking 'constr -r' converts constraints into POs but does not fully
remove them. Now 'constr -pr' can be used to completely remove them,
leaving the set of non-constraint POs unchanged.
parent 7cc11f7f
......@@ -27974,17 +27974,20 @@ usage:
int Abc_CommandConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
{
Abc_Ntk_t * pNtk;
Abc_Ntk_t * pNtkRes;
int c;
int nFrames;
int nConfs;
int nProps;
int fRemove;
int fPurge;
int fStruct;
int fInvert;
int fOldAlgo;
int fVerbose;
int nConstrs;
extern void Abc_NtkDarConstr( Abc_Ntk_t * pNtk, int nFrames, int nConfs, int nProps, int fStruct, int fOldAlgo, int fVerbose );
extern Abc_Ntk_t * Abc_NtkMakeOnePo( Abc_Ntk_t * pNtk, int Output, int nRange );
pNtk = Abc_FrameReadNtk(pAbc);
// set defaults
......@@ -27992,13 +27995,14 @@ int Abc_CommandConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
nConfs = 1000;
nProps = 1000;
fRemove = 0;
fPurge = 0;
fStruct = 0;
fInvert = 0;
fOldAlgo = 0;
fVerbose = 0;
nConstrs = -1;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "FCPNrsiavh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "FCPNrpsiavh" ) ) != EOF )
{
switch ( c )
{
......@@ -28049,6 +28053,9 @@ int Abc_CommandConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'r':
fRemove ^= 1;
break;
case 'p':
fPurge ^= 1;
break;
case 's':
fStruct ^= 1;
break;
......@@ -28084,7 +28091,22 @@ int Abc_CommandConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Constraints are not defined.\n" );
return 0;
}
Abc_Print( 1, "Constraints are converted to be primary outputs.\n" );
if ( fPurge )
{
Abc_Print( 1, "Constraints are removed.\n" );
pNtkRes = Abc_NtkMakeOnePo( pNtk, 0, Abc_NtkPoNum(pNtk) - Abc_NtkConstrNum(pNtk) );
if ( pNtkRes == NULL )
{
Abc_Print( 1,"Transformation has failed.\n" );
return 1;
}
// replace the current network
Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
pNtk = Abc_FrameReadNtk(pAbc);
}
else
Abc_Print( 1, "Constraints are converted to be primary outputs.\n" );
pNtk->nConstrs = 0;
return 0;
}
......@@ -28129,7 +28151,7 @@ int Abc_CommandConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_NtkDarConstr( pNtk, nFrames, nConfs, nProps, fStruct, fOldAlgo, fVerbose );
return 0;
usage:
Abc_Print( -2, "usage: constr [-FCPN num] [-risavh]\n" );
Abc_Print( -2, "usage: constr [-FCPN num] [-rpisavh]\n" );
Abc_Print( -2, "\t a toolkit for constraint manipulation\n" );
Abc_Print( -2, "\t if constraints are absent, detect them functionally\n" );
Abc_Print( -2, "\t if constraints are present, profiles them using random simulation\n" );
......@@ -28138,7 +28160,8 @@ usage:
Abc_Print( -2, "\t-C num : the max number of conflicts in SAT solving [default = %d]\n", nConfs );
Abc_Print( -2, "\t-P num : the max number of propagations in SAT solving [default = %d]\n", nProps );
Abc_Print( -2, "\t-N num : manually set the last <num> POs to be constraints [default = %d]\n", nConstrs );
Abc_Print( -2, "\t-r : manually remove the constraints [default = %s]\n", fRemove? "yes": "no" );
Abc_Print( -2, "\t-r : manually remove the constraints, converting them to POs [default = %s]\n", fRemove? "yes": "no" );
Abc_Print( -2, "\t-p : remove constraints instead of converting them to POs [default = %s]\n", fPurge? "yes": "no" );
Abc_Print( -2, "\t-i : toggle inverting already defined constraints [default = %s]\n", fInvert? "yes": "no" );
Abc_Print( -2, "\t-s : toggle using structural detection methods [default = %s]\n", fStruct? "yes": "no" );
Abc_Print( -2, "\t-a : toggle fast implication detection [default = %s]\n", !fOldAlgo? "yes": "no" );
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