diff options
-rw-r--r-- | src/base/io/io.c | 18 | ||||
-rw-r--r-- | src/base/io/ioAbc.h | 1 | ||||
-rw-r--r-- | src/map/amap/amap.h | 2 | ||||
-rw-r--r-- | src/map/amap/amapInt.h | 1 | ||||
-rw-r--r-- | src/map/amap/amapLiberty.c | 4 | ||||
-rw-r--r-- | src/map/mio/mio.c | 7 | ||||
-rw-r--r-- | src/misc/extra/extraUtilFile.c | 2 |
7 files changed, 27 insertions, 8 deletions
diff --git a/src/base/io/io.c b/src/base/io/io.c index 37774a8c..7894caa1 100644 --- a/src/base/io/io.c +++ b/src/base/io/io.c @@ -165,10 +165,10 @@ void Io_End( Abc_Frame_t * pAbc ) ***********************************************************************/ int IoCommandRead( Abc_Frame_t * pAbc, int argc, char ** argv ) { + char Command[1000]; Abc_Ntk_t * pNtk; char * pFileName, * pTemp; - int fCheck; - int c; + int c, fCheck; fCheck = 1; glo_fMapped = 0; @@ -197,6 +197,20 @@ int IoCommandRead( Abc_Frame_t * pAbc, int argc, char ** argv ) for ( pTemp = pFileName; *pTemp; pTemp++ ) if ( *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 if ( glo_fMapped && Abc_FrameReadLibGen() == NULL ) { diff --git a/src/base/io/ioAbc.h b/src/base/io/ioAbc.h index a5f56bfb..039f53c0 100644 --- a/src/base/io/ioAbc.h +++ b/src/base/io/ioAbc.h @@ -134,6 +134,7 @@ extern int Io_WriteSmv( Abc_Ntk_t * pNtk, char * FileName ); extern void Io_WriteVerilog( Abc_Ntk_t * pNtk, char * FileName ); /*=== abcUtil.c ===============================================================*/ 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_Read( char * pFileName, Io_FileType_t FileType, int fCheck ); extern void Io_Write( Abc_Ntk_t * pNtk, char * pFileName, Io_FileType_t FileType ); diff --git a/src/map/amap/amap.h b/src/map/amap/amap.h index 0a0c7cc0..b4c8b574 100644 --- a/src/map/amap/amap.h +++ b/src/map/amap/amap.h @@ -78,7 +78,7 @@ extern void Amap_LibFree( Amap_Lib_t * p ); extern void Amap_LibPrintSelectedGates( Amap_Lib_t * p, int fAllGates ); extern Amap_Lib_t * Amap_LibReadAndPrepare( char * pFileName, int fVerbose, int fVeryVerbose ); /*=== amapLiberty.c ==========================================================*/ -extern int Amap_LibertyParse( char * pFileName, char * pFileGenlib, int fVerbose ); +extern int Amap_LibertyParse( char * pFileName, int fVerbose ); ABC_NAMESPACE_HEADER_END diff --git a/src/map/amap/amapInt.h b/src/map/amap/amapInt.h index e2284ce6..7a9bef7a 100644 --- a/src/map/amap/amapInt.h +++ b/src/map/amap/amapInt.h @@ -26,6 +26,7 @@ /// INCLUDES /// //////////////////////////////////////////////////////////////////////// +#include "misc/extra/extra.h" #include "aig/aig/aig.h" #include "amap.h" diff --git a/src/map/amap/amapLiberty.c b/src/map/amap/amapLiberty.c index b8232024..20624882 100644 --- a/src/map/amap/amapLiberty.c +++ b/src/map/amap/amapLiberty.c @@ -914,7 +914,7 @@ void Amap_LibertyStop( Amap_Tree_t * p ) SeeAlso [] ***********************************************************************/ -int Amap_LibertyParse( char * pFileName, char * pFileGenlib, int fVerbose ) +int Amap_LibertyParse( char * pFileName, int fVerbose ) { Amap_Tree_t * p; char * pPos; @@ -930,7 +930,7 @@ int Amap_LibertyParse( char * pFileName, char * pFileGenlib, int fVerbose ) if ( fVerbose ) printf( "Parsing finished successfully.\n" ); // Amap_LibertyPrintLiberty( p, "temp_.lib" ); - Amap_LibertyPrintGenlib( p, "temp.genlib", fVerbose ); + Amap_LibertyPrintGenlib( p, Extra_FileNameGenericAppend(pFileName, ".genlib"), fVerbose ); RetValue = 1; } else diff --git a/src/map/mio/mio.c b/src/map/mio/mio.c index 64a066f8..938dbf54 100644 --- a/src/map/mio/mio.c +++ b/src/map/mio/mio.c @@ -149,6 +149,7 @@ void Mio_End( Abc_Frame_t * pAbc ) ***********************************************************************/ int Mio_CommandReadLiberty( Abc_Frame_t * pAbc, int argc, char **argv ) { + char Command[1000]; FILE * pFile; FILE * pOut, * pErr; Abc_Ntk_t * pNet; @@ -196,9 +197,11 @@ int Mio_CommandReadLiberty( Abc_Frame_t * pAbc, int argc, char **argv ) } fclose( pFile ); - if ( !Amap_LibertyParse( FileName, "temp.genlib", fVerbose ) ) + if ( !Amap_LibertyParse( FileName, fVerbose ) ) 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; usage: diff --git a/src/misc/extra/extraUtilFile.c b/src/misc/extra/extraUtilFile.c index f43ccb5f..c0810e4b 100644 --- a/src/misc/extra/extraUtilFile.c +++ b/src/misc/extra/extraUtilFile.c @@ -129,7 +129,7 @@ char * Extra_FileNameExtension( char * FileName ) for ( pDot = FileName + strlen(FileName)-1; pDot >= FileName; pDot-- ) if ( *pDot == '.' ) return pDot + 1; - return NULL; + return FileName; } /**Function************************************************************* |