Commit 573d6d7a by Alan Mishchenko

Enable wire load estimation in buffering/sizing.

parent 118cb03b
...@@ -715,10 +715,11 @@ int Scl_CommandBufSize( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -715,10 +715,11 @@ int Scl_CommandBufSize( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fSizeOnly = 0; pPars->fSizeOnly = 0;
pPars->fAddBufs = 0; pPars->fAddBufs = 0;
pPars->fBufPis = 0; pPars->fBufPis = 0;
pPars->fUseWireLoads = 1;
pPars->fVerbose = 0; pPars->fVerbose = 0;
pPars->fVeryVerbose = 0; pPars->fVeryVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "GSNsbpvwh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "GSNsbpcvwh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -764,6 +765,9 @@ int Scl_CommandBufSize( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -764,6 +765,9 @@ int Scl_CommandBufSize( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'p': case 'p':
pPars->fBufPis ^= 1; pPars->fBufPis ^= 1;
break; break;
case 'c':
pPars->fUseWireLoads ^= 1;
break;
case 'v': case 'v':
pPars->fVerbose ^= 1; pPars->fVerbose ^= 1;
break; break;
...@@ -804,7 +808,7 @@ int Scl_CommandBufSize( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -804,7 +808,7 @@ int Scl_CommandBufSize( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
fprintf( pAbc->Err, "usage: bufsize [-GSM num] [-sbpvwh]\n" ); fprintf( pAbc->Err, "usage: bufsize [-GSM num] [-sbpcvwh]\n" );
fprintf( pAbc->Err, "\t performs buffering and sizing and mapped network\n" ); fprintf( pAbc->Err, "\t performs buffering and sizing and mapped network\n" );
fprintf( pAbc->Err, "\t-G <num> : target gain percentage [default = %d]\n", pPars->GainRatio ); fprintf( pAbc->Err, "\t-G <num> : target gain percentage [default = %d]\n", pPars->GainRatio );
fprintf( pAbc->Err, "\t-S <num> : target slew in pisoseconds [default = %d]\n", pPars->Slew ); fprintf( pAbc->Err, "\t-S <num> : target slew in pisoseconds [default = %d]\n", pPars->Slew );
...@@ -812,6 +816,7 @@ usage: ...@@ -812,6 +816,7 @@ usage:
fprintf( pAbc->Err, "\t-s : toggle performing only sizing [default = %s]\n", pPars->fSizeOnly? "yes": "no" ); fprintf( pAbc->Err, "\t-s : toggle performing only sizing [default = %s]\n", pPars->fSizeOnly? "yes": "no" );
fprintf( pAbc->Err, "\t-b : toggle using buffers instead of inverters [default = %s]\n", pPars->fAddBufs? "yes": "no" ); fprintf( pAbc->Err, "\t-b : toggle using buffers instead of inverters [default = %s]\n", pPars->fAddBufs? "yes": "no" );
fprintf( pAbc->Err, "\t-p : toggle buffering primary inputs [default = %s]\n", pPars->fBufPis? "yes": "no" ); fprintf( pAbc->Err, "\t-p : toggle buffering primary inputs [default = %s]\n", pPars->fBufPis? "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", pPars->fVerbose? "yes": "no" ); fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" );
fprintf( pAbc->Err, "\t-w : toggle printing more verbose information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); fprintf( pAbc->Err, "\t-w : toggle printing more verbose information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
fprintf( pAbc->Err, "\t-h : print the command usage\n"); fprintf( pAbc->Err, "\t-h : print the command usage\n");
......
...@@ -37,6 +37,8 @@ struct Bus_Man_t_ ...@@ -37,6 +37,8 @@ struct Bus_Man_t_
// library // library
SC_Lib * pLib; // cell library SC_Lib * pLib; // cell library
SC_Cell * pInv; // base interter (largest/average/???) SC_Cell * pInv; // base interter (largest/average/???)
SC_WireLoad * pWLoadUsed; // name of the used WireLoad model
Vec_Flt_t * vWireCaps; // estimated wire loads
// internal // internal
Vec_Flt_t * vCins; // input cap for fanouts Vec_Flt_t * vCins; // input cap for fanouts
Vec_Flt_t * vLoads; // loads for all nodes Vec_Flt_t * vLoads; // loads for all nodes
...@@ -75,6 +77,17 @@ Bus_Man_t * Bus_ManStart( Abc_Ntk_t * pNtk, SC_Lib * pLib, SC_BusPars * pPars ) ...@@ -75,6 +77,17 @@ Bus_Man_t * Bus_ManStart( Abc_Ntk_t * pNtk, SC_Lib * pLib, SC_BusPars * pPars )
p->pNtk = pNtk; p->pNtk = pNtk;
p->pLib = pLib; p->pLib = pLib;
p->pInv = Abc_SclFindInvertor(pLib, pPars->fAddBufs)->pAve; p->pInv = Abc_SclFindInvertor(pLib, pPars->fAddBufs)->pAve;
if ( pPars->fUseWireLoads )
{
if ( pNtk->pWLoadUsed == NULL )
{
p->pWLoadUsed = Abc_SclFindWireLoadModel( pLib, Abc_SclGetTotalArea(pNtk) );
pNtk->pWLoadUsed = Abc_UtilStrsav( p->pWLoadUsed->pName );
}
else
p->pWLoadUsed = Abc_SclFetchWireLoadModel( pLib, pNtk->pWLoadUsed );
}
p->vWireCaps = Abc_SclFindWireCaps( p->pWLoadUsed );
p->vCins = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) ); p->vCins = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) );
p->vLoads = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) ); p->vLoads = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) );
p->vDepts = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) ); p->vDepts = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) );
...@@ -83,6 +96,7 @@ Bus_Man_t * Bus_ManStart( Abc_Ntk_t * pNtk, SC_Lib * pLib, SC_BusPars * pPars ) ...@@ -83,6 +96,7 @@ Bus_Man_t * Bus_ManStart( Abc_Ntk_t * pNtk, SC_Lib * pLib, SC_BusPars * pPars )
} }
void Bus_ManStop( Bus_Man_t * p ) void Bus_ManStop( Bus_Man_t * p )
{ {
Vec_FltFree( p->vWireCaps );
Vec_FltFree( p->vCins ); Vec_FltFree( p->vCins );
Vec_FltFree( p->vLoads ); Vec_FltFree( p->vLoads );
Vec_FltFree( p->vDepts ); Vec_FltFree( p->vDepts );
...@@ -165,7 +179,7 @@ void Abc_NtkComputeFanoutCins( Abc_Obj_t * pObj ) ...@@ -165,7 +179,7 @@ void Abc_NtkComputeFanoutCins( Abc_Obj_t * pObj )
Bus_SclObjSetCin( pFanout, cap ); Bus_SclObjSetCin( pFanout, cap );
} }
} }
float Abc_NtkComputeNodeLoad( Abc_Obj_t * pObj ) float Abc_NtkComputeNodeLoad( Bus_Man_t * p, Abc_Obj_t * pObj )
{ {
Abc_Obj_t * pFanout; Abc_Obj_t * pFanout;
float Load = 0; float Load = 0;
...@@ -173,6 +187,7 @@ float Abc_NtkComputeNodeLoad( Abc_Obj_t * pObj ) ...@@ -173,6 +187,7 @@ float Abc_NtkComputeNodeLoad( Abc_Obj_t * pObj )
assert( Bus_SclObjLoad(pObj) == 0 ); assert( Bus_SclObjLoad(pObj) == 0 );
Abc_ObjForEachFanout( pObj, pFanout, i ) Abc_ObjForEachFanout( pObj, pFanout, i )
Load += Bus_SclObjCin( pFanout ); Load += Bus_SclObjCin( pFanout );
Load += Abc_SclFindWireLoad( p->vWireCaps, pObj );
Bus_SclObjSetLoad( pObj, Load ); Bus_SclObjSetLoad( pObj, Load );
return Load; return Load;
} }
...@@ -195,21 +210,6 @@ float Abc_NtkComputeNodeDept( Abc_Obj_t * pObj, float Slew ) ...@@ -195,21 +210,6 @@ float Abc_NtkComputeNodeDept( Abc_Obj_t * pObj, float Slew )
} }
return Bus_SclObjDept( pObj ); return Bus_SclObjDept( pObj );
} }
/*
void Abc_NtkUpdateFaninDeparture( Bus_Man_t * p, Abc_Obj_t * pObj, float Load )
{
SC_Cell * pCell = Abc_SclObjCell( pObj );
Abc_Obj_t * pFanin;
float Dept, Edge;
int i;
Dept = Bus_SclObjDept( pObj );
Abc_ObjForEachFanin( pObj, pFanin, i )
{
Edge = Scl_LibPinArrivalEstimate( pCell, i, Load );
Bus_SclObjUpdateDept( pFanin, Dept + Edge );
}
}
*/
/**Function************************************************************* /**Function*************************************************************
...@@ -301,7 +301,7 @@ Abc_Obj_t * Abc_SclAddOneInv( Bus_Man_t * p, Abc_Obj_t * pObj, Vec_Ptr_t * vFano ...@@ -301,7 +301,7 @@ Abc_Obj_t * Abc_SclAddOneInv( Bus_Man_t * p, Abc_Obj_t * pObj, Vec_Ptr_t * vFano
Vec_IntSetEntry( p->pNtk->vGates, Abc_ObjId(pInv), pCellNew->Id ); Vec_IntSetEntry( p->pNtk->vGates, Abc_ObjId(pInv), pCellNew->Id );
Bus_SclObjSetCin( pInv, SC_CellPinCap(pCellNew, 0) ); Bus_SclObjSetCin( pInv, SC_CellPinCap(pCellNew, 0) );
// update timing // update timing
Abc_NtkComputeNodeLoad( pInv ); Abc_NtkComputeNodeLoad( p, pInv );
Abc_NtkComputeNodeDept( pInv, p->pPars->Slew ); Abc_NtkComputeNodeDept( pInv, p->pPars->Slew );
// update phases // update phases
if ( p->pNtk->vPhases && Abc_SclIsInv(pInv) ) if ( p->pNtk->vPhases && Abc_SclIsInv(pInv) )
...@@ -323,7 +323,7 @@ void Abc_SclBufSize( Bus_Man_t * p ) ...@@ -323,7 +323,7 @@ void Abc_SclBufSize( Bus_Man_t * p )
{ {
// compute load // compute load
Abc_NtkComputeFanoutCins( pObj ); Abc_NtkComputeFanoutCins( pObj );
Load = Abc_NtkComputeNodeLoad( pObj ); Load = Abc_NtkComputeNodeLoad( p, pObj );
// consider the gate // consider the gate
pCell = Abc_SclObjCell( pObj ); pCell = Abc_SclObjCell( pObj );
Cin = SC_CellPinCapAve( pCell->pAve ); Cin = SC_CellPinCapAve( pCell->pAve );
......
...@@ -95,6 +95,7 @@ struct SC_BusPars_ ...@@ -95,6 +95,7 @@ struct SC_BusPars_
int fSizeOnly; // perform only sizing int fSizeOnly; // perform only sizing
int fAddBufs; // add buffers int fAddBufs; // add buffers
int fBufPis; // use CI buffering int fBufPis; // use CI buffering
int fUseWireLoads; // wire loads
int fVerbose; // verbose int fVerbose; // verbose
int fVeryVerbose; // verbose int fVeryVerbose; // verbose
}; };
......
...@@ -42,7 +42,7 @@ ABC_NAMESPACE_IMPL_START ...@@ -42,7 +42,7 @@ ABC_NAMESPACE_IMPL_START
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Vec_Flt_t * Abc_SclFindWireCaps( SC_Man * p, SC_WireLoad * pWL ) Vec_Flt_t * Abc_SclFindWireCaps( SC_WireLoad * pWL )
{ {
Vec_Flt_t * vCaps = NULL; Vec_Flt_t * vCaps = NULL;
float EntryPrev, EntryCur; float EntryPrev, EntryCur;
...@@ -79,14 +79,14 @@ Vec_Flt_t * Abc_SclFindWireCaps( SC_Man * p, SC_WireLoad * pWL ) ...@@ -79,14 +79,14 @@ Vec_Flt_t * Abc_SclFindWireCaps( SC_Man * p, SC_WireLoad * pWL )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
static inline float Abc_SclFindWireLoad( SC_Man * p, Abc_Obj_t * pObj ) float Abc_SclFindWireLoad( Vec_Flt_t * vWireCaps, Abc_Obj_t * pObj )
{ {
int nFans = Abc_MinInt( Vec_FltSize(p->vWireCaps)-1, Abc_ObjFanoutNum(pObj) ); int nFans = Abc_MinInt( Vec_FltSize(vWireCaps)-1, Abc_ObjFanoutNum(pObj) );
return p->vWireCaps ? Vec_FltEntry(p->vWireCaps, nFans) : 0; return vWireCaps ? Vec_FltEntry(vWireCaps, nFans) : 0;
} }
void Abc_SclAddWireLoad( SC_Man * p, Abc_Obj_t * pObj, int fSubtr ) void Abc_SclAddWireLoad( SC_Man * p, Abc_Obj_t * pObj, int fSubtr )
{ {
float Load = Abc_SclFindWireLoad( p, pObj ); float Load = Abc_SclFindWireLoad( p->vWireCaps, pObj );
Abc_SclObjLoad(p, pObj)->rise += fSubtr ? -Load : Load; Abc_SclObjLoad(p, pObj)->rise += fSubtr ? -Load : Load;
Abc_SclObjLoad(p, pObj)->fall += fSubtr ? -Load : Load; Abc_SclObjLoad(p, pObj)->fall += fSubtr ? -Load : Load;
} }
...@@ -125,7 +125,7 @@ void Abc_SclComputeLoad( SC_Man * p ) ...@@ -125,7 +125,7 @@ void Abc_SclComputeLoad( SC_Man * p )
if ( p->pWLoadUsed != NULL ) if ( p->pWLoadUsed != NULL )
{ {
if ( p->vWireCaps == NULL ) if ( p->vWireCaps == NULL )
p->vWireCaps = Abc_SclFindWireCaps( p, p->pWLoadUsed ); p->vWireCaps = Abc_SclFindWireCaps( p->pWLoadUsed );
Abc_NtkForEachNode1( p->pNtk, pObj, i ) Abc_NtkForEachNode1( p->pNtk, pObj, i )
Abc_SclAddWireLoad( p, pObj, 0 ); Abc_SclAddWireLoad( p, pObj, 0 );
Abc_NtkForEachPi( p->pNtk, pObj, i ) Abc_NtkForEachPi( p->pNtk, pObj, i )
......
...@@ -136,7 +136,7 @@ void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll, int fPrintPath ) ...@@ -136,7 +136,7 @@ void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll, int fPrintPath )
printf( "Gates = %6d ", Abc_NtkNodeNum(p->pNtk) ); printf( "Gates = %6d ", Abc_NtkNodeNum(p->pNtk) );
printf( "Cave = %5.1f ", p->EstLoadAve ); printf( "Cave = %5.1f ", p->EstLoadAve );
printf( "Min = %5.1f %% ", 100.0 * Abc_SclCountMinSize(p->pLib, p->pNtk, 0) / Abc_NtkNodeNum(p->pNtk) ); printf( "Min = %5.1f %% ", 100.0 * Abc_SclCountMinSize(p->pLib, p->pNtk, 0) / Abc_NtkNodeNum(p->pNtk) );
printf( "Area = %12.2f ", Abc_SclGetTotalArea( p ) ); printf( "Area = %12.2f ", Abc_SclGetTotalArea(p->pNtk) );
printf( "Delay = %8.2f ps ", maxDelay ); printf( "Delay = %8.2f ps ", maxDelay );
printf( "Min = %5.1f %% ", 100.0 * Abc_SclCountNearCriticalNodes(p) / Abc_NtkNodeNum(p->pNtk) ); printf( "Min = %5.1f %% ", 100.0 * Abc_SclCountNearCriticalNodes(p) / Abc_NtkNodeNum(p->pNtk) );
printf( " \n" ); printf( " \n" );
...@@ -324,7 +324,7 @@ void Abc_SclTimeNtkRecompute( SC_Man * p, float * pArea, float * pDelay, int fRe ...@@ -324,7 +324,7 @@ void Abc_SclTimeNtkRecompute( SC_Man * p, float * pArea, float * pDelay, int fRe
if ( fReverse && DUser > 0 && D < DUser ) if ( fReverse && DUser > 0 && D < DUser )
D = DUser; D = DUser;
if ( pArea ) if ( pArea )
*pArea = Abc_SclGetTotalArea( p ); *pArea = Abc_SclGetTotalArea(p->pNtk);
if ( pDelay ) if ( pDelay )
*pDelay = D; *pDelay = D;
if ( fReverse ) if ( fReverse )
...@@ -600,7 +600,7 @@ SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, in ...@@ -600,7 +600,7 @@ SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, in
{ {
if ( pNtk->pWLoadUsed == NULL ) if ( pNtk->pWLoadUsed == NULL )
{ {
p->pWLoadUsed = Abc_SclFindWireLoadModel( pLib, Abc_SclGetTotalArea(p) ); p->pWLoadUsed = Abc_SclFindWireLoadModel( pLib, Abc_SclGetTotalArea(p->pNtk) );
pNtk->pWLoadUsed = Abc_UtilStrsav( p->pWLoadUsed->pName ); pNtk->pWLoadUsed = Abc_UtilStrsav( p->pWLoadUsed->pName );
} }
else else
......
...@@ -400,12 +400,12 @@ static inline void Abc_SclConeClean( SC_Man * p, Vec_Int_t * vCone ) ...@@ -400,12 +400,12 @@ static inline void Abc_SclConeClean( SC_Man * p, Vec_Int_t * vCone )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
static inline float Abc_SclGetTotalArea( SC_Man * p ) static inline float Abc_SclGetTotalArea( Abc_Ntk_t * pNtk )
{ {
double Area = 0; double Area = 0;
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
int i; int i;
Abc_NtkForEachNode1( p->pNtk, pObj, i ) Abc_NtkForEachNode1( pNtk, pObj, i )
Area += Abc_SclObjCell(pObj)->area; Area += Abc_SclObjCell(pObj)->area;
return Area; return Area;
} }
...@@ -508,6 +508,8 @@ extern Abc_Ntk_t * Abc_SclBufPerform( Abc_Ntk_t * pNtk, int FanMin, int FanMax ...@@ -508,6 +508,8 @@ extern Abc_Ntk_t * Abc_SclBufPerform( Abc_Ntk_t * pNtk, int FanMin, int FanMax
/*=== sclDnsize.c ===============================================================*/ /*=== sclDnsize.c ===============================================================*/
extern void Abc_SclDnsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars ); extern void Abc_SclDnsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars );
/*=== sclLoad.c ===============================================================*/ /*=== sclLoad.c ===============================================================*/
extern Vec_Flt_t * Abc_SclFindWireCaps( SC_WireLoad * pWL );
extern float Abc_SclFindWireLoad( Vec_Flt_t * vWireCaps, Abc_Obj_t * pObj );
extern void Abc_SclAddWireLoad( SC_Man * p, Abc_Obj_t * pObj, int fSubtr ); extern void Abc_SclAddWireLoad( SC_Man * p, Abc_Obj_t * pObj, int fSubtr );
extern void Abc_SclComputeLoad( SC_Man * p ); extern void Abc_SclComputeLoad( SC_Man * p );
extern void Abc_SclUpdateLoad( SC_Man * p, Abc_Obj_t * pObj, SC_Cell * pOld, SC_Cell * pNew ); extern void Abc_SclUpdateLoad( SC_Man * p, Abc_Obj_t * pObj, SC_Cell * pOld, SC_Cell * pNew );
......
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