diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2012-10-09 14:27:49 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2012-10-09 14:27:49 -0700 |
commit | 513dc14a1a8af1aa97aa9dfdd420f75246d5302c (patch) | |
tree | 76ac2e71474bcf8bcc7f17d220e10592a09c4a6f /src | |
parent | d3595d230f51c4208c56a62fa309e2f7861598fc (diff) | |
download | abc-513dc14a1a8af1aa97aa9dfdd420f75246d5302c.tar.gz abc-513dc14a1a8af1aa97aa9dfdd420f75246d5302c.tar.bz2 abc-513dc14a1a8af1aa97aa9dfdd420f75246d5302c.zip |
Improvements to gate-sizing.
Diffstat (limited to 'src')
-rw-r--r-- | src/map/scl/scl.c | 21 | ||||
-rw-r--r-- | src/map/scl/sclInt.h | 2 | ||||
-rw-r--r-- | src/map/scl/sclUpsize.c | 13 |
3 files changed, 27 insertions, 9 deletions
diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c index 93204c01..fb11311f 100644 --- a/src/map/scl/scl.c +++ b/src/map/scl/scl.c @@ -649,7 +649,8 @@ usage: int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); - int nIters = 300; + int nIters = 1000; + int nIterNoChange = 50; int Window = 2; int Ratio = 10; int Notches = 10; @@ -658,7 +659,7 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv ) int c, fVerbose = 0; int fVeryVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "IWRNTdvwh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "IJWRNTdvwh" ) ) != EOF ) { switch ( c ) { @@ -668,6 +669,17 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv ) Abc_Print( -1, "Command line switch \"-I\" should be followed by a positive integer.\n" ); goto usage; } + nIterNoChange = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nIterNoChange < 0 ) + goto usage; + break; + case 'J': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-J\" should be followed by a positive integer.\n" ); + goto usage; + } nIters = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nIters < 0 ) @@ -754,13 +766,14 @@ 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, fDumpStats, fVerbose, fVeryVerbose ); + Abc_SclUpsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, nIters, nIterNoChange, Window, Ratio, Notches, TimeOut, fDumpStats, fVerbose, fVeryVerbose ); return 0; usage: - fprintf( pAbc->Err, "usage: upsize [-IWRNT num] [-dvwh]\n" ); + fprintf( pAbc->Err, "usage: upsize [-IJWRNT num] [-dvwh]\n" ); fprintf( pAbc->Err, "\t selectively increases gate sizes in timing-critical regions\n" ); fprintf( pAbc->Err, "\t-I <num> : the number of upsizing iterations to perform [default = %d]\n", nIters ); + fprintf( pAbc->Err, "\t-J <num> : the number of iterations without improvement [default = %d]\n", nIterNoChange ); fprintf( pAbc->Err, "\t-W <num> : delay window (in percents) of near-critical COs [default = %d]\n", Window ); fprintf( pAbc->Err, "\t-R <num> : ratio of critical nodes (in percents) to update [default = %d]\n", Ratio ); fprintf( pAbc->Err, "\t-N <num> : limit on discrete upsizing steps at a node [default = %d]\n", Notches ); diff --git a/src/map/scl/sclInt.h b/src/map/scl/sclInt.h index 79938c94..da997d98 100644 --- a/src/map/scl/sclInt.h +++ b/src/map/scl/sclInt.h @@ -439,7 +439,7 @@ extern void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fU /*=== 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 fDumpStats, int fVerbose, int fVeryVerbose ); +extern void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nIters, int nIterNoChange, 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/sclUpsize.c b/src/map/scl/sclUpsize.c index 5216ed22..c8010651 100644 --- a/src/map/scl/sclUpsize.c +++ b/src/map/scl/sclUpsize.c @@ -437,8 +437,8 @@ void Abc_SclUpsizePrint( SC_Man * p, int Iter, int win, int nPathPos, int nPathN printf( "(%+5.1f %%) ", 100.0 * (p->MaxDelay - p->MaxDelay0)/ p->MaxDelay0 ); printf( "A: " ); printf( "%.2f ", p->SumArea ); - printf( "(%+5.1f %%) ", 100.0 * (p->SumArea - p->SumArea0)/ p->SumArea0 ); - ABC_PRTn( "T", clock() - p->timeTotal ); + printf( "(%+5.1f %%)", 100.0 * (p->SumArea - p->SumArea0)/ p->SumArea0 ); + printf( "%8.2f", 1.0*(clock() - p->timeTotal)/(CLOCKS_PER_SEC) ); printf( " " ); printf( "%c", fVerbose ? '\n' : '\r' ); } @@ -454,13 +454,13 @@ 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 fDumpStats, int fVerbose, int fVeryVerbose ) +void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nIters, int nIterNoChange, int Window, int Ratio, int Notches, int TimeOut, int fDumpStats, int fVerbose, int fVeryVerbose ) { SC_Man * p; Vec_Int_t * vPathPos = NULL; // critical POs Vec_Int_t * vPathNodes = NULL; // critical nodes and PIs Vec_Int_t * vTFO; - int i, win, nUpsizes = -1; + int i, win, nUpsizes = -1, nFramesNoChange = 0; int nAllPos, nAllNodes, nAllTfos, nAllUpsizes; clock_t clk; @@ -525,7 +525,12 @@ void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nIters, int Wind { p->BestDelay = p->MaxDelay; Abc_SclApplyUpdateToBest( p->vGates, p->vGatesBest, p->vUpdates ); + nFramesNoChange = 0; } + else + nFramesNoChange++; + if ( nFramesNoChange > nIterNoChange ) + break; // report and cleanup Abc_SclUpsizePrint( p, i, win, Vec_IntSize(vPathPos), Vec_IntSize(vPathNodes), nUpsizes, Vec_IntSize(vTFO), fVeryVerbose ); //|| (i == nIters-1) ); |