Commit 8866a1aa by Alan Mishchenko

Fixing performance problem in 'cone -s'

parent f402293b
...@@ -727,6 +727,7 @@ extern ABC_DLL Abc_Obj_t * Abc_ObjAlloc( Abc_Ntk_t * pNtk, Abc_ObjType_t ...@@ -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 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 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_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_NtkDeleteObj_rec( Abc_Obj_t * pObj, int fOnlyNodes );
extern ABC_DLL void Abc_NtkDeleteAll_rec( Abc_Obj_t * pObj ); 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 ); extern ABC_DLL Abc_Obj_t * Abc_NtkDupObj( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj, int fCopyName );
......
...@@ -1538,7 +1538,8 @@ void Abc_NtkMakeSeq( Abc_Ntk_t * pNtk, int nLatchesToAdd ) ...@@ -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 * Abc_NtkMakeOnePo( Abc_Ntk_t * pNtkInit, int Output, int nRange )
{ {
Abc_Ntk_t * pNtk; Abc_Ntk_t * pNtk;
Vec_Ptr_t * vPosToRemove; Vec_Ptr_t * vPosLeft;
Vec_Ptr_t * vCosLeft;
Abc_Obj_t * pNodePo; Abc_Obj_t * pNodePo;
int i; int i;
assert( !Abc_NtkIsNetlist(pNtkInit) ); assert( !Abc_NtkIsNetlist(pNtkInit) );
...@@ -1556,17 +1557,22 @@ Abc_Ntk_t * Abc_NtkMakeOnePo( Abc_Ntk_t * pNtkInit, int Output, int nRange ) ...@@ -1556,17 +1557,22 @@ Abc_Ntk_t * Abc_NtkMakeOnePo( Abc_Ntk_t * pNtkInit, int Output, int nRange )
if ( nRange < 1 ) if ( nRange < 1 )
nRange = 1; nRange = 1;
// collect POs to remove // filter POs
vPosToRemove = Vec_PtrAlloc( 100 ); vPosLeft = Vec_PtrAlloc( nRange );
Abc_NtkForEachPo( pNtk, pNodePo, i ) Abc_NtkForEachPo( pNtk, pNodePo, i )
if ( i < Output || i >= Output + nRange ) if ( i < Output || i >= Output + nRange )
Vec_PtrPush( vPosToRemove, pNodePo ); Abc_NtkDeleteObjPo( pNodePo );
else
// remove the POs Vec_PtrPush( vPosLeft, pNodePo );
Vec_PtrForEachEntry( Abc_Obj_t *, vPosToRemove, pNodePo, i ) // filter COs
Abc_NtkDeleteObj( pNodePo ); vCosLeft = Vec_PtrDup( vPosLeft );
Vec_PtrFree( vPosToRemove ); 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) ) if ( Abc_NtkIsStrash(pNtk) )
{ {
Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc ); Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc );
......
...@@ -230,6 +230,35 @@ void Abc_NtkDeleteObj( Abc_Obj_t * pObj ) ...@@ -230,6 +230,35 @@ void Abc_NtkDeleteObj( Abc_Obj_t * pObj )
/**Function************************************************************* /**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.] Synopsis [Deletes the node and MFFC of the node.]
Description [] Description []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment