diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-02-13 19:42:11 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-02-13 19:42:11 -0800 |
commit | 8866a1aa6dab27a80ee31cde6d68405d9634a5c2 (patch) | |
tree | 90c2e468c4a462ff35fcca6dcb7e8aceb9d71e87 /src | |
parent | f402293bcdb0aa5a247f8da64b03970a3f7026d3 (diff) | |
download | abc-8866a1aa6dab27a80ee31cde6d68405d9634a5c2.tar.gz abc-8866a1aa6dab27a80ee31cde6d68405d9634a5c2.tar.bz2 abc-8866a1aa6dab27a80ee31cde6d68405d9634a5c2.zip |
Fixing performance problem in 'cone -s'
Diffstat (limited to 'src')
-rw-r--r-- | src/base/abc/abc.h | 1 | ||||
-rw-r--r-- | src/base/abc/abcNtk.c | 26 | ||||
-rw-r--r-- | src/base/abc/abcObj.c | 29 |
3 files changed, 46 insertions, 10 deletions
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h index 3180dac8..eeda95a3 100644 --- a/src/base/abc/abc.h +++ b/src/base/abc/abc.h @@ -727,6 +727,7 @@ extern ABC_DLL Abc_Obj_t * Abc_ObjAlloc( Abc_Ntk_t * pNtk, Abc_ObjType_t extern ABC_DLL void Abc_ObjRecycle( Abc_Obj_t * pObj ); extern ABC_DLL Abc_Obj_t * Abc_NtkCreateObj( Abc_Ntk_t * pNtk, Abc_ObjType_t Type ); extern ABC_DLL void Abc_NtkDeleteObj( Abc_Obj_t * pObj ); +extern ABC_DLL void Abc_NtkDeleteObjPo( Abc_Obj_t * pObj ); extern ABC_DLL void Abc_NtkDeleteObj_rec( Abc_Obj_t * pObj, int fOnlyNodes ); extern ABC_DLL void Abc_NtkDeleteAll_rec( Abc_Obj_t * pObj ); extern ABC_DLL Abc_Obj_t * Abc_NtkDupObj( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj, int fCopyName ); diff --git a/src/base/abc/abcNtk.c b/src/base/abc/abcNtk.c index 761fe49a..7074b975 100644 --- a/src/base/abc/abcNtk.c +++ b/src/base/abc/abcNtk.c @@ -1538,7 +1538,8 @@ void Abc_NtkMakeSeq( Abc_Ntk_t * pNtk, int nLatchesToAdd ) Abc_Ntk_t * Abc_NtkMakeOnePo( Abc_Ntk_t * pNtkInit, int Output, int nRange ) { Abc_Ntk_t * pNtk; - Vec_Ptr_t * vPosToRemove; + Vec_Ptr_t * vPosLeft; + Vec_Ptr_t * vCosLeft; Abc_Obj_t * pNodePo; int i; assert( !Abc_NtkIsNetlist(pNtkInit) ); @@ -1556,17 +1557,22 @@ Abc_Ntk_t * Abc_NtkMakeOnePo( Abc_Ntk_t * pNtkInit, int Output, int nRange ) if ( nRange < 1 ) nRange = 1; - // collect POs to remove - vPosToRemove = Vec_PtrAlloc( 100 ); + // filter POs + vPosLeft = Vec_PtrAlloc( nRange ); Abc_NtkForEachPo( pNtk, pNodePo, i ) if ( i < Output || i >= Output + nRange ) - Vec_PtrPush( vPosToRemove, pNodePo ); - - // remove the POs - Vec_PtrForEachEntry( Abc_Obj_t *, vPosToRemove, pNodePo, i ) - Abc_NtkDeleteObj( pNodePo ); - Vec_PtrFree( vPosToRemove ); - + Abc_NtkDeleteObjPo( pNodePo ); + else + Vec_PtrPush( vPosLeft, pNodePo ); + // filter COs + vCosLeft = Vec_PtrDup( vPosLeft ); + for ( i = Abc_NtkPoNum(pNtk); i < Abc_NtkCoNum(pNtk); i++ ) + Vec_PtrPush( vCosLeft, Abc_NtkCo(pNtk, i) ); + // update arrays + Vec_PtrFree( pNtk->vPos ); pNtk->vPos = vPosLeft; + Vec_PtrFree( pNtk->vCos ); pNtk->vCos = vCosLeft; + + // clean the network if ( Abc_NtkIsStrash(pNtk) ) { Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc ); diff --git a/src/base/abc/abcObj.c b/src/base/abc/abcObj.c index 684e6b65..a2bb0380 100644 --- a/src/base/abc/abcObj.c +++ b/src/base/abc/abcObj.c @@ -230,6 +230,35 @@ void Abc_NtkDeleteObj( Abc_Obj_t * pObj ) /**Function************************************************************* + Synopsis [Deletes the PO from the network.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_NtkDeleteObjPo( Abc_Obj_t * pObj ) +{ + assert( Abc_ObjIsPo(pObj) ); + // remove from the table of names + if ( Nm_ManFindNameById(pObj->pNtk->pManName, pObj->Id) ) + Nm_ManDeleteIdName(pObj->pNtk->pManName, pObj->Id); + // delete fanins + Abc_ObjDeleteFanin( pObj, Abc_ObjFanin0(pObj) ); + // remove from the list of objects + Vec_PtrWriteEntry( pObj->pNtk->vObjs, pObj->Id, NULL ); + pObj->Id = (1<<26)-1; + pObj->pNtk->nObjCounts[pObj->Type]--; + pObj->pNtk->nObjs--; + // recycle the object memory + Abc_ObjRecycle( pObj ); +} + + +/**Function************************************************************* + Synopsis [Deletes the node and MFFC of the node.] Description [] |