summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannis Harder <me@jix.one>2022-08-05 13:21:59 +0200
committerJannis Harder <me@jix.one>2022-08-05 13:21:59 +0200
commit8c923ad4929870d4e819b84f62c7f9177b0d0d17 (patch)
tree91fa21d26aa013d43a8e40fd8a87990660c581f6
parent7cc11f7f0c49d4ce7e0ed88950d1c4c8abb1cba4 (diff)
downloadabc-8c923ad4929870d4e819b84f62c7f9177b0d0d17.tar.gz
abc-8c923ad4929870d4e819b84f62c7f9177b0d0d17.tar.bz2
abc-8c923ad4929870d4e819b84f62c7f9177b0d0d17.zip
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.
-rw-r--r--src/base/abci/abc.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 33a8315c..bb64a3f3 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -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" );