summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2015-03-15 10:53:23 +0700
committerAlan Mishchenko <alanmi@berkeley.edu>2015-03-15 10:53:23 +0700
commit05244daba9bcdb4fca431d3801b3de2b31eb5c0a (patch)
tree6875624dfb7c78f27cecbfba7c21e0e17b9c0e81
parent3f2b1233eee6889d580850d78e170eeecb4b06f7 (diff)
downloadabc-05244daba9bcdb4fca431d3801b3de2b31eb5c0a.tar.gz
abc-05244daba9bcdb4fca431d3801b3de2b31eb5c0a.tar.bz2
abc-05244daba9bcdb4fca431d3801b3de2b31eb5c0a.zip
Bug fix in 'move_names' related to feed-through nets.
-rw-r--r--src/base/abc/abcNames.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/base/abc/abcNames.c b/src/base/abc/abcNames.c
index ef09a628..cc2d55e6 100644
--- a/src/base/abc/abcNames.c
+++ b/src/base/abc/abcNames.c
@@ -509,7 +509,7 @@ void Abc_NtkShortNames( Abc_Ntk_t * pNtk )
***********************************************************************/
void Abc_NtkMoveNames( Abc_Ntk_t * pNtk, Abc_Ntk_t * pOld )
{
- Abc_Obj_t * pObj; int i;
+ Abc_Obj_t * pObj, * pObjCi, * pFanin; int i, Count = 0;
Nm_ManFree( pNtk->pManName );
pNtk->pManName = Nm_ManCreate( Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk) + Abc_NtkBoxNum(pNtk) );
Abc_NtkForEachPi( pNtk, pObj, i )
@@ -521,6 +521,25 @@ void Abc_NtkMoveNames( Abc_Ntk_t * pNtk, Abc_Ntk_t * pOld )
Abc_ObjAssignName( Abc_ObjFanin0(pObj), Abc_ObjName(Abc_ObjFanin0(Abc_NtkBox(pOld, i))), NULL );
Abc_ObjAssignName( Abc_ObjFanout0(pObj), Abc_ObjName(Abc_ObjFanout0(Abc_NtkBox(pOld, i))), NULL );
}
+ // if CO points to CI with the same name, remove buffer between them
+ Abc_NtkForEachCo( pNtk, pObj, i )
+ {
+ int nCiId = Nm_ManFindIdByNameTwoTypes( pNtk->pManName, Abc_ObjName(pObj), ABC_OBJ_PI, ABC_OBJ_BO );
+ if ( nCiId == -1 )
+ continue;
+ pObjCi = Abc_NtkObj( pNtk, nCiId );
+ assert( !strcmp( Abc_ObjName(pObj), Abc_ObjName(pObjCi) ) );
+ pFanin = Abc_ObjFanin0(pObj);
+ if ( pFanin == pObjCi )
+ continue;
+ assert( Abc_NodeIsBuf(pFanin) );
+ Abc_ObjPatchFanin( pObj, pFanin, pObjCi );
+ if ( Abc_ObjFanoutNum(pFanin) == 0 )
+ Abc_NtkDeleteObj( pFanin );
+ Count++;
+ }
+ if ( Count )
+ printf( "Redirected %d POs from buffers to PIs with the same name.\n", Count );
}