From 0b1cfe886e982506e4b915322c18c013f83163fc Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 27 Feb 2012 17:50:48 -0800 Subject: Added switch -z to command 'removepo' to enable removing const1 outputs. --- src/base/abc/abcNtk.c | 4 ++-- src/base/abci/abc.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/base/abc/abcNtk.c b/src/base/abc/abcNtk.c index 1f76de81..3840fdfc 100644 --- a/src/base/abc/abcNtk.c +++ b/src/base/abc/abcNtk.c @@ -1607,10 +1607,10 @@ void Abc_NtkSwapOneOutput( Abc_Ntk_t * pNtk, int iOutput ) SeeAlso [] ***********************************************************************/ -void Abc_NtkRemovePo( Abc_Ntk_t * pNtk, int iOutput ) +void Abc_NtkRemovePo( Abc_Ntk_t * pNtk, int iOutput, int fRemoveConst0 ) { Abc_Obj_t * pObj = Abc_NtkPo(pNtk, iOutput); - if ( Abc_ObjFanin0(pObj) == Abc_AigConst1(pNtk) && Abc_ObjFaninC0(pObj) ) + if ( Abc_ObjFanin0(pObj) == Abc_AigConst1(pNtk) && Abc_ObjFaninC0(pObj) == fRemoveConst0 ) Abc_NtkDeleteObj( pObj ); } diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 0d6518ec..bd2f5bfe 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -5997,11 +5997,12 @@ int Abc_CommandRemovePo( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);//, * pNtkRes = NULL; int c, iOutput = -1; - extern void Abc_NtkRemovePo( Abc_Ntk_t * pNtk, int iOutput ); + int fRemoveConst0 = 1; + extern void Abc_NtkRemovePo( Abc_Ntk_t * pNtk, int iOutput, int fRemoveConst0 ); // set defaults Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Nh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "Nzh" ) ) != EOF ) { switch ( c ) { @@ -6016,6 +6017,9 @@ int Abc_CommandRemovePo( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( iOutput < 0 ) goto usage; break; + case 'z': + fRemoveConst0 ^= 1; + break; default: goto usage; } @@ -6047,13 +6051,14 @@ int Abc_CommandRemovePo( Abc_Frame_t * pAbc, int argc, char ** argv ) // pNtkRes = Abc_NtkDup( pNtk ); // Abc_NtkRemovePo( pNtkRes, iOutput ); // Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); - Abc_NtkRemovePo( pNtk, iOutput ); + Abc_NtkRemovePo( pNtk, iOutput, fRemoveConst0 ); return 0; usage: - Abc_Print( -2, "usage: removepo [-N ] [-h]\n" ); + Abc_Print( -2, "usage: removepo [-N ] [-zh]\n" ); Abc_Print( -2, "\t remove PO with number if it is const0\n" ); Abc_Print( -2, "\t-N : the zero-based index of the PO to remove [default = %d]\n", iOutput ); + Abc_Print( -2, "\t-z : toggle removing const1 instead of const0 [default = %s]\n", fRemoveConst0? "const0": "const1" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } -- cgit v1.2.3