mirror of https://github.com/YosysHQ/abc.git
Adding code to estimate buffer trees.
This commit is contained in:
parent
9d19598162
commit
1558fe6110
|
|
@ -422,12 +422,24 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
int fUseWireLoads = 1;
|
||||
int fPrintPath = 0;
|
||||
int fDumpStats = 0;
|
||||
int nTreeCRatio = 0;
|
||||
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "capdh" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "Xcapdh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
case 'X':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
Abc_Print( -1, "Command line switch \"-X\" should be followed by a positive integer.\n" );
|
||||
goto usage;
|
||||
}
|
||||
nTreeCRatio = atoi(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( nTreeCRatio < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'c':
|
||||
fUseWireLoads ^= 1;
|
||||
break;
|
||||
|
|
@ -468,12 +480,13 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
return 1;
|
||||
}
|
||||
|
||||
Abc_SclTimePerform( (SC_Lib *)pAbc->pLibScl, Abc_FrameReadNtk(pAbc), fUseWireLoads, fShowAll, fPrintPath, fDumpStats );
|
||||
Abc_SclTimePerform( (SC_Lib *)pAbc->pLibScl, Abc_FrameReadNtk(pAbc), nTreeCRatio, fUseWireLoads, fShowAll, fPrintPath, fDumpStats );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
fprintf( pAbc->Err, "usage: stime [-capdh]\n" );
|
||||
fprintf( pAbc->Err, "usage: stime [-X num] [-capdth]\n" );
|
||||
fprintf( pAbc->Err, "\t performs STA using Liberty library\n" );
|
||||
fprintf( pAbc->Err, "\t-X : min Cout/Cave ratio for tree estimations [default = %d]\n", nTreeCRatio );
|
||||
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-p : display timing information for critical path [default = %s]\n", fPrintPath? "yes": "no" );
|
||||
|
|
@ -856,13 +869,14 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
pPars->DelayUser = 0;
|
||||
pPars->DelayGap = 0;
|
||||
pPars->TimeOut = 0;
|
||||
pPars->BuffTreeEst = 0;
|
||||
pPars->fUseDept = 1;
|
||||
pPars->fUseWireLoads = 1;
|
||||
pPars->fDumpStats = 0;
|
||||
pPars->fVerbose = 0;
|
||||
pPars->fVeryVerbose = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "IJWRNDGTcsdvwh" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "IJWRNDGTXcsdvwh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
|
|
@ -952,6 +966,17 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
if ( pPars->TimeOut < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'X':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
Abc_Print( -1, "Command line switch \"-X\" should be followed by a positive integer.\n" );
|
||||
goto usage;
|
||||
}
|
||||
pPars->BuffTreeEst = atoi(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( pPars->BuffTreeEst < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'c':
|
||||
pPars->fUseWireLoads ^= 1;
|
||||
break;
|
||||
|
|
@ -999,7 +1024,7 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
return 0;
|
||||
|
||||
usage:
|
||||
fprintf( pAbc->Err, "usage: upsize [-IJWRNDGT num] [-csdvwh]\n" );
|
||||
fprintf( pAbc->Err, "usage: upsize [-IJWRNDGTX num] [-csdvwh]\n" );
|
||||
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 );
|
||||
|
|
@ -1009,6 +1034,7 @@ usage:
|
|||
fprintf( pAbc->Err, "\t-D <num> : delay target set by the user, in picoseconds [default = %d]\n", pPars->DelayUser );
|
||||
fprintf( pAbc->Err, "\t-G <num> : delay gap during updating, in picoseconds [default = %d]\n", pPars->DelayGap );
|
||||
fprintf( pAbc->Err, "\t-T <num> : approximate timeout in seconds [default = %d]\n", pPars->TimeOut );
|
||||
fprintf( pAbc->Err, "\t-X <num> : ratio for buffer tree estimation [default = %d]\n", pPars->BuffTreeEst );
|
||||
fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", pPars->fUseWireLoads? "yes": "no" );
|
||||
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" );
|
||||
|
|
@ -1041,13 +1067,14 @@ int Scl_CommandDnsize( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
pPars->DelayUser = 0;
|
||||
pPars->DelayGap = 1000;
|
||||
pPars->TimeOut = 0;
|
||||
pPars->BuffTreeEst = 0;
|
||||
pPars->fUseDept = 1;
|
||||
pPars->fUseWireLoads = 1;
|
||||
pPars->fDumpStats = 0;
|
||||
pPars->fVerbose = 0;
|
||||
pPars->fVeryVerbose = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "IJNDGTcsdvwh" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "IJNDGTXcsdvwh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
|
|
@ -1115,6 +1142,17 @@ int Scl_CommandDnsize( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
if ( pPars->TimeOut < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'X':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
Abc_Print( -1, "Command line switch \"-X\" should be followed by a positive integer.\n" );
|
||||
goto usage;
|
||||
}
|
||||
pPars->BuffTreeEst = atoi(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( pPars->BuffTreeEst < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'c':
|
||||
pPars->fUseWireLoads ^= 1;
|
||||
break;
|
||||
|
|
@ -1162,7 +1200,7 @@ int Scl_CommandDnsize( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
return 0;
|
||||
|
||||
usage:
|
||||
fprintf( pAbc->Err, "usage: dnsize [-IJNDGT num] [-csdvwh]\n" );
|
||||
fprintf( pAbc->Err, "usage: dnsize [-IJNDGTX num] [-csdvwh]\n" );
|
||||
fprintf( pAbc->Err, "\t selectively decreases gate sizes while maintaining delay\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 );
|
||||
|
|
@ -1170,6 +1208,7 @@ usage:
|
|||
fprintf( pAbc->Err, "\t-D <num> : delay target set by the user, in picoseconds [default = %d]\n", pPars->DelayUser );
|
||||
fprintf( pAbc->Err, "\t-G <num> : delay gap during updating, in picoseconds [default = %d]\n", pPars->DelayGap );
|
||||
fprintf( pAbc->Err, "\t-T <num> : approximate timeout in seconds [default = %d]\n", pPars->TimeOut );
|
||||
fprintf( pAbc->Err, "\t-X <num> : ratio for buffer tree estimation [default = %d]\n", pPars->BuffTreeEst );
|
||||
fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", pPars->fUseWireLoads? "yes": "no" );
|
||||
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" );
|
||||
|
|
@ -1234,8 +1273,8 @@ int Scl_CommandPrintBuf( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
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, "usage: print_buf [-vh]\n" );
|
||||
fprintf( pAbc->Err, "\t prints buffers trees of the current design\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;
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ void Abc_SclDnsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars
|
|||
}
|
||||
|
||||
// prepare the manager; collect init stats
|
||||
p = Abc_SclManStart( pLib, pNtk, pPars->fUseWireLoads, pPars->fUseDept, SC_LibTimeFromPs(pLib, pPars->DelayUser) );
|
||||
p = Abc_SclManStart( pLib, pNtk, pPars->fUseWireLoads, pPars->fUseDept, SC_LibTimeFromPs(pLib, pPars->DelayUser), pPars->BuffTreeEst );
|
||||
p->timeTotal = Abc_Clock();
|
||||
assert( p->vGatesBest == NULL );
|
||||
p->vGatesBest = Vec_IntDup( p->vGates );
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ struct SC_SizePars_
|
|||
int DelayUser;
|
||||
int DelayGap;
|
||||
int TimeOut;
|
||||
int BuffTreeEst; // ratio for buffer tree estimation
|
||||
int fUseDept;
|
||||
int fDumpStats;
|
||||
int fUseWireLoads;
|
||||
|
|
|
|||
|
|
@ -141,6 +141,26 @@ void Abc_SclComputeLoad( SC_Man * p )
|
|||
printf( "Maximum input drive strength is exceeded at primary input %d.\n", i );
|
||||
}
|
||||
}
|
||||
// calculate average load
|
||||
if ( p->EstLoadMax )
|
||||
{
|
||||
double TotalLoad = 0;
|
||||
int nObjs = 0;
|
||||
Abc_NtkForEachNode1( p->pNtk, pObj, i )
|
||||
{
|
||||
SC_Pair * pLoad = Abc_SclObjLoad( p, pObj );
|
||||
TotalLoad += 0.5 * pLoad->fall + 0.5 * pLoad->rise;
|
||||
nObjs++;
|
||||
}
|
||||
Abc_NtkForEachPi( p->pNtk, pObj, i )
|
||||
{
|
||||
SC_Pair * pLoad = Abc_SclObjLoad( p, pObj );
|
||||
TotalLoad += 0.5 * pLoad->fall + 0.5 * pLoad->rise;
|
||||
nObjs++;
|
||||
}
|
||||
p->EstLoadAve = (float)(TotalLoad / nObjs);
|
||||
// printf( "Average load = %.2f\n", p->EstLoadAve );
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
|
|||
|
|
@ -110,17 +110,17 @@ static inline void Abc_SclTimeNodePrint( SC_Man * p, Abc_Obj_t * pObj, int fRise
|
|||
SC_Cell * pCell = Abc_ObjIsNode(pObj) ? Abc_SclObjCell(p, pObj) : NULL;
|
||||
printf( "%6d : ", Abc_ObjId(pObj) );
|
||||
printf( "%d ", Abc_ObjFaninNum(pObj) );
|
||||
printf( "%2d ", Abc_ObjFanoutNum(pObj) );
|
||||
printf( "%4d ", Abc_ObjFanoutNum(pObj) );
|
||||
printf( "%-*s ", Length, pCell ? pCell->pName : "pi" );
|
||||
printf( "A =%7.2f ", pCell ? pCell->area : 0.0 );
|
||||
printf( "D%s =", fRise ? "r" : "f" );
|
||||
printf( "%5.0f ", Abc_MaxFloat(Abc_SclObjTimePs(p, pObj, 0), Abc_SclObjTimePs(p, pObj, 1)) );
|
||||
printf( "%4.0f ps ", -Abc_AbsFloat(Abc_SclObjTimePs(p, pObj, 0) - Abc_SclObjTimePs(p, pObj, 1)) );
|
||||
printf( "%5.0f", Abc_MaxFloat(Abc_SclObjTimePs(p, pObj, 0), Abc_SclObjTimePs(p, pObj, 1)) );
|
||||
printf( "%6.0f ps ", -Abc_AbsFloat(Abc_SclObjTimePs(p, pObj, 0) - Abc_SclObjTimePs(p, pObj, 1)) );
|
||||
printf( "S =%5.0f ps ", Abc_SclObjSlewPs(p, pObj, fRise >= 0 ? fRise : 0 ) );
|
||||
printf( "Cin =%4.0f ff ", pCell ? Abc_SclGatePinCapAve(p->pLib, pCell) : 0.0 );
|
||||
printf( "Cout =%5.0f ff ", Abc_SclObjLoadFf(p, pObj, fRise >= 0 ? fRise : 0 ) );
|
||||
printf( "Cmax =%5.0f ff ", pCell ? SC_CellPin(pCell, pCell->n_inputs)->max_out_cap : 0.0 );
|
||||
printf( "G =%4.1f ", pCell ? Abc_SclObjLoadAve(p, pObj) / SC_CellPinCap(pCell, 0) : 0.0 );
|
||||
printf( "G =%5.1f ", pCell ? Abc_SclObjLoadAve(p, pObj) / SC_CellPinCap(pCell, 0) : 0.0 );
|
||||
printf( "SL =%5.1f ps", Abc_SclObjSlack(p, pObj) );
|
||||
printf( "\n" );
|
||||
}
|
||||
|
|
@ -208,6 +208,13 @@ void Abc_SclTimeNode( SC_Man * p, Abc_Obj_t * pObj, int fDept )
|
|||
SC_Pin * pPin;
|
||||
SC_Cell * pCell;
|
||||
int k;
|
||||
SC_Pair * pLoad = Abc_SclObjLoad( p, pObj );
|
||||
float LoadRise = pLoad->rise;
|
||||
float LoadFall = pLoad->fall;
|
||||
float DeptRise = 0;
|
||||
float DeptFall = 0;
|
||||
// float Value = Abc_MaxFloat(pLoad->fall, pLoad->rise) / (p->EstLoadAve * p->EstLoadMax);
|
||||
float Value = 0.5 * (pLoad->fall + pLoad->rise) / (p->EstLoadAve * p->EstLoadMax);
|
||||
if ( Abc_ObjIsCo(pObj) )
|
||||
{
|
||||
if ( !fDept )
|
||||
|
|
@ -215,6 +222,22 @@ void Abc_SclTimeNode( SC_Man * p, Abc_Obj_t * pObj, int fDept )
|
|||
return;
|
||||
}
|
||||
assert( Abc_ObjIsNode(pObj) );
|
||||
// if ( !(Abc_ObjFaninNum(pObj) == 1 && Abc_ObjIsPi(Abc_ObjFanin0(pObj))) && p->EstLoadMax && Value > 1 )
|
||||
if ( p->EstLoadMax && Value > 1 )
|
||||
{
|
||||
pLoad->rise = p->EstLoadAve * p->EstLoadMax;
|
||||
pLoad->fall = p->EstLoadAve * p->EstLoadMax;
|
||||
if ( fDept )
|
||||
{
|
||||
SC_Pair * pDepOut = Abc_SclObjDept( p, pObj );
|
||||
float EstDelta = p->EstLinear * log( Value );
|
||||
DeptRise = pDepOut->rise;
|
||||
DeptFall = pDepOut->fall;
|
||||
pDepOut->rise += EstDelta;
|
||||
pDepOut->fall += EstDelta;
|
||||
}
|
||||
p->nEstNodes++;
|
||||
}
|
||||
// get the library cell
|
||||
pCell = Abc_SclObjCell( p, pObj );
|
||||
// get the output pin
|
||||
|
|
@ -231,6 +254,24 @@ void Abc_SclTimeNode( SC_Man * p, Abc_Obj_t * pObj, int fDept )
|
|||
else
|
||||
Abc_SclTimeFanin( p, pTime, pObj, Abc_ObjFanin(pObj, k) );
|
||||
}
|
||||
if ( p->EstLoadMax && Value > 1 )
|
||||
{
|
||||
pLoad->rise = LoadRise;
|
||||
pLoad->fall = LoadFall;
|
||||
if ( fDept )
|
||||
{
|
||||
SC_Pair * pDepOut = Abc_SclObjDept( p, pObj );
|
||||
pDepOut->rise = DeptRise;
|
||||
pDepOut->fall = DeptFall;
|
||||
}
|
||||
else
|
||||
{
|
||||
SC_Pair * pArrOut = Abc_SclObjTime( p, pObj );
|
||||
float EstDelta = p->EstLinear * log( Value );
|
||||
pArrOut->rise += EstDelta;
|
||||
pArrOut->fall += EstDelta;
|
||||
}
|
||||
}
|
||||
}
|
||||
void Abc_SclTimeCone( SC_Man * p, Vec_Int_t * vCone )
|
||||
{
|
||||
|
|
@ -256,6 +297,7 @@ void Abc_SclTimeNtkRecompute( SC_Man * p, float * pArea, float * pDelay, int fRe
|
|||
int i;
|
||||
Abc_SclComputeLoad( p );
|
||||
Abc_SclManCleanTime( p );
|
||||
p->nEstNodes = 0;
|
||||
Abc_NtkForEachNode1( p->pNtk, pObj, i )
|
||||
Abc_SclTimeNode( p, pObj, 0 );
|
||||
Abc_NtkForEachCo( p->pNtk, pObj, i )
|
||||
|
|
@ -273,11 +315,18 @@ void Abc_SclTimeNtkRecompute( SC_Man * p, float * pArea, float * pDelay, int fRe
|
|||
*pDelay = D;
|
||||
if ( fReverse )
|
||||
{
|
||||
p->nEstNodes = 0;
|
||||
Abc_NtkForEachNodeReverse1( p->pNtk, pObj, i )
|
||||
Abc_SclTimeNode( p, pObj, 1 );
|
||||
Abc_NtkForEachObj( p->pNtk, pObj, i )
|
||||
{
|
||||
// if ( Abc_SclObjGetSlack(p, pObj, D) < 0 )
|
||||
// printf( "%.2f ", Abc_SclObjGetSlack(p, pObj, D) );
|
||||
p->pSlack[i] = Abc_MaxFloat( 0.0, Abc_SclObjGetSlack(p, pObj, D) );
|
||||
}
|
||||
}
|
||||
if ( p->nEstNodes )
|
||||
printf( "Estimated nodes = %d.\n", p->nEstNodes );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -379,9 +428,14 @@ void Abc_SclManReadSlewAndLoad( SC_Man * p, Abc_Ntk_t * pNtk )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, int fDept, float DUser )
|
||||
SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, int fDept, float DUser, int nTreeCRatio )
|
||||
{
|
||||
SC_Man * p = Abc_SclManAlloc( pLib, pNtk );
|
||||
if ( nTreeCRatio )
|
||||
{
|
||||
p->EstLoadMax = 0.01 * nTreeCRatio; // max ratio of Cout/Cave when the estimation is used
|
||||
p->EstLinear = 100; // linear coefficient
|
||||
}
|
||||
assert( p->vGates == NULL );
|
||||
p->vGates = Abc_SclManFindGates( pLib, pNtk );
|
||||
Abc_SclManReadSlewAndLoad( p, pNtk );
|
||||
|
|
@ -403,10 +457,10 @@ SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, in
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats )
|
||||
void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats )
|
||||
{
|
||||
SC_Man * p;
|
||||
p = Abc_SclManStart( pLib, pNtk, fUseWireLoads, 1, 0 );
|
||||
p = Abc_SclManStart( pLib, pNtk, fUseWireLoads, 1, 0, nTreeCRatio );
|
||||
Abc_SclTimeNtkPrint( p, fShowAll, fPrintPath );
|
||||
if ( fDumpStats )
|
||||
Abc_SclDumpStats( p, "stats.txt", 0 );
|
||||
|
|
@ -470,16 +524,6 @@ void Abc_SclPrintFaninPairs( SC_Man * p, Abc_Ntk_t * pNtk )
|
|||
|
||||
***********************************************************************/
|
||||
static inline int Abc_ObjIsBuffer( Abc_Obj_t * pObj ) { return Abc_ObjIsNode(pObj) && Abc_ObjFaninNum(pObj) == 1; }
|
||||
int Abc_SclCountNonBufferFanouts( Abc_Obj_t * pObj )
|
||||
{
|
||||
Abc_Obj_t * pFanout;
|
||||
int i, Counter = 0;
|
||||
if ( !Abc_ObjIsBuffer(pObj) )
|
||||
return 1;
|
||||
Abc_ObjForEachFanout( pObj, pFanout, i )
|
||||
Counter += Abc_SclCountNonBufferFanouts( pFanout );
|
||||
return Counter;
|
||||
}
|
||||
int Abc_SclHasBufferFanout( Abc_Obj_t * pObj )
|
||||
{
|
||||
Abc_Obj_t * pFanout;
|
||||
|
|
@ -489,44 +533,141 @@ int Abc_SclHasBufferFanout( Abc_Obj_t * pObj )
|
|||
return 1;
|
||||
return 0;
|
||||
}
|
||||
void Abc_SclPrintBuffersInt( SC_Man * p, Abc_Obj_t * pObj, int nOffset )
|
||||
int Abc_SclCountBufferFanoutsInt( Abc_Obj_t * pObj )
|
||||
{
|
||||
// SC_Cell_t * pCell = Abc_SclObjCell(p, pObj);
|
||||
Abc_Obj_t * pFanout;
|
||||
int i, Counter = 0;
|
||||
Abc_ObjForEachFanout( pObj, pFanout, i )
|
||||
if ( Abc_ObjIsBuffer(pFanout) )
|
||||
Counter += Abc_SclCountBufferFanoutsInt( pFanout );
|
||||
return Counter + Abc_ObjIsBuffer(pObj);
|
||||
}
|
||||
int Abc_SclCountBufferFanouts( Abc_Obj_t * pObj )
|
||||
{
|
||||
return Abc_SclCountBufferFanoutsInt(pObj) - Abc_ObjIsBuffer(pObj);
|
||||
}
|
||||
int Abc_SclCountNonBufferFanoutsInt( Abc_Obj_t * pObj )
|
||||
{
|
||||
Abc_Obj_t * pFanout;
|
||||
int i, Counter = 0;
|
||||
if ( !Abc_ObjIsBuffer(pObj) )
|
||||
return 1;
|
||||
Abc_ObjForEachFanout( pObj, pFanout, i )
|
||||
Counter += Abc_SclCountNonBufferFanoutsInt( pFanout );
|
||||
return Counter;
|
||||
}
|
||||
int Abc_SclCountNonBufferFanouts( Abc_Obj_t * pObj )
|
||||
{
|
||||
Abc_Obj_t * pFanout;
|
||||
int i, Counter = 0;
|
||||
Abc_ObjForEachFanout( pObj, pFanout, i )
|
||||
Counter += Abc_SclCountNonBufferFanoutsInt( pFanout );
|
||||
return Counter;
|
||||
}
|
||||
float Abc_SclCountNonBufferDelayInt( SC_Man * p, Abc_Obj_t * pObj )
|
||||
{
|
||||
Abc_Obj_t * pFanout;
|
||||
float Delay = 0;
|
||||
int i;
|
||||
if ( !Abc_ObjIsBuffer(pObj) )
|
||||
return Abc_SclObjTimePs(p, pObj, 1);
|
||||
Abc_ObjForEachFanout( pObj, pFanout, i )
|
||||
Delay += Abc_SclCountNonBufferDelayInt( p, pFanout );
|
||||
return Delay;
|
||||
}
|
||||
float Abc_SclCountNonBufferDelay( SC_Man * p, Abc_Obj_t * pObj )
|
||||
{
|
||||
Abc_Obj_t * pFanout;
|
||||
float Delay = 0;
|
||||
int i;
|
||||
Abc_ObjForEachFanout( pObj, pFanout, i )
|
||||
Delay += Abc_SclCountNonBufferDelayInt( p, pFanout );
|
||||
return Delay;
|
||||
}
|
||||
float Abc_SclCountNonBufferLoadInt( SC_Man * p, Abc_Obj_t * pObj )
|
||||
{
|
||||
Abc_Obj_t * pFanout;
|
||||
float Load = 0;
|
||||
int i;
|
||||
if ( !Abc_ObjIsBuffer(pObj) )
|
||||
return 0;
|
||||
Abc_ObjForEachFanout( pObj, pFanout, i )
|
||||
Load += Abc_SclCountNonBufferLoadInt( p, pFanout );
|
||||
Load += 0.5 * Abc_SclObjLoad(p, pObj)->rise + 0.5 * Abc_SclObjLoad(p, pObj)->fall;
|
||||
Load -= 0.5 * SC_CellPin(Abc_SclObjCell(p, pObj), 0)->rise_cap + 0.5 * SC_CellPin(Abc_SclObjCell(p, pObj), 0)->fall_cap;
|
||||
return Load;
|
||||
}
|
||||
float Abc_SclCountNonBufferLoad( SC_Man * p, Abc_Obj_t * pObj )
|
||||
{
|
||||
Abc_Obj_t * pFanout;
|
||||
float Load = 0;
|
||||
int i;
|
||||
Abc_ObjForEachFanout( pObj, pFanout, i )
|
||||
Load += Abc_SclCountNonBufferLoadInt( p, pFanout );
|
||||
Load += 0.5 * Abc_SclObjLoad(p, pObj)->rise + 0.5 * Abc_SclObjLoad(p, pObj)->fall;
|
||||
return Load;
|
||||
}
|
||||
void Abc_SclPrintBuffersOne( SC_Man * p, Abc_Obj_t * pObj, int nOffset )
|
||||
{
|
||||
int i;
|
||||
assert( Abc_ObjIsBuffer(pObj) );
|
||||
for ( i = 0; i < nOffset; i++ )
|
||||
printf( " " );
|
||||
printf( "%6d: %-16s (%2d:%3d) ", Abc_ObjId(pObj), Mio_GateReadName((Mio_Gate_t *)pObj->pData),
|
||||
Abc_ObjFanoutNum(pObj), Abc_SclCountNonBufferFanouts(pObj) );
|
||||
printf( "%6d: %-16s (%2d:%3d:%3d) ",
|
||||
Abc_ObjId(pObj),
|
||||
Abc_ObjIsPi(pObj) ? "pi" : Mio_GateReadName((Mio_Gate_t *)pObj->pData),
|
||||
Abc_ObjFanoutNum(pObj),
|
||||
Abc_SclCountBufferFanouts(pObj),
|
||||
Abc_SclCountNonBufferFanouts(pObj) );
|
||||
for ( ; i < 4; i++ )
|
||||
printf( " " );
|
||||
printf( "a =%5.2f ", Abc_SclObjCell(p, pObj)->area );
|
||||
printf( "a =%5.2f ", Abc_ObjIsPi(pObj) ? 0 : Abc_SclObjCell(p, pObj)->area );
|
||||
printf( "d = (" );
|
||||
printf( "%7.2f ps; ", Abc_SclObjTimePs(p, pObj, 1) );
|
||||
printf( "%7.2f ps) ", Abc_SclObjTimePs(p, pObj, 0) );
|
||||
printf( "l =%6.2f ff ", Abc_SclObjLoadFf(p, pObj, 0 ) );
|
||||
printf( "s =%6.2f ps ", Abc_SclObjSlewPs(p, pObj, 0 ) );
|
||||
printf( "sl =%6.2f ps", Abc_SclObjSlack(p, pObj) );
|
||||
printf( "%6.0f ps; ", Abc_SclObjTimePs(p, pObj, 1) );
|
||||
printf( "%6.0f ps) ", Abc_SclObjTimePs(p, pObj, 0) );
|
||||
printf( "l =%5.0f ff ", Abc_SclObjLoadFf(p, pObj, 0 ) );
|
||||
printf( "s =%5.0f ps ", Abc_SclObjSlewPs(p, pObj, 0 ) );
|
||||
printf( "sl =%5.0f ps ", Abc_SclObjSlack(p, pObj) );
|
||||
if ( nOffset == 0 )
|
||||
{
|
||||
printf( "L =%5.0f ff ", SC_LibCapFf( p->pLib, Abc_SclCountNonBufferLoad(p, pObj) ) );
|
||||
printf( "Lx =%5.0f ff ", 100.0*Abc_SclCountNonBufferLoad(p, pObj)/p->EstLoadAve );
|
||||
printf( "Dx =%5.0f ps ", Abc_SclCountNonBufferDelay(p, pObj)/Abc_SclCountNonBufferFanouts(pObj) - Abc_SclObjTimePs(p, pObj, 1) );
|
||||
printf( "Cx =%5.0f ps", (Abc_SclCountNonBufferDelay(p, pObj)/Abc_SclCountNonBufferFanouts(pObj) - Abc_SclObjTimePs(p, pObj, 1))/log(Abc_SclCountNonBufferLoad(p, pObj)/p->EstLoadAve) );
|
||||
}
|
||||
printf( "\n" );
|
||||
}
|
||||
void Abc_SclPrintBuffersInt( SC_Man * p, Abc_Obj_t * pObj, int nOffset )
|
||||
{
|
||||
Abc_Obj_t * pFanout;
|
||||
int i;
|
||||
Abc_SclPrintBuffersOne( p, pObj, nOffset );
|
||||
assert( Abc_ObjIsBuffer(pObj) );
|
||||
Abc_ObjForEachFanout( pObj, pFanout, i )
|
||||
if ( Abc_ObjIsBuffer(pFanout) )
|
||||
Abc_SclPrintBuffersInt( p, pFanout, nOffset + 1 );
|
||||
}
|
||||
void Abc_SclPrintBufferTrees( SC_Man * p, Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
Abc_Obj_t * pObj, * pFanout;
|
||||
int i, k;
|
||||
Abc_NtkForEachObj( pNtk, pObj, i )
|
||||
if ( Abc_ObjIsBuffer(pObj) && Abc_SclHasBufferFanout(pObj) )
|
||||
Abc_SclPrintBuffersInt( p, pObj, 0 ), printf( "\n" );
|
||||
{
|
||||
if ( !Abc_ObjIsBuffer(pObj) && Abc_SclCountBufferFanouts(pObj) > 3 )
|
||||
{
|
||||
Abc_SclPrintBuffersOne( p, pObj, 0 );
|
||||
Abc_ObjForEachFanout( pObj, pFanout, k )
|
||||
if ( Abc_ObjIsBuffer(pFanout) )
|
||||
Abc_SclPrintBuffersInt( p, pFanout, 1 );
|
||||
printf( "\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
void Abc_SclPrintBuffers( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fVerbose )
|
||||
{
|
||||
int fUseWireLoads = 0;
|
||||
SC_Man * p;
|
||||
assert( Abc_NtkIsMappedLogic(pNtk) );
|
||||
p = Abc_SclManStart( pLib, pNtk, fUseWireLoads, 1, 0 );
|
||||
p = Abc_SclManStart( pLib, pNtk, fUseWireLoads, 1, 0, 10000 );
|
||||
Abc_SclPrintBufferTrees( p, pNtk );
|
||||
// Abc_SclPrintFaninPairs( p, pNtk );
|
||||
Abc_SclManFree( p );
|
||||
|
|
|
|||
|
|
@ -63,6 +63,11 @@ struct SC_Man_
|
|||
Vec_Flt_t * vTimesOut; // output arrival times
|
||||
Vec_Que_t * vQue; // outputs by their time
|
||||
SC_WireLoad * pWLoadUsed; // name of the used WireLoad model
|
||||
// buffer trees
|
||||
float EstLoadMax; // max ratio of Cout/Cin when this kicks in
|
||||
float EstLoadAve; // average load of the gate
|
||||
float EstLinear; // linear coefficient
|
||||
int nEstNodes; // the number of estimations
|
||||
// intermediate data
|
||||
Vec_Que_t * vNodeByGain; // nodes by gain
|
||||
Vec_Flt_t * vNode2Gain; // mapping node into its gain
|
||||
|
|
@ -401,10 +406,10 @@ extern void Abc_SclUpdateLoad( SC_Man * p, Abc_Obj_t * pObj, SC_Cell *
|
|||
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, int fPrintPath );
|
||||
extern SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, int fDept, float DUser );
|
||||
extern SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, int fDept, float DUser, int nTreeCRatio );
|
||||
extern void Abc_SclTimeCone( SC_Man * p, Vec_Int_t * vCone );
|
||||
extern void Abc_SclTimeNtkRecompute( SC_Man * p, float * pArea, float * pDelay, int fReverse, float DUser );
|
||||
extern void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats );
|
||||
extern void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats );
|
||||
extern void Abc_SclPrintBuffers( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fVerbose );
|
||||
extern int Abc_SclInputDriveOk( SC_Man * p, Abc_Obj_t * pObj, SC_Cell * pCell );
|
||||
/*=== sclUpsize.c ===============================================================*/
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars
|
|||
}
|
||||
|
||||
// prepare the manager; collect init stats
|
||||
p = Abc_SclManStart( pLib, pNtk, pPars->fUseWireLoads, pPars->fUseDept, 0 );
|
||||
p = Abc_SclManStart( pLib, pNtk, pPars->fUseWireLoads, pPars->fUseDept, 0, pPars->BuffTreeEst );
|
||||
p->timeTotal = Abc_Clock();
|
||||
assert( p->vGatesBest == NULL );
|
||||
p->vGatesBest = Vec_IntDup( p->vGates );
|
||||
|
|
|
|||
Loading…
Reference in New Issue