diff options
Diffstat (limited to 'src/map/amap')
-rw-r--r-- | src/map/amap/amap.h | 25 | ||||
-rw-r--r-- | src/map/amap/amapCore.c | 12 | ||||
-rw-r--r-- | src/map/amap/amapGraph.c | 7 | ||||
-rw-r--r-- | src/map/amap/amapInt.h | 32 | ||||
-rw-r--r-- | src/map/amap/amapLib.c | 13 | ||||
-rw-r--r-- | src/map/amap/amapLiberty.c | 5 | ||||
-rw-r--r-- | src/map/amap/amapMan.c | 5 | ||||
-rw-r--r-- | src/map/amap/amapMatch.c | 5 | ||||
-rw-r--r-- | src/map/amap/amapMerge.c | 11 | ||||
-rw-r--r-- | src/map/amap/amapOutput.c | 5 | ||||
-rw-r--r-- | src/map/amap/amapParse.c | 22 | ||||
-rw-r--r-- | src/map/amap/amapPerm.c | 9 | ||||
-rw-r--r-- | src/map/amap/amapRead.c | 42 | ||||
-rw-r--r-- | src/map/amap/amapRule.c | 23 | ||||
-rw-r--r-- | src/map/amap/amapUniq.c | 25 |
15 files changed, 158 insertions, 83 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 + |