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
}
}
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 )
{
......
......@@ -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 );
......
......@@ -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 )
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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 );
}
......
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