diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/base/abc/abcUtil.c | 17 | ||||
-rw-r--r-- | src/base/abci/abc.c | 14 |
2 files changed, 26 insertions, 5 deletions
diff --git a/src/base/abc/abcUtil.c b/src/base/abc/abcUtil.c index abd8c812..33c97e83 100644 --- a/src/base/abc/abcUtil.c +++ b/src/base/abc/abcUtil.c @@ -2030,7 +2030,7 @@ Abc_Obj_t * Abc_NtkAddBuffsOne( Vec_Ptr_t * vBuffs, Abc_Obj_t * pFanin, int Leve } return pBuffer; } -Abc_Ntk_t * Abc_NtkAddBuffs( Abc_Ntk_t * pNtkInit, int fVerbose ) +Abc_Ntk_t * Abc_NtkAddBuffs( Abc_Ntk_t * pNtkInit, int fReverse, int fVerbose ) { Vec_Ptr_t * vBuffs; Abc_Ntk_t * pNtk = Abc_NtkDup( pNtkInit ); @@ -2038,6 +2038,21 @@ Abc_Ntk_t * Abc_NtkAddBuffs( Abc_Ntk_t * pNtkInit, int fVerbose ) int i, k, nLevelMax = Abc_NtkLevel( pNtk ); Abc_NtkForEachCo( pNtk, pObj, i ) pObj->Level = nLevelMax + 1; + if ( fReverse ) + { + Vec_Ptr_t * vNodes = Abc_NtkDfs( pNtk, 1 ); + assert( nLevelMax < (1<<18) ); + Vec_PtrForEachEntryReverse( Abc_Obj_t *, vNodes, pObj, i ) + { + pObj->Level = (1<<18); + Abc_ObjForEachFanout( pObj, pFanin, k ) + pObj->Level = Abc_MinInt( pFanin->Level - 1, pObj->Level ); + assert( pObj->Level > 0 ); + } + Vec_PtrFree( vNodes ); + Abc_NtkForEachCi( pNtk, pObj, i ) + pObj->Level = 0; + } vBuffs = Vec_PtrStart( Abc_NtkObjNumMax(pNtk) * (nLevelMax + 1) ); Abc_NtkForEachObj( pNtk, pObj, i ) { diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index bf3abf26..deb9bad1 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -4550,17 +4550,22 @@ usage: ***********************************************************************/ int Abc_CommandAddBuffs( Abc_Frame_t * pAbc, int argc, char ** argv ) { - extern Abc_Ntk_t * Abc_NtkAddBuffs( Abc_Ntk_t * pNtk, int fVerbose ); + extern Abc_Ntk_t * Abc_NtkAddBuffs( Abc_Ntk_t * pNtk, int fReverse, int fVerbose ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Ntk_t * pNtkRes; int c, fVerbose; + int fReverse; + fReverse = 0; fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "rvh" ) ) != EOF ) { switch ( c ) { + case 'r': + fReverse ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -4583,7 +4588,7 @@ int Abc_CommandAddBuffs( Abc_Frame_t * pAbc, int argc, char ** argv ) } // modify the current network - pNtkRes = Abc_NtkAddBuffs( pNtk, fVerbose ); + pNtkRes = Abc_NtkAddBuffs( pNtk, fReverse, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "The command has failed.\n" ); @@ -4594,8 +4599,9 @@ int Abc_CommandAddBuffs( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - Abc_Print( -2, "usage: addbuffs [-vh]\n" ); + Abc_Print( -2, "usage: addbuffs [-rvh]\n" ); Abc_Print( -2, "\t adds buffers to create balanced CI/CO paths\n" ); + Abc_Print( -2, "\t-r : toggle reversing the levelized order [default = %s]\n", fReverse? "yes": "no" ); Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; |