From 00d023713b68fc554197efeb2c766b14ac3ec4bd Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Wed, 24 Jul 2013 09:54:53 -0700 Subject: Tuning standard-cell mapping flow. --- src/map/mio/mio.c | 112 +++++++++++++++++++++++++++++++----------------------- src/map/mio/mio.h | 4 ++ 2 files changed, 69 insertions(+), 47 deletions(-) (limited to 'src/map/mio') diff --git a/src/map/mio/mio.c b/src/map/mio/mio.c index b5153f1c..9f79ca1b 100644 --- a/src/map/mio/mio.c +++ b/src/map/mio/mio.c @@ -110,6 +110,63 @@ void Mio_End( Abc_Frame_t * pAbc ) Amap_LibFree( (Amap_Lib_t *)Abc_FrameReadLibGen2() ); } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Mio_UpdateGenlib( Mio_Library_t * pLib ) +{ + // free the current superlib because it depends on the old Mio library + if ( Abc_FrameReadLibSuper() ) + { + Map_SuperLibFree( (Map_SuperLib_t *)Abc_FrameReadLibSuper() ); + Abc_FrameSetLibSuper( NULL ); + } + + // replace the current library + Mio_LibraryDelete( (Mio_Library_t *)Abc_FrameReadLibGen() ); + Abc_FrameSetLibGen( pLib ); + + // replace the current library + Amap_LibFree( (Amap_Lib_t *)Abc_FrameReadLibGen2() ); + Abc_FrameSetLibGen2( NULL ); +} +int Mio_UpdateGenlib2( Vec_Str_t * vStr, Vec_Str_t * vStr2, char * pFileName, int fVerbose ) +{ + Mio_Library_t * pLib; + // set the new network + pLib = Mio_LibraryRead( pFileName, Vec_StrArray(vStr), NULL, fVerbose ); + if ( pLib == NULL ) + return 0; + + // free the current superlib because it depends on the old Mio library + if ( Abc_FrameReadLibSuper() ) + { + Map_SuperLibFree( (Map_SuperLib_t *)Abc_FrameReadLibSuper() ); + Abc_FrameSetLibSuper( NULL ); + } + + // replace the current library + Mio_LibraryDelete( (Mio_Library_t *)Abc_FrameReadLibGen() ); + Abc_FrameSetLibGen( pLib ); + + // set the new network + pLib = (Mio_Library_t *)Amap_LibReadAndPrepare( pFileName, Vec_StrArray(vStr2), 0, 0 ); + if ( pLib == NULL ) + return 0; + + // replace the current library + Amap_LibFree( (Amap_Lib_t *)Abc_FrameReadLibGen2() ); + Abc_FrameSetLibGen2( pLib ); + return 1; +} /**Function************************************************************* @@ -155,11 +212,8 @@ int Mio_CommandReadLiberty( Abc_Frame_t * pAbc, int argc, char **argv ) } } - if ( argc != globalUtilOptind + 1 ) - { goto usage; - } // get the input file name pFileName = argv[globalUtilOptind]; @@ -183,43 +237,17 @@ int Mio_CommandReadLiberty( Abc_Frame_t * pAbc, int argc, char **argv ) } else { - Mio_Library_t * pLib; Vec_Str_t * vStr, * vStr2; - + int RetValue; vStr = Amap_LibertyParseStr( pFileName, fVerbose ); if ( vStr == NULL ) return 0; - vStr2 = Vec_StrDup( vStr ); - - // set the new network - pLib = Mio_LibraryRead( pFileName, Vec_StrArray(vStr), NULL, fVerbose ); + vStr2 = Vec_StrDup(vStr); + RetValue = Mio_UpdateGenlib2( vStr, vStr2, pFileName, fVerbose ); Vec_StrFree( vStr ); - if ( pLib == NULL ) - { - Vec_StrFree( vStr2 ); - return 0; - } - - // free the current superlib because it depends on the old Mio library - if ( Abc_FrameReadLibSuper() ) - { - Map_SuperLibFree( (Map_SuperLib_t *)Abc_FrameReadLibSuper() ); - Abc_FrameSetLibSuper( NULL ); - } - - // replace the current library - Mio_LibraryDelete( (Mio_Library_t *)Abc_FrameReadLibGen() ); - Abc_FrameSetLibGen( pLib ); - - // set the new network - pLib = (Mio_Library_t *)Amap_LibReadAndPrepare( pFileName, Vec_StrArray(vStr2), 0, 0 ); Vec_StrFree( vStr2 ); - if ( pLib == NULL ) - return 0; - - // replace the current library - Amap_LibFree( (Amap_Lib_t *)Abc_FrameReadLibGen2() ); - Abc_FrameSetLibGen2( pLib ); + if ( !RetValue ) + printf( "Reading library has filed.\n" ); } return 0; @@ -331,26 +359,16 @@ int Mio_CommandReadGenlib( Abc_Frame_t * pAbc, int argc, char **argv ) if ( WireDelay != 0.0 ) Mio_LibraryShiftDelay( pLib, WireDelay ); - // free the current superlib because it depends on the old Mio library - if ( Abc_FrameReadLibSuper() ) - { - Map_SuperLibFree( (Map_SuperLib_t *)Abc_FrameReadLibSuper() ); - Abc_FrameSetLibSuper( NULL ); - } + // prepare libraries + Mio_UpdateGenlib( pLib ); // replace the current library - Mio_LibraryDelete( (Mio_Library_t *)Abc_FrameReadLibGen() ); - Abc_FrameSetLibGen( pLib ); - - // set the new network pLib2 = Amap_LibReadAndPrepare( pFileName, NULL, 0, 0 ); if ( pLib2 == NULL ) { - fprintf( pErr, "Reading genlib library has failed.\n" ); + fprintf( pErr, "Reading second genlib library has failed.\n" ); return 1; } - // replace the current library - Amap_LibFree( (Amap_Lib_t *)Abc_FrameReadLibGen2() ); Abc_FrameSetLibGen2( pLib2 ); return 0; diff --git a/src/map/mio/mio.h b/src/map/mio/mio.h index ed297a1b..2d78fec8 100644 --- a/src/map/mio/mio.h +++ b/src/map/mio/mio.h @@ -79,6 +79,10 @@ static inline char * Mio_UtilStrsav( char * s ) { return s ? strcpy(ABC_A /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// +/*=== mio.c =============================================================*/ +extern void Mio_UpdateGenlib( Mio_Library_t * pLib ); +extern int Mio_UpdateGenlib2( Vec_Str_t * vStr, Vec_Str_t * vStr2, char * pFileName, int fVerbose ); +extern void Mio_SclDeriveGenlib( void * pScl, float Slew, float Gain, int nGatesMin ); /*=== mioApi.c =============================================================*/ extern char * Mio_LibraryReadName ( Mio_Library_t * pLib ); extern int Mio_LibraryReadGateNum ( Mio_Library_t * pLib ); -- cgit v1.2.3