diff options
Diffstat (limited to 'src/map')
89 files changed, 1249 insertions, 340 deletions
diff --git a/src/map/amap/amap.h b/src/map/amap/amap.h index 284af309..de7fcc18 100644 --- a/src/map/amap/amap.h +++ b/src/map/amap/amap.h @@ -21,6 +21,7 @@ #ifndef __AMAP_H__ #define __AMAP_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -29,14 +30,16 @@ /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -extern "C" { -#endif + + +ABC_NAMESPACE_HEADER_START + //////////////////////////////////////////////////////////////////////// /// BASIC TYPES /// //////////////////////////////////////////////////////////////////////// +typedef struct Amap_Lib_t_ Amap_Lib_t; typedef struct Amap_Par_t_ Amap_Par_t; struct Amap_Par_t_ @@ -45,7 +48,7 @@ struct Amap_Par_t_ int nIterArea; // iteratoins of exact area int fUseMuxes; // enables the use of MUXes int fUseXors; // enables the use of XORs - int fFreeInvs; // assume inverters are ABC_FREE (area = 0) + int fFreeInvs; // assume inverters are free (area = 0) float fEpsilon; // used to compare floating point numbers int fVerbose; // verbosity flag }; @@ -68,15 +71,19 @@ struct Amap_Out_t_ //////////////////////////////////////////////////////////////////////// /*=== amapCore.c ==========================================================*/ -extern void Amap_ManSetDefaultParams( Amap_Par_t * pPars ); +extern void Amap_ManSetDefaultParams( Amap_Par_t * pPars ); //extern Vec_Ptr_t * Amap_ManTest( Aig_Man_t * pAig, Amap_Par_t * pPars ); +/*=== amapLib.c ==========================================================*/ +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, char * pFileGenlib, int fVerbose ); + + +ABC_NAMESPACE_HEADER_END -#ifdef __cplusplus -} -#endif #endif diff --git a/src/map/amap/amapCore.c b/src/map/amap/amapCore.c index 7dedc067..4f2d2310 100644 --- a/src/map/amap/amapCore.c +++ b/src/map/amap/amapCore.c @@ -19,6 +19,10 @@ ***********************************************************************/ #include "amapInt.h" +#include "main.h" + +ABC_NAMESPACE_IMPL_START + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// @@ -46,7 +50,7 @@ void Amap_ManSetDefaultParams( Amap_Par_t * p ) p->nIterArea = 4; // iteratoins of exact area p->fUseMuxes = 0; // enables the use of MUXes p->fUseXors = 1; // enables the use of XORs - p->fFreeInvs = 0; // assume inverters are ABC_FREE (area = 0) + p->fFreeInvs = 0; // assume inverters are free (area = 0) p->fEpsilon = (float)0.001; // used to compare floating point numbers p->fVerbose = 0; // verbosity flag } @@ -64,12 +68,12 @@ void Amap_ManSetDefaultParams( Amap_Par_t * p ) ***********************************************************************/ Vec_Ptr_t * Amap_ManTest( Aig_Man_t * pAig, Amap_Par_t * pPars ) { - extern void * Abc_FrameReadLibGen2(); +// extern void * Abc_FrameReadLibGen2(); Vec_Ptr_t * vRes; Amap_Man_t * p; Amap_Lib_t * pLib; int clkTotal = clock(); - pLib = Abc_FrameReadLibGen2(); + pLib = (Amap_Lib_t *)Abc_FrameReadLibGen2(); if ( pLib == NULL ) { printf( "Library is not available.\n" ); @@ -101,3 +105,5 @@ ABC_PRT( "Total runtime", clock() - clkTotal ); //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/amap/amapGraph.c b/src/map/amap/amapGraph.c index 6f269301..bc0878d1 100644 --- a/src/map/amap/amapGraph.c +++ b/src/map/amap/amapGraph.c @@ -20,6 +20,9 @@ #include "amapInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -341,7 +344,7 @@ void Amap_ManCreate( Amap_Man_t * p, Aig_Man_t * pAig ) Aig_ManForEachPi( pAig, pObj, i ) pObj->pData = Amap_ManCreatePi( p ); // load the AIG into the mapper - Vec_PtrForEachEntry( vNodes, pObj, i ) + Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i ) { fChoices = 0; if ( p->fUseXor && Aig_ObjRecognizeExor(pObj, &pFan0, &pFan1 ) ) @@ -392,3 +395,5 @@ void Amap_ManCreate( Amap_Man_t * p, Aig_Man_t * pAig ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/amap/amapInt.h b/src/map/amap/amapInt.h index d6d5d68b..92e77e10 100644 --- a/src/map/amap/amapInt.h +++ b/src/map/amap/amapInt.h @@ -21,6 +21,7 @@ #ifndef __AMAP_INT_H__ #define __AMAP_INT_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -32,9 +33,10 @@ /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -extern "C" { -#endif + + +ABC_NAMESPACE_HEADER_START + // the largest gate size in the library // (gates above this size will be ignored) @@ -59,7 +61,6 @@ typedef enum { /// BASIC TYPES /// //////////////////////////////////////////////////////////////////////// -typedef struct Amap_Lib_t_ Amap_Lib_t; typedef struct Amap_Pin_t_ Amap_Pin_t; typedef struct Amap_Gat_t_ Amap_Gat_t; typedef struct Amap_Nod_t_ Amap_Nod_t; @@ -264,7 +265,7 @@ static inline void Amap_ObjSetChoice( Amap_Obj_t * pObj, Amap_Obj_t * pE static inline int Amap_ObjPhaseReal( Amap_Obj_t * pObj ) { return Amap_Regular(pObj)->fPhase ^ Amap_IsComplement(pObj); } static inline int Amap_ObjRefsTotal( Amap_Obj_t * pObj ) { return pObj->nFouts[0] + pObj->nFouts[1]; } -static inline Amap_Gat_t * Amap_LibGate( Amap_Lib_t * p, int i ) { return Vec_PtrEntry(p->vGates, i); } +static inline Amap_Gat_t * Amap_LibGate( Amap_Lib_t * p, int i ) { return (Amap_Gat_t *)Vec_PtrEntry(p->vGates, i); } static inline Amap_Nod_t * Amap_LibNod( Amap_Lib_t * p, int i ) { return p->pNodes + i; } // returns pointer to the next cut (internal cuts only) @@ -282,20 +283,20 @@ extern void Kit_DsdPrintFromTruth( unsigned * pTruth, int nVars ); // iterator over the primary inputs #define Amap_ManForEachPi( p, pObj, i ) \ - Vec_PtrForEachEntry( p->vPis, pObj, i ) + Vec_PtrForEachEntry( Amap_Obj_t *, p->vPis, pObj, i ) // iterator over the primary outputs #define Amap_ManForEachPo( p, pObj, i ) \ - Vec_PtrForEachEntry( p->vPos, pObj, i ) + Vec_PtrForEachEntry( Amap_Obj_t *, p->vPos, pObj, i ) // iterator over all objects, including those currently not used #define Amap_ManForEachObj( p, pObj, i ) \ - Vec_PtrForEachEntry( p->vObjs, pObj, i ) if ( (pObj) == NULL ) {} else + Vec_PtrForEachEntry( Amap_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL ) {} else // iterator over all nodes #define Amap_ManForEachNode( p, pObj, i ) \ - Vec_PtrForEachEntry( p->vObjs, pObj, i ) if ( (pObj) == NULL || !Amap_ObjIsNode(pObj) ) {} else + Vec_PtrForEachEntry( Amap_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL || !Amap_ObjIsNode(pObj) ) {} else // iterator through all gates of the library #define Amap_LibForEachGate( pLib, pGate, i ) \ - Vec_PtrForEachEntry( pLib->vGates, pGate, i ) + Vec_PtrForEachEntry( Amap_Gat_t *, pLib->vGates, pGate, i ) // iterator through all pins of the gate #define Amap_GateForEachPin( pGate, pPin ) \ for ( pPin = pGate->Pins; pPin < pGate->Pins + pGate->nPins; pPin++ ) @@ -337,12 +338,9 @@ extern void Amap_ManCreateChoice( Amap_Man_t * p, Amap_Obj_t * pObj ); extern void Amap_ManCreate( Amap_Man_t * p, Aig_Man_t * pAig ); /*=== amapLib.c ==========================================================*/ extern Amap_Lib_t * Amap_LibAlloc(); -extern void Amap_LibFree( Amap_Lib_t * p ); extern int Amap_LibNumPinsMax( Amap_Lib_t * p ); extern void Amap_LibWrite( FILE * pFile, Amap_Lib_t * pLib, int fPrintDsd ); extern Vec_Ptr_t * Amap_LibSelectGates( Amap_Lib_t * p, int fVerbose ); -extern void Amap_LibPrintSelectedGates( Amap_Lib_t * p, int fAllGates ); -extern Amap_Lib_t * Amap_LibReadAndPrepare( char * pFileName, int fVerbose, int fVeryVerbose ); /*=== amapMan.c ==========================================================*/ extern Amap_Man_t * Amap_ManStart( int nNodes ); extern void Amap_ManStop( Amap_Man_t * p ); @@ -368,9 +366,11 @@ extern int Amap_LibCreateNode( Amap_Lib_t * p, int iFan0, int iFan1, i extern int Amap_LibCreateMux( Amap_Lib_t * p, int iFan0, int iFan1, int iFan2 ); extern int ** Amap_LibLookupTableAlloc( Vec_Ptr_t * vVec, int fVerbose ); -#ifdef __cplusplus -} -#endif + + +ABC_NAMESPACE_HEADER_END + + #endif diff --git a/src/map/amap/amapLib.c b/src/map/amap/amapLib.c index f2e5113f..474b444d 100644 --- a/src/map/amap/amapLib.c +++ b/src/map/amap/amapLib.c @@ -20,6 +20,9 @@ #include "amapInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -237,7 +240,7 @@ Amap_Gat_t * Amap_LibFindGate( Amap_Lib_t * p, unsigned uTruth ) { Amap_Gat_t * pGate; int i; - Vec_PtrForEachEntry( p->vSorted, pGate, i ) + Vec_PtrForEachEntry( Amap_Gat_t *, p->vSorted, pGate, i ) if ( pGate->nPins <= 5 && pGate->pFunc[0] == uTruth ) return pGate; return NULL; @@ -264,11 +267,11 @@ Vec_Ptr_t * Amap_LibSelectGates( Amap_Lib_t * p, int fVerbose ) p->pGateBuf = Amap_LibFindGate( p, 0xAAAAAAAA ); p->pGateInv = Amap_LibFindGate( p, ~0xAAAAAAAA ); vSelect = Vec_PtrAlloc( 100 ); - Vec_PtrForEachEntry( p->vSorted, pGate, i ) + Vec_PtrForEachEntry( Amap_Gat_t *, p->vSorted, pGate, i ) { if ( pGate->pFunc == NULL ) continue; - Vec_PtrForEachEntryStop( p->vSorted, pGate2, k, i ) + Vec_PtrForEachEntryStop( Amap_Gat_t *, p->vSorted, pGate2, k, i ) { if ( pGate2->pFunc == NULL ) continue; @@ -301,7 +304,7 @@ void Amap_LibPrintSelectedGates( Amap_Lib_t * p, int fAllGates ) Amap_Gat_t * pGate; int i; vArray = fAllGates? p->vGates : p->vSelect; - Vec_PtrForEachEntry( vArray, pGate, i ) + Vec_PtrForEachEntry( Amap_Gat_t *, vArray, pGate, i ) { printf( "Gate %4d : %15s Area = %9.2f\n", pGate->Id, pGate->pName, pGate->dArea ); printf( " Formula: %s=%s\n", pGate->pOutName, pGate->pForm ); @@ -359,3 +362,5 @@ Amap_Lib_t * Amap_LibReadAndPrepare( char * pFileName, int fVerbose, int fVeryVe //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/amap/amapLiberty.c b/src/map/amap/amapLiberty.c index 4177e27e..cf74a612 100644 --- a/src/map/amap/amapLiberty.c +++ b/src/map/amap/amapLiberty.c @@ -20,6 +20,9 @@ #include "amapInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -920,3 +923,5 @@ int Amap_LibertyParse( char * pFileName, char * pFileGenlib, int fVerbose ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/amap/amapMan.c b/src/map/amap/amapMan.c index a1a66869..6304c078 100644 --- a/src/map/amap/amapMan.c +++ b/src/map/amap/amapMan.c @@ -20,6 +20,9 @@ #include "amapInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -97,3 +100,5 @@ void Amap_ManStop( Amap_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/amap/amapMatch.c b/src/map/amap/amapMatch.c index a997ad48..ca513e61 100644 --- a/src/map/amap/amapMatch.c +++ b/src/map/amap/amapMatch.c @@ -20,6 +20,9 @@ #include "amapInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -536,3 +539,5 @@ void Amap_ManMap( Amap_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/amap/amapMerge.c b/src/map/amap/amapMerge.c index 23d8384b..ecf11b07 100644 --- a/src/map/amap/amapMerge.c +++ b/src/map/amap/amapMerge.c @@ -20,6 +20,9 @@ #include "amapInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -394,9 +397,9 @@ void Amap_ManMergeNodeCutsMux( Amap_Man_t * p, Amap_Obj_t * pNode ) continue; if ( Amap_ManFindCut( pNode, pFanin2, fComplFanin2, Vec_IntEntry(vRules, x+2), p->vCuts2 ) ) continue; - Vec_PtrForEachEntry( p->vCuts0, pCut0, c0 ) - Vec_PtrForEachEntry( p->vCuts1, pCut1, c1 ) - Vec_PtrForEachEntry( p->vCuts2, pCut2, c2 ) + Vec_PtrForEachEntry( Amap_Cut_t *, p->vCuts0, pCut0, c0 ) + Vec_PtrForEachEntry( Amap_Cut_t *, p->vCuts1, pCut1, c1 ) + Vec_PtrForEachEntry( Amap_Cut_t *, p->vCuts2, pCut2, c2 ) { Amap_Nod_t * pNod = Amap_LibNod( p->pLib, Vec_IntEntry(vRules, x+3) ); if ( pNod->pSets == NULL ) @@ -533,3 +536,5 @@ ABC_PRT( "Time ", clock() - clk ); //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/amap/amapOutput.c b/src/map/amap/amapOutput.c index 1decc52e..d590b7b9 100644 --- a/src/map/amap/amapOutput.c +++ b/src/map/amap/amapOutput.c @@ -20,6 +20,9 @@ #include "amapInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -179,3 +182,5 @@ Vec_Ptr_t * Amap_ManProduceMapped( Amap_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/amap/amapParse.c b/src/map/amap/amapParse.c index bfa8e6a5..dd6137c9 100644 --- a/src/map/amap/amapParse.c +++ b/src/map/amap/amapParse.c @@ -20,6 +20,10 @@ #include "amapInt.h" #include "hop.h" +#include "kit.h" + +ABC_NAMESPACE_IMPL_START + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// @@ -69,8 +73,8 @@ Hop_Obj_t * Amap_ParseFormulaOper( Hop_Man_t * pMan, Vec_Ptr_t * pStackFn, int O { Hop_Obj_t * gArg1, * gArg2, * gFunc; // perform the given operation - gArg2 = Vec_PtrPop( pStackFn ); - gArg1 = Vec_PtrPop( pStackFn ); + gArg2 = (Hop_Obj_t *)Vec_PtrPop( pStackFn ); + gArg1 = (Hop_Obj_t *)Vec_PtrPop( pStackFn ); if ( Oper == AMAP_EQN_OPER_AND ) gFunc = Hop_And( pMan, gArg1, gArg2 ); else if ( Oper == AMAP_EQN_OPER_OR ) @@ -177,7 +181,7 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa break; } else // if ( Flag == PARSE_FLAG_VAR ) - Vec_PtrPush( pStackFn, Hop_Not( Vec_PtrPop(pStackFn) ) ); + Vec_PtrPush( pStackFn, Hop_Not( (Hop_Obj_t *)Vec_PtrPop(pStackFn) ) ); break; case AMAP_EQN_SYM_AND: case AMAP_EQN_SYM_OR: @@ -261,7 +265,7 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa } // variable name is found fFound = 0; - Vec_PtrForEachEntry( vVarNames, pName, v ) + Vec_PtrForEachEntry( char *, vVarNames, pName, v ) if ( strncmp(pTemp, pName, i) == 0 && strlen(pName) == (unsigned)i ) { pTemp += i-1; @@ -307,7 +311,7 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa } else { - Vec_PtrPush( pStackFn, Hop_Not(Vec_PtrPop(pStackFn)) ); + Vec_PtrPush( pStackFn, Hop_Not((Hop_Obj_t *)Vec_PtrPop(pStackFn)) ); } } else // if ( Flag == AMAP_EQN_FLAG_OPER ) @@ -344,7 +348,7 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa { if ( Vec_PtrSize(pStackFn) != 0 ) { - gFunc = Vec_PtrPop(pStackFn); + gFunc = (Hop_Obj_t *)Vec_PtrPop(pStackFn); if ( Vec_PtrSize(pStackFn) == 0 ) if ( Vec_IntSize( pStackOp ) == 0 ) { @@ -379,7 +383,7 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa ***********************************************************************/ int Amap_LibParseEquations( Amap_Lib_t * p, int fVerbose ) { - extern int Kit_TruthSupportSize( unsigned * pTruth, int nVars ); +// extern int Kit_TruthSupportSize( unsigned * pTruth, int nVars ); Hop_Man_t * pMan; Hop_Obj_t * pObj; Vec_Ptr_t * vNames; @@ -395,7 +399,7 @@ int Amap_LibParseEquations( Amap_Lib_t * p, int fVerbose ) vNames = Vec_PtrAlloc( 100 ); pMan = Hop_ManStart(); Hop_IthVar( pMan, nPinMax - 1 ); - Vec_PtrForEachEntry( p->vGates, pGate, i ) + Vec_PtrForEachEntry( Amap_Gat_t *, p->vGates, pGate, i ) { if ( pGate->nPins == 0 ) { @@ -463,3 +467,5 @@ void Amap_LibParseTest( char * pFileName ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/amap/amapPerm.c b/src/map/amap/amapPerm.c index 17fb57e2..71d4749a 100644 --- a/src/map/amap/amapPerm.c +++ b/src/map/amap/amapPerm.c @@ -21,6 +21,9 @@ #include "amapInt.h" #include "kit.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -210,7 +213,7 @@ unsigned * Amap_LibVerifyPerm_rec( Amap_Lib_t * pLib, Amap_Nod_t * pNod, int i; assert( pNod->Type != AMAP_OBJ_MUX ); if ( pNod->Id == 0 ) - return Vec_PtrEntry( vTtElems, (*piInput)++ ); + return (unsigned *)Vec_PtrEntry( vTtElems, (*piInput)++ ); pFan0 = Amap_LibNod( pLib, Amap_Lit2Var(pNod->iFan0) ); pTruth0 = Amap_LibVerifyPerm_rec( pLib, pFan0, vTtElems, vTruth, nWords, piInput ); pFan1 = Amap_LibNod( pLib, Amap_Lit2Var(pNod->iFan1) ); @@ -262,7 +265,7 @@ void Amap_LibVerifyPerm( Amap_Lib_t * pLib, Amap_Gat_t * pGate, Kit_DsdNtk_t * p vTtElemsPol = Vec_PtrAlloc( pGate->nPins ); for ( i = 0; i < (int)pGate->nPins; i++ ) { - pTruth = Vec_PtrEntry( vTtElems, Amap_Lit2Var(pArray[i]) ); + pTruth = (unsigned *)Vec_PtrEntry( vTtElems, Amap_Lit2Var(pArray[i]) ); if ( Amap_LitIsCompl( pArray[i] ) ) Kit_TruthNot( pTruth, pTruth, pGate->nPins ); Vec_PtrPush( vTtElemsPol, pTruth ); @@ -342,3 +345,5 @@ int Amap_LibDeriveGatePerm( Amap_Lib_t * pLib, Amap_Gat_t * pGate, Kit_DsdNtk_t //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/amap/amapRead.c b/src/map/amap/amapRead.c index 7ebc239b..ec169773 100644 --- a/src/map/amap/amapRead.c +++ b/src/map/amap/amapRead.c @@ -19,6 +19,10 @@ ***********************************************************************/ #include "amapInt.h" +#include "ioAbc.h" + +ABC_NAMESPACE_IMPL_START + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// @@ -68,7 +72,7 @@ static inline char * Amap_ParseStrsav( Aig_MmFlex_t * p, char * pStr ) ***********************************************************************/ char * Amap_LoadFile( char * pFileName ) { - extern FILE * Io_FileOpen( const char * FileName, const char * PathVar, const char * Mode, int fVerbose ); +// extern FILE * Io_FileOpen( const char * FileName, const char * PathVar, const char * Mode, int fVerbose ); FILE * pFile; char * pBuffer; int nFileSize; @@ -197,7 +201,7 @@ int Amap_ParseCountPins( Vec_Ptr_t * vTokens, int iPos ) { char * pToken; int i, Counter = 0; - Vec_PtrForEachEntryStart( vTokens, pToken, i, iPos ) + Vec_PtrForEachEntryStart( char *, vTokens, pToken, i, iPos ) if ( !strcmp( pToken, AMAP_STRING_PIN ) ) Counter++; else if ( !strcmp( pToken, AMAP_STRING_GATE ) ) @@ -295,7 +299,7 @@ int Amap_CollectFormulaTokens( Vec_Ptr_t * vTokens, char * pToken, int iPos ) while ( *(pPrev-1) != ';' ) { *pPrev++ = ' '; - pNext = Vec_PtrEntry(vTokens, iPos++); + pNext = (char *)Vec_PtrEntry(vTokens, iPos++); while ( *pNext ) *pPrev++ = *pNext++; } @@ -322,7 +326,7 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose ) char * pToken; int nPins, iPos = 0; p = Amap_LibAlloc(); - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); do { if ( strcmp( pToken, AMAP_STRING_GATE ) ) @@ -339,28 +343,28 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose ) pGate->pLib = p; pGate->nPins = nPins; // read gate - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); pGate->pName = Amap_ParseStrsav( p->pMemGates, pToken ); - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); pGate->dArea = atof( pToken ); - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); pGate->pOutName = Amap_ParseStrsav( p->pMemGates, pToken ); - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); iPos = Amap_CollectFormulaTokens( vTokens, pToken, iPos ); pGate->pForm = Amap_ParseStrsav( p->pMemGates, pToken ); // read pins Amap_GateForEachPin( pGate, pPin ) { - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); if ( strcmp( pToken, AMAP_STRING_PIN ) ) { printf( "Cannot parse gate %s.\n", pGate->pName ); return NULL; } // read pin - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); pPin->pName = Amap_ParseStrsav( p->pMemGates, pToken ); - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); if ( strcmp( pToken, AMAP_STRING_UNKNOWN ) == 0 ) pPin->Phase = AMAP_PHASE_UNKNOWN; else if ( strcmp( pToken, AMAP_STRING_INV ) == 0 ) @@ -372,17 +376,17 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose ) printf( "Cannot read phase of pin %s of gate %s\n", pPin->pName, pGate->pName ); return NULL; } - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); pPin->dLoadInput = atof( pToken ); - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); pPin->dLoadMax = atof( pToken ); - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); pPin->dDelayBlockRise = atof( pToken ); - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); pPin->dDelayFanoutRise = atof( pToken ); - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); pPin->dDelayBlockFall = atof( pToken ); - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); pPin->dDelayFanoutFall = atof( pToken ); if ( pPin->dDelayBlockRise > pPin->dDelayBlockFall ) pPin->dDelayBlockMax = pPin->dDelayBlockRise; @@ -396,7 +400,7 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose ) Vec_PtrPop( p->vGates ); Vec_PtrPush( p->vGates, pGate ); } - pToken = Vec_PtrEntry(vTokens, iPos++); + pToken = (char *)Vec_PtrEntry(vTokens, iPos++); } while ( strcmp( pToken, ".end" ) ); return p; @@ -437,3 +441,5 @@ Amap_Lib_t * Amap_LibReadFile( char * pFileName, int fVerbose ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/amap/amapRule.c b/src/map/amap/amapRule.c index 27de49ee..8308a197 100644 --- a/src/map/amap/amapRule.c +++ b/src/map/amap/amapRule.c @@ -21,6 +21,9 @@ #include "amapInt.h" #include "kit.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -100,7 +103,7 @@ int Amap_CreateCheckAllZero( Vec_Ptr_t * vVecNods ) { Vec_Int_t * vNods; int i; - Vec_PtrForEachEntryReverse( vVecNods, vNods, i ) + Vec_PtrForEachEntryReverse( Vec_Int_t *, vVecNods, vNods, i ) if ( Vec_IntSize(vNods) != 1 || Vec_IntEntry(vNods,0) != 0 ) return 0; return 1; @@ -123,7 +126,7 @@ Vec_Int_t * Amap_CreateRulesVector_rec( Amap_Lib_t * p, Vec_Ptr_t * vVecNods, in Vec_Int_t * vRes, * vNods, * vNods0, * vNods1; int i, k; if ( Vec_PtrSize(vVecNods) == 1 ) - return Vec_IntDup( Vec_PtrEntry(vVecNods, 0) ); + return Vec_IntDup( (Vec_Int_t *)Vec_PtrEntry(vVecNods, 0) ); vRes = Vec_IntAlloc( 10 ); vVecNods0 = Vec_PtrAlloc( Vec_PtrSize(vVecNods) ); vVecNods1 = Vec_PtrAlloc( Vec_PtrSize(vVecNods) ); @@ -133,9 +136,9 @@ Vec_Int_t * Amap_CreateRulesVector_rec( Amap_Lib_t * p, Vec_Ptr_t * vVecNods, in { Vec_PtrClear( vVecNods0 ); Vec_PtrClear( vVecNods1 ); - Vec_PtrForEachEntryStop( vVecNods, vNods, k, i ) + Vec_PtrForEachEntryStop( Vec_Int_t *, vVecNods, vNods, k, i ) Vec_PtrPush( vVecNods0, vNods ); - Vec_PtrForEachEntryStart( vVecNods, vNods, k, i ) + Vec_PtrForEachEntryStart( Vec_Int_t *, vVecNods, vNods, k, i ) Vec_PtrPush( vVecNods1, vNods ); vNods0 = Amap_CreateRulesVector_rec( p, vVecNods0, fXor ); vNods1 = Amap_CreateRulesVector_rec( p, vVecNods1, fXor ); @@ -151,7 +154,7 @@ Vec_Int_t * Amap_CreateRulesVector_rec( Amap_Lib_t * p, Vec_Ptr_t * vVecNods, in { Vec_PtrClear( vVecNods0 ); Vec_PtrClear( vVecNods1 ); - Vec_PtrForEachEntryReverse( vVecNods, vNods, k ) + Vec_PtrForEachEntryReverse( Vec_Int_t *, vVecNods, vNods, k ) { if ( i & (1 << k) ) Vec_PtrPush( vVecNods1, vNods ); @@ -218,11 +221,11 @@ Vec_Int_t * Amap_CreateRulesFromDsd_rec( Amap_Lib_t * pLib, Kit_DsdNtk_t * p, in { assert( pObj->nFans == 3 ); assert( Kit_DsdObjTruth(pObj)[0] == 0xCACACACA ); - vRes = Amap_CreateRulesPrime( pLib, Vec_PtrEntry(vVecNods, 0), - Vec_PtrEntry(vVecNods, 1), Vec_PtrEntry(vVecNods, 2) ); + vRes = Amap_CreateRulesPrime( pLib, (Vec_Int_t *)Vec_PtrEntry(vVecNods, 0), + (Vec_Int_t *)Vec_PtrEntry(vVecNods, 1), (Vec_Int_t *)Vec_PtrEntry(vVecNods, 2) ); } else assert( 0 ); - Vec_PtrForEachEntry( vVecNods, vNodsFanin, k ) + Vec_PtrForEachEntry( Vec_Int_t *, vVecNods, vNodsFanin, k ) Vec_IntFree( vNodsFanin ); Vec_PtrFree( vVecNods ); return vRes; @@ -341,7 +344,7 @@ void Amap_LibCreateRules( Amap_Lib_t * pLib, int fVeryVerbose ) pLib->vRulesX = Vec_PtrAlloc( 100 ); pLib->vRules3 = Vec_IntAlloc( 100 ); Amap_LibCreateVar( pLib ); - Vec_PtrForEachEntry( pLib->vSelect, pGate, i ) + Vec_PtrForEachEntry( Amap_Gat_t *, pLib->vSelect, pGate, i ) { if ( pGate->nPins < 2 ) continue; @@ -366,3 +369,5 @@ void Amap_LibCreateRules( Amap_Lib_t * pLib, int fVeryVerbose ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/amap/amapUniq.c b/src/map/amap/amapUniq.c index e57161e4..a2375389 100644 --- a/src/map/amap/amapUniq.c +++ b/src/map/amap/amapUniq.c @@ -20,6 +20,9 @@ #include "amapInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -87,9 +90,9 @@ static inline void Vec_IntPushOrderWithMask( Vec_Int_t * p, int Entry ) int Amap_LibFindNode( Amap_Lib_t * pLib, int iFan0, int iFan1, int fXor ) { if ( fXor ) - return Vec_IntCheckWithMask( Vec_PtrEntry(pLib->vRulesX, iFan0), iFan1 ); + return Vec_IntCheckWithMask( (Vec_Int_t *)Vec_PtrEntry(pLib->vRulesX, iFan0), iFan1 ); else - return Vec_IntCheckWithMask( Vec_PtrEntry(pLib->vRules, iFan0), iFan1 ); + return Vec_IntCheckWithMask( (Vec_Int_t *)Vec_PtrEntry(pLib->vRules, iFan0), iFan1 ); } /**Function************************************************************* @@ -207,21 +210,21 @@ Amap_Lit2Var(iFan1), (Amap_LitIsCompl(iFan1)?'-':'+') ); if ( fXor ) { if ( iFan0 == iFan1 ) - Vec_IntPushOrderWithMask( Vec_PtrEntry(p->vRulesX, iFan0), (pNode->Id << 16) | iFan1 ); + Vec_IntPushOrderWithMask( (Vec_Int_t *)Vec_PtrEntry(p->vRulesX, iFan0), (pNode->Id << 16) | iFan1 ); else { - Vec_IntPushOrderWithMask( Vec_PtrEntry(p->vRulesX, iFan0), (pNode->Id << 16) | iFan1 ); - Vec_IntPushOrderWithMask( Vec_PtrEntry(p->vRulesX, iFan1), (pNode->Id << 16) | iFan0 ); + Vec_IntPushOrderWithMask( (Vec_Int_t *)Vec_PtrEntry(p->vRulesX, iFan0), (pNode->Id << 16) | iFan1 ); + Vec_IntPushOrderWithMask( (Vec_Int_t *)Vec_PtrEntry(p->vRulesX, iFan1), (pNode->Id << 16) | iFan0 ); } } else { if ( iFan0 == iFan1 ) - Vec_IntPushOrderWithMask( Vec_PtrEntry(p->vRules, iFan0), (pNode->Id << 16) | iFan1 ); + Vec_IntPushOrderWithMask( (Vec_Int_t *)Vec_PtrEntry(p->vRules, iFan0), (pNode->Id << 16) | iFan1 ); else { - Vec_IntPushOrderWithMask( Vec_PtrEntry(p->vRules, iFan0), (pNode->Id << 16) | iFan1 ); - Vec_IntPushOrderWithMask( Vec_PtrEntry(p->vRules, iFan1), (pNode->Id << 16) | iFan0 ); + Vec_IntPushOrderWithMask( (Vec_Int_t *)Vec_PtrEntry(p->vRules, iFan0), (pNode->Id << 16) | iFan1 ); + Vec_IntPushOrderWithMask( (Vec_Int_t *)Vec_PtrEntry(p->vRules, iFan1), (pNode->Id << 16) | iFan0 ); } } return pNode->Id; @@ -279,13 +282,13 @@ int ** Amap_LibLookupTableAlloc( Vec_Ptr_t * vVec, int fVerbose ) int i, k, nTotal, nSize, nEntries, Value; // count the total size nEntries = nSize = Vec_PtrSize( vVec ); - Vec_PtrForEachEntry( vVec, vOne, i ) + Vec_PtrForEachEntry( Vec_Int_t *, vVec, vOne, i ) nEntries += Vec_IntSize(vOne); pBuffer = ABC_ALLOC( int, nSize * sizeof(void *) + nEntries ); pRes = (int **)pBuffer; pRes[0] = pBuffer + nSize * sizeof(void *); nTotal = 0; - Vec_PtrForEachEntry( vVec, vOne, i ) + Vec_PtrForEachEntry( Vec_Int_t *, vVec, vOne, i ) { pRes[i] = pRes[0] + nTotal; nTotal += Vec_IntSize(vOne) + 1; @@ -310,3 +313,5 @@ int ** Amap_LibLookupTableAlloc( Vec_Ptr_t * vVec, int fVerbose ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/cov/cov.h b/src/map/cov/cov.h index 8ca81740..f8136a7f 100644 --- a/src/map/cov/cov.h +++ b/src/map/cov/cov.h @@ -21,13 +21,12 @@ #ifndef __COV_H__ #define __COV_H__ -#ifdef __cplusplus -extern "C" { -#endif - #include "abc.h" #include "covInt.h" + +ABC_NAMESPACE_HEADER_START + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -69,7 +68,7 @@ struct Cov_Man_t_ int nNodes; // the number of nodes processed }; -static inline Cov_Obj_t * Abc_ObjGetStr( Abc_Obj_t * pObj ) { return Vec_PtrEntry(((Cov_Man_t *)pObj->pNtk->pManCut)->vObjStrs, pObj->Id); } +static inline Cov_Obj_t * Abc_ObjGetStr( Abc_Obj_t * pObj ) { return (Cov_Obj_t *)Vec_PtrEntry(((Cov_Man_t *)pObj->pNtk->pManCut)->vObjStrs, pObj->Id); } static inline void Abc_ObjSetSupp( Abc_Obj_t * pObj, Vec_Int_t * vVec ) { Abc_ObjGetStr(pObj)->vSupp = vVec; } static inline Vec_Int_t * Abc_ObjGetSupp( Abc_Obj_t * pObj ) { return Abc_ObjGetStr(pObj)->vSupp; } @@ -89,7 +88,7 @@ extern Abc_Ntk_t * Abc_NtkCovDerive( Cov_Man_t * p, Abc_Ntk_t * pNtk ); extern Abc_Ntk_t * Abc_NtkCovDeriveClean( Cov_Man_t * p, Abc_Ntk_t * pNtk ); extern Abc_Ntk_t * Abc_NtkCovDeriveRegular( Cov_Man_t * p, Abc_Ntk_t * pNtk ); /*=== covCore.c ===========================================================*/ -extern Abc_Ntk_t * Abc_NtkSopEsopCover( Abc_Ntk_t * pNtk, int nFaninMax, bool fUseEsop, bool fUseSop, bool fUseInvs, bool fVerbose ); +extern Abc_Ntk_t * Abc_NtkSopEsopCover( Abc_Ntk_t * pNtk, int nFaninMax, int fUseEsop, int fUseSop, int fUseInvs, int fVerbose ); /*=== covMan.c ============================================================*/ extern Cov_Man_t * Cov_ManAlloc( Abc_Ntk_t * pNtk, int nFaninMax ); extern void Cov_ManFree( Cov_Man_t * p ); @@ -97,9 +96,8 @@ extern void Abc_NodeCovDropData( Cov_Man_t * p, Abc_Obj_t * pObj ); /*=== covTest.c ===========================================================*/ extern Abc_Ntk_t * Abc_NtkCovTestSop( Abc_Ntk_t * pNtk ); -#ifdef __cplusplus -} -#endif + +ABC_NAMESPACE_HEADER_END #endif diff --git a/src/map/cov/covBuild.c b/src/map/cov/covBuild.c index 560178be..3975c91d 100644 --- a/src/map/cov/covBuild.c +++ b/src/map/cov/covBuild.c @@ -20,6 +20,9 @@ #include "cov.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -79,9 +82,9 @@ Abc_Obj_t * Abc_NtkCovDeriveCube( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj, Min_Cub Vec_IntWriteEntry( vLits, i, Lit==1 ); Abc_ObjAddFanin( pNodeNew, pFanin->pCopy ); } - pNodeNew->pData = Abc_SopCreateAnd( pNtkNew->pManFunc, vLits->nSize, vLits->pArray ); + pNodeNew->pData = Abc_SopCreateAnd( (Extra_MmFlex_t *)pNtkNew->pManFunc, vLits->nSize, vLits->pArray ); if ( fCompl ) - Abc_SopComplement( pNodeNew->pData ); + Abc_SopComplement( (char *)pNodeNew->pData ); Vec_IntFree( vLits ); return pNodeNew; } @@ -150,7 +153,7 @@ Abc_Obj_t * Abc_NtkCovDeriveNode_rec( Cov_Man_t * p, Abc_Ntk_t * pNtkNew, Abc_Ob pFaninNew = Abc_NtkCovDeriveCube( pNtkNew, pObj, pCube, vSupp, 0 ); Abc_ObjAddFanin( pNodeNew, pFaninNew ); } - pNodeNew->pData = Abc_SopCreateXorSpecial( pNtkNew->pManFunc, nCubes ); + pNodeNew->pData = Abc_SopCreateXorSpecial( (Extra_MmFlex_t *)pNtkNew->pManFunc, nCubes ); } /* printf( "Created node %d(%d) at level %d: ", pNodeNew->Id, pObj->Id, Level ); @@ -277,8 +280,8 @@ Abc_Obj_t * Abc_NtkCovDeriveCubeInv( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj, Min_ // Abc_ObjAddFanin( pNodeNew, pFanin->pCopy ); Abc_ObjAddFanin( pNodeNew, Abc_NtkCovDeriveInv( pNtkNew, pFanin, Lit==1 ) ); } -// pNodeNew->pData = Abc_SopCreateAnd( pNtkNew->pManFunc, vLits->nSize, vLits->pArray ); - pNodeNew->pData = Abc_SopCreateAnd( pNtkNew->pManFunc, vLits->nSize, NULL ); +// pNodeNew->pData = Abc_SopCreateAnd( (Extra_MmFlex_t *)pNtkNew->pManFunc, vLits->nSize, vLits->pArray ); + pNodeNew->pData = Abc_SopCreateAnd( (Extra_MmFlex_t *)pNtkNew->pManFunc, vLits->nSize, NULL ); Vec_IntFree( vLits ); return pNodeNew; } @@ -332,7 +335,7 @@ Abc_Obj_t * Abc_NtkCovDeriveNodeInv_rec( Cov_Man_t * p, Abc_Ntk_t * pNtkNew, Abc pFaninNew = Abc_NtkCovDeriveCubeInv( pNtkNew, pObj, pCube, vSupp ); Abc_ObjAddFanin( pNodeNew, pFaninNew ); } - pNodeNew->pData = Abc_SopCreateXorSpecial( pNtkNew->pManFunc, nCubes ); + pNodeNew->pData = Abc_SopCreateXorSpecial( (Extra_MmFlex_t *)pNtkNew->pManFunc, nCubes ); } pObj->pCopy = pNodeNew; @@ -469,7 +472,7 @@ Abc_Obj_t * Abc_NtkCovDerive_rec( Cov_Man_t * p, Abc_Ntk_t * pNtkNew, Abc_Obj_t // derive the function vCover = Vec_StrAlloc( 100 ); Min_CoverCreate( vCover, pCover, (char)Type ); - pNodeNew->pData = Abc_SopRegister( pNtkNew->pManFunc, Vec_StrArray(vCover) ); + pNodeNew->pData = Abc_SopRegister((Extra_MmFlex_t *)pNtkNew->pManFunc, Vec_StrArray(vCover) ); Vec_StrFree( vCover ); } @@ -514,7 +517,7 @@ Abc_Ntk_t * Abc_NtkCovDeriveRegular( Cov_Man_t * p, Abc_Ntk_t * pNtk ) if ( Abc_ObjFaninC0(pObj) ) { if ( pNodeNew->pData && Abc_ObjFanoutNum(Abc_ObjFanin0(pObj)) == 1 ) - Abc_SopComplement( pNodeNew->pData ); + Abc_SopComplement( (char *)pNodeNew->pData ); else pNodeNew = Abc_NtkCreateNodeInv( pNtkNew, pNodeNew ); } @@ -537,3 +540,5 @@ Abc_Ntk_t * Abc_NtkCovDeriveRegular( Cov_Man_t * p, Abc_Ntk_t * pNtk ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/cov/covCore.c b/src/map/cov/covCore.c index e36a4d2d..a53f6b49 100644 --- a/src/map/cov/covCore.c +++ b/src/map/cov/covCore.c @@ -20,12 +20,15 @@ #include "cov.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// -static void Abc_NtkCovCovers( Cov_Man_t * p, Abc_Ntk_t * pNtk, bool fVerbose ); -static int Abc_NtkCovCoversOne( Cov_Man_t * p, Abc_Ntk_t * pNtk, bool fVerbose ); +static void Abc_NtkCovCovers( Cov_Man_t * p, Abc_Ntk_t * pNtk, int fVerbose ); +static int Abc_NtkCovCoversOne( Cov_Man_t * p, Abc_Ntk_t * pNtk, int fVerbose ); static void Abc_NtkCovCovers_rec( Cov_Man_t * p, Abc_Obj_t * pObj, Vec_Ptr_t * vBoundary ); /* static int Abc_NodeCovPropagateEsop( Cov_Man_t * p, Abc_Obj_t * pObj, Abc_Obj_t * pObj0, Abc_Obj_t * pObj1 ); @@ -54,7 +57,7 @@ static Min_Cube_t * Abc_NodeCovSum( Cov_Man_t * p, Min_Cube_t * pCover0, Min_Cub SeeAlso [] ***********************************************************************/ -Abc_Ntk_t * Abc_NtkSopEsopCover( Abc_Ntk_t * pNtk, int nFaninMax, bool fUseEsop, bool fUseSop, bool fUseInvs, bool fVerbose ) +Abc_Ntk_t * Abc_NtkSopEsopCover( Abc_Ntk_t * pNtk, int nFaninMax, int fUseEsop, int fUseSop, int fUseInvs, int fVerbose ) { Abc_Ntk_t * pNtkNew; Cov_Man_t * p; @@ -102,7 +105,7 @@ Abc_Ntk_t * Abc_NtkSopEsopCover( Abc_Ntk_t * pNtk, int nFaninMax, bool fUseEsop, SeeAlso [] ***********************************************************************/ -void Abc_NtkCovCovers( Cov_Man_t * p, Abc_Ntk_t * pNtk, bool fVerbose ) +void Abc_NtkCovCovers( Cov_Man_t * p, Abc_Ntk_t * pNtk, int fVerbose ) { Abc_Obj_t * pObj; int i, clk = clock(); @@ -146,7 +149,7 @@ ABC_PRT( "Total", clock() - clk ); SeeAlso [] ***********************************************************************/ -int Abc_NtkCovCoversOne( Cov_Man_t * p, Abc_Ntk_t * pNtk, bool fVerbose ) +int Abc_NtkCovCoversOne( Cov_Man_t * p, Abc_Ntk_t * pNtk, int fVerbose ) { ProgressBar * pProgress; Abc_Obj_t * pObj; @@ -202,7 +205,7 @@ int Abc_NtkCovCoversOne( Cov_Man_t * p, Abc_Ntk_t * pNtk, bool fVerbose ) // create the new boundary p->nBoundary = 0; - Vec_PtrForEachEntry( vBoundary, pObj, i ) + Vec_PtrForEachEntry( Abc_Obj_t *, vBoundary, pObj, i ) { if ( !pObj->fMarkA ) { @@ -1021,3 +1024,5 @@ int Abc_NodeCovUnionSop( Cov_Man_t * p, Min_Cube_t * pCover0, Min_Cube_t * pCove //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/cov/covInt.h b/src/map/cov/covInt.h index a06519c0..b2d293d4 100644 --- a/src/map/cov/covInt.h +++ b/src/map/cov/covInt.h @@ -18,8 +18,15 @@ ***********************************************************************/ +#ifndef __COV_INT_H__ +#define __COV_INT_H__ + #include "abc.h" + +ABC_NAMESPACE_HEADER_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -636,8 +643,12 @@ static inline int Min_CoverContainsCube( Min_Man_t * p, Min_Cube_t * pCube ) return 0; } + +ABC_NAMESPACE_HEADER_END + +#endif + + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// - - diff --git a/src/map/cov/covMan.c b/src/map/cov/covMan.c index 74a5cf8a..fb6353c7 100644 --- a/src/map/cov/covMan.c +++ b/src/map/cov/covMan.c @@ -20,6 +20,9 @@ #include "cov.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -142,3 +145,5 @@ void Abc_NodeCovDropData( Cov_Man_t * p, Abc_Obj_t * pObj ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/cov/covMinEsop.c b/src/map/cov/covMinEsop.c index 7dd3db30..8497a6b4 100644 --- a/src/map/cov/covMinEsop.c +++ b/src/map/cov/covMinEsop.c @@ -20,6 +20,9 @@ #include "covInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -297,3 +300,5 @@ void Min_EsopAddCube( Min_Man_t * p, Min_Cube_t * pCube ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/cov/covMinMan.c b/src/map/cov/covMinMan.c index 74aa2e8c..12a9e573 100644 --- a/src/map/cov/covMinMan.c +++ b/src/map/cov/covMinMan.c @@ -20,6 +20,9 @@ #include "covInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -111,3 +114,5 @@ void Min_ManFree( Min_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/cov/covMinSop.c b/src/map/cov/covMinSop.c index 731a6698..244b4702 100644 --- a/src/map/cov/covMinSop.c +++ b/src/map/cov/covMinSop.c @@ -20,6 +20,9 @@ #include "covInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -613,3 +616,5 @@ int Min_SopCheck( Min_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/cov/covMinUtil.c b/src/map/cov/covMinUtil.c index c383a3e8..b573a5cb 100644 --- a/src/map/cov/covMinUtil.c +++ b/src/map/cov/covMinUtil.c @@ -20,6 +20,9 @@ #include "covInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -336,3 +339,5 @@ int Min_CoverSuppVarNum( Min_Man_t * p, Min_Cube_t * pCover ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/cov/covTest.c b/src/map/cov/covTest.c index 39432c90..23851742 100644 --- a/src/map/cov/covTest.c +++ b/src/map/cov/covTest.c @@ -20,6 +20,9 @@ #include "cov.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -118,14 +121,14 @@ int Abc_NodeDeriveSops( Min_Man_t * p, Abc_Obj_t * pRoot, Vec_Ptr_t * vSupp, Vec int i, nCubes, fCompl0, fCompl1; // set elementary vars - Vec_PtrForEachEntry( vSupp, pObj, i ) + Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pObj, i ) { pObj->pCopy = (Abc_Obj_t *)Min_CubeAllocVar( p, i, 0 ); pObj->pNext = (Abc_Obj_t *)Min_CubeAllocVar( p, i, 1 ); } // get the cover for each node in the array - Vec_PtrForEachEntry( vNodes, pObj, i ) + Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) { // get the complements fCompl0 = Abc_ObjFaninC0(pObj); @@ -165,9 +168,9 @@ Min_CoverWrite( stdout, pCoverN ); // nCubes = Min_CoverCountCubes(pCoverP); // clean the copy fields - Vec_PtrForEachEntry( vNodes, pObj, i ) + Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) pObj->pCopy = pObj->pNext = NULL; - Vec_PtrForEachEntry( vSupp, pObj, i ) + Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pObj, i ) pObj->pCopy = pObj->pNext = NULL; // Min_CoverWriteFile( pCoverP, Abc_ObjName(pRoot), 0 ); @@ -313,11 +316,11 @@ int Abc_NodeDeriveEsops( Min_Man_t * p, Abc_Obj_t * pRoot, Vec_Ptr_t * vSupp, Ve int i; // set elementary vars - Vec_PtrForEachEntry( vSupp, pObj, i ) + Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pObj, i ) pObj->pCopy = (Abc_Obj_t *)Min_CubeAllocVar( p, i, 0 ); // get the cover for each node in the array - Vec_PtrForEachEntry( vNodes, pObj, i ) + Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) { pCover = Abc_NodeDeriveCover( p, (Min_Cube_t *)Abc_ObjFanin0(pObj)->pCopy, @@ -351,9 +354,9 @@ int Abc_NodeDeriveEsops( Min_Man_t * p, Abc_Obj_t * pRoot, Vec_Ptr_t * vSupp, Ve pCover = Min_CoverCollect( p, p->nVars ); */ // clean the copy fields - Vec_PtrForEachEntry( vNodes, pObj, i ) + Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i ) pObj->pCopy = NULL; - Vec_PtrForEachEntry( vSupp, pObj, i ) + Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pObj, i ) pObj->pCopy = NULL; // Min_CoverWriteFile( pCover, Abc_ObjName(pRoot), 1 ); @@ -415,3 +418,5 @@ void Abc_NtkTestEsop( Abc_Ntk_t * pNtk ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpga.c b/src/map/fpga/fpga.c index fa2a138c..08adb52e 100644 --- a/src/map/fpga/fpga.c +++ b/src/map/fpga/fpga.c @@ -19,6 +19,9 @@ #include "fpgaInt.h" #include "main.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -78,9 +81,9 @@ void Fpga_Init( Abc_Frame_t * pAbc ) SeeAlso [] ***********************************************************************/ -void Fpga_End() +void Fpga_End( Abc_Frame_t * pAbc ) { - Fpga_LutLibFree( Abc_FrameReadLibLut() ); + Fpga_LutLibFree( (Fpga_LutLib_t *)Abc_FrameReadLibLut() ); } @@ -153,7 +156,7 @@ int Fpga_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv ) goto usage; } // replace the current library - Fpga_LutLibFree( Abc_FrameReadLibLut() ); + Fpga_LutLibFree( (Fpga_LutLib_t *)Abc_FrameReadLibLut() ); Abc_FrameSetLibLut( pLib ); return 0; @@ -224,7 +227,7 @@ int Fpga_CommandPrintLibrary( Abc_Frame_t * pAbc, int argc, char **argv ) } // set the new network - Fpga_LutLibPrint( Abc_FrameReadLibLut() ); + Fpga_LutLibPrint( (Fpga_LutLib_t *)Abc_FrameReadLibLut() ); return 0; usage: @@ -272,7 +275,7 @@ void Fpga_SetSimpleLutLib( int nLutSize ) } if ( pLutLib == NULL ) return; - Fpga_LutLibFree( Abc_FrameReadLibLut() ); + Fpga_LutLibFree( (Fpga_LutLib_t *)Abc_FrameReadLibLut() ); Abc_FrameSetLibLut( Fpga_LutLibDup(pLutLib) ); } @@ -281,3 +284,5 @@ void Fpga_SetSimpleLutLib( int nLutSize ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpga.h b/src/map/fpga/fpga.h index 0479847c..082e6635 100644 --- a/src/map/fpga/fpga.h +++ b/src/map/fpga/fpga.h @@ -19,6 +19,7 @@ #ifndef __FPGA_H__ #define __FPGA_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -27,9 +28,10 @@ /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -extern "C" { -#endif + + +ABC_NAMESPACE_HEADER_START + // the maximum size of LUTs used for mapping #define FPGA_MAX_LUTSIZE 32 @@ -164,9 +166,11 @@ extern Fpga_NodeVec_t * Fpga_CollectNodeTfo( Fpga_Man_t * pMan, Fpga_Node_t * pN /*=== fpga.c =============================================================*/ extern void Fpga_SetSimpleLutLib( int nLutSize ); -#ifdef __cplusplus -} -#endif + + +ABC_NAMESPACE_HEADER_END + + #endif diff --git a/src/map/fpga/fpgaCore.c b/src/map/fpga/fpgaCore.c index 17feac7c..74739852 100644 --- a/src/map/fpga/fpgaCore.c +++ b/src/map/fpga/fpgaCore.c @@ -18,6 +18,9 @@ #include "fpgaInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -186,3 +189,5 @@ ABC_PRT( "Time", clock() - clk ); } +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpgaCreate.c b/src/map/fpga/fpgaCreate.c index 5245f050..168b69c6 100644 --- a/src/map/fpga/fpgaCreate.c +++ b/src/map/fpga/fpgaCreate.c @@ -19,6 +19,9 @@ #include "fpgaInt.h" #include "main.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -169,7 +172,7 @@ Fpga_Man_t * Fpga_ManCreate( int nInputs, int nOutputs, int fVerbose ) // start the manager p = ABC_ALLOC( Fpga_Man_t, 1 ); memset( p, 0, sizeof(Fpga_Man_t) ); - p->pLutLib = Abc_FrameReadLibLut(); + p->pLutLib = (Fpga_LutLib_t *)Abc_FrameReadLibLut(); p->nVarsMax = p->pLutLib->LutMax; p->fVerbose = fVerbose; p->fAreaRecovery = 1; @@ -580,3 +583,5 @@ void Fpga_ManStats( Fpga_Man_t * p ) /// END OF FILE /// //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpgaCut.c b/src/map/fpga/fpgaCut.c index aca4a8ef..5f46be18 100644 --- a/src/map/fpga/fpgaCut.c +++ b/src/map/fpga/fpgaCut.c @@ -18,6 +18,9 @@ #include "fpgaInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -1179,3 +1182,5 @@ Fpga_Cut_t * Fpga_CutArray2List( Fpga_Cut_t ** pArray, int nCuts ) /// END OF FILE /// //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpgaCutUtils.c b/src/map/fpga/fpgaCutUtils.c index 0f003ee7..9b5b2be9 100644 --- a/src/map/fpga/fpgaCutUtils.c +++ b/src/map/fpga/fpgaCutUtils.c @@ -18,6 +18,9 @@ #include "fpgaInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -469,3 +472,5 @@ void Fpga_MappingSetUsedCuts( Fpga_Man_t * pMan ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpgaFanout.c b/src/map/fpga/fpgaFanout.c index c28a8799..e4e8894c 100644 --- a/src/map/fpga/fpgaFanout.c +++ b/src/map/fpga/fpgaFanout.c @@ -18,6 +18,9 @@ #include "fpgaInt.h" +ABC_NAMESPACE_IMPL_START + + #ifdef MAP_ALLOCATE_FANOUT //////////////////////////////////////////////////////////////////////// @@ -139,3 +142,5 @@ int Fpga_NodeGetFanoutNum( Fpga_Node_t * pNode ) #endif +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpgaGENERIC.c b/src/map/fpga/fpgaGENERIC.c index 4483c215..c5a67228 100644 --- a/src/map/fpga/fpgaGENERIC.c +++ b/src/map/fpga/fpgaGENERIC.c @@ -18,6 +18,9 @@ #include "fpgaInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -44,3 +47,5 @@ //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpgaInt.h b/src/map/fpga/fpgaInt.h index ba9538c2..26de9b80 100644 --- a/src/map/fpga/fpgaInt.h +++ b/src/map/fpga/fpgaInt.h @@ -19,6 +19,7 @@ #ifndef __FPGA_INT_H__ #define __FPGA_INT_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -29,6 +30,9 @@ #include "extra.h" #include "fpga.h" +ABC_NAMESPACE_HEADER_START + + //////////////////////////////////////////////////////////////////////// /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// @@ -377,6 +381,10 @@ extern void Fpga_MappingSetChoiceLevels( Fpga_Man_t * pMan ); /*=== CUDD package.c ===============================================================*/ extern unsigned int Cudd_Prime( unsigned int p ); + + +ABC_NAMESPACE_HEADER_END + #endif //////////////////////////////////////////////////////////////////////// diff --git a/src/map/fpga/fpgaLib.c b/src/map/fpga/fpgaLib.c index d5b12293..1c173ad9 100644 --- a/src/map/fpga/fpgaLib.c +++ b/src/map/fpga/fpgaLib.c @@ -18,6 +18,9 @@ #include "fpgaInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -248,3 +251,5 @@ int Fpga_LutLibDelaysAreDiscrete( Fpga_LutLib_t * pLutLib ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpgaMatch.c b/src/map/fpga/fpgaMatch.c index 30448750..08db4bb1 100644 --- a/src/map/fpga/fpgaMatch.c +++ b/src/map/fpga/fpgaMatch.c @@ -18,6 +18,9 @@ #include "fpgaInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -792,3 +795,5 @@ float Fpga_FindBestNode( Fpga_Man_t * p, Fpga_NodeVec_t * vNodes, Fpga_Node_t ** //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpgaSwitch.c b/src/map/fpga/fpgaSwitch.c index 5e881959..524262ec 100644 --- a/src/map/fpga/fpgaSwitch.c +++ b/src/map/fpga/fpgaSwitch.c @@ -18,6 +18,9 @@ #include "fpgaInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -149,3 +152,5 @@ float Fpga_MappingGetSwitching( Fpga_Man_t * pMan, Fpga_NodeVec_t * vMapping ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpgaTime.c b/src/map/fpga/fpgaTime.c index d9bf7947..5454ce3c 100644 --- a/src/map/fpga/fpgaTime.c +++ b/src/map/fpga/fpgaTime.c @@ -18,6 +18,9 @@ #include "fpgaInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -260,3 +263,5 @@ void Fpga_TimePropagateArrival( Fpga_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpgaTruth.c b/src/map/fpga/fpgaTruth.c index 7eca8e3e..d37ff81d 100644 --- a/src/map/fpga/fpgaTruth.c +++ b/src/map/fpga/fpgaTruth.c @@ -19,6 +19,9 @@ #include "fpgaInt.h" #include "cudd.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -81,17 +84,17 @@ void * Fpga_TruthsCutBdd( void * dd, Fpga_Cut_t * pCut ) assert( pCut->nLeaves > 1 ); // set the leaf variables for ( i = 0; i < pCut->nLeaves; i++ ) - pCut->ppLeaves[i]->pCuts->uSign = (unsigned)(ABC_PTRUINT_T)Cudd_bddIthVar( dd, i ); + pCut->ppLeaves[i]->pCuts->uSign = (unsigned)(ABC_PTRUINT_T)Cudd_bddIthVar( (DdManager *)dd, i ); // recursively compute the function vVisited = Fpga_NodeVecAlloc( 10 ); - bFunc = Fpga_TruthsCutBdd_rec( dd, pCut, vVisited ); Cudd_Ref( bFunc ); + bFunc = Fpga_TruthsCutBdd_rec( (DdManager *)dd, pCut, vVisited ); Cudd_Ref( bFunc ); // clean the intermediate BDDs for ( i = 0; i < pCut->nLeaves; i++ ) pCut->ppLeaves[i]->pCuts->uSign = 0; for ( i = 0; i < vVisited->nSize; i++ ) { pCut = (Fpga_Cut_t *)vVisited->pArray[i]; - Cudd_RecursiveDeref( dd, (DdNode*)(ABC_PTRUINT_T)pCut->uSign ); + Cudd_RecursiveDeref( (DdManager *)dd, (DdNode*)(ABC_PTRUINT_T)pCut->uSign ); pCut->uSign = 0; } // printf( "%d ", vVisited->nSize ); @@ -164,3 +167,5 @@ int Fpga_CutVolume( Fpga_Cut_t * pCut ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpgaUtils.c b/src/map/fpga/fpgaUtils.c index f360254b..f10971ad 100644 --- a/src/map/fpga/fpgaUtils.c +++ b/src/map/fpga/fpgaUtils.c @@ -18,6 +18,9 @@ #include "fpgaInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -983,3 +986,5 @@ Fpga_NodeVec_t * Fpga_MappingOrderCosByLevel( Fpga_Man_t * pMan ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/fpga/fpgaVec.c b/src/map/fpga/fpgaVec.c index b17697dd..35260029 100644 --- a/src/map/fpga/fpgaVec.c +++ b/src/map/fpga/fpgaVec.c @@ -18,6 +18,9 @@ #include "fpgaInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -406,3 +409,5 @@ void Fpga_NodeVecReverse( Fpga_NodeVec_t * vNodes ) /// END OF FILE /// //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/if/if.h b/src/map/if/if.h index 91d6e037..96f6f109 100644 --- a/src/map/if/if.h +++ b/src/map/if/if.h @@ -21,10 +21,11 @@ #ifndef __IF_H__ #define __IF_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// - + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -34,9 +35,10 @@ #include "mem.h" #include "tim.h" -#ifdef __cplusplus -extern "C" { -#endif + + +ABC_NAMESPACE_HEADER_START + //////////////////////////////////////////////////////////////////////// /// PARAMETERS /// @@ -92,8 +94,10 @@ struct If_Par_t_ int fCutMin; // performs cut minimization by removing functionally reducdant variables int fSeqMap; // sequential mapping int fBidec; // use bi-decomposition + int fUseBat; // use one specialized feature int fVerbose; // the verbosity flag // internal parameters + int fDelayOpt; // special delay optimization int fAreaOnly; // area only mode int fTruth; // truth table computation enabled int fUsePerm; // use permutation (delay info) @@ -101,13 +105,16 @@ struct If_Par_t_ int fUseSops; // use local SOPs as a cost function int fUseCnfs; // use local CNFs as a cost function int fUseMv; // use local MV-SOPs as a cost function + int fUseAdders; // timing model for adders int nLatches; // the number of latches in seq mapping int fLiftLeaves; // shift the leaves for seq mapping + int fUseCoAttrs; // use CO attributes If_Lib_t * pLutLib; // the LUT library float * pTimesArr; // arrival times float * pTimesReq; // required times int (* pFuncCost) (If_Cut_t *); // procedure to compute the user's cost of a cut int (* pFuncUser) (If_Man_t *, If_Obj_t *, If_Cut_t *); // procedure called for each cut when cut computation is finished + int (* pFuncCell) (unsigned *, int, int); // procedure called for cut functions void * pReoMan; // reordering manager }; @@ -166,10 +173,13 @@ struct If_Man_t_ Mem_Fixed_t * pMemSet; // memory manager for sets of cuts (entrysize = nCutSize*(nCutsMax+1)) If_Set_t * pMemCi; // memory for CI cutsets If_Set_t * pMemAnd; // memory for AND cutsets - If_Set_t * pFreeList; // the list of ABC_FREE cutsets + If_Set_t * pFreeList; // the list of free cutsets int nSmallSupp; // the small support + int nCutsTotal; + int nCutsUseless; // timing manager Tim_Man_t * pManTim; + Vec_Int_t * vCoAttrs; // CO attributes 0=optimize; 1=keep; 2=relax // statistics // int timeTruth; }; @@ -183,9 +193,10 @@ struct If_Cut_t_ float Power; // the power flow float Delay; // delay of the cut unsigned uSign; // cut signature - unsigned Cost : 14; // the user's cost of the cut + unsigned Cost : 13; // the user's cost of the cut unsigned fCompl : 1; // the complemented attribute unsigned fUser : 1; // using the user's area and delay + unsigned fUseless: 1; // using the user's area and delay unsigned nLimit : 8; // the maximum number of leaves unsigned nLeaves : 8; // the number of leaves int * pLeaves; // array of fanins @@ -198,7 +209,7 @@ struct If_Set_t_ { short nCutsMax; // the max number of cuts short nCuts; // the current number of cuts - If_Set_t * pNext; // next cutset in the ABC_FREE list + If_Set_t * pNext; // next cutset in the free list If_Cut_t ** ppCuts; // the array of pointers to the cuts }; @@ -212,7 +223,8 @@ struct If_Obj_t_ unsigned fRepr : 1; // representative of the equivalence class unsigned fMark : 1; // multipurpose mark unsigned fVisit : 1; // multipurpose mark - unsigned Level : 22; // logic level of the node + unsigned fSpec : 1; // multipurpose mark + unsigned Level : 21; // logic level of the node int Id; // integer ID int IdPio; // integer ID of PIs/POs int nRefs; // the number of references @@ -229,6 +241,18 @@ struct If_Obj_t_ If_Cut_t CutBest; // the best cut selected }; +typedef struct If_And_t_ If_And_t; +struct If_And_t_ +{ + unsigned iFan0 : 15; // fanin0 + unsigned fCompl0 : 1; // compl fanin0 + unsigned iFan1 : 15; // fanin1 + unsigned fCompl1 : 1; // compl fanin1 + unsigned Id : 15; // Id + unsigned fCompl : 1; // compl output + unsigned Delay : 16; // delay +}; + static inline If_Obj_t * If_Regular( If_Obj_t * p ) { return (If_Obj_t *)((ABC_PTRUINT_T)(p) & ~01); } static inline If_Obj_t * If_Not( If_Obj_t * p ) { return (If_Obj_t *)((ABC_PTRUINT_T)(p) ^ 01); } static inline If_Obj_t * If_NotCond( If_Obj_t * p, int c ) { return (If_Obj_t *)((ABC_PTRUINT_T)(p) ^ (c)); } @@ -253,6 +277,7 @@ static inline int If_ObjIsTerm( If_Obj_t * pObj ) { r static inline int If_ObjIsLatch( If_Obj_t * pObj ) { return If_ObjIsCi(pObj) && pObj->pFanin0 != NULL; } static inline int If_ObjIsAnd( If_Obj_t * pObj ) { return pObj->Type == IF_AND; } +static inline int If_ObjId( If_Obj_t * pObj ) { return pObj->Id; } static inline If_Obj_t * If_ObjFanin0( If_Obj_t * pObj ) { return pObj->pFanin0; } static inline If_Obj_t * If_ObjFanin1( If_Obj_t * pObj ) { return pObj->pFanin1; } static inline int If_ObjFaninC0( If_Obj_t * pObj ) { return pObj->fCompl0; } @@ -275,6 +300,9 @@ static inline void If_ObjSetLValue( If_Obj_t * pObj, float LValue ) { p static inline void * If_CutData( If_Cut_t * pCut ) { return *(void **)pCut; } static inline void If_CutSetData( If_Cut_t * pCut, void * pData ) { *(void **)pCut = pData; } +static inline int If_CutDataInt( If_Cut_t * pCut ) { return *(int *)pCut; } +static inline void If_CutSetDataInt( If_Cut_t * pCut, int Data ) { *(int *)pCut = Data; } + static inline int If_CutLeaveNum( If_Cut_t * pCut ) { return pCut->nLeaves; } static inline int * If_CutLeaves( If_Cut_t * pCut ) { return pCut->pLeaves; } static inline unsigned * If_CutTruth( If_Cut_t * pCut ) { return pCut->pTruth; } @@ -284,6 +312,11 @@ static inline int If_CutPermWords( int nVarsMax ) { r static inline float If_CutLutArea( If_Man_t * p, If_Cut_t * pCut ) { return pCut->fUser? (float)pCut->Cost : (p->pPars->pLutLib? p->pPars->pLutLib->pLutAreas[pCut->nLeaves] : (float)1.0); } +static inline word If_AndToWrd( If_And_t m ) { union { If_And_t x; word y; } v; v.x = m; return v.y; } +static inline If_And_t If_WrdToAnd( word m ) { union { If_And_t x; word y; } v; v.y = m; return v.x; } +static inline void If_AndClear( If_And_t * pNode ) { *pNode = If_WrdToAnd(0); } + + //////////////////////////////////////////////////////////////////////// /// MACRO DEFINITIONS /// //////////////////////////////////////////////////////////////////////// @@ -298,27 +331,27 @@ static inline float If_CutLutArea( If_Man_t * p, If_Cut_t * pCut ) { r // iterator over the primary inputs #define If_ManForEachCi( p, pObj, i ) \ - Vec_PtrForEachEntry( p->vCis, pObj, i ) + Vec_PtrForEachEntry( If_Obj_t *, p->vCis, pObj, i ) // iterator over the primary outputs #define If_ManForEachCo( p, pObj, i ) \ - Vec_PtrForEachEntry( p->vCos, pObj, i ) + Vec_PtrForEachEntry( If_Obj_t *, p->vCos, pObj, i ) // iterator over the primary inputs #define If_ManForEachPi( p, pObj, i ) \ - Vec_PtrForEachEntryStop( p->vCis, pObj, i, If_ManCiNum(p) - p->pPars->nLatches ) + Vec_PtrForEachEntryStop( If_Obj_t *, p->vCis, pObj, i, If_ManCiNum(p) - p->pPars->nLatches ) // iterator over the primary outputs #define If_ManForEachPo( p, pObj, i ) \ - Vec_PtrForEachEntryStop( p->vCos, pObj, i, If_ManCoNum(p) - p->pPars->nLatches ) + Vec_PtrForEachEntryStop( If_Obj_t *, p->vCos, pObj, i, If_ManCoNum(p) - p->pPars->nLatches ) // iterator over the latches #define If_ManForEachLatchInput( p, pObj, i ) \ - Vec_PtrForEachEntryStart( p->vCos, pObj, i, If_ManCoNum(p) - p->pPars->nLatches ) + Vec_PtrForEachEntryStart( If_Obj_t *, p->vCos, pObj, i, If_ManCoNum(p) - p->pPars->nLatches ) #define If_ManForEachLatchOutput( p, pObj, i ) \ - Vec_PtrForEachEntryStart( p->vCis, pObj, i, If_ManCiNum(p) - p->pPars->nLatches ) + Vec_PtrForEachEntryStart( If_Obj_t *, p->vCis, pObj, i, If_ManCiNum(p) - p->pPars->nLatches ) // iterator over all objects in topological order #define If_ManForEachObj( p, pObj, i ) \ - Vec_PtrForEachEntry( p->vObjs, pObj, i ) + Vec_PtrForEachEntry( If_Obj_t *, p->vObjs, pObj, i ) // iterator over all objects in reverse topological order #define If_ManForEachObjReverse( p, pObj, i ) \ - Vec_PtrForEachEntry( p->vObjsRev, pObj, i ) + Vec_PtrForEachEntry( If_Obj_t *, p->vObjsRev, pObj, i ) // iterator over logic nodes #define If_ManForEachNode( p, pObj, i ) \ If_ManForEachObj( p, pObj, i ) if ( pObj->Type != IF_AND ) {} else @@ -404,6 +437,8 @@ extern void If_ManImproveMapping( If_Man_t * p ); /*=== ifSeq.c =============================================================*/ extern int If_ManPerformMappingSeq( If_Man_t * p ); /*=== ifTime.c ============================================================*/ +extern int If_CutDelaySopCost( If_Man_t * p, If_Cut_t * pCut ); +extern Vec_Wrd_t * If_CutDelaySopArray( If_Man_t * p, If_Cut_t * pCut ); extern float If_CutDelay( If_Man_t * p, If_Cut_t * pCut ); extern void If_CutPropagateRequired( If_Man_t * p, If_Cut_t * pCut, float Required ); extern void If_CutRotatePins( If_Man_t * p, If_Cut_t * pCut ); @@ -427,14 +462,12 @@ extern void If_ManMarkMapping( If_Man_t * p ); extern Vec_Ptr_t * If_ManCollectMappingDirect( If_Man_t * p ); extern Vec_Int_t * If_ManCollectMappingInt( If_Man_t * p ); - extern int If_ManCountSpecialPos( If_Man_t * p ); +// othe packages +extern int Bat_ManCellFuncLookup( unsigned * pTruth, int nVars, int nLeaves ); - -#ifdef __cplusplus -} -#endif +ABC_NAMESPACE_HEADER_END #endif diff --git a/src/map/if/ifCore.c b/src/map/if/ifCore.c index e3fd47f1..fcecb401 100644 --- a/src/map/if/ifCore.c +++ b/src/map/if/ifCore.c @@ -20,6 +20,9 @@ #include "if.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -56,7 +59,7 @@ int If_ManPerformMapping( If_Man_t * p ) if ( p->pPars->fSeqMap ) { // if ( p->pPars->fVerbose ) - printf( "Performing sequential mapping without retiming.\n" ); + Abc_Print( 1, "Performing sequential mapping without retiming.\n" ); return If_ManPerformMappingSeq( p ); } return If_ManPerformMappingComb( p ); @@ -128,21 +131,20 @@ int If_ManPerformMappingComb( If_Man_t * p ) if ( p->pPars->fVerbose ) { -// printf( "Total memory = %7.2f Mb. Peak cut memory = %7.2f Mb. ", +// Abc_Print( 1, "Total memory = %7.2f Mb. Peak cut memory = %7.2f Mb. ", // 1.0 * (p->nObjBytes + 2*sizeof(void *)) * If_ManObjNum(p) / (1<<20), // 1.0 * p->nSetBytes * Mem_FixedReadMaxEntriesUsed(p->pMemSet) / (1<<20) ); - ABC_PRT( "Total time", clock() - clkTotal ); + Abc_PrintTime( 1, "Total time", clock() - clkTotal ); } -// printf( "Cross cut memory = %d.\n", Mem_FixedReadMaxEntriesUsed(p->pMemSet) ); +// Abc_Print( 1, "Cross cut memory = %d.\n", Mem_FixedReadMaxEntriesUsed(p->pMemSet) ); s_MappingTime = clock() - clkTotal; -// printf( "Special POs = %d.\n", If_ManCountSpecialPos(p) ); +// Abc_Print( 1, "Special POs = %d.\n", If_ManCountSpecialPos(p) ); { extern int If_CutGetCones( If_Man_t * p ); extern int If_CutCountTotalFanins( If_Man_t * p ); // If_CutGetCones( p ); // If_CutCountTotalFanins( p ); } - return 1; } @@ -151,3 +153,5 @@ int If_ManPerformMappingComb( If_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c index d3ce5397..58224692 100644 --- a/src/map/if/ifCut.c +++ b/src/map/if/ifCut.c @@ -20,6 +20,9 @@ #include "if.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -440,7 +443,7 @@ static inline int If_ManSortCompare( If_Man_t * p, If_Cut_t * pC0, If_Cut_t * pC return -1; if ( pC0->Area > pC1->Area + p->fEpsilon ) return 1; - //printf("area(%.2f, %.2f), power(%.2f, %.2f), edge(%.2f, %.2f)\n", + //Abc_Print( 1,"area(%.2f, %.2f), power(%.2f, %.2f), edge(%.2f, %.2f)\n", // pC0->Area, pC1->Area, pC0->Power, pC1->Power, pC0->Edge, pC1->Edge); if ( pC0->Power < pC1->Power - p->fEpsilon ) return -1; @@ -511,7 +514,7 @@ static inline int If_ManSortCompare( If_Man_t * p, If_Cut_t * pC0, If_Cut_t * pC return 1; return 0; } - else // reglar + else // regular { if ( p->SortMode == 1 ) // area { @@ -682,16 +685,28 @@ void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut ) return; } + if ( p->pPars->fUseBat && !pCut->fUseless ) + { + If_Cut_t * pFirst = pCutSet->ppCuts[0]; + if ( pFirst->fUseless || If_ManSortCompare(p, pFirst, pCut) == 1 ) + { + pCutSet->ppCuts[0] = pCut; + pCutSet->ppCuts[pCutSet->nCuts] = pFirst; + If_CutSort( p, pCutSet, pFirst ); + return; + } + } + // the cut will be added - find its place for ( i = pCutSet->nCuts-1; i >= 0; i-- ) { // Counter++; - if ( If_ManSortCompare( p, pCutSet->ppCuts[i], pCut ) <= 0 ) + if ( If_ManSortCompare( p, pCutSet->ppCuts[i], pCut ) <= 0 || (i == 0 && !pCutSet->ppCuts[0]->fUseless && pCut->fUseless) ) break; pCutSet->ppCuts[i+1] = pCutSet->ppCuts[i]; pCutSet->ppCuts[i] = pCut; } -// printf( "%d ", Counter ); +// Abc_Print( 1, "%d ", Counter ); // update the number of cuts if ( pCutSet->nCuts < pCutSet->nCutsMax ) @@ -746,7 +761,7 @@ int If_CutCheck( If_Cut_t * pCut ) { if ( pCut->pLeaves[i-1] >= pCut->pLeaves[i] ) { - printf( "If_CutCheck(): Cut has wrong ordering of inputs.\n" ); + Abc_Print( -1, "If_CutCheck(): Cut has wrong ordering of inputs.\n" ); return 0; } assert( pCut->pLeaves[i-1] < pCut->pLeaves[i] ); @@ -769,10 +784,10 @@ int If_CutCheck( If_Cut_t * pCut ) void If_CutPrint( If_Cut_t * pCut ) { unsigned i; - printf( "{" ); + Abc_Print( 1, "{" ); for ( i = 0; i < pCut->nLeaves; i++ ) - printf( " %d", pCut->pLeaves[i] ); - printf( " }\n" ); + Abc_Print( 1, " %d", pCut->pLeaves[i] ); + Abc_Print( 1, " }\n" ); } /**Function************************************************************* @@ -790,10 +805,10 @@ void If_CutPrintTiming( If_Man_t * p, If_Cut_t * pCut ) { If_Obj_t * pLeaf; unsigned i; - printf( "{" ); + Abc_Print( 1, "{" ); If_CutForEachLeaf( p, pCut, pLeaf, i ) - printf( " %d(%.2f/%.2f)", pLeaf->Id, If_ObjCutBest(pLeaf)->Delay, pLeaf->Required ); - printf( " }\n" ); + Abc_Print( 1, " %d(%.2f/%.2f)", pLeaf->Id, If_ObjCutBest(pLeaf)->Delay, pLeaf->Required ); + Abc_Print( 1, " }\n" ); } /**Function************************************************************* @@ -1345,11 +1360,11 @@ int If_CutGetCones( If_Man_t * p ) if ( If_ObjIsAnd(pObj) && pObj->nRefs ) { Counter += !If_CutGetCone_rec( p, pObj, If_ObjCutBest(pObj) ); -// printf( "%d ", If_CutGetCutMinLevel( p, If_ObjCutBest(pObj) ) ); +// Abc_Print( 1, "%d ", If_CutGetCutMinLevel( p, If_ObjCutBest(pObj) ) ); } } - printf( "Cound not find boundary for %d nodes.\n", Counter ); - ABC_PRT( "Cones", clock() - clk ); + Abc_Print( 1, "Cound not find boundary for %d nodes.\n", Counter ); + Abc_PrintTime( 1, "Cones", clock() - clk ); return 1; } @@ -1405,8 +1420,8 @@ int If_CutCountTotalFanins( If_Man_t * p ) Counter += Vec_IntSize(vLeaves); } } - printf( "Total cut inputs = %d. Total fanins incremental = %d.\n", nFaninsTotal, Counter ); - ABC_PRT( "Fanins", clock() - clk ); + Abc_Print( 1, "Total cut inputs = %d. Total fanins incremental = %d.\n", nFaninsTotal, Counter ); + Abc_PrintTime( 1, "Fanins", clock() - clk ); Vec_IntFree( vLeaves ); return 1; } @@ -1416,3 +1431,5 @@ int If_CutCountTotalFanins( If_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/if/ifLib.c b/src/map/if/ifLib.c index 176edb24..90e37a0f 100644 --- a/src/map/if/ifLib.c +++ b/src/map/if/ifLib.c @@ -20,6 +20,9 @@ #include "if.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -51,7 +54,7 @@ If_Lib_t * If_LutLibRead( char * FileName ) pFile = fopen( FileName, "r" ); if ( pFile == NULL ) { - printf( "Cannot open LUT library file \"%s\".\n", FileName ); + Abc_Print( -1, "Cannot open LUT library file \"%s\".\n", FileName ); return NULL; } @@ -69,7 +72,7 @@ If_Lib_t * If_LutLibRead( char * FileName ) continue; if ( i != atoi(pToken) ) { - printf( "Error in the LUT library file \"%s\".\n", FileName ); + Abc_Print( 1, "Error in the LUT library file \"%s\".\n", FileName ); ABC_FREE( p ); return NULL; } @@ -86,7 +89,7 @@ If_Lib_t * If_LutLibRead( char * FileName ) // check for out-of-bound if ( k > i ) { - printf( "LUT %d has too many pins (%d). Max allowed is %d.\n", i, k, i ); + Abc_Print( 1, "LUT %d has too many pins (%d). Max allowed is %d.\n", i, k, i ); return NULL; } @@ -96,7 +99,7 @@ If_Lib_t * If_LutLibRead( char * FileName ) if ( i == IF_MAX_LUTSIZE ) { - printf( "Skipping LUTs of size more than %d.\n", i ); + Abc_Print( 1, "Skipping LUTs of size more than %d.\n", i ); return NULL; } i++; @@ -110,10 +113,10 @@ If_Lib_t * If_LutLibRead( char * FileName ) for ( k = 0; k < i; k++ ) { if ( p->pLutDelays[i][k] <= 0.0 ) - printf( "Warning: Pin %d of LUT %d has delay %f. Pin delays should be non-negative numbers. Technology mapping may not work correctly.\n", + Abc_Print( 0, "Pin %d of LUT %d has delay %f. Pin delays should be non-negative numbers. Technology mapping may not work correctly.\n", k, i, p->pLutDelays[i][k] ); if ( k && p->pLutDelays[i][k-1] > p->pLutDelays[i][k] ) - printf( "Warning: Pin %d of LUT %d has delay %f. Pin %d of LUT %d has delay %f. Pin delays should be in non-decreasing order. Technology mapping may not work correctly.\n", + Abc_Print( 0, "Pin %d of LUT %d has delay %f. Pin %d of LUT %d has delay %f. Pin delays should be in non-decreasing order. Technology mapping may not work correctly.\n", k-1, i, p->pLutDelays[i][k-1], k, i, p->pLutDelays[i][k] ); } @@ -123,7 +126,7 @@ If_Lib_t * If_LutLibRead( char * FileName ) for ( i = 1; i <= p->LutMax; i++ ) { if ( p->pLutDelays[i][0] <= 0.0 ) - printf( "Warning: LUT %d has delay %f. Pin delays should be non-negative numbers. Technology mapping may not work correctly.\n", + Abc_Print( 0, "LUT %d has delay %f. Pin delays should be non-negative numbers. Technology mapping may not work correctly.\n", i, p->pLutDelays[i][0] ); } } @@ -185,21 +188,21 @@ void If_LutLibFree( If_Lib_t * pLutLib ) void If_LutLibPrint( If_Lib_t * pLutLib ) { int i, k; - printf( "# The area/delay of k-variable LUTs:\n" ); - printf( "# k area delay\n" ); + Abc_Print( 1, "# The area/delay of k-variable LUTs:\n" ); + Abc_Print( 1, "# k area delay\n" ); if ( pLutLib->fVarPinDelays ) { for ( i = 1; i <= pLutLib->LutMax; i++ ) { - printf( "%d %7.2f ", i, pLutLib->pLutAreas[i] ); + Abc_Print( 1, "%d %7.2f ", i, pLutLib->pLutAreas[i] ); for ( k = 0; k < i; k++ ) - printf( " %7.2f", pLutLib->pLutDelays[i][k] ); - printf( "\n" ); + Abc_Print( 1, " %7.2f", pLutLib->pLutDelays[i][k] ); + Abc_Print( 1, "\n" ); } } else for ( i = 1; i <= pLutLib->LutMax; i++ ) - printf( "%d %7.2f %7.2f\n", i, pLutLib->pLutAreas[i], pLutLib->pLutDelays[i][0] ); + Abc_Print( 1, "%d %7.2f %7.2f\n", i, pLutLib->pLutAreas[i], pLutLib->pLutDelays[i][0] ); } /**Function************************************************************* @@ -334,3 +337,5 @@ float If_LutLibSlowestPinDelay( If_Lib_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/if/ifMan.c b/src/map/if/ifMan.c index 6294e3d2..f0c37e70 100644 --- a/src/map/if/ifMan.c +++ b/src/map/if/ifMan.c @@ -20,6 +20,9 @@ #include "if.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -50,14 +53,14 @@ If_Man_t * If_ManStart( If_Par_t * pPars ) // start the manager p = ABC_ALLOC( If_Man_t, 1 ); memset( p, 0, sizeof(If_Man_t) ); - p->pPars = pPars; + p->pPars = pPars; p->fEpsilon = pPars->Epsilon; // allocate arrays for nodes - p->vCis = Vec_PtrAlloc( 100 ); - p->vCos = Vec_PtrAlloc( 100 ); - p->vObjs = Vec_PtrAlloc( 100 ); + p->vCis = Vec_PtrAlloc( 100 ); + p->vCos = Vec_PtrAlloc( 100 ); + p->vObjs = Vec_PtrAlloc( 100 ); // p->vMapped = Vec_PtrAlloc( 100 ); - p->vTemp = Vec_PtrAlloc( 100 ); + p->vTemp = Vec_PtrAlloc( 100 ); // prepare the memory manager p->nTruthWords = p->pPars->fTruth? If_CutTruthWords( p->pPars->nLutSize ) : 0; p->nPermWords = p->pPars->fUsePerm? If_CutPermWords( p->pPars->nLutSize ) : 0; @@ -68,7 +71,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars ) // p->pMemSet = Mem_FixedStart( p->nSetBytes ); // report expected memory usage if ( p->pPars->fVerbose ) - printf( "K = %d. Memory (bytes): Truth = %4d. Cut = %4d. Obj = %4d. Set = %4d.\n", + Abc_Print( 1, "K = %d. Memory (bytes): Truth = %4d. Cut = %4d. Obj = %4d. Set = %4d.\n", p->pPars->nLutSize, 4 * p->nTruthWords, p->nCutBytes, p->nObjBytes, p->nSetBytes ); // room for temporary truth tables p->puTemp[0] = p->pPars->fTruth? ABC_ALLOC( unsigned, 4 * p->nTruthWords ) : NULL; @@ -76,7 +79,7 @@ If_Man_t * If_ManStart( If_Par_t * pPars ) p->puTemp[2] = p->puTemp[1] + p->nTruthWords; p->puTemp[3] = p->puTemp[2] + p->nTruthWords; // create the constant node - p->pConst1 = If_ManSetupObj( p ); + p->pConst1 = If_ManSetupObj( p ); p->pConst1->Type = IF_CONST1; p->pConst1->fPhase = 1; p->nObjs[IF_CONST1]++; @@ -124,8 +127,11 @@ void If_ManRestart( If_Man_t * p ) ***********************************************************************/ void If_ManStop( If_Man_t * p ) { -// ABC_PRT( "Truth", p->timeTruth ); -// printf( "Small support = %d.\n", p->nSmallSupp ); + if ( p->nCutsUseless && p->pPars->fVerbose ) + Abc_Print( 1, "Useless cuts = %7d (out of %7d) (%6.2f %%)\n", p->nCutsUseless, p->nCutsTotal, 100.0*p->nCutsUseless/(p->nCutsTotal+1) ); +// Abc_PrintTime( 1, "Truth", p->timeTruth ); +// Abc_Print( 1, "Small support = %d.\n", p->nSmallSupp ); + Vec_IntFreeP( &p->vCoAttrs ); Vec_PtrFree( p->vCis ); Vec_PtrFree( p->vCos ); Vec_PtrFree( p->vObjs ); @@ -192,6 +198,7 @@ If_Obj_t * If_ManCreateCo( If_Man_t * p, If_Obj_t * pDriver ) pObj->Type = IF_CO; pObj->fCompl0 = If_IsComplement(pDriver); pDriver = If_Regular(pDriver); pObj->pFanin0 = pDriver; pDriver->nRefs++; + pObj->fPhase = (pObj->fCompl0 ^ pDriver->fPhase); pObj->Level = pDriver->Level; if ( p->nLevelMax < (int)pObj->Level ) p->nLevelMax = (int)pObj->Level; @@ -379,6 +386,8 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId ) for ( i = 0; i < nTruthWords; i++ ) If_CutTruth(pCut)[i] = 0xAAAAAAAA; } + + assert( pCut->pLeaves[0] < p->vObjs->nSize ); } /**Function************************************************************* @@ -566,12 +575,12 @@ void If_ManSetupSetAll( If_Man_t * p, int nCrossCut ) if ( p->pPars->fVerbose ) { - printf( "Node = %7d. Ch = %5d. Total mem = %7.2f Mb. Peak cut mem = %7.2f Mb.\n", + Abc_Print( 1, "Node = %7d. Ch = %5d. Total mem = %7.2f Mb. Peak cut mem = %7.2f Mb.\n", If_ManAndNum(p), p->nChoices, 1.0 * (p->nObjBytes + 2*sizeof(void *)) * If_ManObjNum(p) / (1<<20), 1.0 * p->nSetBytes * nCrossCut / (1<<20) ); } -// printf( "Cross cut = %d.\n", nCrossCut ); +// Abc_Print( 1, "Cross cut = %d.\n", nCrossCut ); } @@ -580,3 +589,5 @@ void If_ManSetupSetAll( If_Man_t * p, int nCrossCut ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c index ca57868d..66e59d2f 100644 --- a/src/map/if/ifMap.c +++ b/src/map/if/ifMap.c @@ -20,6 +20,9 @@ #include "if.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -87,10 +90,13 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep if ( pCut->nLeaves > 0 ) { // recompute the parameters of the best cut - pCut->Delay = If_CutDelay( p, pCut ); + if ( p->pPars->fDelayOpt ) + pCut->Delay = If_CutDelaySopCost( p, pCut ); + else + pCut->Delay = If_CutDelay( p, pCut ); // assert( pCut->Delay <= pObj->Required + p->fEpsilon ); if ( pCut->Delay > pObj->Required + 2*p->fEpsilon ) - printf( "If_ObjPerformMappingAnd(): Warning! Delay of node %d (%f) exceeds the required times (%f).\n", + Abc_Print( 1, "If_ObjPerformMappingAnd(): Warning! Delay of node %d (%f) exceeds the required times (%f).\n", pObj->Id, pCut->Delay, pObj->Required + p->fEpsilon ); pCut->Area = (Mode == 2)? If_CutAreaDerefed( p, pCut ) : If_CutAreaFlow( p, pCut ); if ( p->pPars->fEdge ) @@ -106,17 +112,20 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep If_ObjForEachCut( pObj->pFanin0, pCut0, i ) If_ObjForEachCut( pObj->pFanin1, pCut1, k ) { - // get the next ABC_FREE cut + // get the next free cut assert( pCutSet->nCuts <= pCutSet->nCutsMax ); pCut = pCutSet->ppCuts[pCutSet->nCuts]; // make sure K-feasible cut exists if ( If_WordCountOnes(pCut0->uSign | pCut1->uSign) > p->pPars->nLutSize ) continue; - // merge the nodes + // merge the cuts if ( !If_CutMerge( pCut0, pCut1, pCut ) ) continue; + if ( pObj->fSpec && pCut->nLeaves == (unsigned)p->pPars->nLutSize ) + continue; assert( p->pPars->fSeqMap || pCut->nLeaves > 1 ); p->nCutsMerged++; + p->nCutsTotal++; // check if this cut is contained in any of the available cuts // if ( p->pPars->pFuncCost == NULL && If_CutFilter( p, pCut ) ) // do not filter functionality cuts if ( If_CutFilter( pCutSet, pCut ) ) @@ -128,6 +137,12 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep // int clk = clock(); If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 ); // p->timeTruth += clock() - clk; + if ( p->pPars->pFuncCell ) + { + assert( pCut->nLimit >= 4 && pCut->nLimit <= 6 ); + pCut->fUseless = !p->pPars->pFuncCell( If_CutTruth(pCut), pCut->nLimit, pCut->nLeaves ); + p->nCutsUseless += pCut->fUseless; + } } // compute the application-specific cost and depth pCut->fUser = (p->pPars->pFuncCost != NULL); @@ -135,8 +150,11 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep if ( pCut->Cost == IF_COST_MAX ) continue; // check if the cut satisfies the required times - pCut->Delay = If_CutDelay( p, pCut ); -// printf( "%.2f ", pCut->Delay ); + if ( p->pPars->fDelayOpt ) + pCut->Delay = If_CutDelaySopCost( p, pCut ); + else + pCut->Delay = If_CutDelay( p, pCut ); +// Abc_Print( 1, "%.2f ", pCut->Delay ); if ( Mode && pCut->Delay > pObj->Required + p->fEpsilon ) continue; // compute area of the cut (this area may depend on the application specific cost) @@ -163,6 +181,8 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep // ref the selected cut if ( Mode && pObj->nRefs > 0 ) If_CutAreaRef( p, If_ObjCutBest(pObj) ); + if ( If_ObjCutBest(pObj)->fUseless ) + Abc_Print( 1, "The best cut is useless.\n" ); // call the user specified function for each cut if ( p->pPars->pFuncUser ) @@ -214,7 +234,7 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP If_ObjForEachCut( pTemp, pCutTemp, i ) { assert( p->pPars->fSeqMap || pCutTemp->nLeaves > 1 ); - // get the next ABC_FREE cut + // get the next free cut assert( pCutSet->nCuts <= pCutSet->nCutsMax ); pCut = pCutSet->ppCuts[pCutSet->nCuts]; // copy the cut into storage @@ -239,7 +259,7 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP // insert the cut into storage If_CutSort( p, pCutSet, pCut ); } - } + } assert( pCutSet->nCuts > 0 ); // add the trivial cut to the set @@ -304,7 +324,7 @@ int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode, int fPrepr } else if ( If_ObjIsCi(pObj) ) { -//printf( "processing CI %d\n", pObj->Id ); +//Abc_Print( 1, "processing CI %d\n", pObj->Id ); arrTime = Tim_ManGetCiArrival( p->pManTim, pObj->IdPio ); If_ObjSetArrTime( pObj, arrTime ); } @@ -342,10 +362,10 @@ int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode, int fPrepr if ( p->pPars->fVerbose ) { char Symb = fPreprocess? 'P' : ((Mode == 0)? 'D' : ((Mode == 1)? 'F' : 'A')); - printf( "%c: Del = %7.2f. Ar = %9.1f. Edge = %8d. Switch = %7.2f. Cut = %8d. ", + Abc_Print( 1, "%c: Del = %7.2f. Ar = %9.1f. Edge = %8d. Switch = %7.2f. Cut = %8d. ", Symb, p->RequiredGlo, p->AreaGlo, p->nNets, p->dPower, p->nCutsMerged ); - ABC_PRT( "T", clock() - clk ); -// printf( "Max number of cuts = %d. Average number of cuts = %5.2f.\n", + Abc_PrintTime( 1, "T", clock() - clk ); +// Abc_Print( 1, "Max number of cuts = %d. Average number of cuts = %5.2f.\n", // p->nCutsMax, 1.0 * p->nCutsMerged / If_ManAndNum(p) ); } return 1; @@ -357,3 +377,5 @@ int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode, int fPrepr //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/if/ifReduce.c b/src/map/if/ifReduce.c index b3130600..622688e7 100644 --- a/src/map/if/ifReduce.c +++ b/src/map/if/ifReduce.c @@ -20,6 +20,9 @@ #include "if.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -55,9 +58,9 @@ void If_ManImproveMapping( If_Man_t * p ) If_ManComputeRequired( p ); if ( p->pPars->fVerbose ) { - printf( "E: Del = %7.2f. Ar = %9.1f. Edge = %8d. Switch = %7.2f. Cut = %8d. ", + Abc_Print( 1, "E: Del = %7.2f. Ar = %9.1f. Edge = %8d. Switch = %7.2f. Cut = %8d. ", p->RequiredGlo, p->AreaGlo, p->nNets, p->dPower, p->nCutsMerged ); - ABC_PRT( "T", clock() - clk ); + Abc_PrintTime( 1, "T", clock() - clk ); } /* @@ -66,9 +69,9 @@ void If_ManImproveMapping( If_Man_t * p ) If_ManComputeRequired( p, 0 ); if ( p->pPars->fVerbose ) { - printf( "R: Del = %6.2f. Area = %8.2f. Nets = %6d. Cuts = %8d. Lim = %2d. Ave = %5.2f. ", + Abc_Print( 1, "R: Del = %6.2f. Area = %8.2f. Nets = %6d. Cuts = %8d. Lim = %2d. Ave = %5.2f. ", p->RequiredGlo, p->AreaGlo, p->nNets, p->nCutsMerged, p->nCutsUsed, 1.0 * p->nCutsMerged / If_ManAndNum(p) ); - ABC_PRT( "T", clock() - clk ); + Abc_PrintTime( 1, "T", clock() - clk ); } */ /* @@ -77,9 +80,9 @@ void If_ManImproveMapping( If_Man_t * p ) If_ManComputeRequired( p, 0 ); if ( p->pPars->fVerbose ) { - printf( "E: Del = %6.2f. Area = %8.2f. Nets = %6d. Cuts = %8d. Lim = %2d. Ave = %5.2f. ", + Abc_Print( 1, "E: Del = %6.2f. Area = %8.2f. Nets = %6d. Cuts = %8d. Lim = %2d. Ave = %5.2f. ", p->RequiredGlo, p->AreaGlo, p->nNets, p->nCutsMerged, p->nCutsUsed, 1.0 * p->nCutsMerged / If_ManAndNum(p) ); - ABC_PRT( "T", clock() - clk ); + Abc_PrintTime( 1, "T", clock() - clk ); } */ } @@ -126,7 +129,7 @@ int If_ManImproveCutCost( If_Man_t * p, Vec_Ptr_t * vFront ) { If_Obj_t * pFanin; int i, Counter = 0; - Vec_PtrForEachEntry( vFront, pFanin, i ) + Vec_PtrForEachEntry( If_Obj_t *, vFront, pFanin, i ) if ( pFanin->nRefs == 0 ) Counter++; return Counter; @@ -170,7 +173,7 @@ void If_ManImproveNodeExpand( If_Man_t * p, If_Obj_t * pObj, int nLimit, Vec_Ptr If_CutAreaRef( p, pCut ); assert( CostBef >= CostAft ); // clean up - Vec_PtrForEachEntry( vVisited, pFanin, i ) + Vec_PtrForEachEntry( If_Obj_t *, vVisited, pFanin, i ) pFanin->fMark = 0; // update the node If_ManImproveNodeUpdate( p, pObj, vFront ); @@ -261,7 +264,7 @@ void If_ManImproveNodeUpdate( If_Man_t * p, If_Obj_t * pObj, Vec_Ptr_t * vFront If_CutAreaDeref( p, pCut ); // update the node's cut pCut->nLeaves = Vec_PtrSize(vFront); - Vec_PtrForEachEntry( vFront, pFanin, i ) + Vec_PtrForEachEntry( If_Obj_t *, vFront, pFanin, i ) pCut->pLeaves[i] = pFanin->Id; If_CutOrder( pCut ); // ref the new cut @@ -363,7 +366,7 @@ int If_ManImproveNodeFaninCompact0( If_Man_t * p, If_Obj_t * pObj, int nLimit, V { If_Obj_t * pFanin; int i; - Vec_PtrForEachEntry( vFront, pFanin, i ) + Vec_PtrForEachEntry( If_Obj_t *, vFront, pFanin, i ) { if ( If_ObjIsCi(pFanin) ) continue; @@ -393,7 +396,7 @@ int If_ManImproveNodeFaninCompact1( If_Man_t * p, If_Obj_t * pObj, int nLimit, V { If_Obj_t * pFanin; int i; - Vec_PtrForEachEntry( vFront, pFanin, i ) + Vec_PtrForEachEntry( If_Obj_t *, vFront, pFanin, i ) { if ( If_ObjIsCi(pFanin) ) continue; @@ -421,7 +424,7 @@ int If_ManImproveNodeFaninCompact2( If_Man_t * p, If_Obj_t * pObj, int nLimit, V { If_Obj_t * pFanin; int i; - Vec_PtrForEachEntry( vFront, pFanin, i ) + Vec_PtrForEachEntry( If_Obj_t *, vFront, pFanin, i ) { if ( If_ObjIsCi(pFanin) ) continue; @@ -574,3 +577,5 @@ void If_ManImproveReduce( If_Man_t * p, int nLimit ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/if/ifSeq.c b/src/map/if/ifSeq.c index e4e27e71..8b5808d5 100644 --- a/src/map/if/ifSeq.c +++ b/src/map/if/ifSeq.c @@ -20,6 +20,9 @@ #include "if.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -99,7 +102,7 @@ Vec_Ptr_t * If_ManCollectLatches( If_Man_t * p ) If_ManForEachLatchOutput( p, pObj, i ) If_ManCollectLatches_rec( pObj, vLatches ); // clean marks - Vec_PtrForEachEntry( vLatches, pObj, i ) + Vec_PtrForEachEntry( If_Obj_t *, vLatches, pObj, i ) pObj->fMark = 0; assert( Vec_PtrSize(vLatches) == p->pPars->nLatches ); return vLatches; @@ -127,7 +130,7 @@ int If_ManPerformMappingRoundSeq( If_Man_t * p, int nIter ) if ( nIter == 1 ) { // if some latches depend on PIs, update their values - Vec_PtrForEachEntry( p->vLatchOrder, pObj, i ) + Vec_PtrForEachEntry( If_Obj_t *, p->vLatchOrder, pObj, i ) { If_ObjSetLValue( pObj, If_ObjLValue(If_ObjFanin0(pObj)) - p->Period ); If_ObjSetArrTime( pObj, If_ObjLValue(pObj) ); @@ -144,7 +147,7 @@ int If_ManPerformMappingRoundSeq( If_Man_t * p, int nIter ) } // postprocess the mapping -//printf( "Itereation %d: \n", nIter ); +//Abc_Print( 1, "Itereation %d: \n", nIter ); If_ManForEachNode( p, pObj, i ) { // update the LValues stored separately @@ -153,15 +156,15 @@ int If_ManPerformMappingRoundSeq( If_Man_t * p, int nIter ) If_ObjSetLValue( pObj, If_ObjCutBest(pObj)->Delay ); fChange = 1; } -//printf( "%d ", (int)If_ObjLValue(pObj) ); +//Abc_Print( 1, "%d ", (int)If_ObjLValue(pObj) ); // reset the visit counters assert( pObj->nVisits == 0 ); pObj->nVisits = pObj->nVisitsCopy; } -//printf( "\n" ); +//Abc_Print( 1, "\n" ); // propagate LValues over the registers - Vec_PtrForEachEntry( p->vLatchOrder, pObj, i ) + Vec_PtrForEachEntry( If_Obj_t *, p->vLatchOrder, pObj, i ) { If_ObjSetLValue( pObj, If_ObjLValue(If_ObjFanin0(pObj)) - p->Period ); If_ObjSetArrTime( pObj, If_ObjLValue(pObj) ); @@ -173,9 +176,9 @@ int If_ManPerformMappingRoundSeq( If_Man_t * p, int nIter ) { p->RequiredGlo = If_ManDelayMax( p, 1 ); // p->AreaGlo = If_ManScanMapping(p); - printf( "S%d: Fi = %6.2f. Del = %6.2f. Area = %8.2f. Cuts = %8d. ", + Abc_Print( 1, "S%d: Fi = %6.2f. Del = %6.2f. Area = %8.2f. Cuts = %8d. ", nIter, (float)p->Period, p->RequiredGlo, p->AreaGlo, p->nCutsMerged ); - ABC_PRT( "T", clock() - clk ); + Abc_PrintTime( 1, "T", clock() - clk ); } return fChange; } @@ -228,7 +231,7 @@ int If_ManBinarySearchPeriod( If_Man_t * p ) break; } p->RequiredGlo = If_ManDelayMax( p, 1 ); -//printf( "Global = %d \n", (int)p->RequiredGlo ); +//Abc_Print( 1, "Global = %d \n", (int)p->RequiredGlo ); if ( p->RequiredGlo > p->Period + p->fEpsilon ) break; } @@ -238,14 +241,14 @@ int If_ManBinarySearchPeriod( If_Man_t * p ) if ( p->pPars->fVerbose ) { // p->AreaGlo = If_ManScanMapping(p); - printf( "Attempt = %2d. Iters = %3d. Area = %10.2f. Fi = %6.2f. ", p->nAttempts, c, p->AreaGlo, (float)p->Period ); + Abc_Print( 1, "Attempt = %2d. Iters = %3d. Area = %10.2f. Fi = %6.2f. ", p->nAttempts, c, p->AreaGlo, (float)p->Period ); if ( fConverged ) - printf( " Feasible" ); + Abc_Print( 1, " Feasible" ); else if ( c > p->nMaxIters ) - printf( "Infeasible (timeout)" ); + Abc_Print( 1, "Infeasible (timeout)" ); else - printf( "Infeasible" ); - printf( "\n" ); + Abc_Print( 1, "Infeasible" ); + Abc_Print( 1, "\n" ); } return fConverged; } @@ -302,12 +305,12 @@ void If_ManPerformMappingSeqPost( If_Man_t * p ) If_ManForEachPo( p, pObj, i ) { p->pPars->pTimesReq[i] = p->RequiredGlo2; -// printf( "Out %3d : %2d \n", i, (int)p->pPars->pTimesReq[i] ); +// Abc_Print( 1, "Out %3d : %2d \n", i, (int)p->pPars->pTimesReq[i] ); } If_ManForEachLatchInput( p, pObjLi, i ) { p->pPars->pTimesReq[i] = If_ObjLValue(If_ObjFanin0(pObjLi)); -// printf( "Out %3d : %2d \n", i, (int)p->pPars->pTimesReq[i] ); +// Abc_Print( 1, "Out %3d : %2d \n", i, (int)p->pPars->pTimesReq[i] ); } // undo previous mapping @@ -359,7 +362,7 @@ int If_ManPerformMappingSeq( If_Man_t * p ) // make sure the clock period works if ( !If_ManBinarySearchPeriod( p ) ) { - printf( "If_ManPerformMappingSeq(): The upper bound on the clock period cannot be computed.\n" ); + Abc_Print( 1, "If_ManPerformMappingSeq(): The upper bound on the clock period cannot be computed.\n" ); return 0; } @@ -372,14 +375,14 @@ int If_ManPerformMappingSeq( If_Man_t * p ) p->Period = PeriodBest; if ( !If_ManBinarySearchPeriod( p ) ) { - printf( "If_ManPerformMappingSeq(): The final clock period cannot be confirmed.\n" ); + Abc_Print( 1, "If_ManPerformMappingSeq(): The final clock period cannot be confirmed.\n" ); return 0; } } // if ( p->pPars->fVerbose ) { - printf( "The best clock period is %3d. ", p->Period ); - ABC_PRT( "Time", clock() - clkTotal ); + Abc_Print( 1, "The best clock period is %3d. ", p->Period ); + Abc_PrintTime( 1, "Time", clock() - clkTotal ); } p->RequiredGlo = (float)(PeriodBest); @@ -394,3 +397,5 @@ int If_ManPerformMappingSeq( If_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/if/ifTime.c b/src/map/if/ifTime.c index 20521805..bfe0d969 100644 --- a/src/map/if/ifTime.c +++ b/src/map/if/ifTime.c @@ -19,6 +19,10 @@ ***********************************************************************/ #include "if.h" +#include "kit.h" + +ABC_NAMESPACE_IMPL_START + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// @@ -32,6 +36,363 @@ static void If_CutSortInputPins( If_Man_t * p, If_Cut_t * pCut, int * pPinPerm, /**Function************************************************************* + Synopsis [Inserts the entry while sorting them by delay.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +word If_AndVerifyArray( Vec_Wrd_t * vAnds, int nVars ) +{ + Vec_Wrd_t * vTruths; + If_And_t This; + word Entry, Truth0, Truth1, TruthR; + int i; + static word Truth[8] = { + 0xAAAAAAAAAAAAAAAA, + 0xCCCCCCCCCCCCCCCC, + 0xF0F0F0F0F0F0F0F0, + 0xFF00FF00FF00FF00, + 0xFFFF0000FFFF0000, + 0xFFFFFFFF00000000, + 0x0000000000000000, + 0xFFFFFFFFFFFFFFFF + }; + if ( Vec_WrdSize(vAnds) == 0 ) + return Truth[6]; + if ( Vec_WrdSize(vAnds) == 1 && Vec_WrdEntry(vAnds,0) == 0 ) + return Truth[7]; + vTruths = Vec_WrdAlloc( Vec_WrdSize(vAnds) ); + for ( i = 0; i < nVars; i++ ) + Vec_WrdPush( vTruths, Truth[i] ); + Vec_WrdForEachEntryStart( vAnds, Entry, i, nVars ) + { + This = If_WrdToAnd(Entry); + Truth0 = Vec_WrdEntry( vTruths, This.iFan0 ); + Truth0 = This.fCompl0 ? ~Truth0 : Truth0; + Truth1 = Vec_WrdEntry( vTruths, This.iFan1 ); + Truth1 = This.fCompl1 ? ~Truth1 : Truth1; + TruthR = Truth0 & Truth1; + Vec_WrdPush( vTruths, TruthR ); + } + Vec_WrdFree( vTruths ); + TruthR = This.fCompl ? ~TruthR : TruthR; + return TruthR; +} + +/**Function************************************************************* + + Synopsis [Inserts the entry while sorting them by delay.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void If_AndInsertSorted( Vec_Wrd_t * vAnds, If_And_t And ) +{ + If_And_t This, Prev; + int i; + Vec_WrdPush( vAnds, If_AndToWrd(And) ); + for ( i = Vec_WrdSize(vAnds) - 1; i > 0; i-- ) + { + This = If_WrdToAnd( Vec_WrdEntry(vAnds, i) ); + Prev = If_WrdToAnd( Vec_WrdEntry(vAnds, i-1) ); + if ( This.Delay <= Prev.Delay ) + break; + Vec_WrdWriteEntry( vAnds, i, If_AndToWrd(Prev) ); + Vec_WrdWriteEntry( vAnds, i-1, If_AndToWrd(This) ); + } +} + +/**Function************************************************************* + + Synopsis [Decomposes the cube into a bunch of AND gates.] + + Description [Records the result of decomposition into vLits. Returns + the last AND gate of the decomposition.] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +If_And_t If_CutDelaySopCube( Vec_Wrd_t * vCube, Vec_Wrd_t * vAnds, int fOrGate ) +{ + If_And_t This, Prev, Next; + assert( Vec_WrdSize(vCube) > 0 ); + while ( Vec_WrdSize(vCube) > 1 ) + { + // get last + This = If_WrdToAnd( Vec_WrdPop(vCube) ); + Prev = If_WrdToAnd( Vec_WrdPop(vCube) ); + // create new + If_AndClear( &Next ); + Next.iFan0 = Prev.Id; + Next.fCompl0 = Prev.fCompl ^ fOrGate; + Next.iFan1 = This.Id; + Next.fCompl1 = This.fCompl ^ fOrGate; + Next.Id = Vec_WrdSize(vAnds); + Next.fCompl = fOrGate; + Next.Delay = 1 + ABC_MAX( This.Delay, Prev.Delay ); + // add new + If_AndInsertSorted( vCube, Next ); + Vec_WrdPush( vAnds, If_AndToWrd(Next) ); + } + return If_WrdToAnd( Vec_WrdPop(vCube) ); +} + + + +/**Function************************************************************* + + Synopsis [Returns the well-balanced structure of AIG nodes.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Vec_Wrd_t * If_CutDelaySopAnds( If_Man_t * p, If_Cut_t * pCut, Vec_Int_t * vCover, int fCompl ) +{ + Vec_Wrd_t * vAnds, * vAndGate, * vOrGate; + If_Obj_t * pLeaf; + If_And_t Leaf; + int i, k, Entry, Literal; + vAnds = Vec_WrdAlloc( 32 ); + if ( Vec_IntSize(vCover) == 0 ) // const 0 + { + assert( fCompl == 0 ); + return vAnds; + } + if ( Vec_IntSize(vCover) == 1 && Vec_IntEntry(vCover, 0) == 0 ) // const 1 + { + assert( fCompl == 0 ); + Vec_WrdPush( vAnds, 0 ); + return vAnds; + } + If_CutForEachLeaf( p, pCut, pLeaf, k ) + { + If_AndClear( &Leaf ); + Leaf.Id = k; + Leaf.Delay = (int)If_ObjCutBest(pLeaf)->Delay; + Vec_WrdPush( vAnds, If_AndToWrd(Leaf) ); + } + // iterate through the cubes + vOrGate = Vec_WrdAlloc( 16 ); + vAndGate = Vec_WrdAlloc( 16 ); + Vec_IntForEachEntry( vCover, Entry, i ) + { + Vec_WrdClear( vAndGate ); + If_CutForEachLeaf( p, pCut, pLeaf, k ) + { + Literal = 3 & (Entry >> (k << 1)); + if ( Literal == 1 ) // neg literal + { + If_AndClear( &Leaf ); + Leaf.fCompl = 1; + Leaf.Id = k; + Leaf.Delay = (int)If_ObjCutBest(pLeaf)->Delay; + If_AndInsertSorted( vAndGate, Leaf ); + } + else if ( Literal == 2 ) // pos literal + { + If_AndClear( &Leaf ); + Leaf.Id = k; + Leaf.Delay = (int)If_ObjCutBest(pLeaf)->Delay; + If_AndInsertSorted( vAndGate, Leaf ); + } + else if ( Literal != 0 ) + assert( 0 ); + } + Leaf = If_CutDelaySopCube( vAndGate, vAnds, 0 ); + If_AndInsertSorted( vOrGate, Leaf ); + } + Leaf = If_CutDelaySopCube( vOrGate, vAnds, 1 ); + Vec_WrdFree( vAndGate ); + Vec_WrdFree( vOrGate ); + if ( Vec_WrdSize(vAnds) == (int)pCut->nLeaves ) + { +// Extra_PrintBinary( stdout, If_CutTruth(pCut), 32 ); printf( "\n" ); + assert( Leaf.Id < pCut->nLeaves ); + Leaf.iFan0 = Leaf.iFan1 = Leaf.Id; + Leaf.Id = Vec_WrdSize(vAnds); + Vec_WrdPush( vAnds, If_AndToWrd(Leaf) ); + } + if ( fCompl ) + { + Leaf = If_WrdToAnd( Vec_WrdPop(vAnds) ); + Leaf.fCompl ^= 1; + Vec_WrdPush( vAnds, If_AndToWrd(Leaf) ); + } + return vAnds; +} + +/**Function************************************************************* + + Synopsis [Computes balanced AND decomposition.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Vec_Wrd_t * If_CutDelaySopArray( If_Man_t * p, If_Cut_t * pCut ) +{ + Vec_Int_t * vCover; + Vec_Wrd_t * vAnds; + int RetValue; + vCover = Vec_IntAlloc(0); + RetValue = Kit_TruthIsop( If_CutTruth(pCut), If_CutLeaveNum(pCut), vCover, 1 ); + if ( RetValue == -1 ) + { + Vec_IntFree( vCover ); + return NULL; + } + assert( RetValue == 0 || RetValue == 1 ); + vAnds = If_CutDelaySopAnds( p, pCut, vCover, RetValue ^ pCut->fCompl ); +/* + if ( pCut->nLeaves <= 5 ) + { + if ( *If_CutTruth(pCut) != (unsigned)If_AndVerifyArray(vAnds, pCut->nLeaves) ) + { + unsigned Truth0 = *If_CutTruth(pCut); + unsigned Truth1 = (unsigned)If_AndVerifyArray(vAnds, pCut->nLeaves); + + printf( "\n" ); + Extra_PrintBinary( stdout, &Truth0, 32 ); printf( "\n" ); + Extra_PrintBinary( stdout, &Truth1, 32 ); printf( "\n" ); + + printf( "Verification failed for %d vars.\n", pCut->nLeaves ); + } +// else +// printf( "Verification passed for %d vars.\n", pCut->nLeaves ); + } + else if ( pCut->nLeaves == 6 ) + { + if ( *((word *)If_CutTruth(pCut)) != If_AndVerifyArray(vAnds, pCut->nLeaves) ) + printf( "Verification failed for %d vars.\n", pCut->nLeaves ); +// else +// printf( "Verification passed for %d vars.\n", pCut->nLeaves ); + } +*/ + Vec_IntFree( vCover ); + return vAnds; +} + + +/**Function************************************************************* + + Synopsis [Derives the maximum depth from the leaf to the root.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int If_CutDelayLeafDepth_rec( Vec_Wrd_t * vAnds, If_And_t And, int iLeaf ) +{ + int Depth0, Depth1, Depth; + if ( (int)And.Id == iLeaf ) + return 0; + if ( And.iFan0 == And.iFan1 ) + return -100; + Depth0 = If_CutDelayLeafDepth_rec( vAnds, If_WrdToAnd(Vec_WrdEntry(vAnds, And.iFan0)), iLeaf ); + Depth1 = If_CutDelayLeafDepth_rec( vAnds, If_WrdToAnd(Vec_WrdEntry(vAnds, And.iFan1)), iLeaf ); + Depth = ABC_MAX( Depth0, Depth1 ); + Depth = (Depth == -100) ? -100 : Depth + 1; + return Depth; +} + +/**Function************************************************************* + + Synopsis [Derives the maximum depth from the leaf to the root.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int If_CutDelayLeafDepth( Vec_Wrd_t * vAnds, int iLeaf ) +{ + If_And_t Leaf; + if ( Vec_WrdSize(vAnds) == 0 ) // const 0 + return -100; + if ( Vec_WrdSize(vAnds) == 1 && Vec_WrdEntry(vAnds, 0) == 0 ) // const 1 + return -100; + Leaf = If_WrdToAnd(Vec_WrdEntryLast(vAnds)); + if ( Leaf.iFan0 == Leaf.iFan1 ) + { + if ( (int)Leaf.iFan0 == iLeaf ) + return 0; + return -100; + } + return If_CutDelayLeafDepth_rec( vAnds, Leaf, iLeaf ); +} + + +/**Function************************************************************* + + Synopsis [Computes the SOP delay using balanced AND decomposition.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int If_CutDelaySopCost( If_Man_t * p, If_Cut_t * pCut ) +{ + If_And_t Leaf; + Vec_Wrd_t * vAnds; + int i;//, Delay; + // mark cut as a user cut + pCut->fUser = 1; + vAnds = If_CutDelaySopArray( p, pCut ); + if ( vAnds == NULL ) + { + assert( 0 ); + return ABC_INFINITY; + } + // get the cost + If_AndClear( &Leaf ); + if ( Vec_WrdSize(vAnds) ) + Leaf = If_WrdToAnd( Vec_WrdEntryLast(vAnds) ); + if ( pCut->nLeaves > 2 && Vec_WrdSize(vAnds) > (int)pCut->nLeaves ) + pCut->Cost = Vec_WrdSize(vAnds) - pCut->nLeaves; + else + pCut->Cost = 1; + // get the permutation + for ( i = 0; i < (int)pCut->nLeaves; i++ ) + pCut->pPerm[i] = If_CutDelayLeafDepth( vAnds, i ); + Vec_WrdFree( vAnds ); + // verify the delay +// Delay = If_CutDelay( p, pCut ); +// assert( (int)Leaf.Delay == Delay ); + return Leaf.Delay; +} + + + + + + +/**Function************************************************************* + Synopsis [Computes delay.] Description [] @@ -81,7 +442,7 @@ float If_CutDelay( If_Man_t * p, If_Cut_t * pCut ) assert( !p->pPars->fLiftLeaves ); If_CutForEachLeaf( p, pCut, pLeaf, i ) { - DelayCur = If_ObjCutBest(pLeaf)->Delay + (float)pCut->pPerm[i]; + DelayCur = If_ObjCutBest(pLeaf)->Delay + (float)(pCut->pPerm ? pCut->pPerm[i] : 1.0); Delay = IF_MAX( Delay, DelayCur ); } } @@ -99,13 +460,6 @@ float If_CutDelay( If_Man_t * p, If_Cut_t * pCut ) { If_CutForEachLeaf( p, pCut, pLeaf, i ) { -/* - if ( pLeaf->IdPio > 2000 ) - { - int x = 0; - printf( "-%d %6.3f ", pLeaf->IdPio, If_ObjCutBest(pLeaf)->Delay ); - } -*/ DelayCur = If_ObjCutBest(pLeaf)->Delay; Delay = IF_MAX( Delay, DelayCur ); } @@ -164,7 +518,7 @@ void If_CutPropagateRequired( If_Man_t * p, If_Cut_t * pCut, float ObjRequired ) { If_CutForEachLeaf( p, pCut, pLeaf, i ) { - Required = ObjRequired - (float)pCut->pPerm[i]; + Required = ObjRequired - (float)(pCut->pPerm ? pCut->pPerm[i] : 1.0); pLeaf->Required = IF_MIN( pLeaf->Required, Required ); } } @@ -252,3 +606,5 @@ void If_CutRotatePins( If_Man_t * p, If_Cut_t * pCut ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/if/ifTruth.c b/src/map/if/ifTruth.c index 637a42b4..75bc49db 100644 --- a/src/map/if/ifTruth.c +++ b/src/map/if/ifTruth.c @@ -20,6 +20,9 @@ #include "if.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -414,6 +417,7 @@ int If_CutTruthMinimize( If_Man_t * p, If_Cut_t * pCut ) // if ( If_CutLeaveNum(pCut) - nSuppSize > 1 ) // return 0; //printf( "%d %d ", If_CutLeaveNum(pCut), nSuppSize ); +// pCut->fUseless = 1; // shrink the truth table If_TruthShrink( p->puTemp[0], If_CutTruth(pCut), nSuppSize, pCut->nLimit, uSupport, 1 ); @@ -440,3 +444,5 @@ int If_CutTruthMinimize( If_Man_t * p, If_Cut_t * pCut ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/if/ifUtil.c b/src/map/if/ifUtil.c index 1e6d7704..da3a4aa5 100644 --- a/src/map/if/ifUtil.c +++ b/src/map/if/ifUtil.c @@ -20,6 +20,9 @@ #include "if.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -103,7 +106,7 @@ float If_ManDelayMax( If_Man_t * p, int fSeq ) int i; if ( p->pPars->fLatchPaths && p->pPars->nLatches == 0 ) { - printf( "Delay optimization of latch path is not performed because there is no latches.\n" ); + Abc_Print( 0, "Delay optimization of latch path is not performed because there is no latches.\n" ); p->pPars->fLatchPaths = 0; } DelayBest = -IF_FLOAT_LARGE; @@ -163,18 +166,25 @@ void If_ManComputeRequired( If_Man_t * p ) if ( If_ObjArrTime(If_ObjFanin0(pObj)) > p->pPars->pTimesReq[i] + p->fEpsilon ) { Counter++; - // printf( "Required times are violated for output %d (arr = %d; req = %d).\n", + // Abc_Print( 0, "Required times are violated for output %d (arr = %d; req = %d).\n", // i, (int)If_ObjArrTime(If_ObjFanin0(pObj)), (int)p->pPars->pTimesReq[i] ); } If_ObjFanin0(pObj)->Required = p->pPars->pTimesReq[i]; } if ( Counter ) - printf( "Required times are violated for %d outputs.\n", Counter ); + Abc_Print( 0, "Required times are violated for %d outputs.\n", Counter ); } else { // get the global required times p->RequiredGlo = If_ManDelayMax( p, 0 ); +/* + //////////////////////////////////////// + // redefine the delay target (positive number means percentage) + if ( p->pPars->DelayTarget > 0 ) + p->pPars->DelayTarget = p->RequiredGlo * (100.0 + p->pPars->DelayTarget) / 100.0; + //////////////////////////////////////// +*/ // update the required times according to the target if ( p->pPars->DelayTarget != -1 ) { @@ -183,7 +193,7 @@ void If_ManComputeRequired( If_Man_t * p ) if ( p->fNextRound == 0 ) { p->fNextRound = 1; - printf( "Cannot meet the target required times (%4.2f). Mapping continues anyway.\n", p->pPars->DelayTarget ); + Abc_Print( 0, "Cannot meet the target required times (%4.2f). Mapping continues anyway.\n", p->pPars->DelayTarget ); } } else if ( p->RequiredGlo < p->pPars->DelayTarget - p->fEpsilon ) @@ -191,7 +201,7 @@ void If_ManComputeRequired( If_Man_t * p ) if ( p->fNextRound == 0 ) { p->fNextRound = 1; - printf( "Relaxing the required times from (%4.2f) to the target (%4.2f).\n", p->RequiredGlo, p->pPars->DelayTarget ); +// Abc_Print( 0, "Relaxing the required times from (%4.2f) to the target (%4.2f).\n", p->RequiredGlo, p->pPars->DelayTarget ); } p->RequiredGlo = p->pPars->DelayTarget; } @@ -212,7 +222,7 @@ void If_ManComputeRequired( If_Man_t * p ) } } // go through the nodes in the reverse topological order - // Vec_PtrForEachEntry( p->vMapped, pObj, i ) + // Vec_PtrForEachEntry( If_Obj_t *, p->vMapped, pObj, i ) // If_CutPropagateRequired( p, If_ObjCutBest(pObj), pObj->Required ); If_ManForEachObjReverse( p, pObj, i ) { @@ -225,12 +235,49 @@ void If_ManComputeRequired( If_Man_t * p ) { // get the global required times p->RequiredGlo = If_ManDelayMax( p, 0 ); + // update the required times according to the target + if ( p->pPars->DelayTarget != -1 ) + { + if ( p->RequiredGlo > p->pPars->DelayTarget + p->fEpsilon ) + { + if ( p->fNextRound == 0 ) + { + p->fNextRound = 1; + Abc_Print( 0, "Cannot meet the target required times (%4.2f). Mapping continues anyway.\n", p->pPars->DelayTarget ); + } + } + else if ( p->RequiredGlo < p->pPars->DelayTarget - p->fEpsilon ) + { + if ( p->fNextRound == 0 ) + { + p->fNextRound = 1; +// Abc_Print( 0, "Relaxing the required times from (%4.2f) to the target (%4.2f).\n", p->RequiredGlo, p->pPars->DelayTarget ); + } + p->RequiredGlo = p->pPars->DelayTarget; + } + } // do not propagate required times if area minimization is requested if ( p->pPars->fAreaOnly ) return; // set the required times for the POs Tim_ManIncrementTravId( p->pManTim ); - if ( p->pPars->fLatchPaths ) + if ( p->vCoAttrs ) + { + assert( If_ManCoNum(p) == Vec_IntSize(p->vCoAttrs) ); + If_ManForEachCo( p, pObj, i ) + { + if ( Vec_IntEntry(p->vCoAttrs, i) == -1 ) // -1=internal + continue; + if ( Vec_IntEntry(p->vCoAttrs, i) == 0 ) // 0=optimize + Tim_ManSetCoRequired( p->pManTim, i, p->RequiredGlo ); + else if ( Vec_IntEntry(p->vCoAttrs, i) == 1 ) // 1=keep + Tim_ManSetCoRequired( p->pManTim, i, If_ObjArrTime(If_ObjFanin0(pObj)) ); + else if ( Vec_IntEntry(p->vCoAttrs, i) == 2 ) // 2=relax + Tim_ManSetCoRequired( p->pManTim, i, IF_FLOAT_LARGE ); + else assert( 0 ); + } + } + else if ( p->pPars->fLatchPaths ) { assert( 0 ); If_ManForEachPo( p, pObj, i ) @@ -529,7 +576,7 @@ int If_ManCrossCut( If_Man_t * p ) pObj->nVisits = pObj->nVisitsCopy; } assert( nCutSize == 0 ); -// printf( "Max cross cut size = %6d.\n", nCutSizeMax ); +// Abc_Print( 1, "Max cross cut size = %6d.\n", nCutSizeMax ); return nCutSizeMax; } @@ -561,12 +608,12 @@ Vec_Ptr_t * If_ManReverseOrder( If_Man_t * p ) } vOrder = Vec_PtrAlloc( If_ManObjNum(p) ); for ( i = p->nLevelMax; i >= 0; i-- ) - for ( pObj = ppStore[i]; pObj; pObj = pObj->pCopy ) + for ( pObj = ppStore[i]; pObj; pObj = (If_Obj_t *)pObj->pCopy ) Vec_PtrPush( vOrder, pObj ); ABC_FREE( ppStore ); // print the order -// Vec_PtrForEachEntry( vOrder, pObj, i ) -// printf( "Obj %2d Type %d Level = %d\n", pObj->Id, pObj->Type, pObj->Level ); +// Vec_PtrForEachEntry( If_Obj_t *, vOrder, pObj, i ) +// Abc_Print( 1, "Obj %2d Type %d Level = %d\n", pObj->Id, pObj->Type, pObj->Level ); return vOrder; } @@ -727,3 +774,5 @@ int If_ManCountSpecialPos( If_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/if/if_.c b/src/map/if/if_.c index d2960077..cc7a2162 100644 --- a/src/map/if/if_.c +++ b/src/map/if/if_.c @@ -20,6 +20,9 @@ #include "if.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -45,3 +48,5 @@ //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapper.c b/src/map/mapper/mapper.c index 37052100..f13a7641 100644 --- a/src/map/mapper/mapper.c +++ b/src/map/mapper/mapper.c @@ -21,6 +21,9 @@ #include "mio.h" #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -58,10 +61,10 @@ void Map_Init( Abc_Frame_t * pAbc ) SeeAlso [] ***********************************************************************/ -void Map_End() +void Map_End( Abc_Frame_t * pAbc ) { // Map_SuperLibFree( s_pSuperLib ); - Map_SuperLibFree( Abc_FrameReadLibSuper() ); + Map_SuperLibFree( (Map_SuperLib_t *)Abc_FrameReadLibSuper() ); } @@ -149,13 +152,13 @@ int Map_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv ) // replace the current library // Map_SuperLibFree( s_pSuperLib ); // s_pSuperLib = pLib; - Map_SuperLibFree( Abc_FrameReadLibSuper() ); + Map_SuperLibFree( (Map_SuperLib_t *)Abc_FrameReadLibSuper() ); Abc_FrameSetLibSuper( pLib ); // replace the current genlib library // if ( s_pLib ) Mio_LibraryDelete( s_pLib ); // s_pLib = s_pSuperLib->pGenlib; - Mio_LibraryDelete( Abc_FrameReadLibGen() ); - Abc_FrameSetLibGen( pLib->pGenlib ); + Mio_LibraryDelete( (Mio_Library_t *)Abc_FrameReadLibGen() ); + Abc_FrameSetLibGen( (Mio_Library_t *)pLib->pGenlib ); return 0; usage: @@ -174,3 +177,5 @@ usage: //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapper.h b/src/map/mapper/mapper.h index ac31feac..aaad08ee 100644 --- a/src/map/mapper/mapper.h +++ b/src/map/mapper/mapper.h @@ -19,6 +19,7 @@ #ifndef __MAPPER_H__ #define __MAPPER_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -27,9 +28,10 @@ /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -extern "C" { -#endif + + +ABC_NAMESPACE_HEADER_START + //////////////////////////////////////////////////////////////////////// /// STRUCTURE DEFINITIONS /// @@ -84,7 +86,7 @@ extern Map_Node_t ** Map_ManReadOutputs( Map_Man_t * p ); extern Map_Node_t * Map_ManReadConst1 ( Map_Man_t * p ); extern Map_Time_t * Map_ManReadInputArrivals( Map_Man_t * p ); extern Mio_Library_t * Map_ManReadGenLib ( Map_Man_t * p ); -extern bool Map_ManReadVerbose( Map_Man_t * p ); +extern int Map_ManReadVerbose( Map_Man_t * p ); extern float Map_ManReadAreaFinal( Map_Man_t * p ); extern float Map_ManReadRequiredGlo( Map_Man_t * p ); extern void Map_ManSetTimeToMap( Map_Man_t * p, int Time ); @@ -95,7 +97,7 @@ extern void Map_ManSetOutputNames( Map_Man_t * p, char ** ppNames ); extern void Map_ManSetAreaRecovery( Map_Man_t * p, int fAreaRecovery ); extern void Map_ManSetDelayTarget( Map_Man_t * p, float DelayTarget ); extern void Map_ManSetInputArrivals( Map_Man_t * p, Map_Time_t * pArrivals ); -extern void Map_ManSetObeyFanoutLimits( Map_Man_t * p, bool fObeyFanoutLimits ); +extern void Map_ManSetObeyFanoutLimits( Map_Man_t * p, int fObeyFanoutLimits ); extern void Map_ManSetNumIterations( Map_Man_t * p, int nNumIterations ); extern int Map_ManReadPass( Map_Man_t * p ); extern void Map_ManSetPass( Map_Man_t * p, int nPass ); @@ -167,6 +169,7 @@ extern void Map_CutCreateFromNode( Map_Man_t * p, Map_Super_t * pSupe extern int Map_Mapping( Map_Man_t * p ); /*=== mapperLib.c =============================================================*/ extern int Map_SuperLibDeriveFromGenlib( Mio_Library_t * pLib ); +extern void Map_SuperLibFree( Map_SuperLib_t * p ); /*=== mapperMntk.c =============================================================*/ //extern Mntk_Man_t * Map_ConvertMappingToMntk( Map_Man_t * pMan ); /*=== mapperSuper.c =============================================================*/ @@ -183,9 +186,11 @@ extern void Map_ManCleanData( Map_Man_t * p ); extern void Map_MappingSetupTruthTables( unsigned uTruths[][2] ); extern void Map_MappingSetupTruthTablesLarge( unsigned uTruths[][32] ); -#ifdef __cplusplus -} -#endif + + +ABC_NAMESPACE_HEADER_END + + #endif diff --git a/src/map/mapper/mapperCanon.c b/src/map/mapper/mapperCanon.c index 4f93ad3b..e9445a4f 100644 --- a/src/map/mapper/mapperCanon.c +++ b/src/map/mapper/mapperCanon.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -270,3 +273,5 @@ int Map_CanonComputeFast( Map_Man_t * p, int nVarsMax, int nVarsReal, unsigned u //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperCore.c b/src/map/mapper/mapperCore.c index fc0d9609..85530a1e 100644 --- a/src/map/mapper/mapperCore.c +++ b/src/map/mapper/mapperCore.c @@ -19,6 +19,9 @@ #include "mapperInt.h" //#include "resm.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -226,3 +229,5 @@ ABC_PRT( "Time", clock() - clk ); Map_MappingPrintOutputArrivals( p ); return 1; } +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperCreate.c b/src/map/mapper/mapperCreate.c index ee2b089c..af1a858f 100644 --- a/src/map/mapper/mapperCreate.c +++ b/src/map/mapper/mapperCreate.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -51,7 +54,7 @@ Map_Node_t ** Map_ManReadOutputs( Map_Man_t * p ) { return Map_Node_t * Map_ManReadConst1 ( Map_Man_t * p ) { return p->pConst1; } Map_Time_t * Map_ManReadInputArrivals( Map_Man_t * p ) { return p->pInputArrivals;} Mio_Library_t * Map_ManReadGenLib ( Map_Man_t * p ) { return p->pSuperLib->pGenlib; } -bool Map_ManReadVerbose( Map_Man_t * p ) { return p->fVerbose; } +int Map_ManReadVerbose( Map_Man_t * p ) { return p->fVerbose; } float Map_ManReadAreaFinal( Map_Man_t * p ) { return p->AreaFinal; } float Map_ManReadRequiredGlo( Map_Man_t * p ) { return p->fRequiredGlo; } void Map_ManSetTimeToMap( Map_Man_t * p, int Time ) { p->timeToMap = Time; } @@ -62,7 +65,7 @@ void Map_ManSetOutputNames( Map_Man_t * p, char ** ppNames ) { p->ppO void Map_ManSetAreaRecovery( Map_Man_t * p, int fAreaRecovery ) { p->fAreaRecovery = fAreaRecovery;} void Map_ManSetDelayTarget( Map_Man_t * p, float DelayTarget ) { p->DelayTarget = DelayTarget;} void Map_ManSetInputArrivals( Map_Man_t * p, Map_Time_t * pArrivals ) { p->pInputArrivals = pArrivals;} -void Map_ManSetObeyFanoutLimits( Map_Man_t * p, bool fObeyFanoutLimits ) { p->fObeyFanoutLimits = fObeyFanoutLimits; } +void Map_ManSetObeyFanoutLimits( Map_Man_t * p, int fObeyFanoutLimits ) { p->fObeyFanoutLimits = fObeyFanoutLimits; } void Map_ManSetNumIterations( Map_Man_t * p, int nIterations ) { p->nIterations = nIterations; } int Map_ManReadFanoutViolations( Map_Man_t * p ) { return p->nFanoutViolations; } void Map_ManSetFanoutViolations( Map_Man_t * p, int nVio ) { p->nFanoutViolations = nVio; } @@ -192,7 +195,7 @@ Map_Man_t * Map_ManCreate( int nInputs, int nOutputs, int fVerbose ) // start the manager p = ABC_ALLOC( Map_Man_t, 1 ); memset( p, 0, sizeof(Map_Man_t) ); - p->pSuperLib = Abc_FrameReadLibSuper(); + p->pSuperLib = (Map_SuperLib_t *)Abc_FrameReadLibSuper(); p->nVarsMax = p->pSuperLib->nVarsMax; p->fVerbose = fVerbose; p->fEpsilon = (float)0.001; @@ -598,3 +601,5 @@ void Map_NodeSetChoice( Map_Man_t * pMan, Map_Node_t * pNodeOld, Map_Node_t * pN /// END OF FILE /// //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperCut.c b/src/map/mapper/mapperCut.c index 19878d5b..e0afa792 100644 --- a/src/map/mapper/mapperCut.c +++ b/src/map/mapper/mapperCut.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -1166,3 +1169,5 @@ unsigned Map_CutComputeTruth( Map_Man_t * p, Map_Cut_t * pCut, Map_Cut_t * pTemp /// END OF FILE /// //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperCutUtils.c b/src/map/mapper/mapperCutUtils.c index 42bdd103..aa307368 100644 --- a/src/map/mapper/mapperCutUtils.c +++ b/src/map/mapper/mapperCutUtils.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -272,3 +275,5 @@ void Map_CutInsertFanouts( Map_Node_t * pNode, Map_Cut_t * pCut, int fPhase ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperFanout.c b/src/map/mapper/mapperFanout.c index 63cdbd2a..f835abe4 100644 --- a/src/map/mapper/mapperFanout.c +++ b/src/map/mapper/mapperFanout.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + #ifdef MAP_ALLOCATE_FANOUT //////////////////////////////////////////////////////////////////////// @@ -139,3 +142,5 @@ int Map_NodeGetFanoutNum( Map_Node_t * pNode ) #endif +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperGENERIC.c b/src/map/mapper/mapperGENERIC.c index 823eb4f2..ff71d3e1 100644 --- a/src/map/mapper/mapperGENERIC.c +++ b/src/map/mapper/mapperGENERIC.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -44,3 +47,5 @@ //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperInt.h b/src/map/mapper/mapperInt.h index 7f4c93dc..ac8110fc 100644 --- a/src/map/mapper/mapperInt.h +++ b/src/map/mapper/mapperInt.h @@ -19,6 +19,7 @@ #ifndef __MAPPER_INT_H__ #define __MAPPER_INT_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -27,10 +28,13 @@ #include <stdlib.h> #include <string.h> #include <float.h> -#include "cuddInt.h" #include "main.h" #include "mio.h" #include "mapper.h" +#include "cuddInt.h" + +ABC_NAMESPACE_HEADER_START + //////////////////////////////////////////////////////////////////////// /// PARAMETERS /// @@ -113,10 +117,10 @@ struct Map_ManStruct_t_ float AreaBase; // the area after delay-oriented mapping float AreaFinal; // the area after delay-oriented mapping int nIterations; // How many matching passes to do - bool fObeyFanoutLimits;// Should mapper try to obey fanout limits or not + int fObeyFanoutLimits;// Should mapper try to obey fanout limits or not float DelayTarget; // the required times set by the user int nTravIds; // the traversal counter - bool fSwitching; // Should mapper try to obey fanout limits or not + int fSwitching; // Should mapper try to obey fanout limits or not // the supergate library Map_SuperLib_t * pSuperLib; // the current supergate library @@ -169,7 +173,7 @@ struct Map_SuperLibStruct_t_ int nSupersAll; // the total number of supergates int nSupersReal; // the total number of supergates int nLines; // the total number of lines in the supergate file - bool fVerbose; // the verbosity flag + int fVerbose; // the verbosity flag // hash tables Map_Super_t ** ppSupers; // the array of supergates @@ -373,7 +377,7 @@ extern void Map_NodeAddFaninFanout( Map_Node_t * pFanin, Map_Node_t extern void Map_NodeRemoveFaninFanout( Map_Node_t * pFanin, Map_Node_t * pFanoutToRemove ); extern int Map_NodeGetFanoutNum( Map_Node_t * pNode ); /*=== mapperLib.c ============================================================*/ -extern Map_SuperLib_t * Map_SuperLibCreate( char * pFileName, char * pExcludeFile, bool fAlgorithm, bool fVerbose ); +extern Map_SuperLib_t * Map_SuperLibCreate( char * pFileName, char * pExcludeFile, int fAlgorithm, int fVerbose ); extern void Map_SuperLibFree( Map_SuperLib_t * p ); /*=== mapperMatch.c ===============================================================*/ extern int Map_MappingMatches( Map_Man_t * p ); @@ -469,6 +473,10 @@ extern void Map_NodeVecWriteEntry( Map_NodeVec_t * p, int i, Map_No extern Map_Node_t * Map_NodeVecReadEntry( Map_NodeVec_t * p, int i ); extern void Map_NodeVecSortByLevel( Map_NodeVec_t * p ); + + +ABC_NAMESPACE_HEADER_END + #endif //////////////////////////////////////////////////////////////////////// diff --git a/src/map/mapper/mapperLib.c b/src/map/mapper/mapperLib.c index cc64d8b8..9cc8747d 100644 --- a/src/map/mapper/mapperLib.c +++ b/src/map/mapper/mapperLib.c @@ -23,6 +23,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -50,7 +53,7 @@ SeeAlso [] ***********************************************************************/ -Map_SuperLib_t * Map_SuperLibCreate( char * pFileName, char * pExcludeFile, bool fAlgorithm, bool fVerbose ) +Map_SuperLib_t * Map_SuperLibCreate( char * pFileName, char * pExcludeFile, int fAlgorithm, int fVerbose ) { Map_SuperLib_t * p; int clk; @@ -251,3 +254,5 @@ int Map_SuperLibDeriveFromGenlib( Mio_Library_t * pLib ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperMatch.c b/src/map/mapper/mapperMatch.c index 32af030a..5fce3dc0 100644 --- a/src/map/mapper/mapperMatch.c +++ b/src/map/mapper/mapperMatch.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + /* A potential improvement: When an internal node is not used in the mapping, its required times @@ -595,3 +598,5 @@ void Map_NodeTransferArrivalTimes( Map_Man_t * p, Map_Node_t * pNode ) //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperRefs.c b/src/map/mapper/mapperRefs.c index 852e759f..9b0be068 100644 --- a/src/map/mapper/mapperRefs.c +++ b/src/map/mapper/mapperRefs.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -555,3 +558,5 @@ float Map_MappingGetArea( Map_Man_t * pMan, Map_NodeVec_t * vMapping ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperSuper.c b/src/map/mapper/mapperSuper.c index 92f73ecb..3be70541 100644 --- a/src/map/mapper/mapperSuper.c +++ b/src/map/mapper/mapperSuper.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -448,3 +451,5 @@ void Map_LibraryPrintClasses( Map_SuperLib_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperSwitch.c b/src/map/mapper/mapperSwitch.c index 9dd6e42b..11e99d24 100644 --- a/src/map/mapper/mapperSwitch.c +++ b/src/map/mapper/mapperSwitch.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -221,3 +224,5 @@ float Map_MappingGetSwitching( Map_Man_t * pMan, Map_NodeVec_t * vMapping ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperTable.c b/src/map/mapper/mapperTable.c index a0805991..2120b5ce 100644 --- a/src/map/mapper/mapperTable.c +++ b/src/map/mapper/mapperTable.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -400,3 +403,5 @@ void Map_SuperTableSortSupergatesByDelay( Map_HashTable_t * p, int nSupersMax ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperTime.c b/src/map/mapper/mapperTime.c index 309863fd..d12b607a 100644 --- a/src/map/mapper/mapperTime.c +++ b/src/map/mapper/mapperTime.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -96,7 +99,7 @@ float Map_TimeCutComputeArrival( Map_Node_t * pNode, Map_Cut_t * pCut, int fPhas unsigned uPhaseTot = pM->uPhaseBest; Map_Time_t * ptArrRes = &pM->tArrive; Map_Time_t * ptArrIn; - bool fPinPhase; + int fPinPhase; float tDelay; int i; @@ -508,3 +511,5 @@ float Map_MatchComputeReqTimes( Map_Cut_t * pCut, int fPhase, Map_Time_t * ptArr //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperTree.c b/src/map/mapper/mapperTree.c index 4cabf86c..f6a0d2d3 100644 --- a/src/map/mapper/mapperTree.c +++ b/src/map/mapper/mapperTree.c @@ -22,6 +22,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -560,7 +563,7 @@ void Map_LibraryAddFaninDelays( Map_SuperLib_t * pLib, Map_Super_t * pGate, Map_ { Mio_PinPhase_t PinPhase; float tDelayBlockRise, tDelayBlockFall, tDelayPin; - bool fMaxDelay = 0; + int fMaxDelay = 0; int i; // use this node to enable max-delay model @@ -823,3 +826,5 @@ void Map_LibraryPrintTree( Map_SuperLib_t * pLib ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperTree_old.c b/src/map/mapper/mapperTree_old.c index 041ba2a0..d0acff12 100644 --- a/src/map/mapper/mapperTree_old.c +++ b/src/map/mapper/mapperTree_old.c @@ -22,6 +22,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -558,7 +561,7 @@ void Map_LibraryAddFaninDelays( Map_SuperLib_t * pLib, Map_Super_t * pGate, Map_ { Mio_PinPhase_t PinPhase; float tDelayBlockRise, tDelayBlockFall, tDelayPin; - bool fMaxDelay = 0; + int fMaxDelay = 0; int i; // use this node to enable max-delay model @@ -821,3 +824,5 @@ void Map_LibraryPrintTree( Map_SuperLib_t * pLib ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperTruth.c b/src/map/mapper/mapperTruth.c index dcc8c1d3..377df9b4 100644 --- a/src/map/mapper/mapperTruth.c +++ b/src/map/mapper/mapperTruth.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -308,3 +311,5 @@ void Map_CutsCollect_rec( Map_Cut_t * pCut, Map_NodeVec_t * vVisited ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperUtils.c b/src/map/mapper/mapperUtils.c index b1f425a3..26033fdb 100644 --- a/src/map/mapper/mapperUtils.c +++ b/src/map/mapper/mapperUtils.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -1151,3 +1154,5 @@ int Map_MappingCountUsedNodes( Map_Man_t * pMan, int fChoices ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/mapper/mapperVec.c b/src/map/mapper/mapperVec.c index f675e0c5..dd87e752 100644 --- a/src/map/mapper/mapperVec.c +++ b/src/map/mapper/mapperVec.c @@ -18,6 +18,9 @@ #include "mapperInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -316,3 +319,5 @@ int Map_NodeVecCompareLevels( Map_Node_t ** pp1, Map_Node_t ** pp2 ) /// END OF FILE /// //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + 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 <ctype.h> #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 + diff --git a/src/map/super/super.c b/src/map/super/super.c index 97420c5c..6483547e 100644 --- a/src/map/super/super.c +++ b/src/map/super/super.c @@ -20,6 +20,9 @@ #include "mainInt.h" #include "mio.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -59,7 +62,7 @@ void Super_Init( Abc_Frame_t * pAbc ) SeeAlso [] ***********************************************************************/ -void Super_End() +void Super_End( Abc_Frame_t * pAbc ) { } @@ -152,8 +155,8 @@ int Super_CommandSupergates( Abc_Frame_t * pAbc, int argc, char **argv ) char * FileName, * ExcludeFile; float DelayLimit; float AreaLimit; - bool fSkipInvs; - bool fWriteOldFormat; + int fSkipInvs; + int fWriteOldFormat; int nVarsMax, nLevels, TimeLimit; int fVerbose; int c; @@ -317,3 +320,5 @@ usage: //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/super/super.h b/src/map/super/super.h index 9f5e83ae..246ea092 100644 --- a/src/map/super/super.h +++ b/src/map/super/super.h @@ -19,6 +19,7 @@ #ifndef __SUPER_H__ #define __SUPER_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -27,9 +28,10 @@ /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -extern "C" { -#endif + + +ABC_NAMESPACE_HEADER_START + //////////////////////////////////////////////////////////////////////// /// STRUCTURE DEFINITIONS /// @@ -49,9 +51,11 @@ extern "C" { /*=== superCore.c =============================================================*/ -#ifdef __cplusplus -} -#endif + + +ABC_NAMESPACE_HEADER_END + + #endif diff --git a/src/map/super/superAnd.c b/src/map/super/superAnd.c index 3014d505..17ba9771 100644 --- a/src/map/super/superAnd.c +++ b/src/map/super/superAnd.c @@ -18,6 +18,9 @@ #include "superInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -694,3 +697,5 @@ int Super2_LibWriteCompare( char * pStr1, char * pStr2 ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/super/superGENERIC.c b/src/map/super/superGENERIC.c index 1f2b7651..9d1f4cf0 100644 --- a/src/map/super/superGENERIC.c +++ b/src/map/super/superGENERIC.c @@ -18,6 +18,9 @@ #include "superInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -44,3 +47,5 @@ //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/super/superGate.c b/src/map/super/superGate.c index 6ffab984..a1962b09 100644 --- a/src/map/super/superGate.c +++ b/src/map/super/superGate.c @@ -16,8 +16,12 @@ ***********************************************************************/ +#include <math.h> #include "superInt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -99,9 +103,9 @@ static void Super_ManStop( Super_Man_t * pMan ); static void Super_AddGateToTable( Super_Man_t * pMan, Super_Gate_t * pGate ); static void Super_First( Super_Man_t * pMan, int nVarsMax ); -static Super_Man_t * Super_Compute( Super_Man_t * pMan, Mio_Gate_t ** ppGates, int nGates, bool fSkipInv ); +static Super_Man_t * Super_Compute( Super_Man_t * pMan, Mio_Gate_t ** ppGates, int nGates, int fSkipInv ); static Super_Gate_t * Super_CreateGateNew( Super_Man_t * pMan, Mio_Gate_t * pRoot, Super_Gate_t ** pSupers, int nSupers, unsigned uTruth[], float Area, float tPinDelaysRes[], float tDelayMax, int nPins ); -static bool Super_CompareGates( Super_Man_t * pMan, unsigned uTruth[], float Area, float tPinDelaysRes[], int nPins ); +static int Super_CompareGates( Super_Man_t * pMan, unsigned uTruth[], float Area, float tPinDelaysRes[], int nPins ); static int Super_DelayCompare( Super_Gate_t ** ppG1, Super_Gate_t ** ppG2 ); static int Super_AreaCompare( Super_Gate_t ** ppG1, Super_Gate_t ** ppG2 ); static void Super_TranferGatesToArray( Super_Man_t * pMan ); @@ -134,7 +138,7 @@ static void Super_WriteLibraryTree_rec( FILE * pFile, Super_Man_t * pM SeeAlso [] ***********************************************************************/ -void Super_Precompute( Mio_Library_t * pLibGen, int nVarsMax, int nLevels, float tDelayMax, float tAreaMax, int TimeLimit, bool fSkipInv, bool fWriteOldFormat, int fVerbose ) +void Super_Precompute( Mio_Library_t * pLibGen, int nVarsMax, int nLevels, float tDelayMax, float tAreaMax, int TimeLimit, int fSkipInv, int fWriteOldFormat, int fVerbose ) { Super_Man_t * pMan; Mio_Gate_t ** ppGates; @@ -291,7 +295,7 @@ void Super_First( Super_Man_t * pMan, int nVarsMax ) SeeAlso [] ***********************************************************************/ -Super_Man_t * Super_Compute( Super_Man_t * pMan, Mio_Gate_t ** ppGates, int nGates, bool fSkipInv ) +Super_Man_t * Super_Compute( Super_Man_t * pMan, Mio_Gate_t ** ppGates, int nGates, int fSkipInv ) { Super_Gate_t * pSupers[6], * pGate0, * pGate1, * pGate2, * pGate3, * pGate4, * pGate5, * pGateNew; float tPinDelaysRes[6], * ptPinDelays[6], tPinDelayMax, tDelayMio; @@ -757,7 +761,7 @@ void Super_AddGateToTable( Super_Man_t * pMan, Super_Gate_t * pGate ) SeeAlso [] ***********************************************************************/ -bool Super_CompareGates( Super_Man_t * pMan, unsigned uTruth[], float Area, float tPinDelaysRes[], int nPins ) +int Super_CompareGates( Super_Man_t * pMan, unsigned uTruth[], float Area, float tPinDelaysRes[], int nPins ) { Super_Gate_t ** ppList, * pPrev, * pGate, * pGate2; int i, fNewIsBetter, fGateIsBetter; @@ -1012,7 +1016,7 @@ void Super_WriteFileHeader( Super_Man_t * pMan, FILE * pFile ) fprintf( pFile, "# The number of attempts = %10d.\n", pMan->nTried ); fprintf( pFile, "# The number of supergates = %10d.\n", pMan->nGates ); fprintf( pFile, "# The number of functions = %10d.\n", pMan->nUnique ); - fprintf( pFile, "# The total functions = %.0f (2^%d).\n", pow(2,pMan->nMints), pMan->nMints ); + fprintf( pFile, "# The total functions = %.0f (2^%d).\n", pow((double)2,pMan->nMints), pMan->nMints ); fprintf( pFile, "#\n" ); fprintf( pFile, "# Generation time (sec) = %10.2f.\n", (float)(pMan->Time)/(float)(CLOCKS_PER_SEC) ); fprintf( pFile, "#\n" ); @@ -1336,3 +1340,5 @@ void Super_WriteLibraryTree_rec( FILE * pFile, Super_Man_t * pMan, Super_Gate_t /// END OF FILE /// //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/map/super/superInt.h b/src/map/super/superInt.h index ec6d0a38..0d4215ff 100644 --- a/src/map/super/superInt.h +++ b/src/map/super/superInt.h @@ -19,6 +19,7 @@ #ifndef __super_INT_H__ #define __super_INT_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -30,6 +31,9 @@ #include "stmm.h" #include "super.h" +ABC_NAMESPACE_HEADER_START + + //////////////////////////////////////////////////////////////////////// /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// @@ -53,7 +57,11 @@ /*=== superAnd.c =============================================================*/ extern void Super2_Precompute( int nInputs, int nLevels, int fVerbose ); /*=== superGate.c =============================================================*/ -extern void Super_Precompute( Mio_Library_t * pLibGen, int nInputs, int nLevels, float tDelayMax, float tAreaMax, int TimeLimit, bool fSkipInv, bool fWriteOldFormat, int fVerbose ); +extern void Super_Precompute( Mio_Library_t * pLibGen, int nInputs, int nLevels, float tDelayMax, float tAreaMax, int TimeLimit, int fSkipInv, int fWriteOldFormat, int fVerbose ); + + + +ABC_NAMESPACE_HEADER_END #endif diff --git a/src/map/super/superWrite.c b/src/map/super/superWrite.c index 395ef145..b8d14837 100644 --- a/src/map/super/superWrite.c +++ b/src/map/super/superWrite.c @@ -18,6 +18,9 @@ #include "superInt.h" +ABC_NAMESPACE_IMPL_START + + /* One record in the supergate library file consists of: @@ -74,3 +77,5 @@ //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + |