Commit 19d50b98 by Alan Mishchenko

New package to read/write a subset of Liberty for STA.

parent 2a7a06b6
...@@ -102,14 +102,14 @@ int Scl_CommandRead( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -102,14 +102,14 @@ int Scl_CommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
// get the input file name // get the input file name
pFileName = argv[globalUtilOptind]; pFileName = argv[globalUtilOptind];
if ( (pFile = fopen( pFileName, "r" )) == NULL ) if ( (pFile = fopen( pFileName, "rb" )) == NULL )
{ {
fprintf( pAbc->Err, "Cannot open input file \"%s\". \n", pFileName ); fprintf( pAbc->Err, "Cannot open input file \"%s\". \n", pFileName );
return 1; return 1;
} }
fclose( pFile ); fclose( pFile );
// set the new network // read new library
Abc_SclLoad( pFileName, &pAbc->pLibScl ); Abc_SclLoad( pFileName, &pAbc->pLibScl );
return 0; return 0;
...@@ -134,6 +134,7 @@ usage: ...@@ -134,6 +134,7 @@ usage:
***********************************************************************/ ***********************************************************************/
int Scl_CommandWrite( Abc_Frame_t * pAbc, int argc, char **argv ) int Scl_CommandWrite( Abc_Frame_t * pAbc, int argc, char **argv )
{ {
FILE * pFile;
char * pFileName; char * pFileName;
int c; int c;
...@@ -157,6 +158,14 @@ int Scl_CommandWrite( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -157,6 +158,14 @@ int Scl_CommandWrite( Abc_Frame_t * pAbc, int argc, char **argv )
} }
// get the input file name // get the input file name
pFileName = argv[globalUtilOptind]; pFileName = argv[globalUtilOptind];
if ( (pFile = fopen( pFileName, "wb" )) == NULL )
{
fprintf( pAbc->Err, "Cannot open output file \"%s\". \n", pFileName );
return 1;
}
fclose( pFile );
// save current library
Abc_SclSave( pFileName, pAbc->pLibScl ); Abc_SclSave( pFileName, pAbc->pLibScl );
return 0; return 0;
......
...@@ -101,6 +101,7 @@ struct SC_Surface_ ...@@ -101,6 +101,7 @@ struct SC_Surface_
Vec_Flt_t * vIndex0; // Vec<float> -- correspondes to "index_1" in the liberty file (for timing: slew) Vec_Flt_t * vIndex0; // Vec<float> -- correspondes to "index_1" in the liberty file (for timing: slew)
Vec_Flt_t * vIndex1; // Vec<float> -- correspondes to "index_2" in the liberty file (for timing: load) Vec_Flt_t * vIndex1; // Vec<float> -- correspondes to "index_2" in the liberty file (for timing: load)
Vec_Ptr_t * vData; // Vec<Vec<float> > -- 'data[i0][i1]' gives value at '(index0[i0], index1[i1])' Vec_Ptr_t * vData; // Vec<Vec<float> > -- 'data[i0][i1]' gives value at '(index0[i0], index1[i1])'
float approx[3][6];
}; };
struct SC_Timing_ struct SC_Timing_
...@@ -153,8 +154,8 @@ struct SC_Lib_ ...@@ -153,8 +154,8 @@ struct SC_Lib_
char * default_wire_load_sel; char * default_wire_load_sel;
float default_max_out_slew; // -- 'default_max_transition'; this is copied to each output pin where 'max_transition' is not defined float default_max_out_slew; // -- 'default_max_transition'; this is copied to each output pin where 'max_transition' is not defined
int unit_time; // -- Valid 9..12. Unit is '10^(-val)' seconds (e.g. 9=1ns, 10=100ps, 11=10ps, 12=1ps) int unit_time; // -- Valid 9..12. Unit is '10^(-val)' seconds (e.g. 9=1ns, 10=100ps, 11=10ps, 12=1ps)
float unit_cap_float; // -- First part is a multiplier, second either 12 or 15 for 'pf' or 'ff'. float unit_cap_fst; // -- First part is a multiplier, second either 12 or 15 for 'pf' or 'ff'.
int unit_cap_int; int unit_cap_snd;
Vec_Ptr_t * vWireLoads; // NamedSet<SC_WireLoad> Vec_Ptr_t * vWireLoads; // NamedSet<SC_WireLoad>
Vec_Ptr_t * vWireLoadSels; // NamedSet<SC_WireLoadSel> Vec_Ptr_t * vWireLoadSels; // NamedSet<SC_WireLoadSel>
Vec_Ptr_t * vTempls; // NamedSet<SC_TableTempl> Vec_Ptr_t * vTempls; // NamedSet<SC_TableTempl>
...@@ -221,7 +222,7 @@ static inline SC_Timings * Abc_SclTimingsAlloc() ...@@ -221,7 +222,7 @@ static inline SC_Timings * Abc_SclTimingsAlloc()
{ {
SC_Timings * p; SC_Timings * p;
p = ABC_CALLOC( SC_Timings, 1 ); p = ABC_CALLOC( SC_Timings, 1 );
p->vTimings = Vec_PtrAlloc( 0 ); p->vTimings = Vec_PtrAlloc( 0 );
return p; return p;
} }
static inline SC_Pin * Abc_SclPinAlloc() static inline SC_Pin * Abc_SclPinAlloc()
...@@ -229,8 +230,8 @@ static inline SC_Pin * Abc_SclPinAlloc() ...@@ -229,8 +230,8 @@ static inline SC_Pin * Abc_SclPinAlloc()
SC_Pin * p; SC_Pin * p;
p = ABC_CALLOC( SC_Pin, 1 ); p = ABC_CALLOC( SC_Pin, 1 );
p->max_out_slew = -1; p->max_out_slew = -1;
p->vRTimings = Vec_PtrAlloc( 0 ); p->vFunc = Vec_WrdAlloc( 0 );
p->vFunc = Vec_WrdAlloc( 0 ); p->vRTimings = Vec_PtrAlloc( 0 );
return p; return p;
} }
static inline SC_Cell * Abc_SclCellAlloc() static inline SC_Cell * Abc_SclCellAlloc()
...@@ -246,8 +247,8 @@ static inline SC_Lib * Abc_SclLibAlloc() ...@@ -246,8 +247,8 @@ static inline SC_Lib * Abc_SclLibAlloc()
p = ABC_CALLOC( SC_Lib, 1 ); p = ABC_CALLOC( SC_Lib, 1 );
p->default_max_out_slew = -1; p->default_max_out_slew = -1;
p->unit_time = 9; p->unit_time = 9;
p->unit_cap_float = 1; p->unit_cap_fst = 1;
p->unit_cap_int = 12; p->unit_cap_snd = 12;
p->vWireLoads = Vec_PtrAlloc( 0 ); p->vWireLoads = Vec_PtrAlloc( 0 );
p->vWireLoadSels = Vec_PtrAlloc( 0 ); p->vWireLoadSels = Vec_PtrAlloc( 0 );
p->vTempls = Vec_PtrAlloc( 0 ); p->vTempls = Vec_PtrAlloc( 0 );
......
...@@ -242,6 +242,7 @@ static inline int Abc_Base16Log( unsigned n ) { int r; if ( n < ...@@ -242,6 +242,7 @@ static inline int Abc_Base16Log( unsigned n ) { int r; if ( n <
static inline char * Abc_UtilStrsav( char * s ) { return s ? strcpy(ABC_ALLOC(char, strlen(s)+1), s) : NULL; } static inline char * Abc_UtilStrsav( char * s ) { return s ? strcpy(ABC_ALLOC(char, strlen(s)+1), s) : NULL; }
static inline int Abc_BitWordNum( int nBits ) { return (nBits>>5) + ((nBits&31) > 0); } static inline int Abc_BitWordNum( int nBits ) { return (nBits>>5) + ((nBits&31) > 0); }
static inline int Abc_TruthWordNum( int nVars ) { return nVars <= 5 ? 1 : (1 << (nVars - 5)); } static inline int Abc_TruthWordNum( int nVars ) { return nVars <= 5 ? 1 : (1 << (nVars - 5)); }
static inline int Abc_Truth6WordNum( int nVars ) { return nVars <= 6 ? 1 : (1 << (nVars - 6)); }
static inline int Abc_InfoHasBit( unsigned * p, int i ) { return (p[(i)>>5] & (1<<((i) & 31))) > 0; } static inline int Abc_InfoHasBit( unsigned * p, int i ) { return (p[(i)>>5] & (1<<((i) & 31))) > 0; }
static inline void Abc_InfoSetBit( unsigned * p, int i ) { p[(i)>>5] |= (1<<((i) & 31)); } static inline void Abc_InfoSetBit( unsigned * p, int i ) { p[(i)>>5] |= (1<<((i) & 31)); }
static inline void Abc_InfoXorBit( unsigned * p, int i ) { p[(i)>>5] ^= (1<<((i) & 31)); } static inline void Abc_InfoXorBit( unsigned * p, int i ) { p[(i)>>5] ^= (1<<((i) & 31)); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment