From e3116600782bcbb0a4a5efebd743ca9a5de04f6c Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 9 Oct 2012 11:19:58 -0700 Subject: Improvements to gate sizing. --- src/map/scl/scl.c | 22 ++++++++++++++++------ src/map/scl/sclInt.h | 4 ++-- src/map/scl/sclTime.c | 3 +-- src/map/scl/sclUpsize.c | 9 +++++---- 4 files changed, 24 insertions(+), 14 deletions(-) (limited to 'src/map') diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c index dfdc000d..93204c01 100644 --- a/src/map/scl/scl.c +++ b/src/map/scl/scl.c @@ -301,9 +301,10 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv ) int fShowAll = 0; int fUseWireLoads = 1; int fShort = 0; + int fDumpStats = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "cash" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "casdh" ) ) != EOF ) { switch ( c ) { @@ -316,6 +317,9 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv ) case 's': fShort ^= 1; break; + case 'd': + fDumpStats ^= 1; + break; case 'h': goto usage; default: @@ -344,15 +348,16 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv ) return 1; } - Abc_SclTimePerform( (SC_Lib *)pAbc->pLibScl, Abc_FrameReadNtk(pAbc), fUseWireLoads, fShowAll, fShort ); + Abc_SclTimePerform( (SC_Lib *)pAbc->pLibScl, Abc_FrameReadNtk(pAbc), fUseWireLoads, fShowAll, fShort, fDumpStats ); return 0; usage: - fprintf( pAbc->Err, "usage: stime [-cash]\n" ); + fprintf( pAbc->Err, "usage: stime [-casdh]\n" ); fprintf( pAbc->Err, "\t performs STA using Liberty library\n" ); fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", fUseWireLoads? "yes": "no" ); fprintf( pAbc->Err, "\t-a : display timing information for all nodes [default = %s]\n", fShowAll? "yes": "no" ); fprintf( pAbc->Err, "\t-s : display timing information without critical path [default = %s]\n", fShort? "yes": "no" ); + fprintf( pAbc->Err, "\t-d : toggle dumping statistics into a file [default = %s]\n", fDumpStats? "yes": "no" ); fprintf( pAbc->Err, "\t-h : print the help massage\n" ); return 1; } @@ -649,10 +654,11 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv ) int Ratio = 10; int Notches = 10; int TimeOut = 0; + int fDumpStats = 0; int c, fVerbose = 0; int fVeryVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "IWRNTvwh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "IWRNTdvwh" ) ) != EOF ) { switch ( c ) { @@ -711,6 +717,9 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv ) if ( TimeOut < 0 ) goto usage; break; + case 'd': + fDumpStats ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -745,17 +754,18 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv ) return 1; } - Abc_SclUpsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, nIters, Window, Ratio, Notches, TimeOut, fVerbose, fVeryVerbose ); + Abc_SclUpsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, nIters, Window, Ratio, Notches, TimeOut, fDumpStats, fVerbose, fVeryVerbose ); return 0; usage: - fprintf( pAbc->Err, "usage: upsize [-IWRNT num] [-vwh]\n" ); + fprintf( pAbc->Err, "usage: upsize [-IWRNT num] [-dvwh]\n" ); fprintf( pAbc->Err, "\t selectively increases gate sizes in timing-critical regions\n" ); fprintf( pAbc->Err, "\t-I : the number of upsizing iterations to perform [default = %d]\n", nIters ); fprintf( pAbc->Err, "\t-W : delay window (in percents) of near-critical COs [default = %d]\n", Window ); fprintf( pAbc->Err, "\t-R : ratio of critical nodes (in percents) to update [default = %d]\n", Ratio ); fprintf( pAbc->Err, "\t-N : limit on discrete upsizing steps at a node [default = %d]\n", Notches ); fprintf( pAbc->Err, "\t-T : approximate timeout in seconds [default = %d]\n", TimeOut ); + fprintf( pAbc->Err, "\t-d : toggle dumping statistics into a file [default = %s]\n", fDumpStats? "yes": "no" ); fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); fprintf( pAbc->Err, "\t-w : toggle printing more verbose information [default = %s]\n", fVeryVerbose? "yes": "no" ); fprintf( pAbc->Err, "\t-h : print the command usage\n"); diff --git a/src/map/scl/sclInt.h b/src/map/scl/sclInt.h index e65d1702..79938c94 100644 --- a/src/map/scl/sclInt.h +++ b/src/map/scl/sclInt.h @@ -435,11 +435,11 @@ extern void Abc_SclSave( char * pFileName, SC_Lib * pScl ); /*=== sclLoad.c ===============================================================*/ extern SC_WireLoad * Abc_SclFindWireLoadModel( SC_Lib * p, float Area ); /*=== sclTime.c ===============================================================*/ -extern void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, int fShowAll, int fShort ); +extern void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, int fShowAll, int fShort, int fDumpStats ); /*=== sclSize.c ===============================================================*/ extern void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * p ); /*=== sclUpsize.c ===============================================================*/ -extern void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nIters, int Window, int Ratio, int Notches, int TimeOut, int fVerbose, int fVeryVerbose ); +extern void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nIters, int Window, int Ratio, int Notches, int TimeOut, int fDumpStats, int fVerbose, int fVeryVerbose ); /*=== sclUtil.c ===============================================================*/ extern void Abc_SclHashCells( SC_Lib * p ); extern int Abc_SclCellFind( SC_Lib * p, char * pName ); diff --git a/src/map/scl/sclTime.c b/src/map/scl/sclTime.c index c684c2df..7b27a9d0 100644 --- a/src/map/scl/sclTime.c +++ b/src/map/scl/sclTime.c @@ -334,9 +334,8 @@ SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads ) SeeAlso [] ***********************************************************************/ -void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, int fShowAll, int fShort ) +void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, int fShowAll, int fShort, int fDumpStats ) { - int fDumpStats = 0; SC_Man * p; p = Abc_SclManStart( pLib, pNtk, fUseWireLoads ); Abc_SclTimeNtkPrint( p, fShowAll, fShort ); diff --git a/src/map/scl/sclUpsize.c b/src/map/scl/sclUpsize.c index 4ad26c84..5fbbe819 100644 --- a/src/map/scl/sclUpsize.c +++ b/src/map/scl/sclUpsize.c @@ -155,8 +155,8 @@ Vec_Int_t * Abc_SclFindCriticalNodeWindow( SC_Man * p, Vec_Int_t * vPathCos, int Abc_NtkForEachObjVec( vPathCos, p->pNtk, pObj, i ) { float fSlackThis = fSlack - (fMaxArr - Abc_SclObjTimeMax(p, pObj)); - assert( fSlackThis >= 0 ); - Abc_SclFindCriticalNodeWindow_rec( p, Abc_ObjFanin0(pObj), vPath, fSlackThis ); + if ( fSlackThis >= 0 ) + Abc_SclFindCriticalNodeWindow_rec( p, Abc_ObjFanin0(pObj), vPath, fSlackThis ); } // label critical nodes Abc_NtkForEachObjVec( vPathCos, p->pNtk, pObj, i ) @@ -452,7 +452,7 @@ void Abc_SclUpsizePrint( SC_Man * p, int Iter, int win, int nPathPos, int nPathN SeeAlso [] ***********************************************************************/ -void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nIters, int Window, int Ratio, int Notches, int TimeOut, int fVerbose, int fVeryVerbose ) +void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nIters, int Window, int Ratio, int Notches, int TimeOut, int fDumpStats, int fVerbose, int fVeryVerbose ) { SC_Man * p; Vec_Int_t * vPathPos; // critical POs @@ -550,7 +550,8 @@ 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 ); + if ( fDumpStats ) + 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