Commit ff5d3591 by Alan Mishchenko

Infrastructure to support full Liberty format and unitification of library representations.

parent d1fed2dd
...@@ -2479,11 +2479,19 @@ SOURCE=.\src\map\scl\sclDnsize.c ...@@ -2479,11 +2479,19 @@ SOURCE=.\src\map\scl\sclDnsize.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\map\scl\sclLib.c SOURCE=.\src\map\scl\sclLib.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\map\scl\sclLib.h SOURCE=.\src\map\scl\sclLiberty.c
# End Source File
# Begin Source File
SOURCE=.\src\map\scl\sclLibScl.c
# End Source File
# Begin Source File
SOURCE=.\src\map\scl\sclLibUtil.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -990,6 +990,10 @@ void Abc_Init( Abc_Frame_t * pAbc ) ...@@ -990,6 +990,10 @@ void Abc_Init( Abc_Frame_t * pAbc )
if ( Sdm_ManCanRead() ) if ( Sdm_ManCanRead() )
Sdm_ManRead(); Sdm_ManRead();
{
// extern void Scl_LibertyTest();
// Scl_LibertyTest();
}
} }
/**Function************************************************************* /**Function*************************************************************
...@@ -70,7 +70,7 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, ...@@ -70,7 +70,7 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti,
assert( Abc_NtkIsStrash(pNtk) ); assert( Abc_NtkIsStrash(pNtk) );
// derive library from SCL // derive library from SCL
if ( Abc_FrameReadLibScl() ) if ( Abc_FrameReadLibScl() )
Mio_SclDeriveGenlib( Abc_FrameReadLibScl(), Slew, Gain, nGatesMin ); Abc_SclDeriveGenlib( Abc_FrameReadLibScl(), Slew, Gain, nGatesMin );
// quit if there is no library // quit if there is no library
pLib = (Mio_Library_t *)Abc_FrameReadLibGen(); pLib = (Mio_Library_t *)Abc_FrameReadLibGen();
if ( pLib == NULL ) if ( pLib == NULL )
......
...@@ -220,7 +220,7 @@ int Mio_CommandReadLiberty( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -220,7 +220,7 @@ int Mio_CommandReadLiberty( Abc_Frame_t * pAbc, int argc, char **argv )
if ( (pFile = Io_FileOpen( pFileName, "open_path", "r", 0 )) == NULL ) if ( (pFile = Io_FileOpen( pFileName, "open_path", "r", 0 )) == NULL )
{ {
fprintf( pErr, "Cannot open input file \"%s\". ", pFileName ); fprintf( pErr, "Cannot open input file \"%s\". ", pFileName );
if ( (pFileName = Extra_FileGetSimilarName( pFileName, ".genlib", ".lib", ".gen", ".g", NULL )) ) if ( (pFileName = Extra_FileGetSimilarName( pFileName, ".genlib", ".lib", ".scl", ".g", NULL )) )
fprintf( pErr, "Did you mean \"%s\"?", pFileName ); fprintf( pErr, "Did you mean \"%s\"?", pFileName );
fprintf( pErr, "\n" ); fprintf( pErr, "\n" );
return 1; return 1;
...@@ -338,7 +338,7 @@ int Mio_CommandReadGenlib( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -338,7 +338,7 @@ int Mio_CommandReadGenlib( Abc_Frame_t * pAbc, int argc, char **argv )
if ( (pFile = Io_FileOpen( pFileName, "open_path", "r", 0 )) == NULL ) if ( (pFile = Io_FileOpen( pFileName, "open_path", "r", 0 )) == NULL )
{ {
fprintf( pErr, "Cannot open input file \"%s\". ", pFileName ); fprintf( pErr, "Cannot open input file \"%s\". ", pFileName );
if ( (pFileName = Extra_FileGetSimilarName( pFileName, ".genlib", ".lib", ".gen", ".g", NULL )) ) if ( (pFileName = Extra_FileGetSimilarName( pFileName, ".genlib", ".lib", ".scl", ".g", NULL )) )
fprintf( pErr, "Did you mean \"%s\"?", pFileName ); fprintf( pErr, "Did you mean \"%s\"?", pFileName );
fprintf( pErr, "\n" ); fprintf( pErr, "\n" );
return 1; return 1;
......
...@@ -82,7 +82,7 @@ static inline char * Mio_UtilStrsav( char * s ) { return s ? strcpy(ABC_A ...@@ -82,7 +82,7 @@ static inline char * Mio_UtilStrsav( char * s ) { return s ? strcpy(ABC_A
/*=== mio.c =============================================================*/ /*=== mio.c =============================================================*/
extern void Mio_UpdateGenlib( Mio_Library_t * pLib ); extern void Mio_UpdateGenlib( Mio_Library_t * pLib );
extern int Mio_UpdateGenlib2( Vec_Str_t * vStr, Vec_Str_t * vStr2, char * pFileName, int fVerbose ); extern int Mio_UpdateGenlib2( Vec_Str_t * vStr, Vec_Str_t * vStr2, char * pFileName, int fVerbose );
extern void Mio_SclDeriveGenlib( void * pScl, float Slew, float Gain, int nGatesMin ); extern void Abc_SclDeriveGenlib( void * pScl, float Slew, float Gain, int nGatesMin );
/*=== mioApi.c =============================================================*/ /*=== mioApi.c =============================================================*/
extern char * Mio_LibraryReadName ( Mio_Library_t * pLib ); extern char * Mio_LibraryReadName ( Mio_Library_t * pLib );
extern int Mio_LibraryReadGateNum ( Mio_Library_t * pLib ); extern int Mio_LibraryReadGateNum ( Mio_Library_t * pLib );
......
...@@ -399,6 +399,8 @@ Vec_Wrd_t * Mio_ParseFormulaTruth( char * pFormInit, char ** ppVarNames, int nVa ...@@ -399,6 +399,8 @@ Vec_Wrd_t * Mio_ParseFormulaTruth( char * pFormInit, char ** ppVarNames, int nVa
Vec_Wrd_t * vTruth; Vec_Wrd_t * vTruth;
// derive expression // derive expression
vExpr = Mio_ParseFormula( pFormInit, ppVarNames, nVars ); vExpr = Mio_ParseFormula( pFormInit, ppVarNames, nVars );
if ( vExpr == NULL )
return NULL;
// convert it into a truth table // convert it into a truth table
vTruth = Vec_WrdStart( Abc_Truth6WordNum(nVars) ); vTruth = Vec_WrdStart( Abc_Truth6WordNum(nVars) );
Exp_Truth( nVars, vExpr, Vec_WrdArray(vTruth) ); Exp_Truth( nVars, vExpr, Vec_WrdArray(vTruth) );
......
...@@ -2,7 +2,9 @@ SRC += src/map/scl/scl.c \ ...@@ -2,7 +2,9 @@ SRC += src/map/scl/scl.c \
src/map/scl/sclBuffer.c \ src/map/scl/sclBuffer.c \
src/map/scl/sclBufSize.c \ src/map/scl/sclBufSize.c \
src/map/scl/sclDnsize.c \ src/map/scl/sclDnsize.c \
src/map/scl/sclLib.c \ src/map/scl/sclLiberty.c \
src/map/scl/sclLibScl.c \
src/map/scl/sclLibUtil.c \
src/map/scl/sclLoad.c \ src/map/scl/sclLoad.c \
src/map/scl/sclSize.c \ src/map/scl/sclSize.c \
src/map/scl/sclUpsize.c \ src/map/scl/sclUpsize.c \
......
...@@ -201,6 +201,7 @@ struct SC_Cell_ ...@@ -201,6 +201,7 @@ struct SC_Cell_
struct SC_Lib_ struct SC_Lib_
{ {
char * pName; char * pName;
char * pFileName;
char * default_wire_load; char * default_wire_load;
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 (not used) float default_max_out_slew; // -- 'default_max_transition'; this is copied to each output pin where 'max_transition' is not defined (not used)
...@@ -237,7 +238,7 @@ static inline SC_Cell * SC_LibCell( SC_Lib * p, int i ) { return (SC ...@@ -237,7 +238,7 @@ static inline SC_Cell * SC_LibCell( SC_Lib * p, int i ) { return (SC
static inline SC_Pin * SC_CellPin( SC_Cell * p, int i ) { return (SC_Pin *)Vec_PtrEntry(p->vPins, i); } static inline SC_Pin * SC_CellPin( SC_Cell * p, int i ) { return (SC_Pin *)Vec_PtrEntry(p->vPins, i); }
static inline Vec_Wrd_t * SC_CellFunc( SC_Cell * p ) { return SC_CellPin(p, p->n_inputs)->vFunc; } static inline Vec_Wrd_t * SC_CellFunc( SC_Cell * p ) { return SC_CellPin(p, p->n_inputs)->vFunc; }
static inline float SC_CellPinCap( SC_Cell * p, int i ) { return 0.5 * SC_CellPin(p, i)->rise_cap + 0.5 * SC_CellPin(p, i)->fall_cap; } static inline float SC_CellPinCap( SC_Cell * p, int i ) { return 0.5 * SC_CellPin(p, i)->rise_cap + 0.5 * SC_CellPin(p, i)->fall_cap; }
static inline float SC_CellPinCapAve( SC_Cell * p ) { int i; float c = 0; for (i = 0; i < p->n_inputs; i++) c += SC_CellPinCap(p, i); return c / p->n_inputs; } static inline float SC_CellPinCapAve( SC_Cell * p ) { int i; float c = 0; for (i = 0; i < p->n_inputs; i++) c += SC_CellPinCap(p, i); return c / Abc_MaxInt(1, p->n_inputs); }
static inline char * SC_CellPinOutFunc( SC_Cell * p, int i ) { return SC_CellPin(p, p->n_inputs + i)->func_text; } static inline char * SC_CellPinOutFunc( SC_Cell * p, int i ) { return SC_CellPin(p, p->n_inputs + i)->func_text; }
static inline char * SC_CellPinName( SC_Cell * p, int i ) { return SC_CellPin(p, i)->pName; } static inline char * SC_CellPinName( SC_Cell * p, int i ) { return SC_CellPin(p, i)->pName; }
...@@ -462,6 +463,7 @@ static inline void Abc_SclLibFree( SC_Lib * p ) ...@@ -462,6 +463,7 @@ static inline void Abc_SclLibFree( SC_Lib * p )
Vec_PtrFree( p->vCells ); Vec_PtrFree( p->vCells );
Vec_PtrFree( p->vCellClasses ); Vec_PtrFree( p->vCellClasses );
ABC_FREE( p->pName ); ABC_FREE( p->pName );
ABC_FREE( p->pFileName );
ABC_FREE( p->default_wire_load ); ABC_FREE( p->default_wire_load );
ABC_FREE( p->default_wire_load_sel ); ABC_FREE( p->default_wire_load_sel );
ABC_FREE( p->pBins ); ABC_FREE( p->pBins );
...@@ -578,22 +580,27 @@ static inline float Scl_LibPinArrivalEstimate( SC_Cell * pCell, int iPin, float ...@@ -578,22 +580,27 @@ static inline float Scl_LibPinArrivalEstimate( SC_Cell * pCell, int iPin, float
return 0.5 * ArrOut.fall + 0.5 * ArrOut.rise; return 0.5 * ArrOut.fall + 0.5 * ArrOut.rise;
} }
/*=== sclLib.c ===============================================================*/ /*=== sclLiberty.c ===============================================================*/
extern SC_Lib * Abc_SclRead( char * pFileName ); extern SC_Lib * Abc_SclReadLiberty( char * pFileName, int fVerbose, int fVeryVerbose );
extern void Abc_SclWrite( char * pFileName, SC_Lib * p ); /*=== sclLibScl.c ===============================================================*/
extern void Abc_SclWriteText( char * pFileName, SC_Lib * p ); extern SC_Lib * Abc_SclReadFromStr( Vec_Str_t * vOut );
extern void Abc_SclLoad( char * pFileName, SC_Lib ** ppScl ); extern SC_Lib * Abc_SclReadFromFile( char * pFileName );
extern void Abc_SclSave( char * pFileName, SC_Lib * pScl ); extern void Abc_SclWriteScl( char * pFileName, SC_Lib * p );
extern void Abc_SclWriteLiberty( char * pFileName, SC_Lib * p );
/*=== sclLibUtil.c ===============================================================*/
extern void Abc_SclHashCells( SC_Lib * p ); extern void Abc_SclHashCells( SC_Lib * p );
extern int Abc_SclCellFind( SC_Lib * p, char * pName ); extern int Abc_SclCellFind( SC_Lib * p, char * pName );
extern int Abc_SclClassCellNum( SC_Cell * pClass ); extern int Abc_SclClassCellNum( SC_Cell * pClass );
extern void Abc_SclLinkCells( SC_Lib * p ); extern void Abc_SclLinkCells( SC_Lib * p );
extern void Abc_SclPrintCells( SC_Lib * p, float Slew, float Gain, int fInvOnly ); extern void Abc_SclPrintCells( SC_Lib * p, float Slew, float Gain, int fInvOnly, int fShort );
extern SC_Cell * Abc_SclFindInvertor( SC_Lib * p, int fFindBuff ); extern SC_Cell * Abc_SclFindInvertor( SC_Lib * p, int fFindBuff );
extern SC_Cell * Abc_SclFindSmallestGate( SC_Cell * p, float CinMin ); extern SC_Cell * Abc_SclFindSmallestGate( SC_Cell * p, float CinMin );
extern SC_WireLoad * Abc_SclFindWireLoadModel( SC_Lib * p, float Area ); extern SC_WireLoad * Abc_SclFindWireLoadModel( SC_Lib * p, float Area );
extern SC_WireLoad * Abc_SclFetchWireLoadModel( SC_Lib * p, char * pName ); extern SC_WireLoad * Abc_SclFetchWireLoadModel( SC_Lib * p, char * pName );
extern void Abc_SclDumpGenlib( char * pFileName, SC_Lib * p, float Slew, float Gain, int nGatesMin ); extern void Abc_SclDumpGenlib( char * pFileName, SC_Lib * p, float Slew, float Gain, int nGatesMin );
extern void Abc_SclDeriveGenlib( void * pScl, float Slew, float Gain, int nGatesMin );
ABC_NAMESPACE_HEADER_END ABC_NAMESPACE_HEADER_END
......
...@@ -551,7 +551,7 @@ void Extra_PrintHex( FILE * pFile, unsigned * pTruth, int nVars ) ...@@ -551,7 +551,7 @@ void Extra_PrintHex( FILE * pFile, unsigned * pTruth, int nVars )
// write the number into the file // write the number into the file
fprintf( pFile, "0x" ); fprintf( pFile, "0x" );
nMints = (1 << nVars); nMints = (1 << nVars);
nDigits = nMints / 4; nDigits = nMints / 4 + ((nMints % 4) > 0);
for ( k = nDigits - 1; k >= 0; k-- ) for ( k = nDigits - 1; k >= 0; k-- )
{ {
Digit = ((pTruth[k/8] >> (k * 4)) & 15); Digit = ((pTruth[k/8] >> (k * 4)) & 15);
...@@ -569,7 +569,7 @@ void Extra_PrintHexReverse( FILE * pFile, unsigned * pTruth, int nVars ) ...@@ -569,7 +569,7 @@ void Extra_PrintHexReverse( FILE * pFile, unsigned * pTruth, int nVars )
// write the number into the file // write the number into the file
fprintf( pFile, "0x" ); fprintf( pFile, "0x" );
nMints = (1 << nVars); nMints = (1 << nVars);
nDigits = nMints / 4; nDigits = nMints / 4 + ((nMints % 4) > 0);
for ( k = 0; k < nDigits; k++ ) for ( k = 0; k < nDigits; k++ )
{ {
Digit = ((pTruth[k/8] >> (k * 4)) & 15); Digit = ((pTruth[k/8] >> (k * 4)) & 15);
......
...@@ -664,6 +664,26 @@ static inline float Vec_FltFindMin( Vec_Flt_t * p ) ...@@ -664,6 +664,26 @@ static inline float Vec_FltFindMin( Vec_Flt_t * p )
/**Function************************************************************* /**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static inline void Vec_FltPrint( Vec_Flt_t * vVec )
{
int i; float Entry;
printf( "Vector has %d entries: {", Vec_FltSize(vVec) );
Vec_FltForEachEntry( vVec, Entry, i )
printf( " %f", Entry );
printf( " }\n" );
}
/**Function*************************************************************
Synopsis [Comparison procedure for two floats.] Synopsis [Comparison procedure for two floats.]
Description [] Description []
......
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