Commit 7a3c33e1 by Alan Mishchenko

New hierarchy manager.

parent 5fff8354
...@@ -194,6 +194,7 @@ struct Abc_Ntk_t_ ...@@ -194,6 +194,7 @@ struct Abc_Ntk_t_
short fHieVisited; // flag to mark the visited network short fHieVisited; // flag to mark the visited network
short fHiePath; // flag to mark the network on the path short fHiePath; // flag to mark the network on the path
int Id; // model ID int Id; // model ID
double dTemp; // temporary value
// miscellaneous data members // miscellaneous data members
int nTravIds; // the unique traversal IDs of nodes int nTravIds; // the unique traversal IDs of nodes
Mem_Fixed_t * pMmObj; // memory manager for objects Mem_Fixed_t * pMmObj; // memory manager for objects
......
...@@ -532,7 +532,7 @@ int Abc_NtkCountInst_rec( Abc_Ntk_t * pNtk ) ...@@ -532,7 +532,7 @@ int Abc_NtkCountInst_rec( Abc_Ntk_t * pNtk )
return pNtk->iStep; return pNtk->iStep;
vOrder = Abc_NtkDfsBoxes( pNtk ); vOrder = Abc_NtkDfsBoxes( pNtk );
Vec_PtrForEachEntry( Abc_Obj_t *, vOrder, pObj, i ) 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 ); Counter += Abc_NtkCountInst_rec( (Abc_Ntk_t *)pObj->pData );
Vec_PtrFree( vOrder ); Vec_PtrFree( vOrder );
return pNtk->iStep = 1 + Counter; return pNtk->iStep = 1 + Counter;
...@@ -554,6 +554,50 @@ void Abc_NtkCountInst( Abc_Ntk_t * pNtk ) ...@@ -554,6 +554,50 @@ void Abc_NtkCountInst( Abc_Ntk_t * pNtk )
/**Function************************************************************* /**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.] Synopsis [Checks if there is a recursive definition.]
Description [] Description []
...@@ -626,6 +670,10 @@ Gia_Man_t * Abc_NtkHieCecTest( char * pFileName, int fVerbose ) ...@@ -626,6 +670,10 @@ Gia_Man_t * Abc_NtkHieCecTest( char * pFileName, int fVerbose )
assert( Abc_NtkIsNetlist(pNtk) ); assert( Abc_NtkIsNetlist(pNtk) );
assert( !Abc_NtkLatchNum(pNtk) ); assert( !Abc_NtkLatchNum(pNtk) );
clk = clock();
Abc_NtkCountNodes( pNtk );
Abc_PrintTime( 1, "Count nodes", clock() - clk );
// print stats // print stats
if ( fVerbose ) if ( fVerbose )
Abc_NtkPrintBoxInfo( pNtk ); Abc_NtkPrintBoxInfo( pNtk );
......
...@@ -365,15 +365,9 @@ int Au_NtkAllocObj( Au_Ntk_t * p, int nFanins, int Type ) ...@@ -365,15 +365,9 @@ int Au_NtkAllocObj( Au_Ntk_t * p, int nFanins, int Type )
{ {
Au_Obj_t * pMem, * pObj, * pTemp; Au_Obj_t * pMem, * pObj, * pTemp;
int Id, nObjInt = ((2+nFanins) >> 2) + (((2+nFanins) & 3) > 0); int Id, nObjInt = ((2+nFanins) >> 2) + (((2+nFanins) & 3) > 0);
int nObjIntReal = nObjInt;
if ( nObjInt > 63 ) if ( nObjInt > 63 )
{ nObjInt = 63 + 64 * (((nObjInt-63) >> 6) + (((nObjInt-63) & 63) > 0));
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;
}
if ( Vec_PtrSize(&p->vPages) == 0 || p->iHandle + nObjInt > (1 << 12) ) if ( Vec_PtrSize(&p->vPages) == 0 || p->iHandle + nObjInt > (1 << 12) )
{ {
if ( nObjInt + 64 > (1 << 12) ) if ( nObjInt + 64 > (1 << 12) )
...@@ -421,7 +415,7 @@ int Au_NtkAllocObj( Au_Ntk_t * p, int nFanins, int Type ) ...@@ -421,7 +415,7 @@ int Au_NtkAllocObj( Au_Ntk_t * p, int nFanins, int Type )
Vec_IntPush( &p->vPos, Au_ObjId(pObj) ); Vec_IntPush( &p->vPos, Au_ObjId(pObj) );
} }
p->iHandle += nObjInt; p->iHandle += nObjInt;
p->nUseful += nObjInt; p->nUseful += nObjIntReal;
p->nObjsUsed++; p->nObjsUsed++;
Id = Au_ObjId(pObj); Id = Au_ObjId(pObj);
......
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