diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2015-09-08 19:53:49 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2015-09-08 19:53:49 -0700 |
commit | 97751e43b71792ded1947d98945e1e832325be6d (patch) | |
tree | 2b88dea48591c73d70bc4172f449de9a6b77bd5b /src/map/scl | |
parent | f623b04da47aaa2810c06b880f85354becef288e (diff) | |
download | abc-97751e43b71792ded1947d98945e1e832325be6d.tar.gz abc-97751e43b71792ded1947d98945e1e832325be6d.tar.bz2 abc-97751e43b71792ded1947d98945e1e832325be6d.zip |
New constraint manager and memory reporting 'ps'.
Diffstat (limited to 'src/map/scl')
-rw-r--r-- | src/map/scl/scl.c | 92 | ||||
-rw-r--r-- | src/map/scl/sclCon.h | 289 | ||||
-rw-r--r-- | src/map/scl/sclUtil.c | 9 |
3 files changed, 384 insertions, 6 deletions
diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c index bd917ca3..8f788628 100644 --- a/src/map/scl/scl.c +++ b/src/map/scl/scl.c @@ -21,6 +21,9 @@ #include "sclSize.h" #include "base/main/mainInt.h" +#include "misc/util/utilNam.h" +#include "sclCon.h" + ABC_NAMESPACE_IMPL_START @@ -47,9 +50,15 @@ static int Scl_CommandUpsize ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandDnsize ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandPrintBuf ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandReadConstr ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Scl_CommandWriteConstr( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandPrintConstr( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Scl_CommandResetConstr( Abc_Frame_t * pAbc, int argc, char ** argv ); +static inline Scl_Con_t * Scl_ConGetMan( Abc_Frame_t * pAbc ) { return (Scl_Con_t *)pAbc->pAbcCon; } +static inline void Scl_ConFreeMan( Abc_Frame_t * pAbc ) { if ( pAbc->pAbcCon ) Scl_ConFree(Scl_ConGetMan(pAbc)); } +static inline void Scl_ConUpdateMan( Abc_Frame_t * pAbc, Scl_Con_t * p ) { Scl_ConFreeMan(pAbc); pAbc->pAbcCon = p; } + Scl_Con_t * Scl_ConReadMan() { return Scl_ConGetMan( Abc_FrameGetGlobalFrame() ); } + //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// @@ -109,12 +118,14 @@ void Scl_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "SCL mapping", "dnsize", Scl_CommandDnsize, 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", "write_constr", Scl_CommandWriteConstr, 0 ); Cmd_CommandAdd( pAbc, "SCL mapping", "print_constr", Scl_CommandPrintConstr, 0 ); Cmd_CommandAdd( pAbc, "SCL mapping", "reset_constr", Scl_CommandResetConstr, 0 ); } void Scl_End( Abc_Frame_t * pAbc ) { Abc_SclLoad( NULL, (SC_Lib **)&pAbc->pLibScl ); + Scl_ConUpdateMan( pAbc, NULL ); } @@ -1799,7 +1810,9 @@ usage: ***********************************************************************/ int Scl_CommandReadConstr( Abc_Frame_t * pAbc, int argc, char ** argv ) { + extern Abc_Nam_t * Abc_NtkNameMan( Abc_Ntk_t * p, int fOuts ); extern void Abc_SclReadTimingConstr( Abc_Frame_t * pAbc, char * pFileName, int fVerbose ); + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); FILE * pFile; char * pFileName; int c, fVerbose = 0; @@ -1830,6 +1843,13 @@ int Scl_CommandReadConstr( Abc_Frame_t * pAbc, int argc, char ** argv ) } fclose( pFile ); Abc_SclReadTimingConstr( pAbc, pFileName, fVerbose ); + + // input constraint manager + if ( pNtk ) + { + Scl_Con_t * pCon = Scl_ConRead( pFileName, Abc_NtkNameMan(pNtk, 0), Abc_NtkNameMan(pNtk, 1) ); + if ( pCon ) Scl_ConUpdateMan( pAbc, pCon ); + } return 0; usage: @@ -1852,8 +1872,72 @@ usage: SeeAlso [] ***********************************************************************/ +int Scl_CommandWriteConstr( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Scl_Con_t * pCon = Scl_ConGetMan( pAbc ); + char * pFileName = NULL; + int c, fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) + { + switch ( c ) + { + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pCon == NULL ) + { + Abc_Print( 1, "Scl_CommandWriteConstr(): There is no constraint manager.\n" ); + return 0; + } + if ( argc == globalUtilOptind + 1 ) + pFileName = argv[globalUtilOptind]; + else if ( argc == globalUtilOptind && pCon ) + pFileName = Extra_FileNameGenericAppend( pCon->pFileName, "_out.constr" ); + else + { + printf( "Output file name should be given on the command line.\n" ); + return 0; + } + // perform writing + if ( !strcmp( Extra_FileNameExtension(pFileName), "constr" ) ) + Scl_ConWrite( pCon, pFileName ); + else + { + printf( "Scl_CommandWriteConstr(): Unrecognized output file extension.\n" ); + return 0; + } + return 0; + +usage: + fprintf( pAbc->Err, "usage: write_constr [-vh] <file>\n" ); + fprintf( pAbc->Err, "\t writes current timing constraints into a file\n" ); + fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + fprintf( pAbc->Err, "\t-h : prints the command summary\n" ); + fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" ); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ int Scl_CommandPrintConstr( Abc_Frame_t * pAbc, int argc, char ** argv ) { + Scl_Con_t * pCon = Scl_ConGetMan( pAbc ); int c, fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) @@ -1869,8 +1953,10 @@ int Scl_CommandPrintConstr( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - printf( "Primary input driving cell = %s\n", Abc_FrameReadDrivingCell() ); - printf( "Primary output maximum load = %f\n", Abc_FrameReadMaxLoad() ); + //printf( "Primary input driving cell = %s\n", Abc_FrameReadDrivingCell() ); + //printf( "Primary output maximum load = %f\n", Abc_FrameReadMaxLoad() ); + + if ( pCon ) Scl_ConWrite( pCon, NULL ); return 0; usage: @@ -1912,6 +1998,8 @@ int Scl_CommandResetConstr( Abc_Frame_t * pAbc, int argc, char ** argv ) } Abc_FrameSetDrivingCell( NULL ); Abc_FrameSetMaxLoad( 0 ); + + Scl_ConUpdateMan( pAbc, NULL ); return 0; usage: diff --git a/src/map/scl/sclCon.h b/src/map/scl/sclCon.h new file mode 100644 index 00000000..982b4641 --- /dev/null +++ b/src/map/scl/sclCon.h @@ -0,0 +1,289 @@ +/**CFile**************************************************************** + + FileName [sclCon.h] + + SystemName [ABC: Logic synthesis and verification system.] + + PackageName [Standard-cell library representation.] + + Synopsis [Constraint manager.] + + Author [Alan Mishchenko] + + Affiliation [UC Berkeley] + + Date [Ver. 1.0. Started - August 24, 2012.] + + Revision [$Id: sclCon.h,v 1.0 2012/08/24 00:00:00 alanmi Exp $] + +***********************************************************************/ + +ABC_NAMESPACE_HEADER_START + +//////////////////////////////////////////////////////////////////////// +/// DECLARATIONS /// +//////////////////////////////////////////////////////////////////////// + +typedef struct Scl_Con_t_ Scl_Con_t; +struct Scl_Con_t_ +{ + char * pFileName; // constraint file name + char * pModelName; // current design name + char * pInCellDef; // default input driving gate + word tInArrDef; // default input arrival time + word tInSlewDef; // default input slew + word tInLoadDef; // default input load + word tOutReqDef; // default output required time + word tOutLoadDef; // default output load + Vec_Ptr_t vInCells; // input driving gates + Vec_Wrd_t vInArrs; // input arrival times + Vec_Wrd_t vInSlews; // input slews + Vec_Wrd_t vInLoads; // input loads + Vec_Wrd_t vOutReqs; // output required times + Vec_Wrd_t vOutLoads; // output loads + Abc_Nam_t * pNamI; // input names + Abc_Nam_t * pNamO; // output names +}; + +#define SCL_INPUT_CELL "input_cell" +#define SCL_INPUT_ARR "input_arrival" +#define SCL_INPUT_SLEW "input_slew" +#define SCL_INPUT_LOAD "input_load" +#define SCL_OUTPUT_REQ "output_required" +#define SCL_OUTPUT_LOAD "output_load" + +#define SCL_DIRECTIVE(ITEM) "."ITEM +#define SCL_DEF_DIRECTIVE(ITEM) ".default_"ITEM + +#define SCL_NUM 1000000 +#define SCL_NUMINV 0.000001 +#define SCL_INFINITY (~(word)0) + +static inline word Scl_Flt2Wrd( float w ) { return SCL_NUM*w; } +static inline float Scl_Wrd2Flt( word w ) { return SCL_NUMINV*(unsigned)(w&0x3FFFFFFF) + SCL_NUMINV*(1<<30)*(unsigned)(w>>30); } + +//////////////////////////////////////////////////////////////////////// +/// FUNCTION DEFINITIONS /// +//////////////////////////////////////////////////////////////////////// + +/**Function************************************************************* + + Synopsis [Manager construction.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline Scl_Con_t * Scl_ConAlloc( char * pFileName, Abc_Nam_t * pNamI, Abc_Nam_t * pNamO ) +{ + Scl_Con_t * p = ABC_CALLOC( Scl_Con_t, 1 ); + p->pFileName = Abc_UtilStrsav( pFileName ); + p->pNamI = pNamI; + p->pNamO = pNamO; + p->pModelName = NULL; + p->pInCellDef = NULL; + p->tInArrDef = SCL_INFINITY; + p->tInSlewDef = SCL_INFINITY; + p->tInLoadDef = SCL_INFINITY; + p->tOutReqDef = SCL_INFINITY; + p->tOutLoadDef = SCL_INFINITY; + Vec_PtrFill( &p->vInCells, Abc_NamObjNumMax(pNamI)-1, NULL ); + Vec_WrdFill( &p->vInArrs, Abc_NamObjNumMax(pNamI)-1, SCL_INFINITY ); + Vec_WrdFill( &p->vInSlews, Abc_NamObjNumMax(pNamI)-1, SCL_INFINITY ); + Vec_WrdFill( &p->vInLoads, Abc_NamObjNumMax(pNamI)-1, SCL_INFINITY ); + Vec_WrdFill( &p->vOutReqs, Abc_NamObjNumMax(pNamO)-1, SCL_INFINITY ); + Vec_WrdFill( &p->vOutLoads, Abc_NamObjNumMax(pNamO)-1, SCL_INFINITY ); + return p; +} +static inline void Scl_ConFree( Scl_Con_t * p ) +{ + Vec_PtrFreeData( &p->vInCells ); + Vec_PtrErase( &p->vInCells ); + Vec_WrdErase( &p->vInArrs ); + Vec_WrdErase( &p->vInSlews ); + Vec_WrdErase( &p->vInLoads ); + Vec_WrdErase( &p->vOutReqs ); + Vec_WrdErase( &p->vOutLoads ); + Abc_NamDeref( p->pNamI ); + Abc_NamDeref( p->pNamO ); + ABC_FREE( p->pInCellDef ); + ABC_FREE( p->pModelName ); + ABC_FREE( p->pFileName ); + ABC_FREE( p ); +} + + +/**Function************************************************************* + + Synopsis [Manager serialization.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline int Scl_ConParse( Scl_Con_t * p, Abc_Nam_t * pNamI, Abc_Nam_t * pNamO ) +{ + char Buffer[1000]; + char * pToken, * pToken2, * pToken3, * pName; + int i, Num = -1, nLines = 0; word Value; + FILE * pFile = fopen( p->pFileName, "rb" ); + while ( fgets( Buffer, 1000, pFile ) ) + { + nLines++; + pToken = strtok( Buffer, " \t\r\n" ); + if ( pToken == NULL ) + continue; + pToken2 = strtok( NULL, " \t\r\n" ); + if ( pToken2 == NULL ) + { + printf( "Line %d: Skipping directive \"%s\" without argument.\n", nLines, pToken ); + continue; + } + pToken3 = strtok( NULL, " \t\r\n" ); + if ( !strcmp(pToken, ".model") ) p->pModelName = Abc_UtilStrsav(pToken2); + else if ( !strcmp(pToken, SCL_DEF_DIRECTIVE(SCL_INPUT_CELL)) ) p->pInCellDef = Abc_UtilStrsav(pToken2); + else if ( !strcmp(pToken, SCL_DEF_DIRECTIVE(SCL_INPUT_ARR)) ) p->tInArrDef = Scl_Flt2Wrd(atof(pToken2)); + else if ( !strcmp(pToken, SCL_DEF_DIRECTIVE(SCL_INPUT_SLEW)) ) p->tInSlewDef = Scl_Flt2Wrd(atof(pToken2)); + else if ( !strcmp(pToken, SCL_DEF_DIRECTIVE(SCL_INPUT_LOAD)) ) p->tInLoadDef = Scl_Flt2Wrd(atof(pToken2)); + else if ( !strcmp(pToken, SCL_DEF_DIRECTIVE(SCL_OUTPUT_REQ)) ) p->tOutReqDef = Scl_Flt2Wrd(atof(pToken2)); + else if ( !strcmp(pToken, SCL_DEF_DIRECTIVE(SCL_OUTPUT_LOAD))) p->tOutLoadDef = Scl_Flt2Wrd(atof(pToken2)); + else if ( pToken3 == NULL ) { printf( "Directive %s should be followed by two arguments.\n", pToken ); continue; } + else if ( !strcmp(pToken, SCL_DIRECTIVE(SCL_INPUT_CELL)) ) if ( (Num = Abc_NamStrFind(pNamI, pToken2)) > 0 ) Vec_PtrWriteEntry( &p->vInCells, Num-1, Abc_UtilStrsav(pToken3) ); else printf( "Line %d: Cannot find input \"%s\".\n", nLines, pToken2 ); + else if ( !strcmp(pToken, SCL_DIRECTIVE(SCL_INPUT_ARR)) ) if ( (Num = Abc_NamStrFind(pNamI, pToken2)) > 0 ) Vec_WrdWriteEntry( &p->vInArrs, Num-1, Scl_Flt2Wrd(atof(pToken3)) ); else printf( "Line %d: Cannot find input \"%s\".\n", nLines, pToken2 ); + else if ( !strcmp(pToken, SCL_DIRECTIVE(SCL_INPUT_SLEW)) ) if ( (Num = Abc_NamStrFind(pNamI, pToken2)) > 0 ) Vec_WrdWriteEntry( &p->vInSlews, Num-1, Scl_Flt2Wrd(atof(pToken3)) ); else printf( "Line %d: Cannot find input \"%s\".\n", nLines, pToken2 ); + else if ( !strcmp(pToken, SCL_DIRECTIVE(SCL_INPUT_LOAD)) ) if ( (Num = Abc_NamStrFind(pNamI, pToken2)) > 0 ) Vec_WrdWriteEntry( &p->vInLoads, Num-1, Scl_Flt2Wrd(atof(pToken3)) ); else printf( "Line %d: Cannot find input \"%s\".\n", nLines, pToken2 ); + else if ( !strcmp(pToken, SCL_DIRECTIVE(SCL_OUTPUT_REQ)) ) if ( (Num = Abc_NamStrFind(pNamO, pToken2)) > 0 ) Vec_WrdWriteEntry( &p->vOutReqs, Num-1, Scl_Flt2Wrd(atof(pToken3)) ); else printf( "Line %d: Cannot find output \"%s\".\n", nLines, pToken2 ); + else if ( !strcmp(pToken, SCL_DIRECTIVE(SCL_OUTPUT_LOAD)) ) if ( (Num = Abc_NamStrFind(pNamO, pToken2)) > 0 ) Vec_WrdWriteEntry( &p->vOutLoads, Num-1, Scl_Flt2Wrd(atof(pToken3)) ); else printf( "Line %d: Cannot find output \"%s\".\n", nLines, pToken2 ); + else printf( "Line %d: Skipping unrecognized directive \"%s\".\n", nLines, pToken ); + } + // set missing defaults + if ( p->pInCellDef == NULL ) p->pInCellDef = NULL; // consider using buffer from the current library + if ( p->tInArrDef == SCL_INFINITY ) p->tInArrDef = 0; + if ( p->tInSlewDef == SCL_INFINITY ) p->tInSlewDef = 0; + if ( p->tInLoadDef == SCL_INFINITY ) p->tInLoadDef = 0; + if ( p->tOutReqDef == SCL_INFINITY ) p->tOutReqDef = 0; + if ( p->tOutLoadDef == SCL_INFINITY ) p->tOutLoadDef = 0; + // set individual defaults + if ( p->pInCellDef ) + Vec_PtrForEachEntry(char *, &p->vInCells, pName, i) if ( pName == NULL ) Vec_PtrWriteEntry( &p->vInCells, i, Abc_UtilStrsav(p->pInCellDef) ); + Vec_WrdForEachEntry( &p->vInArrs, Value, i ) if ( Value == SCL_INFINITY ) Vec_WrdWriteEntry( &p->vInArrs, i, p->tInArrDef ); + Vec_WrdForEachEntry( &p->vInSlews, Value, i ) if ( Value == SCL_INFINITY ) Vec_WrdWriteEntry( &p->vInSlews, i, p->tInSlewDef ); + Vec_WrdForEachEntry( &p->vInLoads, Value, i ) if ( Value == SCL_INFINITY ) Vec_WrdWriteEntry( &p->vInLoads, i, p->tInLoadDef ); + Vec_WrdForEachEntry( &p->vOutReqs, Value, i ) if ( Value == SCL_INFINITY ) Vec_WrdWriteEntry( &p->vOutReqs, i, p->tOutReqDef ); + Vec_WrdForEachEntry( &p->vOutLoads, Value, i ) if ( Value == SCL_INFINITY ) Vec_WrdWriteEntry( &p->vOutLoads, i, p->tOutLoadDef ); + + fclose( pFile ); + return 1; +} +static inline Scl_Con_t * Scl_ConRead( char * pFileName, Abc_Nam_t * pNamI, Abc_Nam_t * pNamO ) +{ + Scl_Con_t * p = Scl_ConAlloc( pFileName, pNamI, pNamO ); + if ( Scl_ConParse(p, pNamI, pNamO) ) + return p; + Scl_ConFree( p ); + return NULL; +} +static inline void Scl_ConWrite( Scl_Con_t * p, char * pFileName ) +{ + char * pName; word Value; int i; + FILE * pFile = pFileName ? fopen( pFileName, "wb" ) : stdout; + if ( pFile == NULL ) + { + printf( "Cannot open output file \"%s\".\n", pFileName ); + return; + } + fprintf( pFile, ".model %s\n", p->pModelName ); + + if ( p->pInCellDef ) fprintf( pFile, ".default_%s %s\n", SCL_INPUT_CELL, p->pInCellDef ); + if ( p->tInArrDef != 0 ) fprintf( pFile, ".default_%s %.2f\n", SCL_INPUT_ARR, Scl_Wrd2Flt(p->tInArrDef) ); + if ( p->tInSlewDef != 0 ) fprintf( pFile, ".default_%s %.2f\n", SCL_INPUT_SLEW, Scl_Wrd2Flt(p->tInSlewDef) ); + if ( p->tInLoadDef != 0 ) fprintf( pFile, ".default_%s %.2f\n", SCL_INPUT_LOAD, Scl_Wrd2Flt(p->tInLoadDef) ); + if ( p->tOutReqDef != 0 ) fprintf( pFile, ".default_%s %.2f\n", SCL_OUTPUT_REQ, Scl_Wrd2Flt(p->tOutReqDef) ); + if ( p->tOutLoadDef != 0 ) fprintf( pFile, ".default_%s %.2f\n", SCL_OUTPUT_LOAD, Scl_Wrd2Flt(p->tOutLoadDef) ); + + Vec_PtrForEachEntry(char *, &p->vInCells, pName, i) if ( pName ) fprintf( pFile, ".%s %s %s\n", SCL_INPUT_CELL, Abc_NamStr(p->pNamI, i+1), pName ); + Vec_WrdForEachEntry( &p->vInArrs, Value, i ) if ( Value != p->tInArrDef ) fprintf( pFile, ".%s %s %.2f\n", SCL_INPUT_ARR, Abc_NamStr(p->pNamI, i+1), Scl_Wrd2Flt(Value) ); + Vec_WrdForEachEntry( &p->vInSlews, Value, i ) if ( Value != p->tInSlewDef ) fprintf( pFile, ".%s %s %.2f\n", SCL_INPUT_SLEW, Abc_NamStr(p->pNamI, i+1), Scl_Wrd2Flt(Value) ); + Vec_WrdForEachEntry( &p->vInLoads, Value, i ) if ( Value != p->tInLoadDef ) fprintf( pFile, ".%s %s %.2f\n", SCL_INPUT_LOAD, Abc_NamStr(p->pNamI, i+1), Scl_Wrd2Flt(Value) ); + Vec_WrdForEachEntry( &p->vOutReqs, Value, i ) if ( Value != p->tOutReqDef ) fprintf( pFile, ".%s %s %.2f\n", SCL_OUTPUT_REQ, Abc_NamStr(p->pNamO, i+1), Scl_Wrd2Flt(Value) ); + Vec_WrdForEachEntry( &p->vOutLoads, Value, i ) if ( Value != p->tOutLoadDef ) fprintf( pFile, ".%s %s %.2f\n", SCL_OUTPUT_LOAD, Abc_NamStr(p->pNamO, i+1), Scl_Wrd2Flt(Value) ); + + if ( pFile != stdout ) + fclose ( pFile ); +} + +/**Function************************************************************* + + Synopsis [Internal APIs.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline int Scl_ConHasInCells_( Scl_Con_t * p ) { return Vec_PtrCountZero(&p->vInCells) != Vec_PtrSize(&p->vInCells); } +static inline int Scl_ConHasInArrs_( Scl_Con_t * p ) { return Vec_WrdCountZero(&p->vInArrs) != Vec_WrdSize(&p->vInArrs); } +static inline int Scl_ConHasInSlews_( Scl_Con_t * p ) { return Vec_WrdCountZero(&p->vInSlews) != Vec_WrdSize(&p->vInSlews); } +static inline int Scl_ConHasInLoads_( Scl_Con_t * p ) { return Vec_WrdCountZero(&p->vInLoads) != Vec_WrdSize(&p->vInLoads); } +static inline int Scl_ConHasOutReqs_( Scl_Con_t * p ) { return Vec_WrdCountZero(&p->vOutReqs) != Vec_WrdSize(&p->vOutReqs); } +static inline int Scl_ConHasOutLoads_( Scl_Con_t * p ) { return Vec_WrdCountZero(&p->vOutLoads) != Vec_WrdSize(&p->vOutLoads); } + +static inline char * Scl_ConGetInCell_( Scl_Con_t * p, int i ) { return Vec_PtrEntry( &p->vInCells, i ); } +static inline word Scl_ConGetInArr_( Scl_Con_t * p, int i ) { return Vec_WrdEntry( &p->vInArrs, i ); } +static inline word Scl_ConGetInSlew_( Scl_Con_t * p, int i ) { return Vec_WrdEntry( &p->vInSlews, i ); } +static inline word Scl_ConGetInLoad_( Scl_Con_t * p, int i ) { return Vec_WrdEntry( &p->vInLoads, i ); } +static inline word Scl_ConGetOutReq_( Scl_Con_t * p, int i ) { return Vec_WrdEntry( &p->vOutReqs, i ); } +static inline word Scl_ConGetOutLoad_( Scl_Con_t * p, int i ) { return Vec_WrdEntry( &p->vOutLoads, i ); } + +/**Function************************************************************* + + Synopsis [External APIs.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +extern Scl_Con_t * Scl_ConReadMan(); + +static inline int Scl_ConIsRunning() { return Scl_ConReadMan() != NULL; } + +static inline int Scl_ConHasInCells() { return Scl_ConHasInCells_ ( Scl_ConReadMan() ); } +static inline int Scl_ConHasInArrs() { return Scl_ConHasInArrs_ ( Scl_ConReadMan() ); } +static inline int Scl_ConHasInSlews() { return Scl_ConHasInSlews_ ( Scl_ConReadMan() ); } +static inline int Scl_ConHasInLoads() { return Scl_ConHasInLoads_ ( Scl_ConReadMan() ); } +static inline int Scl_ConHasOutReqs() { return Scl_ConHasOutReqs_ ( Scl_ConReadMan() ); } +static inline int Scl_ConHasOutLoads() { return Scl_ConHasOutLoads_( Scl_ConReadMan() ); } + +static inline char * Scl_ConGetInCell( int i ) { return Scl_ConGetInCell_ ( Scl_ConReadMan(), i ); } +static inline word Scl_ConGetInArr( int i ) { return Scl_ConGetInArr_ ( Scl_ConReadMan(), i ); } +static inline word Scl_ConGetInSlew( int i ) { return Scl_ConGetInSlew_ ( Scl_ConReadMan(), i ); } +static inline word Scl_ConGetInLoad( int i ) { return Scl_ConGetInLoad_ ( Scl_ConReadMan(), i ); } +static inline word Scl_ConGetOutReq( int i ) { return Scl_ConGetOutReq_ ( Scl_ConReadMan(), i ); } +static inline word Scl_ConGetOutLoad( int i ) { return Scl_ConGetOutLoad_( Scl_ConReadMan(), i ); } + +static inline float Scl_ConGetInArrFloat( int i ) { return Scl_Wrd2Flt( Scl_ConGetInArr(i) ); } +static inline float Scl_ConGetInSlewFloat( int i ) { return Scl_Wrd2Flt( Scl_ConGetInSlew(i) ); } +static inline float Scl_ConGetInLoadFloat( int i ) { return Scl_Wrd2Flt( Scl_ConGetInLoad(i) ); } +static inline float Scl_ConGetOutReqFloat( int i ) { return Scl_Wrd2Flt( Scl_ConGetOutReq(i) ); } +static inline float Scl_ConGetOutLoadFloat( int i ) { return Scl_Wrd2Flt( Scl_ConGetOutLoad(i) ); } + + +//////////////////////////////////////////////////////////////////////// +/// END OF FILE /// +//////////////////////////////////////////////////////////////////////// + + +ABC_NAMESPACE_HEADER_END + + diff --git a/src/map/scl/sclUtil.c b/src/map/scl/sclUtil.c index de33d50a..40d7c638 100644 --- a/src/map/scl/sclUtil.c +++ b/src/map/scl/sclUtil.c @@ -254,20 +254,21 @@ void Abc_SclReadTimingConstr( Abc_Frame_t * pAbc, char * pFileName, int fVerbose pToken = strtok( Buffer, " \t\r\n" ); if ( pToken == NULL ) continue; - if ( !strcmp(pToken, "set_driving_cell") ) +// if ( !strcmp(pToken, "set_driving_cell") ) + if ( !strcmp(pToken, "default_input_cell") ) { Abc_FrameSetDrivingCell( Abc_UtilStrsav(strtok(NULL, " \t\r\n")) ); if ( fVerbose ) printf( "Setting driving cell to be \"%s\".\n", Abc_FrameReadDrivingCell() ); } - else if ( !strcmp(pToken, "set_load") ) +// else if ( !strcmp(pToken, "set_load") ) + else if ( !strcmp(pToken, "default_output_load") ) { Abc_FrameSetMaxLoad( atof(strtok(NULL, " \t\r\n")) ); if ( fVerbose ) printf( "Setting driving cell to be %f.\n", Abc_FrameReadMaxLoad() ); } - else - printf( "Unrecognized token \"%s\".\n", pToken ); +// else printf( "Unrecognized token \"%s\".\n", pToken ); } fclose( pFile ); } |