diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/scl/scl.c | 4 | ||||
-rw-r--r-- | src/map/scl/sclBufSize.c | 33 | ||||
-rw-r--r-- | src/map/scl/sclDnsize.c | 4 | ||||
-rw-r--r-- | src/map/scl/sclLib.h | 1 | ||||
-rw-r--r-- | src/map/scl/sclLibScl.c | 1 | ||||
-rw-r--r-- | src/map/scl/sclLibUtil.c | 60 | ||||
-rw-r--r-- | src/map/scl/sclLiberty.c | 1 | ||||
-rw-r--r-- | src/map/scl/sclUpsize.c | 8 |
8 files changed, 95 insertions, 17 deletions
diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c index 455dd7d6..e5eab4c7 100644 --- a/src/map/scl/scl.c +++ b/src/map/scl/scl.c @@ -99,14 +99,14 @@ void Scl_Init( Abc_Frame_t * pAbc ) 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", "buffer", Scl_CommandBuffer, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "bufsize", Scl_CommandBufSize, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "unbuffer", Scl_CommandUnBuffer, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "minsize", Scl_CommandMinsize, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "maxsize", Scl_CommandMaxsize, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "upsize", Scl_CommandUpsize, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "dnsize", Scl_CommandDnsize, 1 ); - Cmd_CommandAdd( pAbc, "SCL mapping", "bsize", Scl_CommandBsize, 1 ); +// Cmd_CommandAdd( pAbc, "SCL mapping", "bsize", Scl_CommandBsize, 1 ); Cmd_CommandAdd( pAbc, "SCL mapping", "print_buf", Scl_CommandPrintBuf, 0 ); Cmd_CommandAdd( pAbc, "SCL mapping", "read_constr", Scl_CommandReadConstr, 0 ); Cmd_CommandAdd( pAbc, "SCL mapping", "print_constr", Scl_CommandPrintConstr, 0 ); diff --git a/src/map/scl/sclBufSize.c b/src/map/scl/sclBufSize.c index 6257ec38..39989a6c 100644 --- a/src/map/scl/sclBufSize.c +++ b/src/map/scl/sclBufSize.c @@ -95,11 +95,15 @@ 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) + 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 ); + p->vCins = Vec_FltAlloc( 2*Abc_NtkObjNumMax(pNtk) + 1000 ); + p->vETimes = Vec_FltAlloc( 2*Abc_NtkObjNumMax(pNtk) + 1000 ); + p->vLoads = Vec_FltAlloc( 2*Abc_NtkObjNumMax(pNtk) + 1000 ); + p->vDepts = Vec_FltAlloc( 2*Abc_NtkObjNumMax(pNtk) + 1000 ); + Vec_FltFill( p->vCins, Abc_NtkObjNumMax(pNtk), 0 ); + Vec_FltFill( p->vETimes, Abc_NtkObjNumMax(pNtk), 0 ); + Vec_FltFill( p->vLoads, Abc_NtkObjNumMax(pNtk), 0 ); + Vec_FltFill( p->vDepts, Abc_NtkObjNumMax(pNtk), 0 ); pNtk->pBSMan = p; return p; } @@ -131,9 +135,9 @@ void Bus_ManReadInOutLoads( Bus_Man_t * p ) { Abc_Obj_t * pObj; int i; float MaxLoad = Abc_FrameReadMaxLoad(); - Abc_NtkForEachPo( p->pNtk, pObj, i ) + Abc_NtkForEachCo( p->pNtk, pObj, i ) Bus_SclObjSetCin( pObj, MaxLoad ); - printf( "Default output load is specified (%f ff).\n", SC_LibCapFf(p->pLib, MaxLoad) ); +// printf( "Default output load is specified (%f ff).\n", MaxLoad ); } if ( Abc_FrameReadDrivingCell() ) { @@ -146,7 +150,7 @@ void Bus_ManReadInOutLoads( Bus_Man_t * p ) 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 ); +// printf( "Default input driving cell is specified (%s).\n", p->pPiDrive->pName ); } } } @@ -351,8 +355,12 @@ Abc_Obj_t * Abc_SclAddOneInv( Bus_Man_t * p, Abc_Obj_t * pObj, Vec_Ptr_t * vFano pInv = Abc_NtkCreateNodeBuf( p->pNtk, NULL ); else pInv = Abc_NtkCreateNodeInv( p->pNtk, NULL ); - assert( (int)Abc_ObjId(pInv) < Vec_FltSize(p->vDepts) ); - Limit = Abc_MinInt( iStop, Vec_PtrSize(vFanouts) ); + assert( (int)Abc_ObjId(pInv) == Vec_FltSize(p->vCins) ); + Vec_FltPush( p->vCins, 0 ); + Vec_FltPush( p->vETimes, 0 ); + Vec_FltPush( p->vLoads, 0 ); + Vec_FltPush( p->vDepts, 0 ); + Limit = Abc_MinInt( Abc_MaxInt(iStop, 2), Vec_PtrSize(vFanouts) ); Vec_PtrForEachEntryStop( Abc_Obj_t *, vFanouts, pFanout, i, Limit ) { Vec_PtrWriteEntry( vFanouts, i, NULL ); @@ -381,6 +389,7 @@ void Abc_SclBufSize( Bus_Man_t * p ) SC_Cell * pCell, * pCellNew; Abc_Obj_t * pObj, * pFanout; abctime clk = Abc_Clock(); + int nObjsOld = Abc_NtkObjNumMax(p->pNtk); float GainInv = 0.01 * p->pPars->GainRatio; float GainGate = (float)1.0 * GainInv; float Load, LoadNew, Cin, DeptMax = 0; @@ -390,6 +399,11 @@ void Abc_SclBufSize( Bus_Man_t * p ) { if ( !((Abc_ObjIsNode(pObj) && Abc_ObjFaninNum(pObj) > 0) || (Abc_ObjIsCi(pObj) && p->pPiDrive)) ) continue; + if ( 2 * nObjsOld < Abc_NtkObjNumMax(p->pNtk) ) + { + printf( "Buffering could not be completed because the gain value (%d) is too low.\n", p->pPars->GainRatio ); + break; + } // compute load Abc_NtkComputeFanoutInfo( pObj, p->pPars->Slew ); Load = Abc_NtkComputeNodeLoad( p, pObj ); @@ -443,6 +457,7 @@ void Abc_SclBufSize( Bus_Man_t * p ) assert( p->pPars->fSizeOnly || Abc_ObjFanoutNum(pObj) <= p->pPars->nDegree ); } // compute departure time of the PI + if ( i < 0 ) // finished buffering Abc_NtkForEachCi( p->pNtk, pObj, i ) { float DeptCur = Abc_NtkComputeNodeDeparture(pObj, p->pPars->Slew); diff --git a/src/map/scl/sclDnsize.c b/src/map/scl/sclDnsize.c index b81b640f..cb800213 100644 --- a/src/map/scl/sclDnsize.c +++ b/src/map/scl/sclDnsize.c @@ -122,8 +122,8 @@ clk = Abc_Clock(); continue; if ( i > Notches ) break; - if ( p->vInDrive && !Abc_SclInputDriveOk( p, pObj, pCellNew ) ) - continue; +// if ( p->vInDrive && !Abc_SclInputDriveOk( p, pObj, pCellNew ) ) +// continue; // set new cell Abc_SclObjSetCell( pObj, pCellNew ); Abc_SclUpdateLoad( p, pObj, pCellOld, pCellNew ); diff --git a/src/map/scl/sclLib.h b/src/map/scl/sclLib.h index ae799f55..90a52ca9 100644 --- a/src/map/scl/sclLib.h +++ b/src/map/scl/sclLib.h @@ -610,6 +610,7 @@ extern int Abc_SclClassCellNum( SC_Cell * pClass ); extern int Abc_SclLibClassNum( SC_Lib * pLib ); extern void Abc_SclLinkCells( SC_Lib * p ); extern void Abc_SclPrintCells( SC_Lib * p, float Slew, float Gain, int fInvOnly, int fShort ); +extern void Abc_SclLibNormalize( SC_Lib * p ); extern SC_Cell * Abc_SclFindInvertor( SC_Lib * p, int fFindBuff ); extern SC_Cell * Abc_SclFindSmallestGate( SC_Cell * p, float CinMin ); extern SC_WireLoad * Abc_SclFindWireLoadModel( SC_Lib * p, float Area ); diff --git a/src/map/scl/sclLibScl.c b/src/map/scl/sclLibScl.c index 9be525e1..bd0bb5dc 100644 --- a/src/map/scl/sclLibScl.c +++ b/src/map/scl/sclLibScl.c @@ -274,6 +274,7 @@ SC_Lib * Abc_SclReadFromFile( char * pFileName ) // read the library p = Abc_SclReadFromStr( vOut ); p->pFileName = Abc_UtilStrsav( pFileName ); + Abc_SclLibNormalize( p ); Vec_StrFree( vOut ); return p; } diff --git a/src/map/scl/sclLibUtil.c b/src/map/scl/sclLibUtil.c index f62b8b71..2ab362da 100644 --- a/src/map/scl/sclLibUtil.c +++ b/src/map/scl/sclLibUtil.c @@ -505,6 +505,66 @@ void Abc_SclPrintCells( SC_Lib * p, float Slew, float Gain, int fInvOnly, int fS /**Function************************************************************* + Synopsis [Print cells] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_SclLibNormalizeSurface( SC_Surface * p, float Time, float Load ) +{ + Vec_Flt_t * vArray; + int i, k; float Entry; + Vec_FltForEachEntry( p->vIndex0, Entry, i ) // slew + Vec_FltWriteEntry( p->vIndex0, i, Time * Entry ); + Vec_FltForEachEntry( p->vIndex1, Entry, i ) // load + Vec_FltWriteEntry( p->vIndex1, i, Load * Entry ); + Vec_PtrForEachEntry( Vec_Flt_t *, p->vData, vArray, k ) + Vec_FltForEachEntry( vArray, Entry, i ) // delay/slew + Vec_FltWriteEntry( vArray, i, Time * Entry ); +} +void Abc_SclLibNormalize( SC_Lib * p ) +{ + SC_WireLoad * pWL; + SC_Cell * pCell; + SC_Pin * pPin; + SC_Timings * pTimings; + SC_Timing * pTiming; + int i, k, m, n; + float Time = 1.0 * pow(10.0, 12 - p->unit_time); + float Load = p->unit_cap_fst * pow(10.0, 15 - p->unit_cap_snd); + if ( Time == 1 && Load == 1 ) + return; + p->unit_time = 12; + p->unit_cap_fst = 1; + p->unit_cap_snd = 15; + p->default_max_out_slew *= Time; + SC_LibForEachWireLoad( p, pWL, i ) + pWL->cap *= Load; + SC_LibForEachCell( p, pCell, i ) + SC_CellForEachPin( pCell, pPin, k ) + { + pPin->cap *= Load; + pPin->rise_cap *= Load; + pPin->fall_cap *= Load; + pPin->max_out_cap *= Load; + pPin->max_out_slew *= Time; + SC_PinForEachRTiming( pPin, pTimings, m ) + Vec_PtrForEachEntry( SC_Timing *, pTimings->vTimings, pTiming, n ) + { + Abc_SclLibNormalizeSurface( pTiming->pCellRise, Time, Load ); + Abc_SclLibNormalizeSurface( pTiming->pCellFall, Time, Load ); + Abc_SclLibNormalizeSurface( pTiming->pRiseTrans, Time, Load ); + Abc_SclLibNormalizeSurface( pTiming->pFallTrans, Time, Load ); + } + } +} + +/**Function************************************************************* + Synopsis [Derives simple GENLIB library.] Description [] diff --git a/src/map/scl/sclLiberty.c b/src/map/scl/sclLiberty.c index ea8d0f05..74d19143 100644 --- a/src/map/scl/sclLiberty.c +++ b/src/map/scl/sclLiberty.c @@ -1331,6 +1331,7 @@ SC_Lib * Abc_SclReadLiberty( char * pFileName, int fVerbose, int fVeryVerbose ) // construct SCL data-structure pLib = Abc_SclReadFromStr( vStr ); pLib->pFileName = Abc_UtilStrsav( pFileName ); + Abc_SclLibNormalize( pLib ); Vec_StrFree( vStr ); return pLib; } diff --git a/src/map/scl/sclUpsize.c b/src/map/scl/sclUpsize.c index d7196216..228e96be 100644 --- a/src/map/scl/sclUpsize.c +++ b/src/map/scl/sclUpsize.c @@ -291,8 +291,8 @@ int Abc_SclFindBestCell( SC_Man * p, Abc_Obj_t * pObj, Vec_Int_t * vRecalcs, Vec continue; if ( k > Notches ) break; - if ( p->vInDrive && !Abc_SclInputDriveOk( p, pObj, pCellNew ) ) - continue; +// if ( p->vInDrive && !Abc_SclInputDriveOk( p, pObj, pCellNew ) ) +// continue; // set new cell Abc_SclObjSetCell( pObj, pCellNew ); Abc_SclUpdateLoad( p, pObj, pCellOld, pCellNew ); @@ -311,8 +311,8 @@ int Abc_SclFindBestCell( SC_Man * p, Abc_Obj_t * pObj, Vec_Int_t * vRecalcs, Vec } else if ( NoChange ) NoChange++; - if ( NoChange == 4 ) - break; +// if ( NoChange == 4 ) +// break; // printf( "%.2f ", dGain ); } // printf( "Best = %.2f ", dGainBest ); |