50 static int s_Primes[10] = { 1291, 1699, 2357, 4177, 5147, 5647, 6343, 7103, 7873, 8147 };
52 for ( i = 0; pName[i] !=
'\0'; i++ )
53 Key += s_Primes[i%10]*pName[i]*pName[i];
54 return Key % TableSize;
82 return pPlace ? *pPlace : -1;
115 if ( (*pp1)->n_inputs < (*pp2)->n_inputs )
117 if ( (*pp1)->n_inputs > (*pp2)->n_inputs )
127 return strcmp( (*pp1)->pName, (*pp2)->pName );
132 SC_Cell * pCell, * pRepr = NULL;
166 pRepr->
pRepr = pRepr;
175 pCell->
pRepr = pRepr;
206 return pCell ? pCell->
pRepr : NULL;
235 assert( pWLoadUsed != NULL );
241 Abc_Print( -1,
"Cannot find wire load model \"%s\".\n", pWLoadUsed );
249 char * pWLoadUsed = NULL;
347 SC_Pair SlewIn = { Slew, Slew };
348 SC_Pair ArrOut0 = { 0.0, 0.0 };
349 SC_Pair ArrOut1 = { 0.0, 0.0 };
350 SC_Pair ArrOut2 = { 0.0, 0.0 };
351 SC_Pair SlewOut = { 0.0, 0.0 };
354 if ( vIndex == NULL )
383 float LD, PD, ld, pd;
385 LD = PD = ld = pd = 0;
399 float LD, PD, ld, pd;
401 LD = PD = ld = pd = 0;
414 float LD, PD, ld, pd;
416 LD = PD = ld = pd = 0;
428 float LD = 0, PD = 0;
430 return 0.01 * LD * Gain + PD;
477 char Buffer[1000], * pName;
480 int CellId, nSkipped = 0;
482 pFile = fopen( FileName,
"rb" );
485 while ( fgets( Buffer, 999, pFile ) != NULL )
487 pName =
strtok( Buffer,
"\r\n\t " );
493 printf(
"Cannot find cell \"%s\" in the library \"%s\".\n", pName, p->
pName );
501 printf(
"Marked %d cells for skipping in the library \"%s\".\n", nSkipped, p->
pName );
507 int i, j, k, nLength = 0;
509 float LD = 0, PD = 0;
511 printf(
"Library \"%s\" ", p->
pName );
512 printf(
"has %d cells in %d classes. ",
515 printf(
"Delay estimate is based on slew %.2f ps and gain %.2f.", Slew, Gain );
525 if ( fInvOnly && pRepr->
n_inputs != 1 )
531 printf(
"Class%4d : ", k );
533 printf(
"Ins =%2d ", pRepr->
n_inputs );
534 printf(
"Outs =%2d ", pRepr->
n_outputs );
547 printf(
" %3d ", j+1 );
548 printf(
"%s", pCell->
fSkip ?
"s" :
" " );
550 printf(
"%-*s ", nLength, pCell->
pName );
552 printf(
"A =%8.2f ", pCell->
area );
553 printf(
"L =%8.2f ", pCell->
leakage );
558 printf(
"D =%6.1f ps ", 0.01 * Gain * LD + PD );
559 printf(
"LD =%6.1f ps ", LD );
560 printf(
"PD =%6.1f ps ", PD );
606 int i, k;
float Entry;
623 float Time = 1.0 * pow(10.0, 12 - p->
unit_time);
625 if ( Time == 1 && Load == 1 )
669 int i, j, k, Count = 2;
698 sprintf( Buffer,
" UNKNOWN 1 999 1.00 0.00 1.00 0.00\n" );
717 printf(
"Derived GENLIB library \"%s\" with %d gates.\n", p->
pName,
SC_LibCellNum(p) );
719 printf(
"Reading library has filed.\n" );
741 int i, k, Count = 2, nClassMax = 0;
747 if ( nGatesMin && nGatesMin >= nClassMax )
782 sprintf( Buffer,
" UNKNOWN 1 999 %7.2f 0.00 %7.2f 0.00\n", Delay, Delay );
792 *pnCellCount = Count;
802 if ( pFileName == NULL )
803 sprintf( FileName,
"%s_s%03d_g%03d_m%d.genlib", p->
pName, (
int)Slew, (
int)Gain, nGatesMin );
805 sprintf( FileName,
"%s", pFileName );
806 pFile = fopen( FileName,
"wb" );
809 printf(
"Cannot open file \"%s\" for writing.\n", FileName );
816 printf(
"Written GENLIB library with %d gates into file \"%s\".\n", nCellCount, FileName );
827 printf(
"Reading library has filed.\n" );
829 printf(
"Derived GENLIB library \"%s\" with %d gates using slew %.2f ps and gain %.2f.\n", p->
pName, nCellCount, Slew, Gain );
859 printf(
"Reading library has filed.\n" );
860 else if ( Gain != 0 )
861 printf(
"Derived GENLIB library \"%s\" with %d gates using slew %.2f ps and gain %.2f.\n", p->
pName, nGateCount, Slew, Gain );
static SC_Timing * Scl_CellPinTime(SC_Cell *pCell, int iPin)
static int SC_LibCellNum(SC_Lib *p)
void Abc_SclLinkCells(SC_Lib *p)
#define Vec_FltForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
void Abc_SclPrintCells(SC_Lib *p, float SlewInit, float Gain, int fInvOnly, int fShort)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static int Abc_PrimeCudd(unsigned int p)
#define SC_CellForEachPin(p, pPin, i)
int Abc_SclCellFind(SC_Lib *p, char *pName)
Mio_Library_t * Mio_LibraryRead(char *FileName, char *pBuffer, char *ExcludeFile, int fVerbose)
SC_WireLoad * Abc_SclFindWireLoadModel(SC_Lib *p, float Area)
static int Vec_WrdEqual(Vec_Wrd_t *p1, Vec_Wrd_t *p2)
static void Vec_FltWriteEntry(Vec_Flt_t *p, int i, float Entry)
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Mio_Library_t * Abc_SclDeriveGenlib(void *pScl, float SlewInit, float Gain, int nGatesMin, int fVerbose)
int Abc_SclComputeParametersPin(SC_Lib *p, SC_Cell *pCell, int iPin, float Slew, float *pLD, float *pPD)
#define SC_CellForEachPinIn(p, pPin, i)
static char * Vec_StrArray(Vec_Str_t *p)
SC_Cell * Abc_SclFindInvertor(SC_Lib *p, int fFindBuff)
void Abc_SclDumpGenlib(char *pFileName, SC_Lib *p, float SlewInit, float Gain, int nGatesMin)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Vec_Ptr_t * vWireLoadModel
#define SC_LibForEachCellClass(p, pCell, i)
static float SC_CellPinCapAve(SC_Cell *p)
#define SC_RingForEachCell(pRing, pCell, i)
static Vec_Str_t * Vec_StrAlloc(int nCap)
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
static int Abc_MaxInt(int a, int b)
static void Vec_StrPush(Vec_Str_t *p, char Entry)
static int Vec_PtrSize(Vec_Ptr_t *p)
SC_WireLoad * Abc_SclFetchWireLoadModel(SC_Lib *p, char *pWLoadUsed)
void Abc_SclLibNormalizeSurface(SC_Surface *p, float Time, float Load)
void Abc_SclComputeParametersClassPin(SC_Lib *p, SC_Cell *pRepr, int iPin, float Slew, float *pLD, float *pPD)
#define SC_LibForEachWireLoadSel(p, pWLS, i)
Vec_Str_t * Abc_SclProduceGenlibStrSimple(SC_Lib *p)
static int s_Primes[MAX_PRIMES]
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
static void Vec_StrFree(Vec_Str_t *p)
float Abc_SclComputeDelayCellPin(SC_Lib *p, SC_Cell *pCell, int iPin, float Slew, float Gain)
unsigned __int64 word
DECLARATIONS ///.
float default_max_out_slew
#define ABC_NAMESPACE_IMPL_END
int * Abc_SclHashLookup(SC_Lib *p, char *pName)
int Mio_UpdateGenlib2(Vec_Str_t *vStr, Vec_Str_t *vStr2, char *pFileName, int fVerbose)
STRUCTURE DEFINITIONS ///.
void Abc_SclInstallGenlib(void *pScl, float SlewInit, float Gain, int nGatesMin)
static char * SC_CellPinName(SC_Cell *p, int i)
static SC_Pin * SC_CellPin(SC_Cell *p, int i)
void Abc_SclLibNormalize(SC_Lib *p)
static SC_Cell * SC_LibCell(SC_Lib *p, int i)
static void Abc_Print(int level, const char *format,...)
static int Abc_SclCompareCells(SC_Cell **pp1, SC_Cell **pp2)
int Abc_SclLibClassNum(SC_Lib *pLib)
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
float Abc_SclComputeAverageSlew(SC_Lib *p)
int Abc_SclComputeParametersCell(SC_Lib *p, SC_Cell *pCell, float Slew, float *pLD, float *pPD)
static Vec_Wrd_t * SC_CellFunc(SC_Cell *p)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
void Abc_SclConvertLeakageIntoArea(SC_Lib *p, float A, float B)
static ABC_NAMESPACE_IMPL_START word Truth[8]
DECLARATIONS ///.
int Abc_SclHasDelayInfo(void *pScl)
static word * Vec_WrdArray(Vec_Wrd_t *p)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
float Abc_SclComputeAreaClass(SC_Cell *pRepr)
static float SC_CellPinCap(SC_Cell *p, int i)
#define ABC_CONST(number)
PARAMETERS ///.
#define SC_CellForEachPinOut(p, pPin, i)
void Abc_SclHashCells(SC_Lib *p)
static void Scl_LibPinArrival(SC_Timing *pTime, SC_Pair *pArrIn, SC_Pair *pSlewIn, SC_Pair *pLoad, SC_Pair *pArrOut, SC_Pair *pSlewOut)
Vec_Str_t * Abc_SclProduceGenlibStr(SC_Lib *p, float Slew, float Gain, int nGatesMin, int *pnCellCount)
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
void Abc_SclComputeParametersClass(SC_Lib *p, SC_Cell *pRepr, float Slew, float *pLD, float *pPD)
SC_Cell * Abc_SclFindSmallestGate(SC_Cell *p, float CinMin)
#define SC_LibForEachWireLoad(p, pWL, i)
Mio_Library_t * Abc_SclDeriveGenlibSimple(void *pScl)
void Abc_SclMarkSkippedCells(SC_Lib *p)
static char * SC_CellPinOutFunc(SC_Cell *p, int i)
static void Vec_PtrClear(Vec_Ptr_t *p)
static ABC_NAMESPACE_IMPL_START unsigned Abc_SclHashString(char *pName, int TableSize)
DECLARATIONS ///.
static void Vec_StrPrintStr(Vec_Str_t *p, const char *pStr)
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Vec_Ptr_t * vWireLoadSels
#define SC_PinForEachRTiming(p, pRTime, i)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static int Vec_FltSize(Vec_Flt_t *p)
float Abc_SclComputeDelayClassPin(SC_Lib *p, SC_Cell *pRepr, int iPin, float Slew, float Gain)
static void ** Vec_PtrArray(Vec_Ptr_t *p)
static Vec_Str_t * Vec_StrDup(Vec_Str_t *pVec)
int Abc_SclClassCellNum(SC_Cell *pClass)
char * default_wire_load_sel
#define ABC_FALLOC(type, num)
#define SC_LibForEachCell(p, pCell, i)
static void Vec_PtrFree(Vec_Ptr_t *p)