Fixing Liberty parser to handle 'scalar' delay/slew tables.

This commit is contained in:
Alan Mishchenko 2014-02-06 12:22:30 -08:00
parent b910cba3e2
commit 48912a2247
3 changed files with 33 additions and 0 deletions

View File

@ -484,6 +484,15 @@ static inline float Scl_LibLookup( SC_Surface * p, float slew, float load )
float sfrac, lfrac, p0, p1;
int s, l;
// handle constant table
if ( Vec_FltSize(p->vIndex0) == 1 && Vec_FltSize(p->vIndex1) == 1 )
{
Vec_Flt_t * vTemp = (Vec_Flt_t *)Vec_PtrEntry(p->vData, 0);
assert( Vec_PtrSize(p->vData) == 1 );
assert( Vec_FltSize(vTemp) == 1 );
return Vec_FltEntry(vTemp, 0);
}
// Find closest sample points in surface:
pIndex0 = Vec_FltArray(p->vIndex0);
for ( s = 1; s < Vec_FltSize(p->vIndex0)-1; s++ )

View File

@ -353,6 +353,13 @@ int Abc_SclComputeParametersPin( SC_Lib * p, SC_Cell * pCell, int iPin, float Sl
Vec_Flt_t * vIndex = pTime ? pTime->pCellRise->vIndex1 : NULL; // capacitance
if ( vIndex == NULL )
return 0;
// handle constant table
if ( Vec_FltSize(vIndex) == 1 )
{
*pLD = 0;
*pPD = Vec_FltEntry( (Vec_Flt_t *)Vec_PtrEntry(pTime->pCellRise->vData, 0), 0 );
return 1;
}
// get load points
Load0.rise = Load0.fall = 0.0;
Load1.rise = Load1.fall = Vec_FltEntry( vIndex, 0 );

View File

@ -1030,6 +1030,23 @@ int Scl_LibertyScanTable( Scl_Tree_t * p, Vec_Ptr_t * vOut, Scl_Item_t * pTiming
Vec_PtrPush( vOut, vInd2 );
Vec_PtrPush( vOut, vValues );
}
else if ( !strcmp(pTempl, "scalar") )
{
Scl_ItemForEachChild( p, pTable, pItem )
if ( !Scl_LibertyCompare(p, pItem->Key, "values") )
{
assert(vValues == NULL);
vValues = Scl_LibertyReadFloatVec( Scl_LibertyReadString(p, pItem->Head) );
assert( Vec_FltSize(vValues) == 1 );
// write entries
Vec_PtrPush( vOut, Vec_IntStart(1) );
Vec_PtrPush( vOut, Vec_IntStart(1) );
Vec_PtrPush( vOut, vValues );
break;
}
else
{ printf( "Cannot read \"scalar\" template\n" ); return 0; }
}
else
{
// fetch the template