diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2012-01-13 22:49:08 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2012-01-13 22:49:08 -0800 |
commit | 7a3c33e169ec6645589055fe7cd3e534e49d69e0 (patch) | |
tree | 2ad39f999b9448b11e4c028cc20b79b7b164474d /src/base | |
parent | 5fff8354ce305b5873ef69659d5ac01834d14bad (diff) | |
download | abc-7a3c33e169ec6645589055fe7cd3e534e49d69e0.tar.gz abc-7a3c33e169ec6645589055fe7cd3e534e49d69e0.tar.bz2 abc-7a3c33e169ec6645589055fe7cd3e534e49d69e0.zip |
New hierarchy manager.
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/abc/abc.h | 1 | ||||
-rw-r--r-- | src/base/abc/abcHieCec.c | 50 | ||||
-rw-r--r-- | src/base/abc/abcHieNew.c | 12 |
3 files changed, 53 insertions, 10 deletions
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h index 8df9ea70..ad68b5ae 100644 --- a/src/base/abc/abc.h +++ b/src/base/abc/abc.h @@ -194,6 +194,7 @@ struct Abc_Ntk_t_ short fHieVisited; // flag to mark the visited network short fHiePath; // flag to mark the network on the path int Id; // model ID + double dTemp; // temporary value // miscellaneous data members int nTravIds; // the unique traversal IDs of nodes Mem_Fixed_t * pMmObj; // memory manager for objects diff --git a/src/base/abc/abcHieCec.c b/src/base/abc/abcHieCec.c index f882f9cf..3cf59fb8 100644 --- a/src/base/abc/abcHieCec.c +++ b/src/base/abc/abcHieCec.c @@ -532,7 +532,7 @@ int Abc_NtkCountInst_rec( Abc_Ntk_t * pNtk ) return pNtk->iStep; vOrder = Abc_NtkDfsBoxes( pNtk ); Vec_PtrForEachEntry( Abc_Obj_t *, vOrder, pObj, i ) - if ( Abc_ObjIsBox(pObj) ) + if ( Abc_ObjIsBox(pObj) && (Abc_Ntk_t *)pObj->pData != pNtk ) Counter += Abc_NtkCountInst_rec( (Abc_Ntk_t *)pObj->pData ); Vec_PtrFree( vOrder ); return pNtk->iStep = 1 + Counter; @@ -554,6 +554,50 @@ void Abc_NtkCountInst( Abc_Ntk_t * pNtk ) /**Function************************************************************* + Synopsis [Counts the number of nodes.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +double Abc_NtkCountNodes_rec( Abc_Ntk_t * pNtk ) +{ + Vec_Ptr_t * vOrder; + Abc_Obj_t * pObj; + double Counter = 0; + int i; + if ( pNtk->dTemp >= 0 ) + return pNtk->dTemp; + vOrder = Abc_NtkDfsBoxes( pNtk ); + Vec_PtrForEachEntry( Abc_Obj_t *, vOrder, pObj, i ) + if ( Abc_ObjIsNode(pObj) ) + Counter++; + else if ( Abc_ObjIsBox(pObj) && (Abc_Ntk_t *)pObj->pData != pNtk ) + Counter += Abc_NtkCountNodes_rec( (Abc_Ntk_t *)pObj->pData ); + Vec_PtrFree( vOrder ); + return pNtk->dTemp = Counter; +} + +void Abc_NtkCountNodes( Abc_Ntk_t * pNtk ) +{ + Vec_Ptr_t * vMods; + Abc_Ntk_t * pModel; + double Counter; + int i; + + vMods = pNtk->pDesign->vModules; + Vec_PtrForEachEntry( Abc_Ntk_t *, vMods, pModel, i ) + pModel->dTemp = -1; + + Counter = Abc_NtkCountNodes_rec( pNtk ); + printf( "Nodes = %.0f\n", Counter ); +} + +/**Function************************************************************* + Synopsis [Checks if there is a recursive definition.] Description [] @@ -626,6 +670,10 @@ Gia_Man_t * Abc_NtkHieCecTest( char * pFileName, int fVerbose ) assert( Abc_NtkIsNetlist(pNtk) ); assert( !Abc_NtkLatchNum(pNtk) ); + clk = clock(); + Abc_NtkCountNodes( pNtk ); + Abc_PrintTime( 1, "Count nodes", clock() - clk ); + // print stats if ( fVerbose ) Abc_NtkPrintBoxInfo( pNtk ); diff --git a/src/base/abc/abcHieNew.c b/src/base/abc/abcHieNew.c index 00aaa39d..967faaee 100644 --- a/src/base/abc/abcHieNew.c +++ b/src/base/abc/abcHieNew.c @@ -365,15 +365,9 @@ int Au_NtkAllocObj( Au_Ntk_t * p, int nFanins, int Type ) { Au_Obj_t * pMem, * pObj, * pTemp; int Id, nObjInt = ((2+nFanins) >> 2) + (((2+nFanins) & 3) > 0); + int nObjIntReal = nObjInt; if ( nObjInt > 63 ) - { - int nObjInt2 = 63 + 64 * (((nObjInt-63) >> 6) + (((nObjInt-63) & 63) > 0)); - assert( nObjInt2 >= nObjInt ); -// if ( nObjInt2 + 64 < (1 << 12) ) -// p->nUseful += nObjInt - nObjInt2; - nObjInt = nObjInt2; - } - + nObjInt = 63 + 64 * (((nObjInt-63) >> 6) + (((nObjInt-63) & 63) > 0)); if ( Vec_PtrSize(&p->vPages) == 0 || p->iHandle + nObjInt > (1 << 12) ) { if ( nObjInt + 64 > (1 << 12) ) @@ -421,7 +415,7 @@ int Au_NtkAllocObj( Au_Ntk_t * p, int nFanins, int Type ) Vec_IntPush( &p->vPos, Au_ObjId(pObj) ); } p->iHandle += nObjInt; - p->nUseful += nObjInt; + p->nUseful += nObjIntReal; p->nObjsUsed++; Id = Au_ObjId(pObj); |