2012-08-25 06:31:46 +02:00
|
|
|
/**CFile****************************************************************
|
|
|
|
|
|
|
|
|
|
FileName [scl.c]
|
|
|
|
|
|
|
|
|
|
SystemName [ABC: Logic synthesis and verification system.]
|
|
|
|
|
|
|
|
|
|
Synopsis [Standard-cell library representation.]
|
|
|
|
|
|
|
|
|
|
Author [Alan Mishchenko, Niklas Een]
|
|
|
|
|
|
|
|
|
|
Affiliation [UC Berkeley]
|
|
|
|
|
|
|
|
|
|
Date [Ver. 1.0. Started - August 24, 2012.]
|
|
|
|
|
|
|
|
|
|
Revision [$Id: scl.c,v 1.0 2012/08/24 00:00:00 alanmi Exp $]
|
|
|
|
|
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "sclInt.h"
|
|
|
|
|
#include "scl.h"
|
|
|
|
|
#include "base/main/mainInt.h"
|
|
|
|
|
|
|
|
|
|
ABC_NAMESPACE_IMPL_START
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
/// DECLARATIONS ///
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
static int Scl_CommandRead ( Abc_Frame_t * pAbc, int argc, char **argv );
|
|
|
|
|
static int Scl_CommandWrite( Abc_Frame_t * pAbc, int argc, char **argv );
|
2012-08-28 04:58:15 +02:00
|
|
|
static int Scl_CommandPrint( Abc_Frame_t * pAbc, int argc, char **argv );
|
2012-08-26 04:00:26 +02:00
|
|
|
static int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv );
|
2012-08-27 02:32:22 +02:00
|
|
|
static int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv );
|
2012-08-25 06:31:46 +02:00
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
/// FUNCTION DEFINITIONS ///
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/**Function*************************************************************
|
|
|
|
|
|
|
|
|
|
Synopsis []
|
|
|
|
|
|
|
|
|
|
Description []
|
|
|
|
|
|
|
|
|
|
SideEffects []
|
|
|
|
|
|
|
|
|
|
SeeAlso []
|
|
|
|
|
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
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 );
|
2012-08-28 04:58:15 +02:00
|
|
|
Cmd_CommandAdd( pAbc, "SC mapping", "print_scl", Scl_CommandPrint, 0 );
|
2012-08-26 04:00:26 +02:00
|
|
|
Cmd_CommandAdd( pAbc, "SC mapping", "stime", Scl_CommandStime, 0 );
|
2012-08-27 02:32:22 +02:00
|
|
|
Cmd_CommandAdd( pAbc, "SC mapping", "gsize", Scl_CommandGsize, 1 );
|
2012-08-25 06:31:46 +02:00
|
|
|
}
|
|
|
|
|
void Scl_End( Abc_Frame_t * pAbc )
|
|
|
|
|
{
|
|
|
|
|
Abc_SclLoad( NULL, &pAbc->pLibScl );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**Function*************************************************************
|
|
|
|
|
|
|
|
|
|
Synopsis []
|
|
|
|
|
|
|
|
|
|
Description []
|
|
|
|
|
|
|
|
|
|
SideEffects []
|
|
|
|
|
|
|
|
|
|
SeeAlso []
|
|
|
|
|
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
int Scl_CommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|
|
|
|
{
|
|
|
|
|
char * pFileName;
|
|
|
|
|
FILE * pFile;
|
|
|
|
|
int c;
|
|
|
|
|
|
|
|
|
|
Extra_UtilGetoptReset();
|
|
|
|
|
while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
|
|
|
|
|
{
|
|
|
|
|
switch ( c )
|
|
|
|
|
{
|
|
|
|
|
case 'h':
|
|
|
|
|
goto usage;
|
|
|
|
|
default:
|
|
|
|
|
goto usage;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ( argc != globalUtilOptind + 1 )
|
|
|
|
|
goto usage;
|
|
|
|
|
|
|
|
|
|
// get the input file name
|
|
|
|
|
pFileName = argv[globalUtilOptind];
|
2012-08-25 21:34:54 +02:00
|
|
|
if ( (pFile = fopen( pFileName, "rb" )) == NULL )
|
2012-08-25 06:31:46 +02:00
|
|
|
{
|
|
|
|
|
fprintf( pAbc->Err, "Cannot open input file \"%s\". \n", pFileName );
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
fclose( pFile );
|
|
|
|
|
|
2012-08-25 21:34:54 +02:00
|
|
|
// read new library
|
2012-08-25 06:31:46 +02:00
|
|
|
Abc_SclLoad( pFileName, &pAbc->pLibScl );
|
2012-08-26 04:00:26 +02:00
|
|
|
Abc_SclWriteText( "sizing\\scl_out.txt", pAbc->pLibScl );
|
2012-08-25 06:31:46 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
usage:
|
|
|
|
|
fprintf( pAbc->Err, "usage: read_scl [-h] <file>\n" );
|
|
|
|
|
fprintf( pAbc->Err, "\t reads Liberty library from file\n" );
|
|
|
|
|
fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
|
|
|
|
|
fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**Function*************************************************************
|
|
|
|
|
|
|
|
|
|
Synopsis []
|
|
|
|
|
|
|
|
|
|
Description []
|
|
|
|
|
|
|
|
|
|
SideEffects []
|
|
|
|
|
|
|
|
|
|
SeeAlso []
|
|
|
|
|
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
int Scl_CommandWrite( Abc_Frame_t * pAbc, int argc, char **argv )
|
|
|
|
|
{
|
2012-08-25 21:34:54 +02:00
|
|
|
FILE * pFile;
|
2012-08-25 06:31:46 +02:00
|
|
|
char * pFileName;
|
|
|
|
|
int c;
|
|
|
|
|
|
|
|
|
|
Extra_UtilGetoptReset();
|
|
|
|
|
while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
|
|
|
|
|
{
|
|
|
|
|
switch ( c )
|
|
|
|
|
{
|
|
|
|
|
case 'h':
|
|
|
|
|
goto usage;
|
|
|
|
|
default:
|
|
|
|
|
goto usage;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ( argc != globalUtilOptind + 1 )
|
|
|
|
|
goto usage;
|
|
|
|
|
if ( pAbc->pLibScl == NULL )
|
|
|
|
|
{
|
2012-08-27 02:32:22 +02:00
|
|
|
fprintf( pAbc->Err, "There is no Liberty library available.\n" );
|
2012-08-25 06:31:46 +02:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
// get the input file name
|
|
|
|
|
pFileName = argv[globalUtilOptind];
|
2012-08-25 21:34:54 +02:00
|
|
|
if ( (pFile = fopen( pFileName, "wb" )) == NULL )
|
|
|
|
|
{
|
|
|
|
|
fprintf( pAbc->Err, "Cannot open output file \"%s\". \n", pFileName );
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
fclose( pFile );
|
|
|
|
|
|
|
|
|
|
// save current library
|
2012-08-25 06:31:46 +02:00
|
|
|
Abc_SclSave( pFileName, pAbc->pLibScl );
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
usage:
|
|
|
|
|
fprintf( pAbc->Err, "usage: write_scl [-h] <file>\n" );
|
|
|
|
|
fprintf( pAbc->Err, "\t write Liberty library into file\n" );
|
|
|
|
|
fprintf( pAbc->Err, "\t-h : print the help massage\n" );
|
|
|
|
|
fprintf( pAbc->Err, "\t<file> : the name of the file to write\n" );
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-28 04:58:15 +02:00
|
|
|
/**Function*************************************************************
|
|
|
|
|
|
|
|
|
|
Synopsis []
|
|
|
|
|
|
|
|
|
|
Description []
|
|
|
|
|
|
|
|
|
|
SideEffects []
|
|
|
|
|
|
|
|
|
|
SeeAlso []
|
|
|
|
|
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
int Scl_CommandPrint( 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 ( pAbc->pLibScl == NULL )
|
|
|
|
|
{
|
|
|
|
|
fprintf( pAbc->Err, "There is no Liberty library available.\n" );
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// save current library
|
|
|
|
|
Abc_SclPrintCells( pAbc->pLibScl );
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
usage:
|
|
|
|
|
fprintf( pAbc->Err, "usage: print_scl [-h]\n" );
|
|
|
|
|
fprintf( pAbc->Err, "\t prints statistics of Liberty library\n" );
|
|
|
|
|
fprintf( pAbc->Err, "\t-h : print the help massage\n" );
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-26 04:00:26 +02:00
|
|
|
/**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 )
|
|
|
|
|
{
|
2012-08-27 02:32:22 +02:00
|
|
|
fprintf( pAbc->Err, "There is no Liberty library available.\n" );
|
2012-08-26 04:00:26 +02:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-27 02:32:22 +02:00
|
|
|
/**Function*************************************************************
|
|
|
|
|
|
|
|
|
|
Synopsis []
|
|
|
|
|
|
|
|
|
|
Description []
|
|
|
|
|
|
|
|
|
|
SideEffects []
|
|
|
|
|
|
|
|
|
|
SeeAlso []
|
|
|
|
|
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
int Scl_CommandGsize( 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_SclSizingPerform( pAbc->pLibScl, Abc_FrameReadNtk(pAbc) );
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
usage:
|
|
|
|
|
fprintf( pAbc->Err, "usage: gsize [-h]\n" );
|
|
|
|
|
fprintf( pAbc->Err, "\t performs gate sizing using Liberty library\n" );
|
|
|
|
|
fprintf( pAbc->Err, "\t-h : print the help massage\n" );
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-25 06:31:46 +02:00
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
/// END OF FILE ///
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ABC_NAMESPACE_IMPL_END
|
|
|
|
|
|