mirror of https://github.com/YosysHQ/abc.git
Adding node ordering options to command &dfs.
This commit is contained in:
parent
ae98e57caf
commit
ab29dad7f4
|
|
@ -1279,7 +1279,7 @@ extern void Gia_ManDupRemapLiterals( Vec_Int_t * vLits, Gia_Man_t
|
|||
extern void Gia_ManDupRemapEquiv( Gia_Man_t * pNew, Gia_Man_t * p );
|
||||
extern Gia_Man_t * Gia_ManDupOrderDfs( Gia_Man_t * p );
|
||||
extern Gia_Man_t * Gia_ManDupOrderDfsChoices( Gia_Man_t * p );
|
||||
extern Gia_Man_t * Gia_ManDupOrderDfsReverse( Gia_Man_t * p );
|
||||
extern Gia_Man_t * Gia_ManDupOrderDfsReverse( Gia_Man_t * p, int fRevFans, int fRevOuts );
|
||||
extern Gia_Man_t * Gia_ManDupOutputGroup( Gia_Man_t * p, int iOutStart, int iOutStop );
|
||||
extern Gia_Man_t * Gia_ManDupOutputVec( Gia_Man_t * p, Vec_Int_t * vOutPres );
|
||||
extern Gia_Man_t * Gia_ManDupSelectedOutputs( Gia_Man_t * p, Vec_Int_t * vOutsLeft );
|
||||
|
|
|
|||
|
|
@ -466,7 +466,16 @@ Gia_Man_t * Gia_ManDupOrderDfsChoices( Gia_Man_t * p )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Gia_Man_t * Gia_ManDupOrderDfsReverse( Gia_Man_t * p )
|
||||
int Gia_ManDupOrderDfs2_rec( Gia_Man_t * pNew, Gia_Man_t * p, Gia_Obj_t * pObj )
|
||||
{
|
||||
if ( ~pObj->Value )
|
||||
return pObj->Value;
|
||||
assert( Gia_ObjIsAnd(pObj) );
|
||||
Gia_ManDupOrderDfs2_rec( pNew, p, Gia_ObjFanin1(pObj) );
|
||||
Gia_ManDupOrderDfs2_rec( pNew, p, Gia_ObjFanin0(pObj) );
|
||||
return pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
|
||||
}
|
||||
Gia_Man_t * Gia_ManDupOrderDfsReverse( Gia_Man_t * p, int fRevFans, int fRevOuts )
|
||||
{
|
||||
Gia_Man_t * pNew;
|
||||
Gia_Obj_t * pObj;
|
||||
|
|
@ -476,12 +485,28 @@ Gia_Man_t * Gia_ManDupOrderDfsReverse( Gia_Man_t * p )
|
|||
pNew->pName = Abc_UtilStrsav( p->pName );
|
||||
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
|
||||
Gia_ManConst0(p)->Value = 0;
|
||||
Gia_ManForEachCoReverse( p, pObj, i )
|
||||
Gia_ManDupOrderDfs_rec( pNew, p, pObj );
|
||||
Gia_ManForEachCi( p, pObj, i )
|
||||
if ( !~pObj->Value )
|
||||
pObj->Value = Gia_ManAppendCi(pNew);
|
||||
assert( Gia_ManCiNum(pNew) == Gia_ManCiNum(p) );
|
||||
pObj->Value = Gia_ManAppendCi(pNew);
|
||||
if ( fRevOuts )
|
||||
{
|
||||
if ( fRevFans )
|
||||
Gia_ManForEachCoReverse( p, pObj, i )
|
||||
Gia_ManDupOrderDfs2_rec( pNew, p, Gia_ObjFanin0(pObj) );
|
||||
else
|
||||
Gia_ManForEachCoReverse( p, pObj, i )
|
||||
Gia_ManDupOrderDfs_rec( pNew, p, Gia_ObjFanin0(pObj) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( fRevFans )
|
||||
Gia_ManForEachCo( p, pObj, i )
|
||||
Gia_ManDupOrderDfs2_rec( pNew, p, Gia_ObjFanin0(pObj) );
|
||||
else
|
||||
Gia_ManForEachCo( p, pObj, i )
|
||||
Gia_ManDupOrderDfs_rec( pNew, p, Gia_ObjFanin0(pObj) );
|
||||
}
|
||||
Gia_ManForEachCo( p, pObj, i )
|
||||
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
|
||||
Gia_ManDupRemapCis( pNew, p );
|
||||
Gia_ManDupRemapCos( pNew, p );
|
||||
Gia_ManDupRemapEquiv( pNew, p );
|
||||
|
|
|
|||
|
|
@ -32700,18 +32700,22 @@ int Abc_CommandAbc9Dfs( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
Gia_Man_t * pTemp;
|
||||
int c;
|
||||
int fNormal = 0;
|
||||
int fReverse = 0;
|
||||
int fRevFans = 0;
|
||||
int fRevOuts = 0;
|
||||
int fVerbose = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "nrvh" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "nfovh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
case 'n':
|
||||
fNormal ^= 1;
|
||||
break;
|
||||
case 'r':
|
||||
fReverse ^= 1;
|
||||
case 'f':
|
||||
fRevFans ^= 1;
|
||||
break;
|
||||
case 'o':
|
||||
fRevOuts ^= 1;
|
||||
break;
|
||||
case 'v':
|
||||
fVerbose ^= 1;
|
||||
|
|
@ -32728,31 +32732,18 @@ int Abc_CommandAbc9Dfs( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
return 1;
|
||||
}
|
||||
if ( fNormal )
|
||||
{
|
||||
pTemp = Gia_ManDupOrderAiger( pAbc->pGia );
|
||||
if ( fVerbose )
|
||||
Abc_Print( -1, "AIG objects are reordered as follows: CIs, ANDs, COs.\n" );
|
||||
}
|
||||
else if ( fReverse )
|
||||
{
|
||||
pTemp = Gia_ManDupOrderDfsReverse( pAbc->pGia );
|
||||
if ( fVerbose )
|
||||
Abc_Print( -1, "AIG objects are reordered in the reserve DFS order.\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
pTemp = Gia_ManDupOrderDfs( pAbc->pGia );
|
||||
if ( fVerbose )
|
||||
Abc_Print( -1, "AIG objects are reordered in the DFS order.\n" );
|
||||
}
|
||||
else
|
||||
pTemp = Gia_ManDupOrderDfsReverse( pAbc->pGia, fRevFans, fRevOuts );
|
||||
Abc_FrameUpdateGia( pAbc, pTemp );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
Abc_Print( -2, "usage: &dfs [-nrvh]\n" );
|
||||
Abc_Print( -2, "usage: &dfs [-nfovh]\n" );
|
||||
Abc_Print( -2, "\t orders objects in the DFS order\n" );
|
||||
Abc_Print( -2, "\t-n : toggle using normalized ordering [default = %s]\n", fNormal? "yes": "no" );
|
||||
Abc_Print( -2, "\t-r : toggle using reverse DFS ordering [default = %s]\n", fReverse? "yes": "no" );
|
||||
Abc_Print( -2, "\t-f : toggle using reverse fanin traversal order [default = %s]\n", fRevFans? "yes": "no" );
|
||||
Abc_Print( -2, "\t-o : toggle using reverse output traversal order [default = %s]\n", fRevOuts? "yes": "no" );
|
||||
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
|
||||
Abc_Print( -2, "\t-h : print the command usage\n");
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue