From 8e753fc376426531f45a26d4b674942d8dd063a0 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 9 Oct 2012 11:00:18 -0700 Subject: Improvements to gate sizing. --- src/map/scl/sclMan.h | 26 ++++++++++++++++++++++++++ src/map/scl/sclTime.c | 3 +++ src/map/scl/sclUpsize.c | 12 ++++++------ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/map/scl/sclMan.h b/src/map/scl/sclMan.h index b1192bdd..c8fb2ebd 100644 --- a/src/map/scl/sclMan.h +++ b/src/map/scl/sclMan.h @@ -321,6 +321,32 @@ static inline SC_Cell * Abc_SclObjResiable( SC_Man * p, Abc_Obj_t * pObj, int fU return pOld->pPrev->Order < pOld->Order ? pOld->pPrev : NULL; } +/**Function************************************************************* + + Synopsis [Dumps timing results into a file.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline void Abc_SclDumpStats( SC_Man * p, char * pFileName, clock_t Time ) +{ + FILE * pTable; + pTable = fopen( pFileName, "a+" ); + fprintf( pTable, "%s ", p->pNtk->pName ); + fprintf( pTable, "%d ", Abc_NtkPiNum(p->pNtk) ); + fprintf( pTable, "%d ", Abc_NtkPoNum(p->pNtk) ); + fprintf( pTable, "%d ", Abc_NtkNodeNum(p->pNtk) ); + fprintf( pTable, "%d ", (int)p->SumArea0 ); + fprintf( pTable, "%d ", (int)p->MaxDelay0 ); + fprintf( pTable, "%.2f ", 1.0*Time/CLOCKS_PER_SEC ); + fprintf( pTable, "\n" ); + fclose( pTable ); +} + /*=== sclTime.c =============================================================*/ extern Abc_Obj_t * Abc_SclFindCriticalCo( SC_Man * p, int * pfRise ); diff --git a/src/map/scl/sclTime.c b/src/map/scl/sclTime.c index 261e8c75..c684c2df 100644 --- a/src/map/scl/sclTime.c +++ b/src/map/scl/sclTime.c @@ -336,9 +336,12 @@ SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads ) ***********************************************************************/ void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, int fShowAll, int fShort ) { + int fDumpStats = 0; SC_Man * p; p = Abc_SclManStart( pLib, pNtk, fUseWireLoads ); Abc_SclTimeNtkPrint( p, fShowAll, fShort ); + if ( fDumpStats ) + Abc_SclDumpStats( p, "stats.txt", 0 ); Abc_SclManFree( p ); } diff --git a/src/map/scl/sclUpsize.c b/src/map/scl/sclUpsize.c index 270d928d..4ad26c84 100644 --- a/src/map/scl/sclUpsize.c +++ b/src/map/scl/sclUpsize.c @@ -436,10 +436,9 @@ void Abc_SclUpsizePrint( SC_Man * p, int Iter, int win, int nPathPos, int nPathN printf( "A: " ); printf( "%.2f ", p->SumArea ); printf( "(%+5.1f %%) ", 100.0 * (p->SumArea - p->SumArea0)/ p->SumArea0 ); - if ( fVerbose ) - ABC_PRT( "T", clock() - p->timeTotal ); - else - ABC_PRTr( "T", clock() - p->timeTotal ); + ABC_PRTn( "T", clock() - p->timeTotal ); + printf( " " ); + printf( "%c", fVerbose ? '\n' : '\r' ); } /**Function************************************************************* @@ -538,12 +537,12 @@ void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nIters, int Wind } // update for best gates and recompute timing ABC_SWAP( Vec_Int_t *, p->vGatesBest, p->vGates ); + Abc_SclTimeNtkRecompute( p, &p->SumArea, &p->MaxDelay, 0 ); + p->timeTotal = clock() - p->timeTotal; if ( fVerbose ) { - Abc_SclTimeNtkRecompute( p, &p->SumArea, &p->MaxDelay, 0 ); Abc_SclUpsizePrint( p, i, Window, nAllPos/i, nAllNodes/i, nAllUpsizes/i, nAllTfos/i, 1 ); // report runtime - p->timeTotal = clock() - p->timeTotal; p->timeOther = p->timeTotal - p->timeCone - p->timeSize - p->timeTime; ABC_PRTP( "Runtime: Critical path", p->timeCone, p->timeTotal ); ABC_PRTP( "Runtime: Sizing eval ", p->timeSize, p->timeTotal ); @@ -551,6 +550,7 @@ void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nIters, int Wind ABC_PRTP( "Runtime: Other ", p->timeOther, p->timeTotal ); ABC_PRTP( "Runtime: TOTAL ", p->timeTotal, p->timeTotal ); } +// Abc_SclDumpStats( p, "stats2.txt", p->timeTotal ); // save the result and quit Abc_SclManSetGates( pLib, pNtk, p->vGates ); // updates gate pointers -- cgit v1.2.3