From 6130e39b18b5f53902e4eab14f6d5cdde5219563 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 1 Nov 2010 01:35:04 -0700 Subject: initial commit of public abc --- src/map/mio/mio.c | 32 +++++++++++++++++--------------- src/map/mio/mio.h | 18 +++++++++++------- src/map/mio/mioApi.c | 5 +++++ src/map/mio/mioFunc.c | 9 +++++++-- src/map/mio/mioInt.h | 8 ++++++++ src/map/mio/mioRead.c | 29 +++++++++++++++++------------ src/map/mio/mioUtils.c | 7 ++++++- 7 files changed, 71 insertions(+), 37 deletions(-) (limited to 'src/map/mio') diff --git a/src/map/mio/mio.c b/src/map/mio/mio.c index b7dd2895..2121b7b9 100644 --- a/src/map/mio/mio.c +++ b/src/map/mio/mio.c @@ -29,9 +29,8 @@ #include "mapper.h" #include "amap.h" -extern void Amap_LibFree( void * p ); -extern void Amap_LibPrintSelectedGates( void * p, int fAllGates ); -extern void * Amap_LibReadAndPrepare( char * pFileName, int fVerbose, int fVeryVerbose ); +ABC_NAMESPACE_IMPL_START + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// @@ -87,6 +86,7 @@ static char * pMcncGenlib[25] = { ***********************************************************************/ void Mio_Init( Abc_Frame_t * pAbc ) { +/* char * pFileTemp = "mcnc_temp.genlib"; void * pLibGen; FILE * pFile; @@ -108,6 +108,7 @@ void Mio_Init( Abc_Frame_t * pAbc ) #else unlink( pFileTemp ); #endif +*/ Cmd_CommandAdd( pAbc, "SC mapping", "read_liberty", Mio_CommandReadLiberty, 0 ); @@ -129,11 +130,11 @@ void Mio_Init( Abc_Frame_t * pAbc ) SeeAlso [] ***********************************************************************/ -void Mio_End() +void Mio_End( Abc_Frame_t * pAbc ) { // Mio_LibraryDelete( s_pLib ); - Mio_LibraryDelete( Abc_FrameReadLibGen() ); - Amap_LibFree( Abc_FrameReadLibGen2() ); + Mio_LibraryDelete( (Mio_Library_t *)Abc_FrameReadLibGen() ); + Amap_LibFree( (Amap_Lib_t *)Abc_FrameReadLibGen2() ); } @@ -284,24 +285,23 @@ int Mio_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv ) // free the current superlib because it depends on the old Mio library if ( Abc_FrameReadLibSuper() ) { - extern void Map_SuperLibFree( Map_SuperLib_t * p ); - Map_SuperLibFree( Abc_FrameReadLibSuper() ); + Map_SuperLibFree( (Map_SuperLib_t *)Abc_FrameReadLibSuper() ); Abc_FrameSetLibSuper( NULL ); } // replace the current library - Mio_LibraryDelete( Abc_FrameReadLibGen() ); + Mio_LibraryDelete( (Mio_Library_t *)Abc_FrameReadLibGen() ); Abc_FrameSetLibGen( pLib ); // set the new network - pLib = Amap_LibReadAndPrepare( FileName, 1, 0 ); + pLib = (Mio_Library_t *)Amap_LibReadAndPrepare( FileName, 1, 0 ); if ( pLib == NULL ) { fprintf( pErr, "Reading GENLIB library has failed.\n" ); return 1; } // replace the current library - Amap_LibFree( Abc_FrameReadLibGen2() ); + Amap_LibFree( (Amap_Lib_t *)Abc_FrameReadLibGen2() ); Abc_FrameSetLibGen2( pLib ); return 0; @@ -383,7 +383,7 @@ int Mio_CommandReadLibrary2( Abc_Frame_t * pAbc, int argc, char **argv ) fclose( pFile ); // set the new network - pLib = Amap_LibReadAndPrepare( FileName, fVerbose, fVeryVerbose ); + pLib = (Mio_Library_t *)Amap_LibReadAndPrepare( FileName, fVerbose, fVeryVerbose ); if ( pLib == NULL ) { fprintf( pErr, "Reading GENLIB library has failed.\n" ); @@ -391,7 +391,7 @@ int Mio_CommandReadLibrary2( Abc_Frame_t * pAbc, int argc, char **argv ) } // replace the current library - Amap_LibFree( Abc_FrameReadLibGen2() ); + Amap_LibFree( (Amap_Lib_t *)Abc_FrameReadLibGen2() ); Abc_FrameSetLibGen2( pLib ); return 0; @@ -455,7 +455,7 @@ int Mio_CommandPrintLibrary( Abc_Frame_t * pAbc, int argc, char **argv ) } // set the new network - Mio_WriteLibrary( stdout, Abc_FrameReadLibGen(), 0 ); + Mio_WriteLibrary( stdout, (Mio_Library_t *)Abc_FrameReadLibGen(), 0 ); return 0; usage: @@ -519,7 +519,7 @@ int Mio_CommandPrintLibrary2( Abc_Frame_t * pAbc, int argc, char **argv ) } // set the new network - Amap_LibPrintSelectedGates( Abc_FrameReadLibGen2(), fPrintAll ); + Amap_LibPrintSelectedGates( (Amap_Lib_t *)Abc_FrameReadLibGen2(), fPrintAll ); return 0; usage: @@ -536,3 +536,5 @@ usage: //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mio/mio.h b/src/map/mio/mio.h index 66fea292..0e993520 100644 --- a/src/map/mio/mio.h +++ b/src/map/mio/mio.h @@ -19,6 +19,7 @@ #ifndef __MIO_H__ #define __MIO_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -27,9 +28,10 @@ /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -extern "C" { -#endif + + +ABC_NAMESPACE_HEADER_START + //////////////////////////////////////////////////////////////////////// /// STRUCTURE DEFINITIONS /// @@ -134,16 +136,18 @@ extern void Mio_GateDelete( Mio_Gate_t * pGate ); extern void Mio_PinDelete( Mio_Pin_t * pPin ); extern Mio_Pin_t * Mio_PinDup( Mio_Pin_t * pPin ); extern void Mio_WriteLibrary( FILE * pFile, Mio_Library_t * pLib, int fPrintSops ); -extern Mio_Gate_t ** Mio_CollectRoots( Mio_Library_t * pLib, int nInputs, float tDelay, bool fSkipInv, int * pnGates ); +extern Mio_Gate_t ** Mio_CollectRoots( Mio_Library_t * pLib, int nInputs, float tDelay, int fSkipInv, int * pnGates ); extern void Mio_DeriveTruthTable( Mio_Gate_t * pGate, unsigned uTruthsIn[][2], int nSigns, int nInputs, unsigned uTruthRes[] ); extern void Mio_DeriveGateDelays( Mio_Gate_t * pGate, float ** ptPinDelays, int nPins, int nInputs, float tDelayZero, float * ptDelaysRes, float * ptPinDelayMax ); extern Mio_Gate_t * Mio_GateCreatePseudo( int nInputs ); -#ifdef __cplusplus -} -#endif + + +ABC_NAMESPACE_HEADER_END + + #endif diff --git a/src/map/mio/mioApi.c b/src/map/mio/mioApi.c index 61cc2509..9b267c30 100644 --- a/src/map/mio/mioApi.c +++ b/src/map/mio/mioApi.c @@ -18,6 +18,9 @@ #include "mioInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -173,3 +176,5 @@ Mio_Pin_t * Mio_PinReadNext ( Mio_Pin_t * pPin ) { return p //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mio/mioFunc.c b/src/map/mio/mioFunc.c index 05fe245d..f6f327e3 100644 --- a/src/map/mio/mioFunc.c +++ b/src/map/mio/mioFunc.c @@ -19,6 +19,9 @@ #include "mioInt.h" #include "parse.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -110,13 +113,13 @@ int Mio_GateParseFormula( Mio_Gate_t * pGate ) if ( strcmp( pGate->pForm, MIO_STRING_CONST0 ) == 0 ) { pGate->bFunc = b0; - pGate->pSop = Abc_SopRegister( pGate->pLib->pMmFlex, " 0\n" ); + pGate->pSop = Abc_SopRegister( (Extra_MmFlex_t *)pGate->pLib->pMmFlex, " 0\n" ); pGate->pLib->pGate0 = pGate; } else if ( strcmp( pGate->pForm, MIO_STRING_CONST1 ) == 0 ) { pGate->bFunc = b1; - pGate->pSop = Abc_SopRegister( pGate->pLib->pMmFlex, " 1\n" ); + pGate->pSop = Abc_SopRegister( (Extra_MmFlex_t *)pGate->pLib->pMmFlex, " 1\n" ); pGate->pLib->pGate1 = pGate; } else @@ -271,3 +274,5 @@ int Mio_GateCollectNames( char * pFormula, char * pPinNames[] ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mio/mioInt.h b/src/map/mio/mioInt.h index 654b7e19..35a583b6 100644 --- a/src/map/mio/mioInt.h +++ b/src/map/mio/mioInt.h @@ -19,6 +19,7 @@ #ifndef __MIO_INT_H__ #define __MIO_INT_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -29,6 +30,9 @@ #include "mio.h" #include "extra.h" +ABC_NAMESPACE_HEADER_START + + //////////////////////////////////////////////////////////////////////// /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// @@ -121,6 +125,10 @@ struct Mio_PinStruct_t_ /*=== mioRead.c =============================================================*/ /*=== mioUtils.c =============================================================*/ + + +ABC_NAMESPACE_HEADER_END + #endif //////////////////////////////////////////////////////////////////////// diff --git a/src/map/mio/mioRead.c b/src/map/mio/mioRead.c index fdb340aa..42c6d8bf 100644 --- a/src/map/mio/mioRead.c +++ b/src/map/mio/mioRead.c @@ -19,6 +19,9 @@ #include #include "mioInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -27,10 +30,10 @@ /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// -static Mio_Library_t * Mio_LibraryReadOne( Abc_Frame_t * pAbc, char * FileName, bool fExtendedFormat, st_table * tExcludeGate, int fVerbose ); -static int Mio_LibraryReadInternal( Mio_Library_t * pLib, char * pBuffer, bool fExtendedFormat, st_table * tExcludeGate, int fVerbose ); -static Mio_Gate_t * Mio_LibraryReadGate( char ** ppToken, bool fExtendedFormat ); -static Mio_Pin_t * Mio_LibraryReadPin( char ** ppToken, bool fExtendedFormat ); +static Mio_Library_t * Mio_LibraryReadOne( Abc_Frame_t * pAbc, char * FileName, int fExtendedFormat, st_table * tExcludeGate, int fVerbose ); +static int Mio_LibraryReadInternal( Mio_Library_t * pLib, char * pBuffer, int fExtendedFormat, st_table * tExcludeGate, int fVerbose ); +static Mio_Gate_t * Mio_LibraryReadGate( char ** ppToken, int fExtendedFormat ); +static Mio_Pin_t * Mio_LibraryReadPin( char ** ppToken, int fExtendedFormat ); static char * chomp( char *s ); static void Mio_LibraryDetectSpecialGates( Mio_Library_t * pLib ); static void Io_ReadFileRemoveComments( char * pBuffer, int * pnDots, int * pnLines ); @@ -63,13 +66,13 @@ Mio_Library_t * Mio_LibraryRead( void * pAbc, char * FileName, char * ExcludeFil return 0; } - fprintf ( Abc_FrameReadOut( pAbc ), "Read %d gates from exclude file\n", num ); + fprintf ( Abc_FrameReadOut( (Abc_Frame_t *)pAbc ), "Read %d gates from exclude file\n", num ); } - pLib = Mio_LibraryReadOne( pAbc, FileName, 0, tExcludeGate, fVerbose ); // try normal format first .. + pLib = Mio_LibraryReadOne( (Abc_Frame_t *)pAbc, FileName, 0, tExcludeGate, fVerbose ); // try normal format first .. if ( pLib == NULL ) { - pLib = Mio_LibraryReadOne( pAbc, FileName, 1, tExcludeGate, fVerbose ); // .. otherwise try extended format + pLib = Mio_LibraryReadOne( (Abc_Frame_t *)pAbc, FileName, 1, tExcludeGate, fVerbose ); // .. otherwise try extended format if ( pLib != NULL ) printf ( "Warning: Read extended GENLIB format but ignoring extensions\n" ); } @@ -88,7 +91,7 @@ Mio_Library_t * Mio_LibraryRead( void * pAbc, char * FileName, char * ExcludeFil SeeAlso [] ***********************************************************************/ -Mio_Library_t * Mio_LibraryReadOne( Abc_Frame_t * pAbc, char * FileName, bool fExtendedFormat, st_table * tExcludeGate, int fVerbose ) +Mio_Library_t * Mio_LibraryReadOne( Abc_Frame_t * pAbc, char * FileName, int fExtendedFormat, st_table * tExcludeGate, int fVerbose ) { Mio_Library_t * pLib; char * pBuffer = 0; @@ -167,7 +170,7 @@ Mio_Library_t * Mio_LibraryReadOne( Abc_Frame_t * pAbc, char * FileName, bool fE SeeAlso [] ***********************************************************************/ -int Mio_LibraryReadInternal( Mio_Library_t * pLib, char * pBuffer, bool fExtendedFormat, st_table * tExcludeGate, int fVerbose ) +int Mio_LibraryReadInternal( Mio_Library_t * pLib, char * pBuffer, int fExtendedFormat, st_table * tExcludeGate, int fVerbose ) { Mio_Gate_t * pGate, ** ppGate; char * pToken; @@ -236,7 +239,7 @@ int Mio_LibraryReadInternal( Mio_Library_t * pLib, char * pBuffer, bool fExtende SeeAlso [] ***********************************************************************/ -Mio_Gate_t * Mio_LibraryReadGate( char ** ppToken, bool fExtendedFormat ) +Mio_Gate_t * Mio_LibraryReadGate( char ** ppToken, int fExtendedFormat ) { Mio_Gate_t * pGate; Mio_Pin_t * pPin, ** ppPin; @@ -305,7 +308,7 @@ Mio_Gate_t * Mio_LibraryReadGate( char ** ppToken, bool fExtendedFormat ) SeeAlso [] ***********************************************************************/ -Mio_Pin_t * Mio_LibraryReadPin( char ** ppToken, bool fExtendedFormat ) +Mio_Pin_t * Mio_LibraryReadPin( char ** ppToken, int fExtendedFormat ) { Mio_Pin_t * pPin; char * pToken = *ppToken; @@ -584,7 +587,7 @@ int Mio_LibraryReadExclude( void * pAbc, char * ExcludeFile, st_table * tExclude if ( pEx == NULL ) { - fprintf ( Abc_FrameReadErr( pAbc ), "Error: Could not open exclude file %s. Stop.\n", ExcludeFile ); + fprintf ( Abc_FrameReadErr( (Abc_Frame_t *)pAbc ), "Error: Could not open exclude file %s. Stop.\n", ExcludeFile ); return -1; } @@ -664,3 +667,5 @@ void Io_ReadFileRemoveComments( char * pBuffer, int * pnDots, int * pnLines ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mio/mioUtils.c b/src/map/mio/mioUtils.c index 376a0bed..0e8cbb03 100644 --- a/src/map/mio/mioUtils.c +++ b/src/map/mio/mioUtils.c @@ -18,6 +18,9 @@ #include "mioInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -220,7 +223,7 @@ void Mio_WritePin( FILE * pFile, Mio_Pin_t * pPin ) SeeAlso [] ***********************************************************************/ -Mio_Gate_t ** Mio_CollectRoots( Mio_Library_t * pLib, int nInputs, float tDelay, bool fSkipInv, int * pnGates ) +Mio_Gate_t ** Mio_CollectRoots( Mio_Library_t * pLib, int nInputs, float tDelay, int fSkipInv, int * pnGates ) { Mio_Gate_t * pGate; Mio_Gate_t ** ppGates; @@ -534,3 +537,5 @@ Mio_Gate_t * Mio_GateCreatePseudo( int nInputs ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + -- cgit v1.2.3