summaryrefslogtreecommitdiffstats
path: root/src/map/scl/scl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/scl/scl.c')
-rw-r--r--src/map/scl/scl.c211
1 files changed, 110 insertions, 101 deletions
diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c
index fb11311f..f9d88c45 100644
--- a/src/map/scl/scl.c
+++ b/src/map/scl/scl.c
@@ -63,9 +63,9 @@ void Scl_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "SCL mapping", "stime", Scl_CommandStime, 0 );
Cmd_CommandAdd( pAbc, "SCL mapping", "topo", Scl_CommandTopo, 1 );
Cmd_CommandAdd( pAbc, "SCL mapping", "buffer", Scl_CommandBuffer, 1 );
+ Cmd_CommandAdd( pAbc, "SCL mapping", "minsize", Scl_CommandMinsize, 1 );
Cmd_CommandAdd( pAbc, "SCL mapping", "gsize", Scl_CommandGsize, 1 );
Cmd_CommandAdd( pAbc, "SCL mapping", "upsize", Scl_CommandUpsize, 1 );
- Cmd_CommandAdd( pAbc, "SCL mapping", "minsize", Scl_CommandMinsize, 1 );
}
void Scl_End( Abc_Frame_t * pAbc )
{
@@ -510,10 +510,73 @@ usage:
SeeAlso []
***********************************************************************/
+int Scl_CommandMinsize( Abc_Frame_t * pAbc, int argc, char **argv )
+{
+ Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
+ int c, fVerbose = 0;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+
+ if ( Abc_FrameReadNtk(pAbc) == NULL )
+ {
+ fprintf( pAbc->Err, "There is no current network.\n" );
+ return 1;
+ }
+ if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
+ {
+ fprintf( pAbc->Err, "The current network is not mapped.\n" );
+ return 1;
+ }
+ if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
+ {
+ fprintf( pAbc->Err, "The current networks is not in a topo order (run \"topo\").\n" );
+ return 1;
+ }
+ if ( pAbc->pLibScl == NULL )
+ {
+ fprintf( pAbc->Err, "There is no Liberty library available.\n" );
+ return 1;
+ }
+
+ Abc_SclMinsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, fVerbose );
+ return 0;
+
+usage:
+ fprintf( pAbc->Err, "usage: minsize [-vh]\n" );
+ fprintf( pAbc->Err, "\t downsized all gates to their minimum size\n" );
+ fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
+ fprintf( pAbc->Err, "\t-h : print the command usage\n");
+ return 1;
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv )
{
SC_SizePars Pars, * pPars = &Pars;
int c;
+ memset( pPars, 0, sizeof(SC_SizePars) );
pPars->nSteps = 1000000;
pPars->nRange = 0;
pPars->nRangeF = 10;
@@ -623,8 +686,8 @@ usage:
fprintf( pAbc->Err, "usage: gsize [-NWUT num] [-acpvwh]\n" );
fprintf( pAbc->Err, "\t performs gate sizing using Liberty library\n" );
fprintf( pAbc->Err, "\t-N <num> : the number of gate-sizing steps performed [default = %d]\n", pPars->nSteps );
- fprintf( pAbc->Err, "\t-W <num> : delay window (in percents) of near-critical COs [default = %d]\n", pPars->nRange );
- fprintf( pAbc->Err, "\t-U <num> : delay window (in percents) of near-critical fanins [default = %d]\n", pPars->nRangeF );
+ fprintf( pAbc->Err, "\t-W <num> : delay window (in percent) of near-critical COs [default = %d]\n", pPars->nRange );
+ fprintf( pAbc->Err, "\t-U <num> : delay window (in percent) of near-critical fanins [default = %d]\n", pPars->nRangeF );
fprintf( pAbc->Err, "\t-T <num> : an approximate timeout, in seconds [default = %d]\n", pPars->nTimeOut );
fprintf( pAbc->Err, "\t-a : try resizing all gates (not only critical) [default = %s]\n", pPars->fTryAll? "yes": "no" );
fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", pPars->fUseWireLoads? "yes": "no" );
@@ -648,18 +711,22 @@ usage:
***********************************************************************/
int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
{
+ SC_UpSizePars Pars, * pPars = &Pars;
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
- int nIters = 1000;
- int nIterNoChange = 50;
- int Window = 2;
- int Ratio = 10;
- int Notches = 10;
- int TimeOut = 0;
- int fDumpStats = 0;
- int c, fVerbose = 0;
- int fVeryVerbose = 0;
+ int c;
+ memset( pPars, 0, sizeof(SC_UpSizePars) );
+ pPars->nIters = 1000;
+ pPars->nIterNoChange = 50;
+ pPars->Window = 2;
+ pPars->Ratio = 10;
+ pPars->Notches = 20;
+ pPars->TimeOut = 0;
+ pPars->fUseDept = 1;
+ pPars->fDumpStats = 0;
+ pPars->fVerbose = 0;
+ pPars->fVeryVerbose = 0;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "IJWRNTdvwh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "IJWRNTsdvwh" ) ) != EOF )
{
switch ( c )
{
@@ -669,9 +736,9 @@ 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]);
+ pPars->nIters = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
- if ( nIterNoChange < 0 )
+ if ( pPars->nIters < 0 )
goto usage;
break;
case 'J':
@@ -680,9 +747,9 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
Abc_Print( -1, "Command line switch \"-J\" should be followed by a positive integer.\n" );
goto usage;
}
- nIters = atoi(argv[globalUtilOptind]);
+ pPars->nIterNoChange = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
- if ( nIters < 0 )
+ if ( pPars->nIterNoChange < 0 )
goto usage;
break;
case 'W':
@@ -691,9 +758,9 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
Abc_Print( -1, "Command line switch \"-W\" should be followed by a positive integer.\n" );
goto usage;
}
- Window = atoi(argv[globalUtilOptind]);
+ pPars->Window = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
- if ( Window < 0 )
+ if ( pPars->Window < 0 )
goto usage;
break;
case 'R':
@@ -702,9 +769,9 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
Abc_Print( -1, "Command line switch \"-R\" should be followed by a positive integer.\n" );
goto usage;
}
- Ratio = atoi(argv[globalUtilOptind]);
+ pPars->Ratio = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
- if ( Ratio < 0 )
+ if ( pPars->Ratio < 0 )
goto usage;
break;
case 'N':
@@ -713,9 +780,9 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" );
goto usage;
}
- Notches = atoi(argv[globalUtilOptind]);
+ pPars->Notches = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
- if ( Notches < 0 )
+ if ( pPars->Notches < 0 )
goto usage;
break;
case 'T':
@@ -724,19 +791,22 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
Abc_Print( -1, "Command line switch \"-T\" should be followed by a positive integer.\n" );
goto usage;
}
- TimeOut = atoi(argv[globalUtilOptind]);
+ pPars->TimeOut = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
- if ( TimeOut < 0 )
+ if ( pPars->TimeOut < 0 )
goto usage;
break;
+ case 's':
+ pPars->fUseDept ^= 1;
+ break;
case 'd':
- fDumpStats ^= 1;
+ pPars->fDumpStats ^= 1;
break;
case 'v':
- fVerbose ^= 1;
+ pPars->fVerbose ^= 1;
break;
case 'w':
- fVeryVerbose ^= 1;
+ pPars->fVeryVerbose ^= 1;
break;
case 'h':
goto usage;
@@ -766,83 +836,22 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
return 1;
}
- Abc_SclUpsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, nIters, nIterNoChange, Window, Ratio, Notches, TimeOut, fDumpStats, fVerbose, fVeryVerbose );
+ Abc_SclUpsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, pPars );
return 0;
usage:
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 );
- fprintf( pAbc->Err, "\t-T <num> : 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");
- return 1;
-}
-
-/**Function*************************************************************
-
- Synopsis []
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-int Scl_CommandMinsize( Abc_Frame_t * pAbc, int argc, char **argv )
-{
- Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
- int c, fVerbose = 0;
- Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
- {
- switch ( c )
- {
- case 'v':
- fVerbose ^= 1;
- break;
- case 'h':
- goto usage;
- default:
- goto usage;
- }
- }
-
- if ( Abc_FrameReadNtk(pAbc) == NULL )
- {
- fprintf( pAbc->Err, "There is no current network.\n" );
- return 1;
- }
- if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
- {
- fprintf( pAbc->Err, "The current network is not mapped.\n" );
- return 1;
- }
- if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
- {
- fprintf( pAbc->Err, "The current networks is not in a topo order (run \"topo\").\n" );
- return 1;
- }
- if ( pAbc->pLibScl == NULL )
- {
- fprintf( pAbc->Err, "There is no Liberty library available.\n" );
- return 1;
- }
-
- Abc_SclMinsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, fVerbose );
- return 0;
-
-usage:
- fprintf( pAbc->Err, "usage: minsize [-vh]\n" );
- fprintf( pAbc->Err, "\t downsized all gates to their minimum size\n" );
- fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
+ fprintf( pAbc->Err, "\t selectively increases gate sizes on the critical path\n" );
+ fprintf( pAbc->Err, "\t-I <num> : the number of upsizing iterations to perform [default = %d]\n", pPars->nIters );
+ fprintf( pAbc->Err, "\t-J <num> : the number of iterations without improvement to stop [default = %d]\n", pPars->nIterNoChange );
+ fprintf( pAbc->Err, "\t-W <num> : delay window (in percent) of near-critical COs [default = %d]\n", pPars->Window );
+ fprintf( pAbc->Err, "\t-R <num> : ratio of critical nodes (in percent) to update [default = %d]\n", pPars->Ratio );
+ fprintf( pAbc->Err, "\t-N <num> : limit on discrete upsizing steps at a node [default = %d]\n", pPars->Notches );
+ fprintf( pAbc->Err, "\t-T <num> : approximate timeout in seconds [default = %d]\n", pPars->TimeOut );
+ fprintf( pAbc->Err, "\t-s : toggle using slack based on departure times [default = %s]\n", pPars->fUseDept? "yes": "no" );
+ fprintf( pAbc->Err, "\t-d : toggle dumping statistics into a file [default = %s]\n", pPars->fDumpStats? "yes": "no" );
+ fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" );
+ fprintf( pAbc->Err, "\t-w : toggle printing more verbose information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
fprintf( pAbc->Err, "\t-h : print the command usage\n");
return 1;
}