diff options
| author | Alan Mishchenko <alanmi@berkeley.edu> | 2012-02-27 17:50:48 -0800 | 
|---|---|---|
| committer | Alan Mishchenko <alanmi@berkeley.edu> | 2012-02-27 17:50:48 -0800 | 
| commit | 0b1cfe886e982506e4b915322c18c013f83163fc (patch) | |
| tree | 0382877a4b9bba431582a0b1fbb0b4cec1c2c7c3 | |
| parent | bc85e5121d1a0bb5e643a74352682690f887fa98 (diff) | |
| download | abc-0b1cfe886e982506e4b915322c18c013f83163fc.tar.gz abc-0b1cfe886e982506e4b915322c18c013f83163fc.tar.bz2 abc-0b1cfe886e982506e4b915322c18c013f83163fc.zip  | |
Added switch -z to command 'removepo' to enable removing const1 outputs.
| -rw-r--r-- | src/base/abc/abcNtk.c | 4 | ||||
| -rw-r--r-- | 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 <num>] [-h]\n" ); +    Abc_Print( -2, "usage: removepo [-N <num>] [-zh]\n" );      Abc_Print( -2, "\t           remove PO with number <num> if it is const0\n" );      Abc_Print( -2, "\t-N <num> : 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;  }  | 
