diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2015-11-08 11:44:37 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2015-11-08 11:44:37 -0800 |
commit | 96d8f899d93dcf51d98a370deb5d4fcb67bb271c (patch) | |
tree | b234898fecfab9d047338b58fe6715d47b4319c9 /src/map | |
parent | e50fc467fd54420cf262bf5266959f6c02a65bf7 (diff) | |
download | abc-96d8f899d93dcf51d98a370deb5d4fcb67bb271c.tar.gz abc-96d8f899d93dcf51d98a370deb5d4fcb67bb271c.tar.bz2 abc-96d8f899d93dcf51d98a370deb5d4fcb67bb271c.zip |
Extending and improving timing manager.
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/mio/mioApi.c | 2 | ||||
-rw-r--r-- | src/map/mio/mioInt.h | 1 | ||||
-rw-r--r-- | src/map/scl/sclLib.h | 134 | ||||
-rw-r--r-- | src/map/scl/sclLibScl.c | 27 |
4 files changed, 161 insertions, 3 deletions
diff --git a/src/map/mio/mioApi.c b/src/map/mio/mioApi.c index 551203ff..8af85193 100644 --- a/src/map/mio/mioApi.c +++ b/src/map/mio/mioApi.c @@ -178,7 +178,9 @@ Vec_Int_t * Mio_GateReadExpr ( Mio_Gate_t * pGate ) { return word Mio_GateReadTruth ( Mio_Gate_t * pGate ) { return pGate->nInputs <= 6 ? pGate->uTruth : 0; } word * Mio_GateReadTruthP ( Mio_Gate_t * pGate ) { return pGate->nInputs <= 6 ? NULL: pGate->pTruth; } int Mio_GateReadValue ( Mio_Gate_t * pGate ) { return pGate->Value; } +int Mio_GateReadCell ( Mio_Gate_t * pGate ) { return pGate->Cell; } void Mio_GateSetValue ( Mio_Gate_t * pGate, int Value ) { pGate->Value = Value; } +void Mio_GateSetCell ( Mio_Gate_t * pGate, int Cell ) { pGate->Value = Cell; } int Mio_GateIsInv ( Mio_Gate_t * pGate ) { return pGate->uTruth == ABC_CONST(0x5555555555555555); } /**Function************************************************************* diff --git a/src/map/mio/mioInt.h b/src/map/mio/mioInt.h index 07514f16..8edc51d1 100644 --- a/src/map/mio/mioInt.h +++ b/src/map/mio/mioInt.h @@ -93,6 +93,7 @@ struct Mio_GateStruct_t_ Mio_Gate_t * pTwin; // the derived information + int Cell; // cell id int nInputs; // the number of inputs double dDelayMax; // the maximum delay char * pSop; // sum-of-products diff --git a/src/map/scl/sclLib.h b/src/map/scl/sclLib.h index 3fe36e16..ea3ab60f 100644 --- a/src/map/scl/sclLib.h +++ b/src/map/scl/sclLib.h @@ -65,6 +65,12 @@ struct SC_Pair_ float rise; float fall; }; +typedef struct SC_PairI_ SC_PairI; +struct SC_PairI_ +{ + int rise; + int fall; +}; typedef struct SC_SizePars_ SC_SizePars; struct SC_SizePars_ @@ -144,6 +150,9 @@ struct SC_Surface_ Vec_Flt_t vIndex0; // Vec<float> -- correspondes to "index_1" in the liberty file (for timing: slew) Vec_Flt_t vIndex1; // Vec<float> -- correspondes to "index_2" in the liberty file (for timing: load) Vec_Ptr_t vData; // Vec<Vec<float> > -- 'data[i0][i1]' gives value at '(index0[i0], index1[i1])' + Vec_Int_t vIndex0I; // Vec<float> -- correspondes to "index_1" in the liberty file (for timing: slew) + Vec_Int_t vIndex1I; // Vec<float> -- correspondes to "index_2" in the liberty file (for timing: load) + Vec_Ptr_t vDataI; // Vec<Vec<float> > -- 'data[i0][i1]' gives value at '(index0[i0], index1[i1])' float approx[3][6]; }; @@ -171,6 +180,8 @@ struct SC_Pin_ float cap; // -- this value is used if 'rise_cap' and 'fall_cap' is missing (copied by 'postProcess()'). (not used) float rise_cap; // }- used for input pins ('cap' too). float fall_cap; // } + float rise_capI; // }- used for input pins ('cap' too). + float fall_capI; // } float max_out_cap; // } (not used) float max_out_slew; // }- used only for output pins (max values must not be exceeded or else mapping is illegal) (not used) char * func_text; // } @@ -188,6 +199,8 @@ struct SC_Cell_ int unsupp; // -- set to TRUE by parser if cell contains information we cannot handle float area; float leakage; + float areaI; + float leakageI; int drive_strength; // -- some library files provide this field (currently unused, but may be a good hint for sizing) (not used) Vec_Ptr_t vPins; // NamedSet<SC_Pin> int n_inputs; // -- 'pins[0 .. n_inputs-1]' are input pins @@ -372,7 +385,10 @@ static inline void Abc_SclSurfaceFree( SC_Surface * p ) { Vec_FltErase( &p->vIndex0 ); Vec_FltErase( &p->vIndex1 ); + Vec_IntErase( &p->vIndex0I ); + Vec_IntErase( &p->vIndex1I ); Vec_VecErase( (Vec_Vec_t *)&p->vData ); + Vec_VecErase( (Vec_Vec_t *)&p->vDataI ); ABC_FREE( p->pName ); // ABC_FREE( p ); } @@ -531,6 +547,84 @@ static inline void Scl_LibPinDeparture( SC_Timing * pTime, SC_Pair * pDepIn, SC_ /**Function************************************************************* + Synopsis [Lookup table delay computation.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline int Scl_LibLookupI( SC_Surface * p, int slew, int load ) +{ + int * pIndex0, * pIndex1, * pDataS, * pDataS1; + int p0, p1, s, l; + iword lFrac0, lFrac1, sFrac; + + // handle constant table + if ( Vec_IntSize(&p->vIndex0I) == 1 && Vec_IntSize(&p->vIndex1I) == 1 ) + { + Vec_Int_t * vTemp = (Vec_Int_t *)Vec_PtrEntry(&p->vDataI, 0); + assert( Vec_PtrSize(&p->vDataI) == 1 ); + assert( Vec_IntSize(vTemp) == 1 ); + return Vec_IntEntry(vTemp, 0); + } + + // Find closest sample points in surface: + pIndex0 = Vec_IntArray(&p->vIndex0I); + for ( s = 1; s < Vec_IntSize(&p->vIndex0I)-1; s++ ) + if ( pIndex0[s] > slew ) + break; + s--; + + pIndex1 = Vec_IntArray(&p->vIndex1I); + for ( l = 1; l < Vec_IntSize(&p->vIndex1I)-1; l++ ) + if ( pIndex1[l] > load ) + break; + l--; + + pDataS = Vec_IntArray( (Vec_Int_t *)Vec_PtrEntry(&p->vDataI, s) ); + pDataS1 = Vec_IntArray( (Vec_Int_t *)Vec_PtrEntry(&p->vDataI, s+1) ); + + // Interpolate (or extrapolate) function value from sample points: +// lfrac = (load - pIndex1[l]) / (pIndex1[l+1] - pIndex1[l]); +// sfrac = (slew - pIndex0[s]) / (pIndex0[s+1] - pIndex0[s]); + + lFrac0 = (iword)(pDataS [l+1] - pDataS [l]) * (iword)(load - pIndex1[l]) / (iword)(pIndex1[l+1] - pIndex1[l]); + lFrac1 = (iword)(pDataS1[l+1] - pDataS1[l]) * (iword)(load - pIndex1[l]) / (iword)(pIndex1[l+1] - pIndex1[l]); + +// p0 = pDataS [l] + lfrac * (pDataS [l+1] - pDataS [l]); +// p1 = pDataS1[l] + lfrac * (pDataS1[l+1] - pDataS1[l]); + + p0 = pDataS [l] + (int)lFrac0; + p1 = pDataS1[l] + (int)lFrac1; + + sFrac = (iword)(p1 - p0) * (iword)(slew - pIndex0[s]) / (iword)(pIndex0[s+1] - pIndex0[s]); + +// return p0 + sfrac * (p1 - p0); + return p0 + (int)sFrac; +} +static inline void Scl_LibPinArrivalI( SC_Timing * pTime, SC_PairI * pArrIn, SC_PairI * pSlewIn, SC_PairI * pLoad, SC_PairI * pArrOut, SC_PairI * pSlewOut ) +{ + if (pTime->tsense == sc_ts_Pos || pTime->tsense == sc_ts_Non) + { + pArrOut->rise = Abc_MaxInt( pArrOut->rise, pArrIn->rise + Scl_LibLookupI(&pTime->pCellRise, pSlewIn->rise, pLoad->rise) ); + pArrOut->fall = Abc_MaxInt( pArrOut->fall, pArrIn->fall + Scl_LibLookupI(&pTime->pCellFall, pSlewIn->fall, pLoad->fall) ); + pSlewOut->rise = Abc_MaxInt( pSlewOut->rise, Scl_LibLookupI(&pTime->pRiseTrans, pSlewIn->rise, pLoad->rise) ); + pSlewOut->fall = Abc_MaxInt( pSlewOut->fall, Scl_LibLookupI(&pTime->pFallTrans, pSlewIn->fall, pLoad->fall) ); + } + if (pTime->tsense == sc_ts_Neg || pTime->tsense == sc_ts_Non) + { + pArrOut->rise = Abc_MaxInt( pArrOut->rise, pArrIn->fall + Scl_LibLookupI(&pTime->pCellRise, pSlewIn->fall, pLoad->rise) ); + pArrOut->fall = Abc_MaxInt( pArrOut->fall, pArrIn->rise + Scl_LibLookupI(&pTime->pCellFall, pSlewIn->rise, pLoad->fall) ); + pSlewOut->rise = Abc_MaxInt( pSlewOut->rise, Scl_LibLookupI(&pTime->pRiseTrans, pSlewIn->fall, pLoad->rise) ); + pSlewOut->fall = Abc_MaxInt( pSlewOut->fall, Scl_LibLookupI(&pTime->pFallTrans, pSlewIn->rise, pLoad->fall) ); + } +} + +/**Function************************************************************* + Synopsis [Compute one timing edge.] Description [] @@ -582,6 +676,46 @@ static inline void Scl_LibHandleInputDriver( SC_Cell * pCell, SC_Pair * pLoadIn, pArrOut->rise = ArrOut1.rise - ArrOut0.rise; } +/**Function************************************************************* + + Synopsis [Compute one timing edge.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline int Scl_LibPinArrivalEstimateI( SC_Cell * pCell, int iPin, int Slew, int Load ) +{ + SC_PairI LoadIn = { Load, Load }; + SC_PairI ArrIn = { 0, 0 }; + SC_PairI ArrOut = { 0, 0 }; + SC_PairI SlewIn = { 0, 0 }; + SC_PairI SlewOut = { 0, 0 }; +// Vec_Flt_t * vIndex0 = pTime->pCellRise->vIndex0; // slew +// SlewIn.fall = SlewIn.rise = Vec_FltEntry( vIndex0, Vec_FltSize(vIndex0)/2 ); + SlewIn.fall = SlewIn.rise = Slew; + Scl_LibPinArrivalI( Scl_CellPinTime(pCell, iPin), &ArrIn, &SlewIn, &LoadIn, &ArrOut, &SlewOut ); + return (ArrOut.fall + ArrOut.rise) >> 1; +} +static inline void Scl_LibHandleInputDriver2( SC_Cell * pCell, SC_PairI * pLoadIn, SC_PairI * pArrOut, SC_PairI * pSlewOut ) +{ + SC_PairI LoadIn = { 0, 0 }; // zero input load + SC_PairI ArrIn = { 0, 0 }; // zero input time + SC_PairI SlewIn = { 0, 0 }; // zero input slew + SC_PairI ArrOut0 = { 0, 0 }; // output time under zero load + SC_PairI ArrOut1 = { 0, 0 }; // output time under given load + SC_PairI SlewOut = { 0, 0 }; // output slew under zero load + pSlewOut->fall = pSlewOut->rise = 0; + assert( pCell->n_inputs == 1 ); + Scl_LibPinArrivalI( Scl_CellPinTime(pCell, 0), &ArrIn, &SlewIn, &LoadIn, &ArrOut0, &SlewOut ); + Scl_LibPinArrivalI( Scl_CellPinTime(pCell, 0), &ArrIn, &SlewIn, pLoadIn, &ArrOut1, pSlewOut ); + pArrOut->fall = ArrOut1.fall - ArrOut0.fall; + pArrOut->rise = ArrOut1.rise - ArrOut0.rise; +} + /*=== sclLiberty.c ===============================================================*/ extern SC_Lib * Abc_SclReadLiberty( char * pFileName, int fVerbose, int fVeryVerbose ); /*=== sclLibScl.c ===============================================================*/ diff --git a/src/map/scl/sclLibScl.c b/src/map/scl/sclLibScl.c index d9b14273..59f8cbc6 100644 --- a/src/map/scl/sclLibScl.c +++ b/src/map/scl/sclLibScl.c @@ -49,20 +49,35 @@ ABC_NAMESPACE_IMPL_START static void Abc_SclReadSurface( Vec_Str_t * vOut, int * pPos, SC_Surface * p ) { Vec_Flt_t * vVec; + Vec_Int_t * vVecI; int i, j; for ( i = Vec_StrGetI(vOut, pPos); i != 0; i-- ) - Vec_FltPush( &p->vIndex0, Vec_StrGetF(vOut, pPos) ); + { + float Num = Vec_StrGetF(vOut, pPos); + Vec_FltPush( &p->vIndex0, Num ); + Vec_IntPush( &p->vIndex0I, (int)(MIO_NUM*Num) ); + } for ( i = Vec_StrGetI(vOut, pPos); i != 0; i-- ) - Vec_FltPush( &p->vIndex1, Vec_StrGetF(vOut, pPos) ); + { + float Num = Vec_StrGetF(vOut, pPos); + Vec_FltPush( &p->vIndex1, Num ); + Vec_IntPush( &p->vIndex1I, (int)(MIO_NUM*Num) ); + } for ( i = 0; i < Vec_FltSize(&p->vIndex0); i++ ) { vVec = Vec_FltAlloc( Vec_FltSize(&p->vIndex1) ); Vec_PtrPush( &p->vData, vVec ); + vVecI = Vec_IntAlloc( Vec_FltSize(&p->vIndex1) ); + Vec_PtrPush( &p->vDataI, vVecI ); for ( j = 0; j < Vec_FltSize(&p->vIndex1); j++ ) - Vec_FltPush( vVec, Vec_StrGetF(vOut, pPos) ); + { + float Num = Vec_StrGetF(vOut, pPos); + Vec_FltPush( vVec, Num ); + Vec_IntPush( vVecI, (int)(MIO_NUM*Num) ); + } } for ( i = 0; i < 3; i++ ) @@ -138,6 +153,9 @@ static int Abc_SclReadLibrary( Vec_Str_t * vOut, int * pPos, SC_Lib * p ) pCell->n_inputs = Vec_StrGetI(vOut, pPos); pCell->n_outputs = Vec_StrGetI(vOut, pPos); + + pCell->areaI = (int)(MIO_NUM*pCell->area); + pCell->leakageI = (int)(MIO_NUM*pCell->leakage); /* printf( "%s\n", pCell->pName ); if ( !strcmp( "XOR3_X4M_A9TL", pCell->pName ) ) @@ -154,6 +172,9 @@ static int Abc_SclReadLibrary( Vec_Str_t * vOut, int * pPos, SC_Lib * p ) pPin->pName = Vec_StrGetS(vOut, pPos); pPin->rise_cap = Vec_StrGetF(vOut, pPos); pPin->fall_cap = Vec_StrGetF(vOut, pPos); + + pPin->rise_capI = (int)(MIO_NUM*pPin->rise_capI); + pPin->fall_capI = (int)(MIO_NUM*pPin->fall_capI); } for ( j = 0; j < pCell->n_outputs; j++ ) |