summaryrefslogtreecommitdiffstats
path: root/src/map/scl
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2013-10-12 22:51:43 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2013-10-12 22:51:43 -0700
commitf8410b532b7ad523ba03bd7e91c2b24f73f07987 (patch)
tree50bb6e664d6a0b8a917a8faf1861e27e64b6fcd7 /src/map/scl
parent2c7f39026a12da14874b2d418d9aa8610e0ab726 (diff)
downloadabc-f8410b532b7ad523ba03bd7e91c2b24f73f07987.tar.gz
abc-f8410b532b7ad523ba03bd7e91c2b24f73f07987.tar.bz2
abc-f8410b532b7ad523ba03bd7e91c2b24f73f07987.zip
Improvements to buffering and sizing.
Diffstat (limited to 'src/map/scl')
-rw-r--r--src/map/scl/scl.c6
-rw-r--r--src/map/scl/sclBufSize.c99
-rw-r--r--src/map/scl/sclSize.c4
3 files changed, 59 insertions, 50 deletions
diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c
index 70b11288..455dd7d6 100644
--- a/src/map/scl/scl.c
+++ b/src/map/scl/scl.c
@@ -946,11 +946,11 @@ int Scl_CommandBufSize( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Ntk_t * pNtkRes, * pNtk = Abc_FrameReadNtk(pAbc);
int c;
memset( pPars, 0, sizeof(SC_BusPars) );
- pPars->GainRatio = 200;
+ pPars->GainRatio = 1000;
pPars->Slew = 100;
- pPars->nDegree = 8;
+ pPars->nDegree = 10;
pPars->fSizeOnly = 0;
- pPars->fAddBufs = 0;
+ pPars->fAddBufs = 1;
pPars->fBufPis = 0;
pPars->fUseWireLoads = 1;
pPars->fVerbose = 0;
diff --git a/src/map/scl/sclBufSize.c b/src/map/scl/sclBufSize.c
index cbf514d9..6257ec38 100644
--- a/src/map/scl/sclBufSize.c
+++ b/src/map/scl/sclBufSize.c
@@ -20,6 +20,7 @@
#include "sclSize.h"
#include "map/mio/mio.h"
+#include "base/main/main.h"
ABC_NAMESPACE_IMPL_START
@@ -34,6 +35,7 @@ struct Bus_Man_t_
// user data
SC_BusPars * pPars; // parameters
Abc_Ntk_t * pNtk; // user's network
+ SC_Cell * pPiDrive; // PI driver
// library
SC_Lib * pLib; // cell library
SC_Cell * pInv; // base interter (largest/average/???)
@@ -93,10 +95,10 @@ Bus_Man_t * Bus_ManStart( Abc_Ntk_t * pNtk, SC_Lib * pLib, SC_BusPars * pPars )
}
if ( p->pWLoadUsed )
p->vWireCaps = Abc_SclFindWireCaps( p->pWLoadUsed );
- p->vCins = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) + 1000 );
- p->vETimes = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) + 1000 );
- p->vLoads = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) + 1000 );
- p->vDepts = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) + 1000 );
+ p->vCins = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) + 10000 );
+ p->vETimes = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) + 10000 );
+ p->vLoads = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) + 10000 );
+ p->vDepts = Vec_FltStart( 2*Abc_NtkObjNumMax(pNtk) + 10000 );
p->vFanouts = Vec_PtrAlloc( 100 );
pNtk->pBSMan = p;
return p;
@@ -125,46 +127,28 @@ void Bus_ManStop( Bus_Man_t * p )
***********************************************************************/
void Bus_ManReadInOutLoads( Bus_Man_t * p )
{
- Abc_Time_t * pTime;
- Abc_Obj_t * pObj;
- int i;
- if ( p->pNtk->pManTime == NULL )
- return;
- // read input load
- pTime = Abc_NtkReadDefaultInputDrive( p->pNtk );
- if ( Abc_MaxFloat(pTime->Rise, pTime->Fall) != 0 )
- {
- printf( "Default input drive strength is specified (%.2f ff; %.2f ff).\n", pTime->Rise, pTime->Fall );
- Abc_NtkForEachPi( p->pNtk, pObj, i )
- Bus_SclObjSetCin( pObj, SC_LibCapFromFf(p->pLib, 0.5 * pTime->Rise + 0.5 * pTime->Fall) );
- }
- if ( Abc_NodeReadInputDrive(p->pNtk, 0) != NULL )
+ if ( Abc_FrameReadMaxLoad() )
{
- printf( "Input drive strengths for some primary inputs are specified.\n" );
- Abc_NtkForEachPi( p->pNtk, pObj, i )
- {
- pTime = Abc_NodeReadInputDrive(p->pNtk, i);
- Bus_SclObjSetCin( pObj, SC_LibCapFromFf(p->pLib, 0.5 * pTime->Rise + 0.5 * pTime->Fall) );
- }
- }
- // read output load
- pTime = Abc_NtkReadDefaultOutputLoad( p->pNtk );
- if ( Abc_MaxFloat(pTime->Rise, pTime->Fall) != 0 )
- {
- printf( "Default output load is specified (%.2f ff; %.2f ff).\n", pTime->Rise, pTime->Fall );
+ Abc_Obj_t * pObj; int i;
+ float MaxLoad = Abc_FrameReadMaxLoad();
Abc_NtkForEachPo( p->pNtk, pObj, i )
- Bus_SclObjSetCin( pObj, SC_LibCapFromFf(p->pLib, 0.5 * pTime->Rise + 0.5 * pTime->Fall) );
+ Bus_SclObjSetCin( pObj, MaxLoad );
+ printf( "Default output load is specified (%f ff).\n", SC_LibCapFf(p->pLib, MaxLoad) );
}
- if ( Abc_NodeReadOutputLoad(p->pNtk, 0) != NULL )
+ if ( Abc_FrameReadDrivingCell() )
{
- printf( "Output loads for some primary outputs are specified.\n" );
- Abc_NtkForEachPo( p->pNtk, pObj, i )
+ int iCell = Abc_SclCellFind( p->pLib, Abc_FrameReadDrivingCell() );
+ if ( iCell == -1 )
+ printf( "Cannot find the default PI driving cell (%s) in the library.\n", Abc_FrameReadDrivingCell() );
+ else
{
- pTime = Abc_NodeReadOutputLoad(p->pNtk, i);
- Bus_SclObjSetCin( pObj, SC_LibCapFromFf(p->pLib, 0.5 * pTime->Rise + 0.5 * pTime->Fall) );
+// printf( "Default PI driving cell is specified (%s).\n", Abc_FrameReadDrivingCell() );
+ p->pPiDrive = SC_LibCell( p->pLib, iCell );
+ assert( p->pPiDrive != NULL );
+ assert( p->pPiDrive->n_inputs == 1 );
+ printf( "Default input driving cell is specified (%s).\n", p->pPiDrive->pName );
}
}
- // read arrival/required times
}
/**Function*************************************************************
@@ -205,7 +189,7 @@ void Abc_NtkComputeFanoutInfo( Abc_Obj_t * pObj, float Slew )
Abc_ObjForEachFanout( pObj, pFanout, i )
if ( !Abc_ObjIsCo(pFanout) )
{
- int iFanin = Abc_NodeFindFanin(pFanout, pObj);;
+ int iFanin = Abc_NodeFindFanin(pFanout, pObj);
Bus_SclObjSetETime( pFanout, Abc_NtkComputeEdgeDept(pFanout, iFanin, Slew) );
Bus_SclObjSetCin( pFanout, SC_CellPinCap( Abc_SclObjCell(pFanout), iFanin ) );
}
@@ -252,7 +236,9 @@ void Abc_NtkPrintFanoutProfileVec( Abc_Obj_t * pObj, Vec_Ptr_t * vFanouts )
Vec_PtrForEachEntry( Abc_Obj_t *, vFanouts, pFanout, i )
{
printf( "%3d : time = %7.2f ps load = %7.2f ff ", i, Bus_SclObjETime(pFanout), Bus_SclObjCin(pFanout) );
- printf( "%s\n", (pObj && Abc_ObjFanoutNum(pObj) == Vec_PtrSize(vFanouts) && Abc_ObjFaninPhase( pFanout, Abc_NodeFindFanin(pFanout, pObj) )) ? "*" : " " );
+ if ( pObj->pNtk->vPhases )
+ printf( "%s", (pObj && Abc_ObjFanoutNum(pObj) == Vec_PtrSize(vFanouts) && Abc_ObjFaninPhase( pFanout, Abc_NodeFindFanin(pFanout, pObj) )) ? "*" : " " );
+ printf( "\n" );
}
printf( "\n" );
}
@@ -400,15 +386,25 @@ void Abc_SclBufSize( Bus_Man_t * p )
float Load, LoadNew, Cin, DeptMax = 0;
int i, k, nObjOld = Abc_NtkObjNumMax(p->pNtk);
Abc_SclMioGates2SclGates( p->pLib, p->pNtk );
- Abc_NtkForEachNodeReverse1( p->pNtk, pObj, i )
+ Abc_NtkForEachObjReverse( p->pNtk, pObj, i )
{
+ if ( !((Abc_ObjIsNode(pObj) && Abc_ObjFaninNum(pObj) > 0) || (Abc_ObjIsCi(pObj) && p->pPiDrive)) )
+ continue;
// compute load
Abc_NtkComputeFanoutInfo( pObj, p->pPars->Slew );
Load = Abc_NtkComputeNodeLoad( p, pObj );
// consider the gate
- pCell = Abc_SclObjCell( pObj );
- Cin = SC_CellPinCapAve( pCell->pAve );
+ if ( Abc_ObjIsCi(pObj) )
+ {
+ pCell = p->pPiDrive;
+ Cin = SC_CellPinCapAve( pCell );
+ }
+ else
+ {
+ pCell = Abc_SclObjCell( pObj );
+ Cin = SC_CellPinCapAve( pCell->pAve );
// Cin = SC_CellPinCapAve( pCell->pRepr->pNext );
+ }
// consider upsizing the gate
if ( !p->pPars->fSizeOnly && (Abc_ObjFanoutNum(pObj) > p->pPars->nDegree || Load > GainGate * Cin) )
{
@@ -427,7 +423,7 @@ void Abc_SclBufSize( Bus_Man_t * p )
Bus_SclInsertFanout( p->vFanouts, pInv );
Load = Abc_NtkComputeFanoutLoad( p, p->vFanouts );
}
- while ( Vec_PtrSize(p->vFanouts) > p->pPars->nDegree || Load > GainGate * Cin );
+ while ( Vec_PtrSize(p->vFanouts) > p->pPars->nDegree || (Vec_PtrSize(p->vFanouts) > 1 && Load > GainGate * Cin) );
// update node fanouts
Vec_PtrForEachEntry( Abc_Obj_t *, p->vFanouts, pFanout, k )
if ( Abc_ObjFaninNum(pFanout) == 0 )
@@ -436,6 +432,8 @@ void Abc_SclBufSize( Bus_Man_t * p )
LoadNew = Abc_NtkComputeNodeLoad( p, pObj );
assert( LoadNew - Load < 1 && Load - LoadNew < 1 );
}
+ if ( Abc_ObjIsCi(pObj) )
+ continue;
Abc_NtkComputeNodeDeparture( pObj, p->pPars->Slew );
// create cell
pCellNew = Abc_SclFindSmallestGate( pCell, Load / GainGate );
@@ -444,12 +442,23 @@ void Abc_SclBufSize( Bus_Man_t * p )
Abc_SclOneNodePrint( p, pObj );
assert( p->pPars->fSizeOnly || Abc_ObjFanoutNum(pObj) <= p->pPars->nDegree );
}
+ // compute departure time of the PI
Abc_NtkForEachCi( p->pNtk, pObj, i )
- DeptMax = Abc_MaxFloat( DeptMax, Abc_NtkComputeNodeDeparture(pObj, p->pPars->Slew) );
+ {
+ float DeptCur = Abc_NtkComputeNodeDeparture(pObj, p->pPars->Slew);
+ if ( p->pPiDrive )
+ {
+ float Load = Bus_SclObjLoad( pObj );
+ SC_Pair ArrOut, SlewOut, LoadIn = { Load, Load };
+ Scl_LibHandleInputDriver( p->pPiDrive, &LoadIn, &ArrOut, &SlewOut );
+ DeptCur += 0.5 * ArrOut.fall + 0.5 * ArrOut.rise;
+ }
+ DeptMax = Abc_MaxFloat( DeptMax, DeptCur );
+ }
Abc_SclSclGates2MioGates( p->pLib, p->pNtk );
if ( p->pPars->fVerbose )
{
- printf( "WireLoads = %d. Degree = %d. Target gain =%5d Slew =%5d Inv = %6d Delay =%7.0f ps ",
+ printf( "WireLoads = %d. Degree = %d. Target gain =%5d Slew =%5d Buf = %6d Delay =%7.0f ps ",
p->pPars->fUseWireLoads, p->pPars->nDegree, p->pPars->GainRatio, p->pPars->Slew,
Abc_NtkObjNumMax(p->pNtk) - nObjOld, SC_LibTimePs(p->pLib, DeptMax) );
Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
diff --git a/src/map/scl/sclSize.c b/src/map/scl/sclSize.c
index 33b7474a..072c0b97 100644
--- a/src/map/scl/sclSize.c
+++ b/src/map/scl/sclSize.c
@@ -123,7 +123,7 @@ static inline void Abc_SclTimeNodePrint( SC_Man * p, Abc_Obj_t * pObj, int fRise
printf( "Cout =%6.1f ff ", Abc_SclObjLoadFf(p, pObj, fRise >= 0 ? fRise : 0) );
printf( "Cmax =%6.1f ff ", pCell ? SC_LibCapFf(p->pLib, SC_CellPin(pCell, pCell->n_inputs)->max_out_cap) : 0.0 );
printf( "G =%5d ", pCell ? (int)(100.0 * Abc_SclObjLoadAve(p, pObj) / SC_CellPinCapAve(pCell)) : 0 );
- printf( "SL =%6.1f ps", Abc_SclObjSlackPs(p, pObj, p->MaxDelay0) );
+// printf( "SL =%6.1f ps", Abc_SclObjSlackPs(p, pObj, p->MaxDelay0) );
printf( "\n" );
}
void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll, int fPrintPath )
@@ -142,7 +142,7 @@ void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll, int fPrintPath )
printf( "(%5.1f %%) ", 100.0 * Abc_SclCountMinSize(p->pLib, p->pNtk, 0) / Abc_NtkNodeNum(p->pNtk) );
printf( "Delay =%9.2f ps ", maxDelay );
printf( "(%5.1f %%) ", 100.0 * Abc_SclCountNearCriticalNodes(p) / Abc_NtkNodeNum(p->pNtk) );
- printf( " \n" );
+ printf( " \n" );
if ( fShowAll )
{
// printf( "Timing information for all nodes: \n" );