From aed3b3a13acf9113cc4ec254933efce6114519be Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 25 Sep 2012 01:34:26 -0700 Subject: Cleaned up interfaces of genlib/liberty/supergate reading/writing. --- src/base/abci/abcMap.c | 7 +++++-- src/base/io/io.c | 23 ++++++++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) (limited to 'src/base') diff --git a/src/base/abci/abcMap.c b/src/base/abci/abcMap.c index fb8c87ed..7c1c05be 100644 --- a/src/base/abci/abcMap.c +++ b/src/base/abci/abcMap.c @@ -93,8 +93,11 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, { // printf( "A simple supergate library is derived from gate library \"%s\".\n", // Mio_LibraryReadName((Mio_Library_t *)Abc_FrameReadLibGen()) ); + if ( fVerbose ) + printf( "Converting \"%s\" into supergate library \"%s\".\n", + Mio_LibraryReadName(pLib), Extra_FileNameGenericAppend(Mio_LibraryReadName(pLib), ".super") ); // compute supergate library to be used for mapping - Map_SuperLibDeriveFromGenlib( pLib ); + Map_SuperLibDeriveFromGenlib( pLib, fVerbose ); } // return the library to normal @@ -455,7 +458,7 @@ Abc_Ntk_t * Abc_NtkSuperChoice( Abc_Ntk_t * pNtk ) { // printf( "A simple supergate library is derived from gate library \"%s\".\n", // Mio_LibraryReadName((Mio_Library_t *)Abc_FrameReadLibGen()) ); - Map_SuperLibDeriveFromGenlib( (Mio_Library_t *)Abc_FrameReadLibGen() ); + Map_SuperLibDeriveFromGenlib( (Mio_Library_t *)Abc_FrameReadLibGen(), 0 ); } // print a warning about choice nodes diff --git a/src/base/io/io.c b/src/base/io/io.c index e7e87c57..0873c2c0 100644 --- a/src/base/io/io.c +++ b/src/base/io/io.c @@ -201,7 +201,7 @@ int IoCommandRead( Abc_Frame_t * pAbc, int argc, char ** argv ) Command[0] = 0; assert( strlen(pFileName) < 900 ); if ( !strcmp( Extra_FileNameExtension(pFileName), "genlib" ) ) - sprintf( Command, "read_library %s", pFileName ); + sprintf( Command, "read_genlib %s", pFileName ); else if ( !strcmp( Extra_FileNameExtension(pFileName), "lib" ) ) sprintf( Command, "read_liberty %s", pFileName ); else if ( !strcmp( Extra_FileNameExtension(pFileName), "scl" ) ) @@ -1298,6 +1298,7 @@ usage: ***********************************************************************/ int IoCommandWrite( Abc_Frame_t * pAbc, int argc, char **argv ) { + char Command[1000]; char * pFileName; int c; @@ -1312,15 +1313,27 @@ int IoCommandWrite( Abc_Frame_t * pAbc, int argc, char **argv ) goto usage; } } + if ( argc != globalUtilOptind + 1 ) + goto usage; + // get the output file name + pFileName = argv[globalUtilOptind]; + // write libraries + Command[0] = 0; + assert( strlen(pFileName) < 900 ); + if ( !strcmp( Extra_FileNameExtension(pFileName), "genlib" ) ) + sprintf( Command, "write_genlib %s", pFileName ); + else if ( !strcmp( Extra_FileNameExtension(pFileName), "lib" ) ) + sprintf( Command, "write_liberty %s", pFileName ); + if ( Command[0] ) + { + Cmd_CommandExecute( pAbc, Command ); + return 0; + } if ( pAbc->pNtkCur == NULL ) { fprintf( pAbc->Out, "Empty network.\n" ); return 0; } - if ( argc != globalUtilOptind + 1 ) - goto usage; - // get the output file name - pFileName = argv[globalUtilOptind]; // call the corresponding file writer Io_Write( pAbc->pNtkCur, pFileName, Io_ReadFileType(pFileName) ); return 0; -- cgit v1.2.3