mirror of https://github.com/YosysHQ/abc.git
Modified 'read' to read all types of libraries (genlib, liberty, scl).
This commit is contained in:
parent
fdfb083c5c
commit
bc44087bac
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
/// INCLUDES ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "misc/extra/extra.h"
|
||||
#include "aig/aig/aig.h"
|
||||
#include "amap.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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*************************************************************
|
||||
|
|
|
|||
Loading…
Reference in New Issue