Commit 6b2744ff by Alan Mishchenko

Improving print-outs in 'stime' and 'gsize'.

parent b26d698f
...@@ -236,7 +236,7 @@ int Mio_LibraryReadInternal( Mio_Library_t * pLib, char * pBuffer, int fExtended ...@@ -236,7 +236,7 @@ int Mio_LibraryReadInternal( Mio_Library_t * pLib, char * pBuffer, int fExtended
} }
} }
if ( fVerbose ) if ( fVerbose )
printf( "The number of gates read = %d.\n", nGates ); printf( "Entered GENLIB library with %d gates from file \"%s\".\n", nGates, pLib->pName );
if ( nGates == 0 ) if ( nGates == 0 )
{ {
......
...@@ -33,6 +33,7 @@ static int Scl_CommandWrite ( Abc_Frame_t * pAbc, int argc, char **argv ); ...@@ -33,6 +33,7 @@ static int Scl_CommandWrite ( Abc_Frame_t * pAbc, int argc, char **argv );
static int Scl_CommandPrint ( Abc_Frame_t * pAbc, int argc, char **argv ); static int Scl_CommandPrint ( Abc_Frame_t * pAbc, int argc, char **argv );
static int Scl_CommandPrintGS( Abc_Frame_t * pAbc, int argc, char **argv ); static int Scl_CommandPrintGS( Abc_Frame_t * pAbc, int argc, char **argv );
static int Scl_CommandStime ( Abc_Frame_t * pAbc, int argc, char **argv ); static int Scl_CommandStime ( Abc_Frame_t * pAbc, int argc, char **argv );
static int Scl_CommandTopo ( Abc_Frame_t * pAbc, int argc, char **argv );
static int Scl_CommandBuffer ( Abc_Frame_t * pAbc, int argc, char **argv ); static int Scl_CommandBuffer ( Abc_Frame_t * pAbc, int argc, char **argv );
static int Scl_CommandGsize ( Abc_Frame_t * pAbc, int argc, char **argv ); static int Scl_CommandGsize ( Abc_Frame_t * pAbc, int argc, char **argv );
...@@ -58,6 +59,7 @@ void Scl_Init( Abc_Frame_t * pAbc ) ...@@ -58,6 +59,7 @@ void Scl_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "SCL mapping", "print_scl", Scl_CommandPrint, 0 ); Cmd_CommandAdd( pAbc, "SCL mapping", "print_scl", Scl_CommandPrint, 0 );
Cmd_CommandAdd( pAbc, "SCL mapping", "print_gs", Scl_CommandPrintGS, 0 ); Cmd_CommandAdd( pAbc, "SCL mapping", "print_gs", Scl_CommandPrintGS, 0 );
Cmd_CommandAdd( pAbc, "SCL mapping", "stime", Scl_CommandStime, 0 ); 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", "buffer", Scl_CommandBuffer, 1 );
Cmd_CommandAdd( pAbc, "SCL mapping", "gsize", Scl_CommandGsize, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "gsize", Scl_CommandGsize, 1 );
} }
...@@ -83,13 +85,16 @@ int Scl_CommandRead( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -83,13 +85,16 @@ int Scl_CommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
char * pFileName; char * pFileName;
FILE * pFile; FILE * pFile;
int c; int c, fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
case 'v':
fVerbose ^= 1;
break;
case 'h': case 'h':
goto usage; goto usage;
default: default:
...@@ -110,12 +115,14 @@ int Scl_CommandRead( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -110,12 +115,14 @@ int Scl_CommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
// read new library // read new library
Abc_SclLoad( pFileName, (SC_Lib **)&pAbc->pLibScl ); Abc_SclLoad( pFileName, (SC_Lib **)&pAbc->pLibScl );
// Abc_SclWriteText( "sizing\\scl_out.txt", pAbc->pLibScl ); if ( fVerbose )
Abc_SclWriteText( "scl_out.txt", pAbc->pLibScl );
return 0; return 0;
usage: usage:
fprintf( pAbc->Err, "usage: read_scl [-h] <file>\n" ); fprintf( pAbc->Err, "usage: read_scl [-vh] <file>\n" );
fprintf( pAbc->Err, "\t reads Liberty library from file\n" ); fprintf( pAbc->Err, "\t reads Liberty library from file\n" );
fprintf( pAbc->Err, "\t-v : toggle writing the result into file \"scl_out.txt\" [default = %s]\n", fVerbose? "yes": "no" );
fprintf( pAbc->Err, "\t-h : prints the command summary\n" ); fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" ); fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
return 1; return 1;
...@@ -288,12 +295,16 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -288,12 +295,16 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv )
{ {
int c; int c;
int fShowAll = 0; int fShowAll = 0;
int fUseWireLoads = 1;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "ah" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "cah" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
case 'c':
fUseWireLoads ^= 1;
break;
case 'a': case 'a':
fShowAll ^= 1; fShowAll ^= 1;
break; break;
...@@ -316,7 +327,7 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -316,7 +327,7 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv )
} }
if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) ) if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
{ {
fprintf( pAbc->Err, "The current networks is not in a topo order (run \"buffer -N 1000\").\n" ); fprintf( pAbc->Err, "The current networks is not in a topo order (run \"topo\").\n" );
return 1; return 1;
} }
if ( pAbc->pLibScl == NULL ) if ( pAbc->pLibScl == NULL )
...@@ -325,12 +336,13 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -325,12 +336,13 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv )
return 1; return 1;
} }
Abc_SclTimePerform( pAbc->pLibScl, Abc_FrameReadNtk(pAbc), fShowAll ); Abc_SclTimePerform( pAbc->pLibScl, Abc_FrameReadNtk(pAbc), fShowAll, fUseWireLoads );
return 0; return 0;
usage: usage:
fprintf( pAbc->Err, "usage: stime [-ah]\n" ); fprintf( pAbc->Err, "usage: stime [-cah]\n" );
fprintf( pAbc->Err, "\t performs STA using Liberty library\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-a : display timing information for all nodes [default = %s]\n", fShowAll? "yes": "no" );
fprintf( pAbc->Err, "\t-h : print the help massage\n" ); fprintf( pAbc->Err, "\t-h : print the help massage\n" );
return 1; return 1;
...@@ -347,6 +359,67 @@ usage: ...@@ -347,6 +359,67 @@ usage:
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Scl_CommandTopo( Abc_Frame_t * pAbc, int argc, char ** argv )
{
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
Abc_Ntk_t * pNtkRes;
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 ( pNtk == NULL )
{
Abc_Print( -1, "Empty network.\n" );
return 1;
}
if ( !Abc_NtkIsLogic(pNtk) )
{
Abc_Print( -1, "This command can only be applied to a logic network.\n" );
return 1;
}
// modify the current network
pNtkRes = Abc_NtkDupDfs( pNtk );
if ( pNtkRes == NULL )
{
Abc_Print( -1, "The command has failed.\n" );
return 1;
}
// replace the current network
Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
return 0;
usage:
fprintf( pAbc->Err, "usage: topo [-vh]\n" );
fprintf( pAbc->Err, "\t rearranges nodes to be in a topological order\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_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv ) int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
...@@ -425,18 +498,20 @@ usage: ...@@ -425,18 +498,20 @@ usage:
***********************************************************************/ ***********************************************************************/
int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv ) int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv )
{ {
SC_SizePars Pars, * pPars = &Pars;
int c; int c;
int nSteps = 1000000; pPars->nSteps = 1000000;
int nRange = 0; pPars->nRange = 0;
int nRangeF = 10; pPars->nRangeF = 10;
int nTimeOut = 300; pPars->nTimeOut = 300;
int fTryAll = 1; pPars->fTryAll = 1;
int fPrintCP = 0; pPars->fUseWireLoads = 1;
int fVerbose = 0; pPars->fPrintCP = 0;
int fVeryVerbose = 0; pPars->fVerbose = 0;
pPars->fVeryVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "NWUTapvwh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "NWUTacpvwh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -446,9 +521,9 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -446,9 +521,9 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv )
Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" ); Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" );
goto usage; goto usage;
} }
nSteps = atoi(argv[globalUtilOptind]); pPars->nSteps = atoi(argv[globalUtilOptind]);
globalUtilOptind++; globalUtilOptind++;
if ( nSteps <= 0 ) if ( pPars->nSteps <= 0 )
goto usage; goto usage;
break; break;
case 'W': case 'W':
...@@ -457,9 +532,9 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -457,9 +532,9 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv )
Abc_Print( -1, "Command line switch \"-W\" should be followed by a positive integer.\n" ); Abc_Print( -1, "Command line switch \"-W\" should be followed by a positive integer.\n" );
goto usage; goto usage;
} }
nRange = atoi(argv[globalUtilOptind]); pPars->nRange = atoi(argv[globalUtilOptind]);
globalUtilOptind++; globalUtilOptind++;
if ( nRange < 0 ) if ( pPars->nRange < 0 )
goto usage; goto usage;
break; break;
case 'U': case 'U':
...@@ -468,9 +543,9 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -468,9 +543,9 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv )
Abc_Print( -1, "Command line switch \"-U\" should be followed by a positive integer.\n" ); Abc_Print( -1, "Command line switch \"-U\" should be followed by a positive integer.\n" );
goto usage; goto usage;
} }
nRangeF = atoi(argv[globalUtilOptind]); pPars->nRangeF = atoi(argv[globalUtilOptind]);
globalUtilOptind++; globalUtilOptind++;
if ( nRangeF < 0 ) if ( pPars->nRangeF < 0 )
goto usage; goto usage;
break; break;
case 'T': case 'T':
...@@ -479,22 +554,25 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -479,22 +554,25 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv )
Abc_Print( -1, "Command line switch \"-T\" should be followed by a positive integer.\n" ); Abc_Print( -1, "Command line switch \"-T\" should be followed by a positive integer.\n" );
goto usage; goto usage;
} }
nTimeOut = atoi(argv[globalUtilOptind]); pPars->nTimeOut = atoi(argv[globalUtilOptind]);
globalUtilOptind++; globalUtilOptind++;
if ( nTimeOut < 0 ) if ( pPars->nTimeOut < 0 )
goto usage; goto usage;
break; break;
case 'a': case 'a':
fTryAll ^= 1; pPars->fTryAll ^= 1;
break;
case 'c':
pPars->fUseWireLoads ^= 1;
break; break;
case 'p': case 'p':
fPrintCP ^= 1; pPars->fPrintCP ^= 1;
break; break;
case 'v': case 'v':
fVerbose ^= 1; pPars->fVerbose ^= 1;
break; break;
case 'w': case 'w':
fVeryVerbose ^= 1; pPars->fVeryVerbose ^= 1;
break; break;
case 'h': case 'h':
goto usage; goto usage;
...@@ -515,7 +593,7 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -515,7 +593,7 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv )
} }
if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) ) if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
{ {
fprintf( pAbc->Err, "The current networks is not in a topo order (run \"buffer -N 1000\").\n" ); fprintf( pAbc->Err, "The current networks is not in a topo order (run \"topo\").\n" );
return 1; return 1;
} }
if ( pAbc->pLibScl == NULL ) if ( pAbc->pLibScl == NULL )
...@@ -524,20 +602,21 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -524,20 +602,21 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv )
return 1; return 1;
} }
Abc_SclSizingPerform( pAbc->pLibScl, Abc_FrameReadNtk(pAbc), nSteps, nRange, nRangeF, nTimeOut, fTryAll, fPrintCP, fVerbose, fVeryVerbose ); Abc_SclSizingPerform( pAbc->pLibScl, Abc_FrameReadNtk(pAbc), pPars );
return 0; return 0;
usage: usage:
fprintf( pAbc->Err, "usage: gsize [-NWUT num] [-apvwh]\n" ); fprintf( pAbc->Err, "usage: gsize [-NWUT num] [-acpvwh]\n" );
fprintf( pAbc->Err, "\t performs gate sizing using Liberty library\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", nSteps ); 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", nRange ); 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", nRangeF ); fprintf( pAbc->Err, "\t-U <num> : delay window (in percents) of near-critical fanins [default = %d]\n", pPars->nRangeF );
fprintf( pAbc->Err, "\t-T <num> : an approximate timeout, in seconds [default = %d]\n", nTimeOut ); 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", fTryAll? "yes": "no" ); fprintf( pAbc->Err, "\t-a : try resizing all gates (not only critical) [default = %s]\n", pPars->fTryAll? "yes": "no" );
fprintf( pAbc->Err, "\t-p : toggle printing critical path before and after sizing [default = %s]\n", fPrintCP? "yes": "no" ); fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", pPars->fUseWireLoads? "yes": "no" );
fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); fprintf( pAbc->Err, "\t-p : toggle printing critical path before and after sizing [default = %s]\n", pPars->fPrintCP? "yes": "no" );
fprintf( pAbc->Err, "\t-w : toggle printing even more information [default = %s]\n", fVeryVerbose? "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 even more information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
fprintf( pAbc->Err, "\t-h : print the help massage\n" ); fprintf( pAbc->Err, "\t-h : print the help massage\n" );
return 1; return 1;
} }
......
...@@ -60,6 +60,20 @@ typedef enum // -- timing sense, positive-, negative- or non-unate ...@@ -60,6 +60,20 @@ typedef enum // -- timing sense, positive-, negative- or non-unate
sc_ts_Non, sc_ts_Non,
} SC_TSense; } SC_TSense;
typedef struct SC_SizePars_ SC_SizePars;
struct SC_SizePars_
{
int nSteps;
int nRange;
int nRangeF;
int nTimeOut;
int fTryAll;
int fUseWireLoads;
int fPrintCP;
int fVerbose;
int fVeryVerbose;
};
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// STRUCTURE DEFINITIONS /// /// STRUCTURE DEFINITIONS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
...@@ -418,9 +432,9 @@ extern void Abc_SclWriteText( char * pFileName, SC_Lib * p ); ...@@ -418,9 +432,9 @@ extern void Abc_SclWriteText( char * pFileName, SC_Lib * p );
extern void Abc_SclLoad( char * pFileName, SC_Lib ** ppScl ); extern void Abc_SclLoad( char * pFileName, SC_Lib ** ppScl );
extern void Abc_SclSave( char * pFileName, SC_Lib * pScl ); extern void Abc_SclSave( char * pFileName, SC_Lib * pScl );
/*=== sclTime.c =============================================================*/ /*=== sclTime.c =============================================================*/
extern void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fShowAll ); extern void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fShowAll, int fUseWireLoads );
/*=== sclSize.c =============================================================*/ /*=== sclSize.c =============================================================*/
extern void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRange, int nRangeF, int nTimeOut, int fTryAll, int fPrintCP, int fVerbose, int fVeryVerbose ); extern void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * p );
/*=== sclUtil.c =============================================================*/ /*=== sclUtil.c =============================================================*/
extern void Abc_SclHashCells( SC_Lib * p ); extern void Abc_SclHashCells( SC_Lib * p );
extern int Abc_SclCellFind( SC_Lib * p, char * pName ); extern int Abc_SclCellFind( SC_Lib * p, char * pName );
......
...@@ -84,7 +84,7 @@ Vec_Flt_t * Abc_SclFindWireCaps( SC_Man * p ) ...@@ -84,7 +84,7 @@ Vec_Flt_t * Abc_SclFindWireCaps( SC_Man * p )
SC_LibForEachWireLoad( p->pLib, pWL, i ) SC_LibForEachWireLoad( p->pLib, pWL, i )
if ( !strcmp(pWL->pName, p->pWLoadUsed) ) if ( !strcmp(pWL->pName, p->pWLoadUsed) )
break; break;
if ( i == Vec_PtrSize(p->pLib->vWireLoadSels) ) if ( i == Vec_PtrSize(p->pLib->vWireLoads) )
{ {
Abc_Print( -1, "Cannot find wire load model \"%s\".\n", p->pWLoadUsed ); Abc_Print( -1, "Cannot find wire load model \"%s\".\n", p->pWLoadUsed );
exit(1); exit(1);
...@@ -143,6 +143,8 @@ void Abc_SclComputeLoad( SC_Man * p ) ...@@ -143,6 +143,8 @@ void Abc_SclComputeLoad( SC_Man * p )
pLoad->fall += pPin->fall_cap; pLoad->fall += pPin->fall_cap;
} }
} }
if ( !p->fUseWireLoads )
return;
// add wire load // add wire load
vWireCaps = Abc_SclFindWireCaps( p ); vWireCaps = Abc_SclFindWireCaps( p );
if ( vWireCaps ) if ( vWireCaps )
......
...@@ -49,8 +49,9 @@ struct SC_Man_ ...@@ -49,8 +49,9 @@ struct SC_Man_
{ {
SC_Lib * pLib; // library SC_Lib * pLib; // library
Abc_Ntk_t * pNtk; // network Abc_Ntk_t * pNtk; // network
Vec_Int_t * vGates; // mapping of objId into gateId int fUseWireLoads; // set to 1 if wireloads are used
int nObjs; // allocated size int nObjs; // allocated size
Vec_Int_t * vGates; // mapping of objId into gateId
SC_Pair * pLoads; // loads for each gate SC_Pair * pLoads; // loads for each gate
SC_Pair * pTimes; // arrivals for each gate SC_Pair * pTimes; // arrivals for each gate
SC_Pair * pSlews; // slews for each gate SC_Pair * pSlews; // slews for each gate
...@@ -210,7 +211,7 @@ static inline float Abc_SclGetMaxDelayNode( SC_Man * p, Abc_Obj_t * pNode ) ...@@ -210,7 +211,7 @@ static inline float Abc_SclGetMaxDelayNode( SC_Man * p, Abc_Obj_t * pNode )
extern Abc_Obj_t * Abc_SclFindCriticalCo( SC_Man * p, int * pfRise ); extern Abc_Obj_t * Abc_SclFindCriticalCo( SC_Man * p, int * pfRise );
extern Abc_Obj_t * Abc_SclFindMostCriticalFanin( SC_Man * p, int * pfRise, Abc_Obj_t * pNode ); extern Abc_Obj_t * Abc_SclFindMostCriticalFanin( SC_Man * p, int * pfRise, Abc_Obj_t * pNode );
extern void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll ); extern void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll );
extern SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk ); extern SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads );
extern void Abc_SclTimeCone( SC_Man * p, Vec_Int_t * vCone ); extern void Abc_SclTimeCone( SC_Man * p, Vec_Int_t * vCone );
/*=== sclTime.c =============================================================*/ /*=== sclTime.c =============================================================*/
extern void Abc_SclComputeLoad( SC_Man * p ); extern void Abc_SclComputeLoad( SC_Man * p );
......
...@@ -395,20 +395,20 @@ void Abc_SclManUpsize( SC_Man * p ) ...@@ -395,20 +395,20 @@ void Abc_SclManUpsize( SC_Man * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRange, int nRangeF, int nTimeOut, int fTryAll, int fPrintCP, int fVerbose, int fVeryVerbose ) void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars )
{ {
int nIters = 1; int nIters = 1;
SC_Man * p; SC_Man * p;
Vec_Int_t * vPath, * vPivots; Vec_Int_t * vPath, * vPivots;
Abc_Obj_t * pBest; Abc_Obj_t * pBest;
clock_t nRuntimeLimit = nTimeOut ? nTimeOut * CLOCKS_PER_SEC + clock() : 0; clock_t nRuntimeLimit = pPars->nTimeOut ? pPars->nTimeOut * CLOCKS_PER_SEC + clock() : 0;
int r, i, nNodes, nCones = 0, nDownSize = 0; int r, i, nNodes, nCones = 0, nDownSize = 0;
p = Abc_SclManStart( pLib, pNtk ); p = Abc_SclManStart( pLib, pNtk, pPars->fUseWireLoads );
if ( fPrintCP ) if ( pPars->fPrintCP )
Abc_SclTimeNtkPrint( p, 0 ); Abc_SclTimeNtkPrint( p, 0 );
if ( fVerbose ) if ( pPars->fVerbose )
printf( "Iterative gate-sizing of network \"%s\" with library \"%s\":\n", Abc_NtkName(pNtk), pLib->pName ); printf( "Iterative gate-sizing of network \"%s\" with library \"%s\":\n", Abc_NtkName(pNtk), pLib->pName );
if ( fVerbose ) if ( pPars->fVerbose )
{ {
// printf( "%5d : ", 0 ); // printf( "%5d : ", 0 );
printf( "Starting parameters of current mapping: " ); printf( "Starting parameters of current mapping: " );
...@@ -422,18 +422,18 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan ...@@ -422,18 +422,18 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan
float nThresh1 = p->MaxDelay0/100000; float nThresh1 = p->MaxDelay0/100000;
float nThresh2 = p->MaxDelay0/1000; float nThresh2 = p->MaxDelay0/1000;
// try upsizing // try upsizing
for ( ; i < nSteps; i++ ) for ( ; i < pPars->nSteps; i++ )
{ {
vPath = Abc_SclFindCriticalPath( p, nRange, &vPivots ); vPath = Abc_SclFindCriticalPath( p, pPars->nRange, &vPivots );
pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 1, nThresh1 ); pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 1, nThresh1 );
nNodes = Vec_IntSize(vPath); nNodes = Vec_IntSize(vPath);
Vec_IntFree( vPath ); Vec_IntFree( vPath );
Vec_IntFree( vPivots ); Vec_IntFree( vPivots );
if ( pBest == NULL ) if ( pBest == NULL )
{ {
if ( fTryAll ) if ( pPars->fTryAll )
{ {
vPath = Abc_SclFindCriticalCone( p, nRange, nRangeF, &vPivots ); vPath = Abc_SclFindCriticalCone( p, pPars->nRange, pPars->nRangeF, &vPivots );
pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 1, nThresh1 ); pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 1, nThresh1 );
nNodes = Vec_IntSize(vPath); nNodes = Vec_IntSize(vPath);
Vec_IntFree( vPath ); Vec_IntFree( vPath );
...@@ -443,7 +443,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan ...@@ -443,7 +443,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan
if ( pBest == NULL ) if ( pBest == NULL )
break; break;
} }
Abc_SclUpdateNetwork( p, pBest, nNodes, 1, i+1, fVerbose, fVeryVerbose ); Abc_SclUpdateNetwork( p, pBest, nNodes, 1, i+1, pPars->fVerbose, pPars->fVeryVerbose );
// recompute loads every 100 steps // recompute loads every 100 steps
if ( i && i % 100 == 0 ) if ( i && i % 100 == 0 )
Abc_SclComputeLoad( p ); Abc_SclComputeLoad( p );
...@@ -454,12 +454,12 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan ...@@ -454,12 +454,12 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan
break; break;
if ( nRuntimeLimit && clock() > nRuntimeLimit ) // timeout if ( nRuntimeLimit && clock() > nRuntimeLimit ) // timeout
break; break;
if ( fVeryVerbose ) if ( pPars->fVeryVerbose )
printf( "\n" ); printf( "\n" );
// try downsizing // try downsizing
for ( ; i < nSteps; i++ ) for ( ; i < pPars->nSteps; i++ )
{ {
vPath = Abc_SclFindCriticalPath( p, nRange, &vPivots ); vPath = Abc_SclFindCriticalPath( p, pPars->nRange, &vPivots );
// pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 0, -p->MaxDelay0/100000 ); // pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 0, -p->MaxDelay0/100000 );
pBest = Abc_SclChooseBiggestGain( p, vPath, NULL, 0, nThresh2 ); pBest = Abc_SclChooseBiggestGain( p, vPath, NULL, 0, nThresh2 );
nNodes = Vec_IntSize(vPath); nNodes = Vec_IntSize(vPath);
...@@ -468,9 +468,9 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan ...@@ -468,9 +468,9 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan
if ( pBest == NULL ) if ( pBest == NULL )
{ {
if ( fTryAll ) if ( pPars->fTryAll )
{ {
vPath = Abc_SclFindCriticalCone( p, nRange, nRangeF, &vPivots ); vPath = Abc_SclFindCriticalCone( p, pPars->nRange, pPars->nRangeF, &vPivots );
// pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 0, -p->MaxDelay0/100000 ); // pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 0, -p->MaxDelay0/100000 );
pBest = Abc_SclChooseBiggestGain( p, vPath, NULL, 0, nThresh2 ); pBest = Abc_SclChooseBiggestGain( p, vPath, NULL, 0, nThresh2 );
nNodes = Vec_IntSize(vPath); nNodes = Vec_IntSize(vPath);
...@@ -481,7 +481,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan ...@@ -481,7 +481,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan
if ( pBest == NULL ) if ( pBest == NULL )
break; break;
} }
Abc_SclUpdateNetwork( p, pBest, nNodes, 0, i+1, fVerbose, fVeryVerbose ); Abc_SclUpdateNetwork( p, pBest, nNodes, 0, i+1, pPars->fVerbose, pPars->fVeryVerbose );
// recompute loads every 100 steps // recompute loads every 100 steps
if ( i && i % 100 == 0 ) if ( i && i % 100 == 0 )
Abc_SclComputeLoad( p ); Abc_SclComputeLoad( p );
...@@ -491,15 +491,15 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan ...@@ -491,15 +491,15 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan
} }
if ( nRuntimeLimit && clock() > nRuntimeLimit ) // timeout if ( nRuntimeLimit && clock() > nRuntimeLimit ) // timeout
break; break;
if ( fVeryVerbose ) if ( pPars->fVeryVerbose )
printf( "\n" ); printf( "\n" );
} }
p->MaxDelay = Abc_SclGetMaxDelay(p); p->MaxDelay = Abc_SclGetMaxDelay(p);
if ( fPrintCP ) if ( pPars->fPrintCP )
Abc_SclTimeNtkPrint( p, 0 ); Abc_SclTimeNtkPrint( p, 0 );
if ( nRuntimeLimit && clock() > nRuntimeLimit ) if ( nRuntimeLimit && clock() > nRuntimeLimit )
printf( "Timeout was reached after %d seconds.\n", nTimeOut ); printf( "Timeout was reached after %d seconds.\n", pPars->nTimeOut );
// print cumulative statistics // print cumulative statistics
printf( "Cones: %d. ", nCones ); printf( "Cones: %d. ", nCones );
printf( "Resized: %d(%d). ", i, nDownSize ); printf( "Resized: %d(%d). ", i, nDownSize );
......
...@@ -82,11 +82,11 @@ Abc_Obj_t * Abc_SclFindMostCriticalFanin( SC_Man * p, int * pfRise, Abc_Obj_t * ...@@ -82,11 +82,11 @@ Abc_Obj_t * Abc_SclFindMostCriticalFanin( SC_Man * p, int * pfRise, Abc_Obj_t *
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
static inline void Abc_SclTimeGatePrint( SC_Man * p, Abc_Obj_t * pObj, int fRise ) static inline void Abc_SclTimeGatePrint( SC_Man * p, Abc_Obj_t * pObj, int fRise, int Length )
{ {
printf( "%7d : ", Abc_ObjId(pObj) ); printf( "%7d : ", Abc_ObjId(pObj) );
printf( "%d ", Abc_ObjFaninNum(pObj) ); printf( "%d ", Abc_ObjFaninNum(pObj) );
printf( "%-12s ", Abc_SclObjCell(p, pObj)->pName ); printf( "%-*s ", Length, Abc_SclObjCell(p, pObj)->pName );
if ( fRise >= 0 ) if ( fRise >= 0 )
printf( "(%s) ", fRise ? "rise" : "fall" ); printf( "(%s) ", fRise ? "rise" : "fall" );
printf( "delay = (" ); printf( "delay = (" );
...@@ -98,28 +98,42 @@ static inline void Abc_SclTimeGatePrint( SC_Man * p, Abc_Obj_t * pObj, int fRise ...@@ -98,28 +98,42 @@ static inline void Abc_SclTimeGatePrint( SC_Man * p, Abc_Obj_t * pObj, int fRise
} }
void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll ) void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll )
{ {
int i, fRise = 0; int i, nLength = 0, fRise = 0;
Abc_Obj_t * pObj = Abc_SclFindCriticalCo( p, &fRise ); Abc_Obj_t * pObj, * pPivot = Abc_SclFindCriticalCo( p, &fRise );
printf( "WireLoad model = \"%s\". ", p->pWLoadUsed ); printf( "WireLoad model = \"%s\". ", p->pWLoadUsed ? p->pWLoadUsed : "none" );
printf( "Total area = %10.2f. ", Abc_SclGetTotalArea( p ) ); printf( "Gates = %d. ", Abc_NtkNodeNum(p->pNtk) );
printf( "Critical delay = %.1f ps\n", Abc_SclObjTimePs(p, pObj, fRise) ); printf( "Area = %.2f. ", Abc_SclGetTotalArea( p ) );
printf( "Critical delay = %.1f ps\n", Abc_SclObjTimePs(p, pPivot, fRise) );
if ( fShowAll ) if ( fShowAll )
{ {
// printf( "Timing information for all nodes: \n" ); // printf( "Timing information for all nodes: \n" );
// find the longest cell name
Abc_NtkForEachNodeReverse( p->pNtk, pObj, i ) Abc_NtkForEachNodeReverse( p->pNtk, pObj, i )
if ( Abc_ObjFaninNum(pObj) > 0 ) if ( Abc_ObjFaninNum(pObj) > 0 )
Abc_SclTimeGatePrint( p, pObj, -1 ); nLength = Abc_MaxInt( nLength, strlen(Abc_SclObjCell(p, pObj)->pName) );
// print timing
Abc_NtkForEachNodeReverse( p->pNtk, pObj, i )
if ( Abc_ObjFaninNum(pObj) > 0 )
Abc_SclTimeGatePrint( p, pObj, -1, nLength );
} }
else else
{ {
// printf( "Critical path: \n" ); // printf( "Critical path: \n" );
pObj = Abc_ObjFanin0(pObj); // find the longest cell name
pObj = Abc_ObjFanin0(pPivot);
while ( pObj && Abc_ObjIsNode(pObj) )
{
nLength = Abc_MaxInt( nLength, strlen(Abc_SclObjCell(p, pObj)->pName) );
pObj = Abc_SclFindMostCriticalFanin( p, &fRise, pObj );
}
// print timing
pObj = Abc_ObjFanin0(pPivot);
while ( pObj && Abc_ObjIsNode(pObj) ) while ( pObj && Abc_ObjIsNode(pObj) )
{ {
printf( "Critical path -- " ); printf( "Critical path -- " );
Abc_SclTimeGatePrint( p, pObj, fRise ); Abc_SclTimeGatePrint( p, pObj, fRise, nLength );
pObj = Abc_SclFindMostCriticalFanin( p, &fRise, pObj ); pObj = Abc_SclFindMostCriticalFanin( p, &fRise, pObj );
} }
} }
...@@ -257,9 +271,10 @@ void Abc_SclTimeNtk( SC_Man * p ) ...@@ -257,9 +271,10 @@ void Abc_SclTimeNtk( SC_Man * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk ) SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads )
{ {
SC_Man * p = Abc_SclManAlloc( pLib, pNtk ); SC_Man * p = Abc_SclManAlloc( pLib, pNtk );
p->fUseWireLoads = fUseWireLoads;
assert( p->vGates == NULL ); assert( p->vGates == NULL );
p->vGates = Abc_SclManFindGates( pLib, pNtk ); p->vGates = Abc_SclManFindGates( pLib, pNtk );
// Abc_SclManUpsize( p ); // Abc_SclManUpsize( p );
...@@ -281,10 +296,10 @@ SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk ) ...@@ -281,10 +296,10 @@ SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fShowAll ) void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fShowAll, int fUseWireLoads )
{ {
SC_Man * p; SC_Man * p;
p = Abc_SclManStart( pLib, pNtk ); p = Abc_SclManStart( pLib, pNtk, fUseWireLoads );
Abc_SclTimeNtkPrint( p, fShowAll ); Abc_SclTimeNtkPrint( p, fShowAll );
Abc_SclManFree( p ); Abc_SclManFree( p );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment