diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/mio/mio.h | 1 | ||||
-rw-r--r-- | src/map/mio/mioApi.c | 2 | ||||
-rw-r--r-- | src/map/mio/mioRead.c | 1 | ||||
-rw-r--r-- | src/map/mio/mioUtils.c | 40 | ||||
-rw-r--r-- | src/map/scl/scl.c | 8 | ||||
-rw-r--r-- | src/map/scl/sclLib.h | 39 |
6 files changed, 78 insertions, 13 deletions
diff --git a/src/map/mio/mio.h b/src/map/mio/mio.h index 669f8bc7..0baf73ec 100644 --- a/src/map/mio/mio.h +++ b/src/map/mio/mio.h @@ -199,6 +199,7 @@ extern void Mio_LibraryShiftDelay( Mio_Library_t * pLib, double Shi extern void Mio_LibraryMultiArea( Mio_Library_t * pLib, double Multi ); extern void Mio_LibraryMultiDelay( Mio_Library_t * pLib, double Multi ); extern void Mio_LibraryTransferDelays( Mio_Library_t * pLibD, Mio_Library_t * pLibS ); +extern void Mio_LibraryTransferCellIds(); /*=== sclUtil.c =========================================================*/ extern Mio_Library_t * Abc_SclDeriveGenlibSimple( void * pScl ); diff --git a/src/map/mio/mioApi.c b/src/map/mio/mioApi.c index 8af85193..4b469ba2 100644 --- a/src/map/mio/mioApi.c +++ b/src/map/mio/mioApi.c @@ -180,7 +180,7 @@ word * Mio_GateReadTruthP ( Mio_Gate_t * pGate ) { return 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; } +void Mio_GateSetCell ( Mio_Gate_t * pGate, int Cell ) { pGate->Cell = Cell; } int Mio_GateIsInv ( Mio_Gate_t * pGate ) { return pGate->uTruth == ABC_CONST(0x5555555555555555); } /**Function************************************************************* diff --git a/src/map/mio/mioRead.c b/src/map/mio/mioRead.c index 0364d363..f9a16b18 100644 --- a/src/map/mio/mioRead.c +++ b/src/map/mio/mioRead.c @@ -347,6 +347,7 @@ Mio_Gate_t * Mio_LibraryReadGate( char ** ppToken, int fExtendedFormat ) // allocate the gate structure pGate = ABC_CALLOC( Mio_Gate_t, 1 ); + pGate->Cell = -1; // read the name pToken = strtok( NULL, " \t\r\n" ); diff --git a/src/map/mio/mioUtils.c b/src/map/mio/mioUtils.c index 16a5502f..623b7c84 100644 --- a/src/map/mio/mioUtils.c +++ b/src/map/mio/mioUtils.c @@ -22,6 +22,7 @@ #include "exp.h" #include "misc/util/utilTruth.h" #include "opt/dau/dau.h" +#include "map/scl/sclLib.h" ABC_NAMESPACE_IMPL_START @@ -1305,6 +1306,45 @@ void Nf_ManPrepareLibraryTest2() } +/**Function************************************************************* + + Synopsis [Install library.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Mio_LibraryTransferCellIds() +{ + Mio_Gate_t * pGate; + Mio_Library_t * pLib = (Mio_Library_t *)Abc_FrameReadLibGen(); + SC_Lib * pScl = (SC_Lib *)Abc_FrameReadLibScl(); + int CellId; + if ( pScl == NULL ) + { + printf( "SC library cannot be found.\n" ); + return; + } + if ( pLib == NULL ) + { + printf( "Genlib library cannot be found.\n" ); + return; + } + Mio_LibraryForEachGate( pLib, pGate ) + { + if ( Mio_GateReadPinNum(pGate) == 0 ) + continue; + CellId = Abc_SclCellFind( pScl, Mio_GateReadName(pGate) ); + if ( CellId < 0 ) + printf( "Cannot find cell ID of gate %s.\n", Mio_GateReadName(pGate) ); + else + Mio_GateSetCell( pGate, CellId ); + } +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c index 8f788628..24c45b6e 100644 --- a/src/map/scl/scl.c +++ b/src/map/scl/scl.c @@ -24,6 +24,8 @@ #include "misc/util/utilNam.h" #include "sclCon.h" +#include "map/mio/mio.h" + ABC_NAMESPACE_IMPL_START @@ -242,7 +244,10 @@ int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_SclWriteLiberty( Extra_FileNameGenericAppend(pFileName, "_temp.lib"), (SC_Lib *)pAbc->pLibScl ); // extract genlib library if ( pAbc->pLibScl ) + { Abc_SclInstallGenlib( pAbc->pLibScl, Slew, Gain, nGatesMin ); + Mio_LibraryTransferCellIds(); + } return 0; usage: @@ -522,7 +527,10 @@ int Scl_CommandReadScl( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_SclWriteLiberty( Extra_FileNameGenericAppend(pFileName, "_temp.lib"), (SC_Lib *)pAbc->pLibScl ); // extract genlib library if ( pAbc->pLibScl ) + { Abc_SclInstallGenlib( pAbc->pLibScl, 0, 0, 0 ); + Mio_LibraryTransferCellIds(); + } return 0; usage: diff --git a/src/map/scl/sclLib.h b/src/map/scl/sclLib.h index ea3ab60f..25e60a41 100644 --- a/src/map/scl/sclLib.h +++ b/src/map/scl/sclLib.h @@ -605,21 +605,34 @@ static inline int Scl_LibLookupI( SC_Surface * p, int slew, int load ) // 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 ) +static inline void Scl_LibPinArrivalI( SC_Timing * pTime, SC_PairI * pArrIn, SC_PairI * pSlewIn, SC_PairI * pLoad, SC_PairI * pArrOut, SC_PairI * pSlewOut, int * pArray ) { 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) ); + pArrOut->rise = Abc_MaxInt( pArrOut->rise, pArrIn->rise + (pArray[0] = Scl_LibLookupI(&pTime->pCellRise, pSlewIn->rise, pLoad->rise)) ); + pArrOut->fall = Abc_MaxInt( pArrOut->fall, pArrIn->fall + (pArray[1] = 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) ); + pArrOut->rise = Abc_MaxInt( pArrOut->rise, pArrIn->fall + (pArray[2] = Scl_LibLookupI(&pTime->pCellRise, pSlewIn->fall, pLoad->rise)) ); + pArrOut->fall = Abc_MaxInt( pArrOut->fall, pArrIn->rise + (pArray[3] = 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) ); + } +} +static inline void Scl_LibPinRequiredI( SC_Timing * pTime, SC_PairI * pReqIn, SC_PairI * pReqOut, int * pArray ) +{ + if (pTime->tsense == sc_ts_Pos || pTime->tsense == sc_ts_Non) + { + pReqIn->rise = Abc_MinInt( pReqIn->rise, pReqOut->rise - pArray[0] ); + pReqIn->fall = Abc_MinInt( pReqIn->fall, pReqOut->fall - pArray[1] ); + } + if (pTime->tsense == sc_ts_Neg || pTime->tsense == sc_ts_Non) + { + pReqIn->fall = Abc_MinInt( pReqIn->fall, pReqOut->rise - pArray[2] ); + pReqIn->rise = Abc_MinInt( pReqIn->rise, pReqOut->fall - pArray[3] ); } } @@ -689,6 +702,7 @@ static inline void Scl_LibHandleInputDriver( SC_Cell * pCell, SC_Pair * pLoadIn, ***********************************************************************/ static inline int Scl_LibPinArrivalEstimateI( SC_Cell * pCell, int iPin, int Slew, int Load ) { + int Arrray[4]; SC_PairI LoadIn = { Load, Load }; SC_PairI ArrIn = { 0, 0 }; SC_PairI ArrOut = { 0, 0 }; @@ -697,11 +711,12 @@ static inline int Scl_LibPinArrivalEstimateI( SC_Cell * pCell, int iPin, int Sle // 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 ); + Scl_LibPinArrivalI( Scl_CellPinTime(pCell, iPin), &ArrIn, &SlewIn, &LoadIn, &ArrOut, &SlewOut, Arrray ); return (ArrOut.fall + ArrOut.rise) >> 1; } static inline void Scl_LibHandleInputDriver2( SC_Cell * pCell, SC_PairI * pLoadIn, SC_PairI * pArrOut, SC_PairI * pSlewOut ) { + int Arrray[4]; SC_PairI LoadIn = { 0, 0 }; // zero input load SC_PairI ArrIn = { 0, 0 }; // zero input time SC_PairI SlewIn = { 0, 0 }; // zero input slew @@ -710,8 +725,8 @@ static inline void Scl_LibHandleInputDriver2( SC_Cell * pCell, SC_PairI * pLoadI 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 ); + Scl_LibPinArrivalI( Scl_CellPinTime(pCell, 0), &ArrIn, &SlewIn, &LoadIn, &ArrOut0, &SlewOut, Arrray ); + Scl_LibPinArrivalI( Scl_CellPinTime(pCell, 0), &ArrIn, &SlewIn, pLoadIn, &ArrOut1, pSlewOut, Arrray ); pArrOut->fall = ArrOut1.fall - ArrOut0.fall; pArrOut->rise = ArrOut1.rise - ArrOut0.rise; } |