Commit dfd6ab08 by Alan Mishchenko

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

parent fba0552f
......@@ -29,6 +29,7 @@ ABC_NAMESPACE_IMPL_START
static int Scl_CommandRead ( Abc_Frame_t * pAbc, int argc, char **argv );
static int Scl_CommandWrite( Abc_Frame_t * pAbc, int argc, char **argv );
static int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
......@@ -49,19 +50,8 @@ void Scl_Init( Abc_Frame_t * pAbc )
{
Cmd_CommandAdd( pAbc, "SC mapping", "read_scl", Scl_CommandRead, 0 );
Cmd_CommandAdd( pAbc, "SC mapping", "write_scl", Scl_CommandWrite, 0 );
Cmd_CommandAdd( pAbc, "SC mapping", "stime", Scl_CommandStime, 0 );
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Scl_End( Abc_Frame_t * pAbc )
{
Abc_SclLoad( NULL, &pAbc->pLibScl );
......@@ -111,6 +101,7 @@ int Scl_CommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
// read new library
Abc_SclLoad( pFileName, &pAbc->pLibScl );
Abc_SclWriteText( "sizing\\scl_out.txt", pAbc->pLibScl );
return 0;
usage:
......@@ -177,6 +168,59 @@ usage:
return 1;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv )
{
int c;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
{
switch ( c )
{
case 'h':
goto usage;
default:
goto usage;
}
}
if ( Abc_FrameReadNtk(pAbc) == NULL )
{
fprintf( pAbc->Err, "There is no current network.\n" );
return 1;
}
if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
{
fprintf( pAbc->Err, "The current network is not mapped.\n" );
return 1;
}
if ( pAbc->pLibScl == NULL )
{
fprintf( pAbc->Err, "There is no Liberty Library available.\n" );
return 1;
}
Abc_SclTimePerform( pAbc->pLibScl, Abc_FrameReadNtk(pAbc) );
return 0;
usage:
fprintf( pAbc->Err, "usage: stime [-h]\n" );
fprintf( pAbc->Err, "\t performs STA using Liberty library\n" );
fprintf( pAbc->Err, "\t-h : print the help massage\n" );
return 1;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
......
......@@ -46,9 +46,12 @@ ABC_NAMESPACE_HEADER_START
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/*=== scl.c =============================================================*/
extern void Abc_SclLoad( char * pFileName, void ** ppScl );
extern void Abc_SclSave( char * pFileName, void * pScl );
/*=== sclFile.c =============================================================*/
extern void Abc_SclLoad( char * pFileName, void ** ppScl );
extern void Abc_SclSave( char * pFileName, void * pScl );
/*=== sclTime.c =============================================================*/
extern void Abc_SclTimePerform( SC_Lib * pLib, void * pNtk );
ABC_NAMESPACE_HEADER_END
......
......@@ -159,7 +159,9 @@ struct SC_Lib_
Vec_Ptr_t * vWireLoads; // NamedSet<SC_WireLoad>
Vec_Ptr_t * vWireLoadSels; // NamedSet<SC_WireLoadSel>
Vec_Ptr_t * vTempls; // NamedSet<SC_TableTempl>
Vec_Ptr_t * vCells; // NamedSet<SC_Cell>
Vec_Ptr_t * vCells; // NamedSet<SC_Cell>
int * pBins; // hashing gateName -> gateId
int nBins;
};
////////////////////////////////////////////////////////////////////////
......@@ -170,6 +172,9 @@ struct SC_Lib_
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
static inline SC_Cell * SC_LibCell( SC_Lib * p, int i ) { return (SC_Cell *)Vec_PtrEntry(p->vCells, i); }
static inline SC_Pin * SC_CellPin( SC_Cell * p, int i ) { return (SC_Pin *)Vec_PtrEntry(p->vPins, i); }
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
......@@ -351,11 +356,18 @@ static inline void Abc_SclLibFree( SC_Lib * p )
ABC_FREE( p->lib_name );
ABC_FREE( p->default_wire_load );
ABC_FREE( p->default_wire_load_sel );
ABC_FREE( p->pBins );
ABC_FREE( p );
}
/*=== scl.c =============================================================*/
/*=== sclFile.c =============================================================*/
extern SC_Lib * Abc_SclRead( char * pFileName );
extern void Abc_SclWrite( char * pFileName, SC_Lib * p );
extern void Abc_SclWriteText( char * pFileName, SC_Lib * p );
extern int Abc_SclCellFind( SC_Lib * p, char * pName );
ABC_NAMESPACE_HEADER_END
......
......@@ -41,6 +41,7 @@ ABC_NAMESPACE_IMPL_START
***********************************************************************/
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
......
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