From a2d97cf2b66c040fa6c1b31763e7bebe717c7098 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 17 Sep 2013 16:43:42 -0700 Subject: Debugging and finetuning the flow. --- src/map/amap/amapRead.c | 11 ++++++++--- src/map/scl/scl.c | 3 +++ src/map/scl/sclLib.h | 15 +++++++++++++++ src/map/scl/sclLibScl.c | 19 +++++++------------ src/map/scl/sclSize.c | 15 ++++++++------- src/map/scl/sclSize.h | 21 +++++++++++++++++++++ 6 files changed, 62 insertions(+), 22 deletions(-) (limited to 'src/map') diff --git a/src/map/amap/amapRead.c b/src/map/amap/amapRead.c index 8ea3c9c0..183989c1 100644 --- a/src/map/amap/amapRead.c +++ b/src/map/amap/amapRead.c @@ -328,8 +328,8 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose ) Amap_Lib_t * p; Amap_Gat_t * pGate, * pPrev; Amap_Pin_t * pPin; - char * pToken; - int i, nPins, iPos = 0; + char * pToken, * pMoGate = NULL; + int i, nPins, iPos = 0, Count = 0; p = Amap_LibAlloc(); pToken = (char *)Vec_PtrEntry(vTokens, iPos++); do @@ -420,10 +420,15 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose ) if ( pPrev && !strcmp(pPrev->pName, pGate->pName) ) { pPrev->pTwin = pGate, pGate->pTwin = pPrev; - printf( "Warning: Detected multi-output gate \"%s\".\n", pGate->pName ); +// printf( "Warning: Detected multi-output gate \"%s\".\n", pGate->pName ); + if ( pMoGate == NULL ) + pMoGate = pGate->pName; + Count++; } pPrev = pGate; } + if ( Count ) + printf( "Warning: Detected %d multi-output gates (for example, \"%s\").\n", Count, pMoGate ); return p; } diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c index 82429a79..6b386547 100644 --- a/src/map/scl/scl.c +++ b/src/map/scl/scl.c @@ -422,6 +422,9 @@ int Scl_CommandReadScl( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_SclLoad( pLib, (SC_Lib **)&pAbc->pLibScl ); if ( fDump ) Abc_SclWriteLiberty( Extra_FileNameGenericAppend(pFileName, "_temp.lib"), (SC_Lib *)pAbc->pLibScl ); + // extract genlib library + if ( pAbc->pLibScl ) + Abc_SclInstallGenlib( pAbc->pLibScl, 0, 0, 0 ); return 0; usage: diff --git a/src/map/scl/sclLib.h b/src/map/scl/sclLib.h index 09f30dd4..bdd870ac 100644 --- a/src/map/scl/sclLib.h +++ b/src/map/scl/sclLib.h @@ -580,6 +580,21 @@ static inline float Scl_LibPinArrivalEstimate( SC_Cell * pCell, int iPin, float Scl_LibPinArrival( Scl_CellPinTime(pCell, iPin), &ArrIn, &SlewIn, &LoadIn, &ArrOut, &SlewOut ); return 0.5 * ArrOut.fall + 0.5 * ArrOut.rise; } +static inline void Scl_LibHandleInputDriver( SC_Cell * pCell, SC_Pair * pLoadIn, SC_Pair * pArrOut, SC_Pair * pSlewOut ) +{ + SC_Pair LoadIn = { 0.0, 0.0 }; // zero input load + SC_Pair ArrIn = { 0.0, 0.0 }; // zero input time + SC_Pair SlewIn = { 0.0, 0.0 }; // zero input slew + SC_Pair ArrOut0 = { 0.0, 0.0 }; // output time under zero load + SC_Pair ArrOut1 = { 0.0, 0.0 }; // output time under given load + SC_Pair SlewOut = { 0.0, 0.0 }; // output slew under zero load + pSlewOut->fall = pSlewOut->rise = 0; + assert( pCell->n_inputs == 1 ); + Scl_LibPinArrival( Scl_CellPinTime(pCell, 0), &ArrIn, &SlewIn, &LoadIn, &ArrOut0, &SlewOut ); + Scl_LibPinArrival( 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 ); diff --git a/src/map/scl/sclLibScl.c b/src/map/scl/sclLibScl.c index 8f726d1e..dbf50627 100644 --- a/src/map/scl/sclLibScl.c +++ b/src/map/scl/sclLibScl.c @@ -404,20 +404,15 @@ static void Abc_SclWriteLibrary( Vec_Str_t * vOut, SC_Lib * p ) Vec_StrPutS( vOut, pPin->pName ); Vec_StrPutF( vOut, pPin->max_out_cap ); Vec_StrPutF( vOut, pPin->max_out_slew ); + Vec_StrPutI( vOut, pCell->n_inputs ); // write function - if ( pPin->func_text == NULL ) - { - // formula is not given - write empty string - Vec_StrPutS( vOut, "" ); - // write truth table - assert( Vec_WrdSize(pPin->vFunc) == Abc_Truth6WordNum(pCell->n_inputs) ); - Vec_StrPutI( vOut, pCell->n_inputs ); - Vec_WrdForEachEntry( pPin->vFunc, uWord, k ) // -- 'size = 1u << (n_vars - 6)' - Vec_StrPutW( vOut, uWord ); // -- 64-bit number, written uncompressed (low-byte first) - } - else // formula is given - Vec_StrPutS( vOut, pPin->func_text ); + Vec_StrPutS( vOut, pPin->func_text ? pPin->func_text : "" ); + + // write truth table + assert( Vec_WrdSize(pPin->vFunc) == Abc_Truth6WordNum(pCell->n_inputs) ); + Vec_WrdForEachEntry( pPin->vFunc, uWord, k ) // -- 'size = 1u << (n_vars - 6)' + Vec_StrPutW( vOut, uWord ); // -- 64-bit number, written uncompressed (low-byte first) // Write 'rtiming': (pin-to-pin timing tables for this particular output) assert( Vec_PtrSize(pPin->vRTimings) == pCell->n_inputs ); diff --git a/src/map/scl/sclSize.c b/src/map/scl/sclSize.c index dce76988..3bd192da 100644 --- a/src/map/scl/sclSize.c +++ b/src/map/scl/sclSize.c @@ -116,14 +116,14 @@ static inline void Abc_SclTimeNodePrint( SC_Man * p, Abc_Obj_t * pObj, int fRise printf( "%-*s ", Length, pCell ? pCell->pName : "pi" ); printf( "A =%7.2f ", pCell ? pCell->area : 0.0 ); printf( "D%s =", fRise ? "r" : "f" ); - printf( "%5.0f", Abc_MaxFloat(Abc_SclObjTimePs(p, pObj, 0), Abc_SclObjTimePs(p, pObj, 1)) ); - printf( "%6.0f ps ", -Abc_AbsFloat(Abc_SclObjTimePs(p, pObj, 0) - Abc_SclObjTimePs(p, pObj, 1)) ); - printf( "S =%5.0f ps ", Abc_SclObjSlewPs(p, pObj, fRise >= 0 ? fRise : 0 ) ); - printf( "Cin =%4.0f ff ", pCell ? SC_CellPinCapAve(pCell) : 0.0 ); - printf( "Cout =%5.0f ff ", Abc_SclObjLoadFf(p, pObj, fRise >= 0 ? fRise : 0 ) ); - printf( "Cmax =%5.0f ff ", pCell ? SC_CellPin(pCell, pCell->n_inputs)->max_out_cap : 0.0 ); + printf( "%6.1f", Abc_MaxFloat(Abc_SclObjTimePs(p, pObj, 0), Abc_SclObjTimePs(p, pObj, 1)) ); + printf( "%7.1f ps ", -Abc_AbsFloat(Abc_SclObjTimePs(p, pObj, 0) - Abc_SclObjTimePs(p, pObj, 1)) ); + printf( "S =%6.1f ps ", Abc_SclObjSlewPs(p, pObj, fRise >= 0 ? fRise : 0) ); + printf( "Cin =%5.1f ff ", pCell ? SC_LibCapFf(p->pLib, SC_CellPinCapAve(pCell)) : 0.0 ); + 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 =%5.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 ) @@ -527,6 +527,7 @@ void Abc_SclManReadSlewAndLoad( SC_Man * p, Abc_Ntk_t * pNtk ) // 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 ); } } if ( pNtk->pManTime == NULL ) diff --git a/src/map/scl/sclSize.h b/src/map/scl/sclSize.h index f4a937c2..86008e54 100644 --- a/src/map/scl/sclSize.h +++ b/src/map/scl/sclSize.h @@ -226,6 +226,7 @@ static inline void Abc_SclManFree( SC_Man * p ) ABC_FREE( p->pSlews ); ABC_FREE( p ); } +/* static inline void Abc_SclManCleanTime( SC_Man * p ) { Vec_Flt_t * vSlews; @@ -249,6 +250,26 @@ static inline void Abc_SclManCleanTime( SC_Man * p ) } Vec_FltFree( vSlews ); } +*/ +static inline void Abc_SclManCleanTime( SC_Man * p ) +{ + memset( p->pTimes, 0, sizeof(SC_Pair) * p->nObjs ); + memset( p->pSlews, 0, sizeof(SC_Pair) * p->nObjs ); + memset( p->pDepts, 0, sizeof(SC_Pair) * p->nObjs ); + if ( p->pPiDrive != NULL ) + { + SC_Pair * pSlew, * pTime, * pLoad; + Abc_Obj_t * pObj; + int i; + Abc_NtkForEachPi( p->pNtk, pObj, i ) + { + pLoad = Abc_SclObjLoad( p, pObj ); + pTime = Abc_SclObjTime( p, pObj ); + pSlew = Abc_SclObjSlew( p, pObj ); + Scl_LibHandleInputDriver( p->pPiDrive, pLoad, pTime, pSlew ); + } + } +} /**Function************************************************************* -- cgit v1.2.3