From e7527a47ba9d6cba9c9e72800aa91817ec923616 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 25 Sep 2012 16:37:25 -0700 Subject: Cleaned up interfaces of genlib/liberty/supergate reading/writing. --- src/map/mio/mio.c | 10 +++++----- src/map/mio/mio.h | 1 + src/map/mio/mioRead.c | 15 ++++++++------- 3 files changed, 14 insertions(+), 12 deletions(-) (limited to 'src/map/mio') diff --git a/src/map/mio/mio.c b/src/map/mio/mio.c index 791a7ac0..14878f94 100644 --- a/src/map/mio/mio.c +++ b/src/map/mio/mio.c @@ -40,7 +40,7 @@ static int Mio_CommandWriteGenlib( Abc_Frame_t * pAbc, int argc, char **argv ); static int Mio_CommandPrintGenlib( Abc_Frame_t * pAbc, int argc, char **argv ); /* -// internal version of GENLIB library +// internal version of genlib library static char * pMcncGenlib[25] = { "GATE inv1 1 O=!a; PIN * INV 1 999 0.9 0.0 0.9 0.0\n", "GATE inv2 2 O=!a; PIN * INV 2 999 1.0 0.0 1.0 0.0\n", @@ -320,7 +320,7 @@ int Mio_CommandReadGenlib( Abc_Frame_t * pAbc, int argc, char **argv ) pLib = Mio_LibraryRead( pFileName, NULL, pExcludeFile, fVerbose ); if ( pLib == NULL ) { - fprintf( pErr, "Reading GENLIB library has failed.\n" ); + fprintf( pErr, "Reading genlib library has failed.\n" ); return 1; } // add the fixed number (wire delay) to all delays in the library @@ -342,14 +342,14 @@ int Mio_CommandReadGenlib( Abc_Frame_t * pAbc, int argc, char **argv ) pLib = (Mio_Library_t *)Amap_LibReadAndPrepare( pFileName, NULL, 0, 0 ); if ( pLib == NULL ) { - fprintf( pErr, "Reading GENLIB library has failed.\n" ); + fprintf( pErr, "Reading genlib library has failed.\n" ); return 1; } // replace the current library Amap_LibFree( (Amap_Lib_t *)Abc_FrameReadLibGen2() ); Abc_FrameSetLibGen2( pLib ); if ( fVerbose ) - printf( "Entered GENLIB library with %d gates from file \"%s\".\n", Mio_LibraryReadGateNum(pLib), pFileName ); + printf( "Entered genlib library with %d gates from file \"%s\".\n", Mio_LibraryReadGateNum(pLib), pFileName ); return 0; usage: @@ -425,7 +425,7 @@ int Mio_CommandWriteGenlib( Abc_Frame_t * pAbc, int argc, char **argv ) } Mio_WriteLibrary( pFile, (Mio_Library_t *)Abc_FrameReadLibGen(), 0 ); fclose( pFile ); - printf( "The current GENLIB library is written into file \"%s\".\n", pFileName ); + printf( "The current genlib library is written into file \"%s\".\n", pFileName ); return 0; usage: diff --git a/src/map/mio/mio.h b/src/map/mio/mio.h index f2899654..3b9990a1 100644 --- a/src/map/mio/mio.h +++ b/src/map/mio/mio.h @@ -129,6 +129,7 @@ extern double Mio_PinReadDelayFanoutFall( Mio_Pin_t * pPin ); extern double Mio_PinReadDelayBlockMax ( Mio_Pin_t * pPin ); extern Mio_Pin_t * Mio_PinReadNext ( Mio_Pin_t * pPin ); /*=== mioRead.c =============================================================*/ +extern char * Mio_ReadFile( char * FileName, int fAddEnd ); extern Mio_Library_t * Mio_LibraryRead( char * FileName, char * pBuffer, char * ExcludeFile, int fVerbose ); extern int Mio_LibraryReadExclude( char * ExcludeFile, st_table * tExcludeGate ); /*=== mioFunc.c =============================================================*/ diff --git a/src/map/mio/mioRead.c b/src/map/mio/mioRead.c index aa92c9cd..19c68899 100644 --- a/src/map/mio/mioRead.c +++ b/src/map/mio/mioRead.c @@ -89,7 +89,7 @@ Mio_Library_t * Mio_LibraryRead( char * FileName, char * pBuffer, char * Exclude pLib->pName = Abc_UtilStrsav( Extra_FileNameGenericAppend(FileName, ".genlib") ); } if ( pLib != NULL ) - printf ( "Warning: Read extended GENLIB format but ignoring extensions\n" ); + printf ( "Warning: Read extended genlib format but ignoring extensions\n" ); } if ( tExcludeGate ) st_free_table( tExcludeGate ); @@ -108,7 +108,7 @@ Mio_Library_t * Mio_LibraryRead( char * FileName, char * pBuffer, char * Exclude SeeAlso [] ***********************************************************************/ -char * Mio_ReadFile( char * FileName ) +char * Mio_ReadFile( char * FileName, int fAddEnd ) { char * pBuffer; FILE * pFile; @@ -131,7 +131,8 @@ char * Mio_ReadFile( char * FileName ) RetValue = fread( pBuffer, nFileSize, 1, pFile ); // terminate the string with '\0' pBuffer[ nFileSize ] = '\0'; - strcat( pBuffer, "\n.end\n" ); + if ( fAddEnd ) + strcat( pBuffer, "\n.end\n" ); // close file fclose( pFile ); return pBuffer; @@ -201,7 +202,7 @@ Mio_Library_t * Mio_LibraryReadOne( char * FileName, int fExtendedFormat, st_tab // pBuffer = Io_ReadFileFileContents( FileName, NULL ); // we don't use above function but actually do the same thing explicitly // to handle open_path expansion correctly - pBuffer = Mio_ReadFile( FileName ); + pBuffer = Mio_ReadFile( FileName, 1 ); if ( pBuffer == NULL ) return NULL; pLib = Mio_LibraryReadBuffer( pBuffer, fExtendedFormat, tExcludeGate, fVerbose ); @@ -617,7 +618,7 @@ void Mio_LibraryDetectSpecialGates( Mio_Library_t * pLib ) pLib->pGateBuf = Mio_GateCompare( pLib->pGateBuf, pGate, uFuncBuf ); if ( pLib->pGateBuf == NULL ) { - printf( "Warnings: GENLIB library reader cannot detect the buffer gate.\n" ); + printf( "Warnings: genlib library reader cannot detect the buffer gate.\n" ); printf( "Some parts of the supergate-based technology mapper may not work correctly.\n" ); } @@ -626,7 +627,7 @@ void Mio_LibraryDetectSpecialGates( Mio_Library_t * pLib ) pLib->pGateInv = Mio_GateCompare( pLib->pGateInv, pGate, uFuncInv ); if ( pLib->pGateInv == NULL ) { - printf( "Warnings: GENLIB library reader cannot detect the invertor gate.\n" ); + printf( "Warnings: genlib library reader cannot detect the invertor gate.\n" ); printf( "Some parts of the supergate-based technology mapper may not work correctly.\n" ); } @@ -637,7 +638,7 @@ void Mio_LibraryDetectSpecialGates( Mio_Library_t * pLib ) pLib->pGateAnd2 = Mio_GateCompare( pLib->pGateAnd2, pGate, uFuncAnd2 ); if ( pLib->pGateAnd2 == NULL && pLib->pGateNand2 == NULL ) { - printf( "Warnings: GENLIB library reader cannot detect the AND2 or NAND2 gate.\n" ); + printf( "Warnings: genlib library reader cannot detect the AND2 or NAND2 gate.\n" ); printf( "Some parts of the supergate-based technology mapper may not work correctly.\n" ); } } -- cgit v1.2.3