Commit bc44087b by Alan Mishchenko

Modified 'read' to read all types of libraries (genlib, liberty, scl).

parent fdfb083c
...@@ -165,10 +165,10 @@ void Io_End( Abc_Frame_t * pAbc ) ...@@ -165,10 +165,10 @@ void Io_End( Abc_Frame_t * pAbc )
***********************************************************************/ ***********************************************************************/
int IoCommandRead( Abc_Frame_t * pAbc, int argc, char ** argv ) int IoCommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
char Command[1000];
Abc_Ntk_t * pNtk; Abc_Ntk_t * pNtk;
char * pFileName, * pTemp; char * pFileName, * pTemp;
int fCheck; int c, fCheck;
int c;
fCheck = 1; fCheck = 1;
glo_fMapped = 0; glo_fMapped = 0;
...@@ -197,6 +197,20 @@ int IoCommandRead( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -197,6 +197,20 @@ int IoCommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
for ( pTemp = pFileName; *pTemp; pTemp++ ) for ( pTemp = pFileName; *pTemp; pTemp++ )
if ( *pTemp == '>' ) if ( *pTemp == '>' )
*pTemp = '\\'; *pTemp = '\\';
// read libraries
Command[0] = 0;
assert( strlen(pFileName) < 900 );
if ( !strcmp( Extra_FileNameExtension(pFileName), "genlib" ) )
sprintf( Command, "read_library %s", pFileName );
else if ( !strcmp( Extra_FileNameExtension(pFileName), "lib" ) )
sprintf( Command, "read_liberty %s", pFileName );
else if ( !strcmp( Extra_FileNameExtension(pFileName), "scl" ) )
sprintf( Command, "read_scl %s", pFileName );
if ( Command[0] )
{
Cmd_CommandExecute( pAbc, Command );
return 0;
}
// check if the library is available // check if the library is available
if ( glo_fMapped && Abc_FrameReadLibGen() == NULL ) if ( glo_fMapped && Abc_FrameReadLibGen() == NULL )
{ {
......
...@@ -134,6 +134,7 @@ extern int Io_WriteSmv( Abc_Ntk_t * pNtk, char * FileName ); ...@@ -134,6 +134,7 @@ extern int Io_WriteSmv( Abc_Ntk_t * pNtk, char * FileName );
extern void Io_WriteVerilog( Abc_Ntk_t * pNtk, char * FileName ); extern void Io_WriteVerilog( Abc_Ntk_t * pNtk, char * FileName );
/*=== abcUtil.c ===============================================================*/ /*=== abcUtil.c ===============================================================*/
extern Io_FileType_t Io_ReadFileType( char * pFileName ); extern Io_FileType_t Io_ReadFileType( char * pFileName );
extern Io_FileType_t Io_ReadLibType( char * pFileName );
extern Abc_Ntk_t * Io_ReadNetlist( char * pFileName, Io_FileType_t FileType, int fCheck ); extern Abc_Ntk_t * Io_ReadNetlist( char * pFileName, Io_FileType_t FileType, int fCheck );
extern Abc_Ntk_t * Io_Read( char * pFileName, Io_FileType_t FileType, int fCheck ); extern Abc_Ntk_t * Io_Read( char * pFileName, Io_FileType_t FileType, int fCheck );
extern void Io_Write( Abc_Ntk_t * pNtk, char * pFileName, Io_FileType_t FileType ); extern void Io_Write( Abc_Ntk_t * pNtk, char * pFileName, Io_FileType_t FileType );
......
...@@ -78,7 +78,7 @@ extern void Amap_LibFree( Amap_Lib_t * p ); ...@@ -78,7 +78,7 @@ extern void Amap_LibFree( Amap_Lib_t * p );
extern void Amap_LibPrintSelectedGates( Amap_Lib_t * p, int fAllGates ); extern void Amap_LibPrintSelectedGates( Amap_Lib_t * p, int fAllGates );
extern Amap_Lib_t * Amap_LibReadAndPrepare( char * pFileName, int fVerbose, int fVeryVerbose ); extern Amap_Lib_t * Amap_LibReadAndPrepare( char * pFileName, int fVerbose, int fVeryVerbose );
/*=== amapLiberty.c ==========================================================*/ /*=== amapLiberty.c ==========================================================*/
extern int Amap_LibertyParse( char * pFileName, char * pFileGenlib, int fVerbose ); extern int Amap_LibertyParse( char * pFileName, int fVerbose );
ABC_NAMESPACE_HEADER_END ABC_NAMESPACE_HEADER_END
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
/// INCLUDES /// /// INCLUDES ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
#include "misc/extra/extra.h"
#include "aig/aig/aig.h" #include "aig/aig/aig.h"
#include "amap.h" #include "amap.h"
......
...@@ -914,7 +914,7 @@ void Amap_LibertyStop( Amap_Tree_t * p ) ...@@ -914,7 +914,7 @@ void Amap_LibertyStop( Amap_Tree_t * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Amap_LibertyParse( char * pFileName, char * pFileGenlib, int fVerbose ) int Amap_LibertyParse( char * pFileName, int fVerbose )
{ {
Amap_Tree_t * p; Amap_Tree_t * p;
char * pPos; char * pPos;
...@@ -930,7 +930,7 @@ int Amap_LibertyParse( char * pFileName, char * pFileGenlib, int fVerbose ) ...@@ -930,7 +930,7 @@ int Amap_LibertyParse( char * pFileName, char * pFileGenlib, int fVerbose )
if ( fVerbose ) if ( fVerbose )
printf( "Parsing finished successfully.\n" ); printf( "Parsing finished successfully.\n" );
// Amap_LibertyPrintLiberty( p, "temp_.lib" ); // Amap_LibertyPrintLiberty( p, "temp_.lib" );
Amap_LibertyPrintGenlib( p, "temp.genlib", fVerbose ); Amap_LibertyPrintGenlib( p, Extra_FileNameGenericAppend(pFileName, ".genlib"), fVerbose );
RetValue = 1; RetValue = 1;
} }
else else
......
...@@ -149,6 +149,7 @@ void Mio_End( Abc_Frame_t * pAbc ) ...@@ -149,6 +149,7 @@ void Mio_End( Abc_Frame_t * pAbc )
***********************************************************************/ ***********************************************************************/
int Mio_CommandReadLiberty( Abc_Frame_t * pAbc, int argc, char **argv ) int Mio_CommandReadLiberty( Abc_Frame_t * pAbc, int argc, char **argv )
{ {
char Command[1000];
FILE * pFile; FILE * pFile;
FILE * pOut, * pErr; FILE * pOut, * pErr;
Abc_Ntk_t * pNet; Abc_Ntk_t * pNet;
...@@ -196,9 +197,11 @@ int Mio_CommandReadLiberty( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -196,9 +197,11 @@ int Mio_CommandReadLiberty( Abc_Frame_t * pAbc, int argc, char **argv )
} }
fclose( pFile ); fclose( pFile );
if ( !Amap_LibertyParse( FileName, "temp.genlib", fVerbose ) ) if ( !Amap_LibertyParse( FileName, fVerbose ) )
return 0; return 0;
Cmd_CommandExecute( pAbc, "read_library temp.genlib" ); assert( strlen(FileName) < 900 );
sprintf( Command, "read_library %s", Extra_FileNameGenericAppend(FileName, ".genlib") );
Cmd_CommandExecute( pAbc, Command );
return 0; return 0;
usage: usage:
......
...@@ -129,7 +129,7 @@ char * Extra_FileNameExtension( char * FileName ) ...@@ -129,7 +129,7 @@ char * Extra_FileNameExtension( char * FileName )
for ( pDot = FileName + strlen(FileName)-1; pDot >= FileName; pDot-- ) for ( pDot = FileName + strlen(FileName)-1; pDot >= FileName; pDot-- )
if ( *pDot == '.' ) if ( *pDot == '.' )
return pDot + 1; return pDot + 1;
return NULL; return FileName;
} }
/**Function************************************************************* /**Function*************************************************************
......
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