diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/mio/mioRead.c | 2 | ||||
-rw-r--r-- | src/map/scl/scl.c | 159 | ||||
-rw-r--r-- | src/map/scl/sclInt.h | 18 | ||||
-rw-r--r-- | src/map/scl/sclLoad.c | 4 | ||||
-rw-r--r-- | src/map/scl/sclMan.h | 33 | ||||
-rw-r--r-- | src/map/scl/sclSize.c | 44 | ||||
-rw-r--r-- | src/map/scl/sclTime.c | 41 |
7 files changed, 206 insertions, 95 deletions
diff --git a/src/map/mio/mioRead.c b/src/map/mio/mioRead.c index e79baeee..3632e3a7 100644 --- a/src/map/mio/mioRead.c +++ b/src/map/mio/mioRead.c @@ -236,7 +236,7 @@ int Mio_LibraryReadInternal( Mio_Library_t * pLib, char * pBuffer, int fExtended } } 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 ) { diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c index 61288ccf..337c5a05 100644 --- a/src/map/scl/scl.c +++ b/src/map/scl/scl.c @@ -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_CommandPrintGS( 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_CommandGsize ( Abc_Frame_t * pAbc, int argc, char **argv ); @@ -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_gs", Scl_CommandPrintGS, 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", "gsize", Scl_CommandGsize, 1 ); } @@ -83,13 +85,16 @@ int Scl_CommandRead( Abc_Frame_t * pAbc, int argc, char ** argv ) { char * pFileName; FILE * pFile; - int c; + int c, fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) { switch ( c ) { + case 'v': + fVerbose ^= 1; + break; case 'h': goto usage; default: @@ -110,12 +115,14 @@ int Scl_CommandRead( Abc_Frame_t * pAbc, int argc, char ** argv ) // read new library 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; 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-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<file> : the name of a file to read\n" ); return 1; @@ -288,12 +295,16 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv ) { int c; int fShowAll = 0; + int fUseWireLoads = 1; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "ah" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "cah" ) ) != EOF ) { switch ( c ) { + case 'c': + fUseWireLoads ^= 1; + break; case 'a': fShowAll ^= 1; break; @@ -316,7 +327,7 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv ) } 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; } if ( pAbc->pLibScl == NULL ) @@ -325,12 +336,13 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv ) return 1; } - Abc_SclTimePerform( pAbc->pLibScl, Abc_FrameReadNtk(pAbc), fShowAll ); + Abc_SclTimePerform( pAbc->pLibScl, Abc_FrameReadNtk(pAbc), fShowAll, fUseWireLoads ); return 0; 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-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-h : print the help massage\n" ); return 1; @@ -347,6 +359,67 @@ usage: 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 ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); @@ -425,18 +498,20 @@ usage: ***********************************************************************/ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv ) { + SC_SizePars Pars, * pPars = &Pars; int c; - int nSteps = 1000000; - int nRange = 0; - int nRangeF = 10; - int nTimeOut = 300; - int fTryAll = 1; - int fPrintCP = 0; - int fVerbose = 0; - int fVeryVerbose = 0; + pPars->nSteps = 1000000; + pPars->nRange = 0; + pPars->nRangeF = 10; + pPars->nTimeOut = 300; + pPars->fTryAll = 1; + pPars->fUseWireLoads = 1; + pPars->fPrintCP = 0; + pPars->fVerbose = 0; + pPars->fVeryVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "NWUTapvwh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "NWUTacpvwh" ) ) != EOF ) { switch ( c ) { @@ -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" ); goto usage; } - nSteps = atoi(argv[globalUtilOptind]); + pPars->nSteps = atoi(argv[globalUtilOptind]); globalUtilOptind++; - if ( nSteps <= 0 ) + if ( pPars->nSteps <= 0 ) goto usage; break; case 'W': @@ -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" ); goto usage; } - nRange = atoi(argv[globalUtilOptind]); + pPars->nRange = atoi(argv[globalUtilOptind]); globalUtilOptind++; - if ( nRange < 0 ) + if ( pPars->nRange < 0 ) goto usage; break; case 'U': @@ -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" ); goto usage; } - nRangeF = atoi(argv[globalUtilOptind]); + pPars->nRangeF = atoi(argv[globalUtilOptind]); globalUtilOptind++; - if ( nRangeF < 0 ) + if ( pPars->nRangeF < 0 ) goto usage; break; case 'T': @@ -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" ); goto usage; } - nTimeOut = atoi(argv[globalUtilOptind]); + pPars->nTimeOut = atoi(argv[globalUtilOptind]); globalUtilOptind++; - if ( nTimeOut < 0 ) + if ( pPars->nTimeOut < 0 ) goto usage; break; case 'a': - fTryAll ^= 1; + pPars->fTryAll ^= 1; + break; + case 'c': + pPars->fUseWireLoads ^= 1; break; case 'p': - fPrintCP ^= 1; + pPars->fPrintCP ^= 1; break; case 'v': - fVerbose ^= 1; + pPars->fVerbose ^= 1; break; case 'w': - fVeryVerbose ^= 1; + pPars->fVeryVerbose ^= 1; break; case 'h': goto usage; @@ -515,7 +593,7 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv ) } 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; } if ( pAbc->pLibScl == NULL ) @@ -524,20 +602,21 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv ) 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; 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-N <num> : the number of gate-sizing steps performed [default = %d]\n", nSteps ); - fprintf( pAbc->Err, "\t-W <num> : delay window (in percents) of near-critical COs [default = %d]\n", nRange ); - fprintf( pAbc->Err, "\t-U <num> : delay window (in percents) of near-critical fanins [default = %d]\n", nRangeF ); - fprintf( pAbc->Err, "\t-T <num> : an approximate timeout, in seconds [default = %d]\n", nTimeOut ); - fprintf( pAbc->Err, "\t-a : try resizing all gates (not only critical) [default = %s]\n", 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-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pAbc->Err, "\t-w : toggle printing even more information [default = %s]\n", fVeryVerbose? "yes": "no" ); + 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-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" ); + fprintf( pAbc->Err, "\t-p : toggle printing critical path before and after sizing [default = %s]\n", pPars->fPrintCP? "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" ); return 1; } diff --git a/src/map/scl/sclInt.h b/src/map/scl/sclInt.h index be9b49b0..c674c82e 100644 --- a/src/map/scl/sclInt.h +++ b/src/map/scl/sclInt.h @@ -60,6 +60,20 @@ typedef enum // -- timing sense, positive-, negative- or non-unate sc_ts_Non, } 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 /// //////////////////////////////////////////////////////////////////////// @@ -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_SclSave( char * pFileName, SC_Lib * pScl ); /*=== 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 =============================================================*/ -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 =============================================================*/ extern void Abc_SclHashCells( SC_Lib * p ); extern int Abc_SclCellFind( SC_Lib * p, char * pName ); diff --git a/src/map/scl/sclLoad.c b/src/map/scl/sclLoad.c index 3d763bd7..0ad3a405 100644 --- a/src/map/scl/sclLoad.c +++ b/src/map/scl/sclLoad.c @@ -84,7 +84,7 @@ Vec_Flt_t * Abc_SclFindWireCaps( SC_Man * p ) SC_LibForEachWireLoad( p->pLib, pWL, i ) if ( !strcmp(pWL->pName, p->pWLoadUsed) ) 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 ); exit(1); @@ -143,6 +143,8 @@ void Abc_SclComputeLoad( SC_Man * p ) pLoad->fall += pPin->fall_cap; } } + if ( !p->fUseWireLoads ) + return; // add wire load vWireCaps = Abc_SclFindWireCaps( p ); if ( vWireCaps ) diff --git a/src/map/scl/sclMan.h b/src/map/scl/sclMan.h index 3798152c..228ff8c9 100644 --- a/src/map/scl/sclMan.h +++ b/src/map/scl/sclMan.h @@ -47,21 +47,22 @@ struct SC_Pair_ struct SC_Man_ { - SC_Lib * pLib; // library - Abc_Ntk_t * pNtk; // network - Vec_Int_t * vGates; // mapping of objId into gateId - int nObjs; // allocated size - SC_Pair * pLoads; // loads for each gate - SC_Pair * pTimes; // arrivals for each gate - SC_Pair * pSlews; // slews for each gate - SC_Pair * pTimes2; // arrivals for each gate - SC_Pair * pSlews2; // slews for each gate - char * pWLoadUsed; // name of the used WireLoad model - clock_t clkStart; // starting time - float SumArea; // total area - float MaxDelay; // max delay - float SumArea0; // total area at the begining - float MaxDelay0; // max delay at the begining + SC_Lib * pLib; // library + Abc_Ntk_t * pNtk; // network + int fUseWireLoads; // set to 1 if wireloads are used + int nObjs; // allocated size + Vec_Int_t * vGates; // mapping of objId into gateId + SC_Pair * pLoads; // loads for each gate + SC_Pair * pTimes; // arrivals for each gate + SC_Pair * pSlews; // slews for each gate + SC_Pair * pTimes2; // arrivals for each gate + SC_Pair * pSlews2; // slews for each gate + char * pWLoadUsed; // name of the used WireLoad model + clock_t clkStart; // starting time + float SumArea; // total area + float MaxDelay; // max delay + float SumArea0; // total area at the begining + float MaxDelay0; // max delay at the begining }; //////////////////////////////////////////////////////////////////////// @@ -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_SclFindMostCriticalFanin( SC_Man * p, int * pfRise, Abc_Obj_t * pNode ); 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 ); /*=== sclTime.c =============================================================*/ extern void Abc_SclComputeLoad( SC_Man * p ); diff --git a/src/map/scl/sclSize.c b/src/map/scl/sclSize.c index 4be4fd5b..6b6e2778 100644 --- a/src/map/scl/sclSize.c +++ b/src/map/scl/sclSize.c @@ -395,25 +395,25 @@ void Abc_SclManUpsize( SC_Man * p ) 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; SC_Man * p; Vec_Int_t * vPath, * vPivots; 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; - p = Abc_SclManStart( pLib, pNtk ); - if ( fPrintCP ) + p = Abc_SclManStart( pLib, pNtk, pPars->fUseWireLoads ); + if ( pPars->fPrintCP ) 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 ); - if ( fVerbose ) + if ( pPars->fVerbose ) { // printf( "%5d : ", 0 ); printf( "Starting parameters of current mapping: " ); printf( "d =%8.2f ps ", SC_LibTimePs(p->pLib, Abc_SclGetMaxDelay(p)) ); - printf( "a =%10.2f ", p->SumArea ); + printf( "a =%10.2f ", p->SumArea ); printf( " " ); Abc_PrintTime( 1, "Time", clock() - p->clkStart ); } @@ -422,18 +422,18 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan float nThresh1 = p->MaxDelay0/100000; float nThresh2 = p->MaxDelay0/1000; // 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 ); nNodes = Vec_IntSize(vPath); Vec_IntFree( vPath ); Vec_IntFree( vPivots ); 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 ); nNodes = Vec_IntSize(vPath); Vec_IntFree( vPath ); @@ -443,7 +443,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan if ( pBest == NULL ) 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 if ( i && i % 100 == 0 ) Abc_SclComputeLoad( p ); @@ -454,12 +454,12 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan break; if ( nRuntimeLimit && clock() > nRuntimeLimit ) // timeout break; - if ( fVeryVerbose ) + if ( pPars->fVeryVerbose ) printf( "\n" ); // 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, NULL, 0, nThresh2 ); nNodes = Vec_IntSize(vPath); @@ -468,9 +468,9 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan 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, NULL, 0, nThresh2 ); nNodes = Vec_IntSize(vPath); @@ -481,7 +481,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan if ( pBest == NULL ) 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 if ( i && i % 100 == 0 ) Abc_SclComputeLoad( p ); @@ -491,18 +491,18 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan } if ( nRuntimeLimit && clock() > nRuntimeLimit ) // timeout break; - if ( fVeryVerbose ) + if ( pPars->fVeryVerbose ) printf( "\n" ); } p->MaxDelay = Abc_SclGetMaxDelay(p); - if ( fPrintCP ) + if ( pPars->fPrintCP ) Abc_SclTimeNtkPrint( p, 0 ); 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 printf( "Cones: %d. ", nCones ); - printf( "Resized: %d(%d). ", i, nDownSize ); + printf( "Resized: %d(%d). ", i, nDownSize ); printf( "Delay: " ); printf( "%.2f -> %.2f ps ", SC_LibTimePs(p->pLib, p->MaxDelay0), SC_LibTimePs(p->pLib, p->MaxDelay) ); printf( "(%+.1f %%). ", 100.0 * (p->MaxDelay - p->MaxDelay0)/ p->MaxDelay0 ); diff --git a/src/map/scl/sclTime.c b/src/map/scl/sclTime.c index c132fe5e..6b5031c1 100644 --- a/src/map/scl/sclTime.c +++ b/src/map/scl/sclTime.c @@ -82,11 +82,11 @@ Abc_Obj_t * Abc_SclFindMostCriticalFanin( SC_Man * p, int * pfRise, Abc_Obj_t * 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( "%d ", Abc_ObjFaninNum(pObj) ); - printf( "%-12s ", Abc_SclObjCell(p, pObj)->pName ); + printf( "%-*s ", Length, Abc_SclObjCell(p, pObj)->pName ); if ( fRise >= 0 ) printf( "(%s) ", fRise ? "rise" : "fall" ); printf( "delay = (" ); @@ -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 ) { - int i, fRise = 0; - Abc_Obj_t * pObj = Abc_SclFindCriticalCo( p, &fRise ); + int i, nLength = 0, fRise = 0; + Abc_Obj_t * pObj, * pPivot = Abc_SclFindCriticalCo( p, &fRise ); - printf( "WireLoad model = \"%s\". ", p->pWLoadUsed ); - printf( "Total area = %10.2f. ", Abc_SclGetTotalArea( p ) ); - printf( "Critical delay = %.1f ps\n", Abc_SclObjTimePs(p, pObj, fRise) ); + printf( "WireLoad model = \"%s\". ", p->pWLoadUsed ? p->pWLoadUsed : "none" ); + printf( "Gates = %d. ", Abc_NtkNodeNum(p->pNtk) ); + printf( "Area = %.2f. ", Abc_SclGetTotalArea( p ) ); + printf( "Critical delay = %.1f ps\n", Abc_SclObjTimePs(p, pPivot, fRise) ); if ( fShowAll ) { // printf( "Timing information for all nodes: \n" ); + // find the longest cell name Abc_NtkForEachNodeReverse( p->pNtk, pObj, i ) 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 { // 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) ) { printf( "Critical path -- " ); - Abc_SclTimeGatePrint( p, pObj, fRise ); + Abc_SclTimeGatePrint( p, pObj, fRise, nLength ); pObj = Abc_SclFindMostCriticalFanin( p, &fRise, pObj ); } } @@ -257,9 +271,10 @@ void Abc_SclTimeNtk( SC_Man * p ) 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 ); + p->fUseWireLoads = fUseWireLoads; assert( p->vGates == NULL ); p->vGates = Abc_SclManFindGates( pLib, pNtk ); // Abc_SclManUpsize( p ); @@ -281,10 +296,10 @@ SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk ) 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; - p = Abc_SclManStart( pLib, pNtk ); + p = Abc_SclManStart( pLib, pNtk, fUseWireLoads ); Abc_SclTimeNtkPrint( p, fShowAll ); Abc_SclManFree( p ); } |