diff options
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/abc/abc.h | 2 | ||||
-rw-r--r-- | src/base/abc/abcHie.c | 2 | ||||
-rw-r--r-- | src/base/abc/abcNames.c | 44 | ||||
-rw-r--r-- | src/base/abci/abc.c | 14 | ||||
-rw-r--r-- | src/base/abci/abcMini.c | 2 | ||||
-rw-r--r-- | src/base/abci/abcPrint.c | 34 | ||||
-rw-r--r-- | src/base/main/mainInt.h | 1 |
7 files changed, 81 insertions, 18 deletions
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h index bce318a5..727e492e 100644 --- a/src/base/abc/abc.h +++ b/src/base/abc/abc.h @@ -813,7 +813,7 @@ extern ABC_DLL void Abc_NtkDontCareFree( Odc_Man_t * p ); extern ABC_DLL int Abc_NtkDontCareCompute( Odc_Man_t * p, Abc_Obj_t * pNode, Vec_Ptr_t * vLeaves, unsigned * puTruth ); /*=== abcPrint.c ==========================================================*/ extern ABC_DLL float Abc_NtkMfsTotalSwitching( Abc_Ntk_t * pNtk ); -extern ABC_DLL void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf ); +extern ABC_DLL void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf, int fPrintMem ); extern ABC_DLL void Abc_NtkPrintIo( FILE * pFile, Abc_Ntk_t * pNtk, int fPrintFlops ); extern ABC_DLL void Abc_NtkPrintLatch( FILE * pFile, Abc_Ntk_t * pNtk ); extern ABC_DLL void Abc_NtkPrintFanio( FILE * pFile, Abc_Ntk_t * pNtk, int fUsePis ); diff --git a/src/base/abc/abcHie.c b/src/base/abc/abcHie.c index c27b0bd3..8397301f 100644 --- a/src/base/abc/abcHie.c +++ b/src/base/abc/abcHie.c @@ -470,7 +470,7 @@ void Abc_NtkPrintBoxInfo( Abc_Ntk_t * pNtk ) Vec_IntAddToEntry( vCounts, Num, 1 ); } -// Abc_NtkPrintStats( pModel, 0, 0, 0, 0, 0, 0, 0, 0 ); +// Abc_NtkPrintStats( pModel, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); printf( "MODULE " ); printf( "%-30s : ", Abc_NtkName(pModel) ); printf( "PI=%6d ", Abc_NtkPiNum(pModel) ); diff --git a/src/base/abc/abcNames.c b/src/base/abc/abcNames.c index 27bd924a..b32093e9 100644 --- a/src/base/abc/abcNames.c +++ b/src/base/abc/abcNames.c @@ -355,6 +355,39 @@ void Abc_NtkOrderObjsByName( Abc_Ntk_t * pNtk, int fComb ) /**Function************************************************************* + Synopsis [Creates name manager storing input/output names.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Abc_Nam_t * Abc_NtkNameMan( Abc_Ntk_t * p, int fOuts ) +{ + if ( fOuts ) + { + Abc_Obj_t * pObj; int i; + Abc_Nam_t * pStrsCo = Abc_NamStart( Abc_NtkCoNum(p), 24 ); + Abc_NtkForEachCo( p, pObj, i ) + Abc_NamStrFindOrAdd( pStrsCo, Abc_ObjName(pObj), NULL ); + assert( Abc_NamObjNumMax(pStrsCo) == i + 1 ); + return pStrsCo; + } + else + { + Abc_Obj_t * pObj; int i; + Abc_Nam_t * pStrsCi = Abc_NamStart( Abc_NtkCiNum(p), 24 ); + Abc_NtkForEachCi( p, pObj, i ) + Abc_NamStrFindOrAdd( pStrsCi, Abc_ObjName(pObj), NULL ); + assert( Abc_NamObjNumMax(pStrsCi) == i + 1 ); + return pStrsCi; + } +} + +/**Function************************************************************* + Synopsis [Orders PIs/POs/latches alphabetically.] Description [] @@ -376,18 +409,11 @@ int Abc_NodeCompareIndexes( Abc_Obj_t ** pp1, Abc_Obj_t ** pp2 ) void Abc_NtkTransferOrder( Abc_Ntk_t * pNtkOld, Abc_Ntk_t * pNtkNew ) { Abc_Obj_t * pObj; int i; - Abc_Nam_t * pStrsCi = Abc_NamStart( Abc_NtkCiNum(pNtkOld), 24 ); - Abc_Nam_t * pStrsCo = Abc_NamStart( Abc_NtkCoNum(pNtkOld), 24 ); + Abc_Nam_t * pStrsCi = Abc_NtkNameMan( pNtkOld, 0 ); + Abc_Nam_t * pStrsCo = Abc_NtkNameMan( pNtkOld, 1 ); assert( Abc_NtkPiNum(pNtkOld) == Abc_NtkPiNum(pNtkNew) ); assert( Abc_NtkPoNum(pNtkOld) == Abc_NtkPoNum(pNtkNew) ); assert( Abc_NtkLatchNum(pNtkOld) == Abc_NtkLatchNum(pNtkNew) ); - // save IDs of the names - Abc_NtkForEachCi( pNtkOld, pObj, i ) - Abc_NamStrFindOrAdd( pStrsCi, Abc_ObjName(pObj), NULL ); - assert( Abc_NamObjNumMax(pStrsCi) == i + 1 ); - Abc_NtkForEachCo( pNtkOld, pObj, i ) - Abc_NamStrFindOrAdd( pStrsCo, Abc_ObjName(pObj), NULL ); - assert( Abc_NamObjNumMax(pStrsCo) == i + 1 ); // transfer to the new network Abc_NtkForEachCi( pNtkNew, pObj, i ) { diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 1482dc8c..18427583 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -1184,6 +1184,7 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) int fPower; int fGlitch; int fSkipBuf; + int fPrintMem; int c; pNtk = Abc_FrameReadNtk(pAbc); @@ -1198,8 +1199,9 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) fPower = 0; fGlitch = 0; fSkipBuf = 0; + fPrintMem = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "fbdltmpgsh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "fbdltmpgsuh" ) ) != EOF ) { switch ( c ) { @@ -1230,6 +1232,9 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) case 's': fSkipBuf ^= 1; break; + case 'u': + fPrintMem ^= 1; + break; case 'h': goto usage; default: @@ -1247,7 +1252,7 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -1, "Cannot print LUT delay for a non-logic network.\n" ); return 1; } - Abc_NtkPrintStats( pNtk, fFactor, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf ); + Abc_NtkPrintStats( pNtk, fFactor, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf, fPrintMem ); if ( fPrintTime ) { pAbc->TimeTotal += pAbc->TimeCommand; @@ -1257,7 +1262,7 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - Abc_Print( -2, "usage: print_stats [-fbdltmpgsh]\n" ); + Abc_Print( -2, "usage: print_stats [-fbdltmpgsuh]\n" ); Abc_Print( -2, "\t prints the network statistics\n" ); Abc_Print( -2, "\t-f : toggles printing the literal count in the factored forms [default = %s]\n", fFactor? "yes": "no" ); Abc_Print( -2, "\t-b : toggles saving the best logic network in \"best.blif\" [default = %s]\n", fSaveBest? "yes": "no" ); @@ -1268,6 +1273,7 @@ usage: Abc_Print( -2, "\t-p : toggles printing power dissipation due to switching [default = %s]\n", fPower? "yes": "no" ); Abc_Print( -2, "\t-g : toggles printing percentage of increased power due to glitching [default = %s]\n", fGlitch? "yes": "no" ); Abc_Print( -2, "\t-s : toggles not counting single-output nodes as nodes [default = %s]\n", fSkipBuf? "yes": "no" ); + Abc_Print( -2, "\t-u : toggles printing memory usage [default = %s]\n", fPrintMem? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -1348,7 +1354,7 @@ int Abc_CommandPrintExdc( Abc_Frame_t * pAbc, int argc, char ** argv ) } else Abc_Print( 1, "EXDC network statistics: \n" ); - Abc_NtkPrintStats( pNtk->pExdc, 0, 0, 0, 0, 0, 0, 0, 0 ); + Abc_NtkPrintStats( pNtk->pExdc, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); return 0; usage: diff --git a/src/base/abci/abcMini.c b/src/base/abci/abcMini.c index c8f3bca5..8f9e48fe 100644 --- a/src/base/abci/abcMini.c +++ b/src/base/abci/abcMini.c @@ -195,7 +195,7 @@ void Abc_NtkMiniAigTest( Abc_Ntk_t * pNtk ) p = Abc_NtkToMiniAig( pNtk ); pNtkNew = Abc_NtkFromMiniAig( p ); Mini_AigStop( p ); - Abc_NtkPrintStats( pNtkNew, 0, 0, 0, 0, 0, 0, 0, 0 ); + Abc_NtkPrintStats( pNtkNew, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); Abc_NtkDelete( pNtkNew ); // test dumping diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c index 3d2c2551..2d60c730 100644 --- a/src/base/abci/abcPrint.c +++ b/src/base/abci/abcPrint.c @@ -123,6 +123,34 @@ int Abc_NtkCompareAndSaveBest( Abc_Ntk_t * pNtk ) /**Function************************************************************* + Synopsis [Collects memory usage.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +double Abc_NtkMemory( Abc_Ntk_t * p ) +{ + Abc_Obj_t * pObj; int i; + double Memory = sizeof(Abc_Ntk_t); + Memory += sizeof(Abc_Obj_t) * Abc_NtkObjNum(p); + Memory += Vec_PtrMemory(p->vPis); + Memory += Vec_PtrMemory(p->vPos); + Memory += Vec_PtrMemory(p->vCis); + Memory += Vec_PtrMemory(p->vCos); + Memory += Vec_PtrMemory(p->vObjs); + Memory += Vec_IntMemory(&p->vTravIds); + Memory += Vec_IntMemory(p->vLevelsR); + Abc_NtkForEachObj( p, pObj, i ) + Memory += sizeof(int) * (Vec_IntCap(&pObj->vFanins) + Vec_IntCap(&pObj->vFanouts)); + return Memory; +} + +/**Function************************************************************* + Synopsis [Marks nodes for power-optimization.] Description [] @@ -207,7 +235,7 @@ float Abc_NtkGetArea( Abc_Ntk_t * pNtk ) SeeAlso [] ***********************************************************************/ -void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf ) +void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf, int fPrintMem ) { int nSingles = fSkipBuf ? Abc_NtkGetBufNum(pNtk) : 0; if ( fPrintMuxes && Abc_NtkIsStrash(pNtk) ) @@ -329,6 +357,8 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum else printf( "\nCurrently computes glitching only for K-LUT networks with K <= 6." ); } + if ( fPrintMem ) + Abc_Print( 1," mem =%5.2f MB", Abc_NtkMemory(pNtk)/(1<<20) ); Abc_Print( 1,"\n" ); // print the statistic into a file @@ -425,7 +455,7 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum fflush( stdout ); if ( pNtk->pExdc ) - Abc_NtkPrintStats( pNtk->pExdc, fFactored, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf ); + Abc_NtkPrintStats( pNtk->pExdc, fFactored, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf, fPrintMem ); } /**Function************************************************************* diff --git a/src/base/main/mainInt.h b/src/base/main/mainInt.h index 369b46f1..c1b687bc 100644 --- a/src/base/main/mainInt.h +++ b/src/base/main/mainInt.h @@ -94,6 +94,7 @@ struct Abc_Frame_t_ void * pLibGen2; // the current genlib void * pLibSuper; // the current supergate library void * pLibScl; // the current Liberty library + void * pAbcCon; // constraint manager // timing constraints char * pDrivingCell; // name of the driving cell float MaxLoad; // maximum output load |