From 1ba1e6574cb4421f8a7c5984aa199e4efa62c3bf Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 26 Aug 2012 17:32:22 -0700 Subject: New package to read/write a subset of Liberty for STA. --- src/map/scl/scl.c | 59 ++++++++++++++- src/map/scl/scl.h | 3 +- src/map/scl/sclFile.c | 197 +++++++++++++++++++++++--------------------------- src/map/scl/sclSize.c | 4 + src/map/scl/sclTime.c | 173 +++++++++++++++++++++++++++++--------------- 5 files changed, 267 insertions(+), 169 deletions(-) diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c index 4db37891..58d87315 100644 --- a/src/map/scl/scl.c +++ b/src/map/scl/scl.c @@ -30,6 +30,7 @@ ABC_NAMESPACE_IMPL_START static int Scl_CommandRead ( Abc_Frame_t * pAbc, int argc, char **argv ); static int Scl_CommandWrite( Abc_Frame_t * pAbc, int argc, char **argv ); static int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv ); +static int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv ); //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// @@ -51,6 +52,7 @@ void Scl_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "SC mapping", "read_scl", Scl_CommandRead, 0 ); Cmd_CommandAdd( pAbc, "SC mapping", "write_scl", Scl_CommandWrite, 0 ); Cmd_CommandAdd( pAbc, "SC mapping", "stime", Scl_CommandStime, 0 ); + Cmd_CommandAdd( pAbc, "SC mapping", "gsize", Scl_CommandGsize, 1 ); } void Scl_End( Abc_Frame_t * pAbc ) { @@ -144,7 +146,7 @@ int Scl_CommandWrite( Abc_Frame_t * pAbc, int argc, char **argv ) goto usage; if ( pAbc->pLibScl == NULL ) { - fprintf( pAbc->Err, "There is no Liberty Library available.\n" ); + fprintf( pAbc->Err, "There is no Liberty library available.\n" ); return 1; } // get the input file name @@ -207,7 +209,7 @@ int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv ) } if ( pAbc->pLibScl == NULL ) { - fprintf( pAbc->Err, "There is no Liberty Library available.\n" ); + fprintf( pAbc->Err, "There is no Liberty library available.\n" ); return 1; } @@ -221,6 +223,59 @@ usage: return 1; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv ) +{ + int c; + + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) + { + switch ( c ) + { + case 'h': + goto usage; + default: + goto usage; + } + } + + if ( Abc_FrameReadNtk(pAbc) == NULL ) + { + fprintf( pAbc->Err, "There is no current network.\n" ); + return 1; + } + if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) ) + { + fprintf( pAbc->Err, "The current network is not mapped.\n" ); + return 1; + } + if ( pAbc->pLibScl == NULL ) + { + fprintf( pAbc->Err, "There is no Liberty library available.\n" ); + return 1; + } + + Abc_SclSizingPerform( pAbc->pLibScl, Abc_FrameReadNtk(pAbc) ); + return 0; + +usage: + fprintf( pAbc->Err, "usage: gsize [-h]\n" ); + fprintf( pAbc->Err, "\t performs gate sizing using Liberty library\n" ); + fprintf( pAbc->Err, "\t-h : print the help massage\n" ); + return 1; +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// diff --git a/src/map/scl/scl.h b/src/map/scl/scl.h index 41e89e15..660bfe1f 100644 --- a/src/map/scl/scl.h +++ b/src/map/scl/scl.h @@ -51,7 +51,8 @@ extern void Abc_SclLoad( char * pFileName, void ** ppScl ); extern void Abc_SclSave( char * pFileName, void * pScl ); /*=== sclTime.c =============================================================*/ extern void Abc_SclTimePerform( SC_Lib * pLib, void * pNtk ); - +/*=== sclSize.c =============================================================*/ +extern void Abc_SclSizingPerform( SC_Lib * pLib, void * pNtk ); ABC_NAMESPACE_HEADER_END diff --git a/src/map/scl/sclFile.c b/src/map/scl/sclFile.c index f8a360de..3696a036 100644 --- a/src/map/scl/sclFile.c +++ b/src/map/scl/sclFile.c @@ -592,36 +592,45 @@ static void Abc_SclWriteSurfaceText( FILE * s, SC_Surface * p ) float Entry; int i, k; - fprintf( s, "Surface:\n" ); - - fprintf( s, "%d", Vec_FltSize(p->vIndex0) ); - fprintf( s, "\n" ); + fprintf( s, " index_1(\"" ); Vec_FltForEachEntry( p->vIndex0, Entry, i ) - fprintf( s, "%f ", Entry ); - fprintf( s, "\n" ); + fprintf( s, "%f%s", Entry, i == Vec_FltSize(p->vIndex0)-1 ? "":", " ); + fprintf( s, "\");\n" ); - fprintf( s, "%d", Vec_FltSize(p->vIndex1) ); - fprintf( s, "\n" ); + fprintf( s, " index_2(\"" ); Vec_FltForEachEntry( p->vIndex1, Entry, i ) - fprintf( s, "%f ", Entry ); - fprintf( s, "\n" ); + fprintf( s, "%f%s", Entry, i == Vec_FltSize(p->vIndex1)-1 ? "":", " ); + fprintf( s, "\");\n" ); + fprintf( s, " values (\"" ); Vec_PtrForEachEntry( Vec_Flt_t *, p->vData, vVec, i ) { Vec_FltForEachEntry( vVec, Entry, k ) - fprintf( s, "%f ", Entry ); - fprintf( s, "\n" ); + fprintf( s, "%f%s", Entry, i == Vec_PtrSize(p->vData)-1 && k == Vec_FltSize(vVec)-1 ? "\");":", " ); + if ( i == Vec_PtrSize(p->vData)-1 ) + fprintf( s, "\n" ); + else + { + fprintf( s, "\\\n" ); + fprintf( s, " " ); + } } - +/* + fprintf( s, " approximations: \n" ); + fprintf( s, " " ); for ( i = 0; i < 3; i++ ) fprintf( s, "%f ", p->approx[0][i] ); fprintf( s, "\n" ); + fprintf( s, " " ); for ( i = 0; i < 4; i++ ) fprintf( s, "%f ", p->approx[1][i] ); fprintf( s, "\n" ); + fprintf( s, " " ); for ( i = 0; i < 6; i++ ) fprintf( s, "%f ", p->approx[2][i] ); fprintf( s, "\n" ); + fprintf( s, " \n" ); +*/ } static void Abc_SclWriteLibraryText( FILE * s, SC_Lib * p ) { @@ -633,71 +642,47 @@ static void Abc_SclWriteLibraryText( FILE * s, SC_Lib * p ) int i, j, k; // fprintf( s, "%d", ABC_SCL_CUR_VERSION ); - fprintf( s, "Liberty:\n" ); - - // Write non-composite fields: - fprintf( s, "%s", p->lib_name ); - fprintf( s, "\n" ); - fprintf( s, "%s", p->default_wire_load ); - fprintf( s, "\n" ); - fprintf( s, "%s", p->default_wire_load_sel ); - fprintf( s, "\n" ); - fprintf( s, "%f", p->default_max_out_slew ); - fprintf( s, "\n" ); - - assert( p->unit_time >= 0 ); - assert( p->unit_cap_snd >= 0 ); - fprintf( s, "%d", p->unit_time ); - fprintf( s, "\n" ); - fprintf( s, "%f", p->unit_cap_fst ); - fprintf( s, "\n" ); - fprintf( s, "%d", p->unit_cap_snd ); + fprintf( s, "library(%s) {\n\n", p->lib_name ); + if ( p->default_wire_load && strlen(p->default_wire_load) ) + fprintf( s, " default_wire_load : \"%s\";\n", p->default_wire_load ); + if ( p->default_wire_load_sel && strlen(p->default_wire_load_sel) ) + fprintf( s, " default_wire_load_selection : \"%s\";\n", p->default_wire_load_sel ); + if ( p->default_max_out_slew != -1 ) + fprintf( s, " default_max_transition : %f;\n", p->default_max_out_slew ); + if ( p->unit_time == 9 ) + fprintf( s, " time_unit : \"1ns\";\n" ); + else if ( p->unit_time == 10 ) + fprintf( s, " time_unit : \"100ps\";\n" ); + else if ( p->unit_time == 11 ) + fprintf( s, " time_unit : \"10ps\";\n" ); + else if ( p->unit_time == 12 ) + fprintf( s, " time_unit : \"1ps\";\n" ); + else assert( 0 ); + fprintf( s, " capacitive_load_unit(%.1f,%s);\n", p->unit_cap_fst, p->unit_cap_snd == 12 ? "pf" : "ff" ); fprintf( s, "\n" ); // Write 'wire_load' vector: - fprintf( s, "\n" ); - fprintf( s, "%d", Vec_PtrSize(p->vWireLoads) ); - fprintf( s, "\n" ); Vec_PtrForEachEntry( SC_WireLoad *, p->vWireLoads, pWL, i ) { - fprintf( s, "WireLoad:\n" ); - fprintf( s, "%s ", pWL->name ); - fprintf( s, "%f ", pWL->res ); - fprintf( s, "%f", pWL->cap ); - fprintf( s, "\n" ); - - fprintf( s, "%d", Vec_IntSize(pWL->vFanout) ); - fprintf( s, "\n" ); + fprintf( s, " wire_load(\"%s\") {\n", pWL->name ); + fprintf( s, " capacitance : %f;\n", pWL->cap ); + fprintf( s, " resistance : %f;\n", pWL->res ); for ( j = 0; j < Vec_IntSize(pWL->vFanout); j++ ) - { - fprintf( s, "%d ", Vec_IntEntry(pWL->vFanout, j) ); - fprintf( s, "%f ", Vec_FltEntry(pWL->vLen, j) ); - } - fprintf( s, "\n" ); + fprintf( s, " fanout_length( %d, %f );\n", Vec_IntEntry(pWL->vFanout, j), Vec_FltEntry(pWL->vLen, j) ); + fprintf( s, " }\n\n" ); } - fprintf( s, "\n" ); // Write 'wire_load_sel' vector: - fprintf( s, "%d", Vec_PtrSize(p->vWireLoadSels) ); - fprintf( s, "\n" ); Vec_PtrForEachEntry( SC_WireLoadSel *, p->vWireLoadSels, pWLS, i ) { - fprintf( s, "WireLoadSel:\n" ); - fprintf( s, "%s", pWLS->name ); - fprintf( s, "\n" ); - fprintf( s, "%d", Vec_FltSize(pWLS->vAreaFrom) ); - fprintf( s, "\n" ); + fprintf( s, " wire_load_selection(\"%s\") {\n", pWLS->name ); for ( j = 0; j < Vec_FltSize(pWLS->vAreaFrom); j++) - { - fprintf( s, "%f", Vec_FltEntry(pWLS->vAreaFrom, j) ); - fprintf( s, " " ); - fprintf( s, "%f", Vec_FltEntry(pWLS->vAreaTo, j) ); - fprintf( s, " " ); - fprintf( s, "%s", (char *)Vec_PtrEntry(pWLS->vWireLoadModel, j) ); - fprintf( s, "\n" ); - } + fprintf( s, " wire_load_from_area( %f, %f, \"%s\" );\n", + Vec_FltEntry(pWLS->vAreaFrom, j), + Vec_FltEntry(pWLS->vAreaTo, j), + (char *)Vec_PtrEntry(pWLS->vWireLoadModel, j) ); + fprintf( s, " }\n\n" ); } - fprintf( s, "\n" ); // Write 'cells' vector: n_valid_cells = 0; @@ -705,32 +690,25 @@ static void Abc_SclWriteLibraryText( FILE * s, SC_Lib * p ) if ( !(pCell->seq || pCell->unsupp) ) n_valid_cells++; - fprintf( s, "%d", n_valid_cells ); - fprintf( s, "\n" ); Vec_PtrForEachEntry( SC_Cell *, p->vCells, pCell, i ) { if ( pCell->seq || pCell->unsupp ) continue; - fprintf( s, "\nCell:\n" ); - fprintf( s, "%s ", pCell->name ); - fprintf( s, "%f ", pCell->area ); - fprintf( s, "%d", pCell->drive_strength ); - fprintf( s, " " ); - - // Write 'pins': (sorted at this point; first inputs, then outputs) - fprintf( s, "%d ", pCell->n_inputs); - fprintf( s, "%d", pCell->n_outputs); fprintf( s, "\n" ); + fprintf( s, " cell(%s) {\n", pCell->name ); + fprintf( s, " /* n_inputs = %d n_outputs = %d */\n", pCell->n_inputs, pCell->n_outputs ); + fprintf( s, " area : %f;\n", pCell->area ); + fprintf( s, " drive_strength : %d;\n", pCell->drive_strength ); Vec_PtrForEachEntryStop( SC_Pin *, pCell->vPins, pPin, j, pCell->n_inputs ) { assert(pPin->dir == sc_dir_Input); - fprintf( s, "Pin:\n" ); - fprintf( s, "%s ", pPin->name ); - fprintf( s, "%f ", pPin->rise_cap ); - fprintf( s, "%f", pPin->fall_cap ); - fprintf( s, "\n" ); + fprintf( s, " pin(%s) {\n", pPin->name ); + fprintf( s, " direction : %s;\n", "input" ); + fprintf( s, " fall_capacitance : %f;\n", pPin->fall_cap ); + fprintf( s, " rise_capacitance : %f;\n", pPin->rise_cap ); + fprintf( s, " }\n" ); } Vec_PtrForEachEntryStart( SC_Pin *, pCell->vPins, pPin, j, pCell->n_inputs ) @@ -738,50 +716,57 @@ static void Abc_SclWriteLibraryText( FILE * s, SC_Lib * p ) SC_Timings * pRTime; // word uWord; assert(pPin->dir == sc_dir_Output); - - fprintf( s, "Pin:\n" ); - fprintf( s, "%s ", pPin->name ); - fprintf( s, "%f ", pPin->max_out_cap ); - fprintf( s, "%f", pPin->max_out_slew ); - fprintf( s, "\n" ); -/* - // write function - assert( Vec_WrdSize(pPin->vFunc) == Abc_Truth6WordNum(pCell->n_inputs) ); - fprintf( s, "%d", pCell->n_inputs ); - Vec_WrdForEachEntry( pPin->vFunc, uWord, k ) // -- 'size = 1u << (n_vars - 6)' - Vec_StrPutW( s, uWord ); // -- 64-bit number, written uncompressed (low-byte first) -*/ + fprintf( s, " pin(%s) {\n", pPin->name ); + fprintf( s, " direction : %s;\n", "output" ); + fprintf( s, " max_capacitance : %f;\n", pPin->max_out_cap ); + fprintf( s, " max_transition : %f;\n", pPin->max_out_slew ); + fprintf( s, " function : \"%s\";\n", pPin->func_text ? pPin->func_text : "?" ); + fprintf( s, " /* truth table = " ); Extra_PrintHex( s, (unsigned *)Vec_WrdArray(pPin->vFunc), pCell->n_inputs ); - fprintf( s, "\n" ); + fprintf( s, " */\n" ); // Write 'rtiming': (pin-to-pin timing tables for this particular output) assert( Vec_PtrSize(pPin->vRTimings) == pCell->n_inputs ); Vec_PtrForEachEntry( SC_Timings *, pPin->vRTimings, pRTime, k ) { - fprintf( s, "%s ", pRTime->name ); - fprintf( s, "%d", Vec_PtrSize(pRTime->vTimings) ); - fprintf( s, "\n" ); - // -- NOTE! After post-processing, the size of the 'rtiming[k]' vector is either - // 0 or 1 (in static timing, we have merged all tables to get the worst case). - // The case with size 0 should only occur for multi-output gates. if ( Vec_PtrSize(pRTime->vTimings) == 1 ) { SC_Timing * pTime = (SC_Timing *)Vec_PtrEntry( pRTime->vTimings, 0 ); - // -- NOTE! We don't need to save 'related_pin' string because we have sorted - // the elements on input pins. - fprintf( s, "%d", (int)pTime->tsense); - fprintf( s, "\n" ); + fprintf( s, " timing() {\n" ); + fprintf( s, " related_pin : \"%s\"\n", pRTime->name ); + if ( pTime->tsense == sc_ts_Pos ) + fprintf( s, " timing_sense : positive_unate;\n" ); + else if ( pTime->tsense == sc_ts_Neg ) + fprintf( s, " timing_sense : negative_unate;\n" ); + else if ( pTime->tsense == sc_ts_Non ) + fprintf( s, " timing_sense : non_unate;\n" ); + else assert( 0 ); + + fprintf( s, " cell_rise() {\n" ); Abc_SclWriteSurfaceText( s, pTime->pCellRise ); + fprintf( s, " }\n" ); + + fprintf( s, " cell_fall() {\n" ); Abc_SclWriteSurfaceText( s, pTime->pCellFall ); + fprintf( s, " }\n" ); + + fprintf( s, " rise_transition() {\n" ); Abc_SclWriteSurfaceText( s, pTime->pRiseTrans ); + fprintf( s, " }\n" ); + + fprintf( s, " fall_transition() {\n" ); Abc_SclWriteSurfaceText( s, pTime->pFallTrans ); + fprintf( s, " }\n" ); + fprintf( s, " }\n" ); } else assert( Vec_PtrSize(pRTime->vTimings) == 0 ); } + fprintf( s, " }\n" ); } - fprintf( s, "\n" ); + fprintf( s, " }\n" ); } + fprintf( s, "}\n\n" ); } void Abc_SclWriteText( char * pFileName, SC_Lib * p ) { diff --git a/src/map/scl/sclSize.c b/src/map/scl/sclSize.c index 717c5ab5..8270bcea 100644 --- a/src/map/scl/sclSize.c +++ b/src/map/scl/sclSize.c @@ -29,6 +29,7 @@ ABC_NAMESPACE_IMPL_START /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// + /**Function************************************************************* Synopsis [] @@ -40,6 +41,9 @@ ABC_NAMESPACE_IMPL_START SeeAlso [] ***********************************************************************/ +void Abc_SclSizingPerform( SC_Lib * pLib, void * pNtk ) +{ +} //////////////////////////////////////////////////////////////////////// diff --git a/src/map/scl/sclTime.c b/src/map/scl/sclTime.c index 883b1ddd..45eb4ee5 100644 --- a/src/map/scl/sclTime.c +++ b/src/map/scl/sclTime.c @@ -82,6 +82,7 @@ void Abc_SclManFindGates( SC_Man * p ) gateId = Abc_SclCellFind( p->pLib, pName ); assert( gateId >= 0 ); Vec_IntWriteEntry( p->vGates, i, gateId ); +//printf( "Found gate %s\n", pName ); } } SC_Man * Abc_SclManAlloc( SC_Lib * pLib, Abc_Ntk_t * pNtk ) @@ -133,9 +134,10 @@ Vec_Flt_t * Abc_SclFindWireCaps( SC_Man * p, Vec_Ptr_t * vNodes ) { Vec_Flt_t * vCaps = NULL; SC_WireLoad * pWL = NULL; - int i, Entry, EntryPrev, EntryMax; + int i, Entry, EntryMax; + float EntryPrev, EntryCur; p->pWireLoadUsed = NULL; - if ( p->pLib->default_wire_load_sel ) + if ( p->pLib->default_wire_load_sel && strlen(p->pLib->default_wire_load_sel) ) { float Area; SC_WireLoadSel * pWLS = NULL; @@ -157,7 +159,7 @@ Vec_Flt_t * Abc_SclFindWireCaps( SC_Man * p, Vec_Ptr_t * vNodes ) if ( i == Vec_FltSize(pWLS->vAreaFrom) ) p->pWireLoadUsed = (char *)Vec_PtrEntryLast(pWLS->vWireLoadModel); } - else if ( p->pLib->default_wire_load ) + else if ( p->pLib->default_wire_load && strlen(p->pLib->default_wire_load) ) p->pWireLoadUsed = p->pLib->default_wire_load; else { @@ -184,16 +186,107 @@ Vec_Flt_t * Abc_SclFindWireCaps( SC_Man * p, Vec_Ptr_t * vNodes ) Vec_FltWriteEntry( vCaps, Entry, Vec_FltEntry(pWL->vLen, i) * pWL->cap ); // reformat EntryPrev = 0; - Vec_FltForEachEntry( vCaps, Entry, i ) + Vec_FltForEachEntry( vCaps, EntryCur, i ) { - if ( Entry ) - EntryPrev = Entry; + if ( EntryCur ) + EntryPrev = EntryCur; else Vec_FltWriteEntry( vCaps, i, EntryPrev ); } return vCaps; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_SclComputeLoad( SC_Man * p, Vec_Ptr_t * vNodes, Vec_Flt_t * vWireCaps ) +{ + Abc_Obj_t * pObj, * pFanin; + int i, k; + Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) + { + SC_Cell * pCell = Abc_SclObjCell( p, pObj ); + Abc_ObjForEachFanin( pObj, pFanin, k ) + { + SC_Pin * pPin = SC_CellPin( pCell, k ); + SC_Pair * pLoad = Abc_SclObjLoad( p, pFanin ); + pLoad->rise += pPin->rise_cap; + pLoad->fall += pPin->fall_cap; + } + } + if ( vWireCaps ) + { + Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) + { + SC_Pair * pLoad = Abc_SclObjLoad( p, pObj ); + k = Abc_MinInt( Vec_FltSize(vWireCaps)-1, Abc_ObjFanoutNum(pObj) ); + pLoad->rise += Vec_FltEntry(vWireCaps, k); + pLoad->fall += Vec_FltEntry(vWireCaps, k); + } + } +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Abc_Obj_t * Abc_SclFindMostCritical( SC_Man * p, int * pfRise, Vec_Ptr_t * vNodes ) +{ + Abc_Obj_t * pObj, * pPivot = NULL; + float fMaxArr = 0; + int i; + Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) + { + SC_Pair * pArr = Abc_SclObjArr( p, pObj ); + if ( fMaxArr < pArr->rise ) fMaxArr = pArr->rise, *pfRise = 1, pPivot = pObj; + if ( fMaxArr < pArr->fall ) fMaxArr = pArr->fall, *pfRise = 0, pPivot = pObj; + } + assert( pPivot != NULL ); + return pPivot; +} +void Abc_SclTimeNtkPrint( SC_Man * p, Vec_Ptr_t * vNodes ) +{ +/* + int fRise = 0; + Abc_Obj_t * pPivot = Abc_SclFindMostCritical( p, &fRise, vNodes ); + printf( "Critical delay: ObjId = %d. ", Abc_ObjId(pPivot) ); + printf( "Rise = %f. ", Abc_SclObjArr(p, pPivot)->rise ); + printf( "Fall = %f. ", Abc_SclObjArr(p, pPivot)->fall ); + printf( "\n" ); +*/ + + Abc_Obj_t * pObj; + int i; + printf( "WireLoad model = \"%s\".\n", p->pWireLoadUsed ); + printf( "Area = %f.\n", Abc_SclTotalArea( p, vNodes ) ); + Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) + { + printf( "Node %6d : ", Abc_ObjId(pObj) ); + printf( "TimeR = %f. ", Abc_SclObjArr(p, pObj)->rise ); + printf( "RimeF = %f. ", Abc_SclObjArr(p, pObj)->fall ); + printf( "SlewR = %f. ", Abc_SclObjSlew(p, pObj)->rise ); + printf( "SlewF = %f. ", Abc_SclObjSlew(p, pObj)->fall ); + printf( "LoadR = %f. ", Abc_SclObjLoad(p, pObj)->rise ); + printf( "LoadF = %f. ", Abc_SclObjLoad(p, pObj)->fall ); + printf( "\n" ); + } +} + /**Function************************************************************* Synopsis [] @@ -238,51 +331,25 @@ static inline float Abc_SclLookup( SC_Surface * p, float slew, float load ) } void Abc_SclTimeGate( SC_Man * p, SC_Timing * pTime, Abc_Obj_t * pObj, Abc_Obj_t * pFanin ) { - SC_Pair * pArrIn = Abc_SclObjLoad( p, pFanin ); - SC_Pair * pSlewIn = Abc_SclObjLoad( p, pFanin ); + SC_Pair * pArrIn = Abc_SclObjArr ( p, pFanin ); + SC_Pair * pSlewIn = Abc_SclObjSlew( p, pFanin ); SC_Pair * pLoad = Abc_SclObjLoad( p, pObj ); - SC_Pair * pArrOut = Abc_SclObjLoad( p, pObj ); // modified - SC_Pair * pSlewOut = Abc_SclObjLoad( p, pObj ); // modified + SC_Pair * pArrOut = Abc_SclObjArr ( p, pObj ); // modified + SC_Pair * pSlewOut = Abc_SclObjSlew( p, pObj ); // modified if (pTime->tsense == sc_ts_Pos || pTime->tsense == sc_ts_Non) { - pArrOut->rise = Abc_MaxInt( pArrOut->rise, pArrIn->rise + Abc_SclLookup(pTime->pCellRise, pSlewIn->rise, pLoad->rise) ); - pArrOut->fall = Abc_MaxInt( pArrOut->fall, pArrIn->fall + Abc_SclLookup(pTime->pCellFall, pSlewIn->fall, pLoad->fall) ); - pSlewOut->rise = Abc_MaxInt( pSlewOut->rise, Abc_SclLookup(pTime->pRiseTrans, pSlewIn->rise, pLoad->rise) ); - pSlewOut->fall = Abc_MaxInt( pSlewOut->fall, Abc_SclLookup(pTime->pFallTrans, pSlewIn->fall, pLoad->fall) ); + pArrOut->rise = Abc_MaxFloat( pArrOut->rise, pArrIn->rise + Abc_SclLookup(pTime->pCellRise, pSlewIn->rise, pLoad->rise) ); + pArrOut->fall = Abc_MaxFloat( pArrOut->fall, pArrIn->fall + Abc_SclLookup(pTime->pCellFall, pSlewIn->fall, pLoad->fall) ); + pSlewOut->rise = Abc_MaxFloat( pSlewOut->rise, Abc_SclLookup(pTime->pRiseTrans, pSlewIn->rise, pLoad->rise) ); + pSlewOut->fall = Abc_MaxFloat( pSlewOut->fall, Abc_SclLookup(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 + Abc_SclLookup(pTime->pCellRise, pSlewIn->fall, pLoad->rise) ); - pArrOut->fall = Abc_MaxInt( pArrOut->fall, pArrIn->rise + Abc_SclLookup(pTime->pCellFall, pSlewIn->rise, pLoad->fall) ); - pSlewOut->rise = Abc_MaxInt( pSlewOut->rise, Abc_SclLookup(pTime->pRiseTrans, pSlewIn->fall, pLoad->rise) ); - pSlewOut->fall = Abc_MaxInt( pSlewOut->fall, Abc_SclLookup(pTime->pFallTrans, pSlewIn->rise, pLoad->fall) ); - } -} -void Abc_SclComputeLoad( SC_Man * p, Vec_Ptr_t * vNodes, Vec_Flt_t * vWireCaps ) -{ - Abc_Obj_t * pObj, * pFanin; - int i, k; - Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) - { - SC_Cell * pCell = Abc_SclObjCell( p, pObj ); - Abc_ObjForEachFanin( pObj, pFanin, k ) - { - SC_Pin * pPin = SC_CellPin( pCell, k ); - SC_Pair * pLoad = Abc_SclObjLoad( p, pFanin ); - pLoad->rise += pPin->rise_cap; - pLoad->fall += pPin->fall_cap; - } - } - if ( vWireCaps ) - { - Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) - { - SC_Pair * pLoad = Abc_SclObjLoad( p, pObj ); - k = Abc_MinInt( Vec_FltSize(vWireCaps)-1, Abc_ObjFanoutNum(pObj) ); - pLoad->rise += Vec_FltEntry(vWireCaps, k); - pLoad->fall += Vec_FltEntry(vWireCaps, k); - } + pArrOut->rise = Abc_MaxFloat( pArrOut->rise, pArrIn->fall + Abc_SclLookup(pTime->pCellRise, pSlewIn->fall, pLoad->rise) ); + pArrOut->fall = Abc_MaxFloat( pArrOut->fall, pArrIn->rise + Abc_SclLookup(pTime->pCellFall, pSlewIn->rise, pLoad->fall) ); + pSlewOut->rise = Abc_MaxFloat( pSlewOut->rise, Abc_SclLookup(pTime->pRiseTrans, pSlewIn->fall, pLoad->rise) ); + pSlewOut->fall = Abc_MaxFloat( pSlewOut->fall, Abc_SclLookup(pTime->pFallTrans, pSlewIn->rise, pLoad->fall) ); } } void Abc_SclTimeNtk( SC_Man * p ) @@ -313,24 +380,11 @@ void Abc_SclTimeNtk( SC_Man * p ) Abc_SclTimeGate( p, pTime, pObj, Abc_ObjFanin(pObj, k) ); } } + Abc_SclTimeNtkPrint( p, vNodes ); + Vec_FltFree( vWireCaps ); Vec_PtrFree( vNodes ); } -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -void Abc_SclTimeNtkPrint( SC_Man * p ) -{ -} - /**Function************************************************************* Synopsis [] @@ -347,7 +401,6 @@ void Abc_SclTimePerform( SC_Lib * pLib, void * pNtk ) SC_Man * p; p = Abc_SclManAlloc( pLib, (Abc_Ntk_t *)pNtk ); Abc_SclTimeNtk( p ); - Abc_SclTimeNtkPrint( p ); Abc_SclManFree( p ); } -- cgit v1.2.3