mirror of https://github.com/YosysHQ/abc.git
Added switch -z to command 'removepo' to enable removing const1 outputs.
This commit is contained in:
parent
bc85e5121d
commit
0b1cfe886e
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue