diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2010-11-01 01:35:04 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2010-11-01 01:35:04 -0700 |
commit | 6130e39b18b5f53902e4eab14f6d5cdde5219563 (patch) | |
tree | 0db0628479a1b750e9af1f66cb8379ebd0913d31 /src/aig/ivy | |
parent | f0e77f6797c0504b0da25a56152b707d3357f386 (diff) | |
download | abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.tar.gz abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.tar.bz2 abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.zip |
initial commit of public abc
Diffstat (limited to 'src/aig/ivy')
-rw-r--r-- | src/aig/ivy/attr.h | 16 | ||||
-rw-r--r-- | src/aig/ivy/ivy.h | 33 | ||||
-rw-r--r-- | src/aig/ivy/ivyBalance.c | 37 | ||||
-rw-r--r-- | src/aig/ivy/ivyCanon.c | 5 | ||||
-rw-r--r-- | src/aig/ivy/ivyCheck.c | 5 | ||||
-rw-r--r-- | src/aig/ivy/ivyCut.c | 21 | ||||
-rw-r--r-- | src/aig/ivy/ivyCutTrav.c | 47 | ||||
-rw-r--r-- | src/aig/ivy/ivyDfs.c | 11 | ||||
-rw-r--r-- | src/aig/ivy/ivyDsd.c | 15 | ||||
-rw-r--r-- | src/aig/ivy/ivyFanout.c | 5 | ||||
-rw-r--r-- | src/aig/ivy/ivyFastMap.c | 23 | ||||
-rw-r--r-- | src/aig/ivy/ivyFraig.c | 39 | ||||
-rw-r--r-- | src/aig/ivy/ivyHaig.c | 19 | ||||
-rw-r--r-- | src/aig/ivy/ivyMan.c | 13 | ||||
-rw-r--r-- | src/aig/ivy/ivyMem.c | 7 | ||||
-rw-r--r-- | src/aig/ivy/ivyMulti.c | 13 | ||||
-rw-r--r-- | src/aig/ivy/ivyMulti8.c | 5 | ||||
-rw-r--r-- | src/aig/ivy/ivyObj.c | 5 | ||||
-rw-r--r-- | src/aig/ivy/ivyOper.c | 7 | ||||
-rw-r--r-- | src/aig/ivy/ivyResyn.c | 5 | ||||
-rw-r--r-- | src/aig/ivy/ivyRwr.c | 51 | ||||
-rw-r--r-- | src/aig/ivy/ivyRwrAlg.c | 27 | ||||
-rw-r--r-- | src/aig/ivy/ivySeq.c | 39 | ||||
-rw-r--r-- | src/aig/ivy/ivyShow.c | 9 | ||||
-rw-r--r-- | src/aig/ivy/ivyTable.c | 5 | ||||
-rw-r--r-- | src/aig/ivy/ivyUtil.c | 5 | ||||
-rw-r--r-- | src/aig/ivy/ivy_.c | 5 |
27 files changed, 307 insertions, 165 deletions
diff --git a/src/aig/ivy/attr.h b/src/aig/ivy/attr.h index ad342ce9..b65906cf 100644 --- a/src/aig/ivy/attr.h +++ b/src/aig/ivy/attr.h @@ -21,6 +21,7 @@ #ifndef __ATTR_H__ #define __ATTR_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -31,9 +32,10 @@ /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -extern "C" { -#endif + + +ABC_NAMESPACE_HEADER_START + //////////////////////////////////////////////////////////////////////// /// BASIC TYPES /// @@ -402,9 +404,11 @@ static inline void Attr_ManSetAttrPtr( Attr_Man_t * p, int Id, void * pAttr ) -#ifdef __cplusplus -} -#endif + + +ABC_NAMESPACE_HEADER_END + + #endif diff --git a/src/aig/ivy/ivy.h b/src/aig/ivy/ivy.h index 2c915e5b..870c0906 100644 --- a/src/aig/ivy/ivy.h +++ b/src/aig/ivy/ivy.h @@ -21,6 +21,7 @@ #ifndef __IVY_H__ #define __IVY_H__ + //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// @@ -33,9 +34,10 @@ /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -extern "C" { -#endif + + +ABC_NAMESPACE_HEADER_START + //////////////////////////////////////////////////////////////////////// /// BASIC TYPES /// @@ -121,7 +123,7 @@ struct Ivy_Man_t_ // memory management Vec_Ptr_t * vChunks; // allocated memory pieces Vec_Ptr_t * vPages; // memory pages used by nodes - Ivy_Obj_t * pListFree; // the list of ABC_FREE nodes + Ivy_Obj_t * pListFree; // the list of free nodes // timing statistics int time1; int time2; @@ -180,6 +182,8 @@ struct Ivy_Store_t_ #define IVY_MIN(a,b) (((a) < (b))? (a) : (b)) #define IVY_MAX(a,b) (((a) > (b))? (a) : (b)) +extern void Ivy_ManAddMemory( Ivy_Man_t * p ); + static inline int Ivy_BitWordNum( int nBits ) { return (nBits>>5) + ((nBits&31) > 0); } static inline int Ivy_TruthWordNum( int nVars ) { return nVars <= 5 ? 1 : (1 << (nVars - 5)); } static inline int Ivy_InfoHasBit( unsigned * p, int i ) { return (p[(i)>>5] & (1<<((i) & 31))) > 0; } @@ -224,8 +228,8 @@ static inline int Ivy_ManNodeNum( Ivy_Man_t * p ) { return p->nO static inline int Ivy_ManHashObjNum( Ivy_Man_t * p ) { return p->nObjs[IVY_AND]+p->nObjs[IVY_EXOR]+p->nObjs[IVY_LATCH]; } static inline int Ivy_ManGetCost( Ivy_Man_t * p ) { return p->nObjs[IVY_AND]+3*p->nObjs[IVY_EXOR]+8*p->nObjs[IVY_LATCH]; } -static inline Ivy_Type_t Ivy_ObjType( Ivy_Obj_t * pObj ) { return pObj->Type; } -static inline Ivy_Init_t Ivy_ObjInit( Ivy_Obj_t * pObj ) { return pObj->Init; } +static inline Ivy_Type_t Ivy_ObjType( Ivy_Obj_t * pObj ) { return (Ivy_Type_t)pObj->Type; } +static inline Ivy_Init_t Ivy_ObjInit( Ivy_Obj_t * pObj ) { return (Ivy_Init_t)pObj->Init; } static inline int Ivy_ObjIsConst1( Ivy_Obj_t * pObj ) { return pObj->Id == 0; } static inline int Ivy_ObjIsGhost( Ivy_Obj_t * pObj ) { return pObj->Id < 0; } static inline int Ivy_ObjIsNone( Ivy_Obj_t * pObj ) { return pObj->Type == IVY_NONE; } @@ -359,7 +363,6 @@ static Ivy_Init_t Ivy_InitExor( Ivy_Init_t InitA, Ivy_Init_t InitB ) // internal memory manager static inline Ivy_Obj_t * Ivy_ManFetchMemory( Ivy_Man_t * p ) { - extern void Ivy_ManAddMemory( Ivy_Man_t * p ); Ivy_Obj_t * pTemp; if ( p->pListFree == NULL ) Ivy_ManAddMemory( p ); @@ -382,13 +385,13 @@ static inline void Ivy_ManRecycleMemory( Ivy_Man_t * p, Ivy_Obj_t * pEntry ) // iterator over the primary inputs #define Ivy_ManForEachPi( p, pObj, i ) \ - Vec_PtrForEachEntry( p->vPis, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vPis, pObj, i ) // iterator over the primary outputs #define Ivy_ManForEachPo( p, pObj, i ) \ - Vec_PtrForEachEntry( p->vPos, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vPos, pObj, i ) // iterator over all objects, including those currently not used #define Ivy_ManForEachObj( p, pObj, i ) \ - Vec_PtrForEachEntry( p->vObjs, pObj, i ) if ( (pObj) == NULL ) {} else + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL ) {} else // iterator over the combinational inputs #define Ivy_ManForEachCi( p, pObj, i ) \ Ivy_ManForEachObj( p, pObj, i ) if ( !Ivy_ObjIsCi(pObj) ) {} else @@ -407,7 +410,7 @@ static inline void Ivy_ManRecycleMemory( Ivy_Man_t * p, Ivy_Obj_t * pEntry ) // iterator over the fanouts of an object #define Ivy_ObjForEachFanout( p, pObj, vArray, pFanout, i ) \ for ( i = 0, Ivy_ObjCollectFanouts(p, pObj, vArray); \ - i < Vec_PtrSize(vArray) && ((pFanout) = Vec_PtrEntry(vArray,i)); i++ ) + i < Vec_PtrSize(vArray) && ((pFanout) = (Ivy_Obj_t *)Vec_PtrEntry(vArray,i)); i++ ) //////////////////////////////////////////////////////////////////////// /// FUNCTION DECLARATIONS /// @@ -545,9 +548,11 @@ extern void Ivy_ObjPrintVerbose( Ivy_Man_t * p, Ivy_Obj_t * pObj, int extern void Ivy_ManPrintVerbose( Ivy_Man_t * p, int fHaig ); extern int Ivy_CutTruthPrint( Ivy_Man_t * p, Ivy_Cut_t * pCut, unsigned uTruth ); -#ifdef __cplusplus -} -#endif + + +ABC_NAMESPACE_HEADER_END + + #endif diff --git a/src/aig/ivy/ivyBalance.c b/src/aig/ivy/ivyBalance.c index b5c77e39..4abdf8c3 100644 --- a/src/aig/ivy/ivyBalance.c +++ b/src/aig/ivy/ivyBalance.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -139,8 +142,8 @@ int Ivy_NodeBalance_rec( Ivy_Man_t * pNew, Ivy_Obj_t * pObjOld, Vec_Vec_t * vSto // for each old node, derive the new well-balanced node for ( i = 0; i < vSuper->nSize; i++ ) { - NewNodeId = Ivy_NodeBalance_rec( pNew, Ivy_Regular(vSuper->pArray[i]), vStore, Level + 1, fUpdateLevel ); - NewNodeId = Ivy_EdgeNotCond( NewNodeId, Ivy_IsComplement(vSuper->pArray[i]) ); + NewNodeId = Ivy_NodeBalance_rec( pNew, Ivy_Regular((Ivy_Obj_t *)vSuper->pArray[i]), vStore, Level + 1, fUpdateLevel ); + NewNodeId = Ivy_EdgeNotCond( NewNodeId, Ivy_IsComplement((Ivy_Obj_t *)vSuper->pArray[i]) ); vSuper->pArray[i] = Ivy_EdgeToNode( pNew, NewNodeId ); } // build the supergate @@ -170,7 +173,7 @@ Ivy_Obj_t * Ivy_NodeBalanceBuildSuper( Ivy_Man_t * p, Vec_Ptr_t * vSuper, Ivy_Ty int LeftBound; assert( vSuper->nSize > 1 ); // sort the new nodes by level in the decreasing order - Vec_PtrSort( vSuper, Ivy_NodeCompareLevelsDecrease ); + Vec_PtrSort( vSuper, (int (*)(void))Ivy_NodeCompareLevelsDecrease ); // balance the nodes while ( vSuper->nSize > 1 ) { @@ -179,11 +182,11 @@ Ivy_Obj_t * Ivy_NodeBalanceBuildSuper( Ivy_Man_t * p, Vec_Ptr_t * vSuper, Ivy_Ty // find the node that can be shared (if no such node, randomize choice) Ivy_NodeBalancePermute( p, vSuper, LeftBound, Type == IVY_EXOR ); // pull out the last two nodes - pObj1 = Vec_PtrPop(vSuper); - pObj2 = Vec_PtrPop(vSuper); + pObj1 = (Ivy_Obj_t *)Vec_PtrPop(vSuper); + pObj2 = (Ivy_Obj_t *)Vec_PtrPop(vSuper); Ivy_NodeBalancePushUniqueOrderByLevel( vSuper, Ivy_Oper(p, pObj1, pObj2, Type) ); } - return Vec_PtrEntry(vSuper, 0); + return (Ivy_Obj_t *)Vec_PtrEntry(vSuper, 0); } /**Function************************************************************* @@ -252,13 +255,13 @@ Vec_Ptr_t * Ivy_NodeBalanceCone( Ivy_Obj_t * pObj, Vec_Vec_t * vStore, int Level if ( Vec_VecSize( vStore ) <= Level ) Vec_VecPush( vStore, Level, 0 ); // get the temporary array of nodes - vNodes = Vec_VecEntry( vStore, Level ); + vNodes = (Vec_Ptr_t *)Vec_VecEntry( vStore, Level ); Vec_PtrClear( vNodes ); // collect the nodes in the implication supergate RetValue = Ivy_NodeBalanceCone_rec( pObj, pObj, vNodes ); assert( vNodes->nSize > 1 ); // unmark the visited nodes - Vec_PtrForEachEntry( vNodes, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vNodes, pObj, i ) Ivy_Regular(pObj)->fMarkB = 0; // if we found the node and its complement in the same implication supergate, // return empty set of nodes (meaning that we should use constant-0 node) @@ -291,19 +294,19 @@ int Ivy_NodeBalanceFindLeft( Vec_Ptr_t * vSuper ) return 0; // set the pointer to the one before the last Current = Vec_PtrSize(vSuper) - 2; - pObjRight = Vec_PtrEntry( vSuper, Current ); + pObjRight = (Ivy_Obj_t *)Vec_PtrEntry( vSuper, Current ); // go through the nodes to the left of this one for ( Current--; Current >= 0; Current-- ) { // get the next node on the left - pObjLeft = Vec_PtrEntry( vSuper, Current ); + pObjLeft = (Ivy_Obj_t *)Vec_PtrEntry( vSuper, Current ); // if the level of this node is different, quit the loop if ( Ivy_Regular(pObjLeft)->Level != Ivy_Regular(pObjRight)->Level ) break; } Current++; // get the node, for which the equality holds - pObjLeft = Vec_PtrEntry( vSuper, Current ); + pObjLeft = (Ivy_Obj_t *)Vec_PtrEntry( vSuper, Current ); assert( Ivy_Regular(pObjLeft)->Level == Ivy_Regular(pObjRight)->Level ); return Current; } @@ -330,14 +333,14 @@ void Ivy_NodeBalancePermute( Ivy_Man_t * p, Vec_Ptr_t * vSuper, int LeftBound, i if ( LeftBound == RightBound ) return; // get the two last nodes - pObj1 = Vec_PtrEntry( vSuper, RightBound + 1 ); - pObj2 = Vec_PtrEntry( vSuper, RightBound ); + pObj1 = (Ivy_Obj_t *)Vec_PtrEntry( vSuper, RightBound + 1 ); + pObj2 = (Ivy_Obj_t *)Vec_PtrEntry( vSuper, RightBound ); if ( Ivy_Regular(pObj1) == p->pConst1 || Ivy_Regular(pObj2) == p->pConst1 ) return; // find the first node that can be shared for ( i = RightBound; i >= LeftBound; i-- ) { - pObj3 = Vec_PtrEntry( vSuper, i ); + pObj3 = (Ivy_Obj_t *)Vec_PtrEntry( vSuper, i ); if ( Ivy_Regular(pObj3) == p->pConst1 ) { Vec_PtrWriteEntry( vSuper, i, pObj2 ); @@ -387,8 +390,8 @@ void Ivy_NodeBalancePushUniqueOrderByLevel( Vec_Ptr_t * vStore, Ivy_Obj_t * pObj // find the p of the node for ( i = vStore->nSize-1; i > 0; i-- ) { - pObj1 = vStore->pArray[i ]; - pObj2 = vStore->pArray[i-1]; + pObj1 = (Ivy_Obj_t *)vStore->pArray[i ]; + pObj2 = (Ivy_Obj_t *)vStore->pArray[i-1]; if ( Ivy_Regular(pObj1)->Level <= Ivy_Regular(pObj2)->Level ) break; vStore->pArray[i ] = pObj2; @@ -402,3 +405,5 @@ void Ivy_NodeBalancePushUniqueOrderByLevel( Vec_Ptr_t * vStore, Ivy_Obj_t * pObj //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyCanon.c b/src/aig/ivy/ivyCanon.c index db5918de..34ed781f 100644 --- a/src/aig/ivy/ivyCanon.c +++ b/src/aig/ivy/ivyCanon.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -142,3 +145,5 @@ Ivy_Obj_t * Ivy_CanonLatch( Ivy_Man_t * p, Ivy_Obj_t * pObj, Ivy_Init_t Init ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyCheck.c b/src/aig/ivy/ivyCheck.c index 55448f19..c924e2d0 100644 --- a/src/aig/ivy/ivyCheck.c +++ b/src/aig/ivy/ivyCheck.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -271,3 +274,5 @@ int Ivy_ManCheckChoices( Ivy_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyCut.c b/src/aig/ivy/ivyCut.c index e3651645..d5a31dee 100644 --- a/src/aig/ivy/ivyCut.c +++ b/src/aig/ivy/ivyCut.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -332,7 +335,7 @@ int Ivy_ManFindBoolCut( Ivy_Man_t * p, Ivy_Obj_t * pRoot, Vec_Ptr_t * vFront, Ve while ( 1 ) { // find the next node to expand on this level - Vec_PtrForEachEntry( vFront, pObj, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pObj, k ) if ( (int)pObj->Level == Lev ) break; if ( k == Vec_PtrSize(vFront) ) @@ -399,11 +402,11 @@ int Ivy_ManFindBoolCut( Ivy_Man_t * p, Ivy_Obj_t * pRoot, Vec_Ptr_t * vFront, Ve if ( pFaninC && !pFaninC->fMarkA && !pFaninC->fMarkB ) Vec_PtrPush( vFront, pFaninC ); // clean the markings - Vec_PtrForEachEntry( vVolume, pObj, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vVolume, pObj, k ) pObj->fMarkA = pObj->fMarkB = 0; // mark the nodes on the frontier (including the pivot) - Vec_PtrForEachEntry( vFront, pObj, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pObj, k ) pObj->fMarkA = 1; // cut exists, collect all the nodes on the shortest path to the pivot Vec_PtrClear( vLeaves ); @@ -411,16 +414,16 @@ int Ivy_ManFindBoolCut( Ivy_Man_t * p, Ivy_Obj_t * pRoot, Vec_Ptr_t * vFront, Ve RetValue = Ivy_ManFindBoolCut_rec( p, pRoot, vLeaves, vVolume, pPivot ); assert( RetValue == 1 ); // unmark the nodes on the frontier (including the pivot) - Vec_PtrForEachEntry( vFront, pObj, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pObj, k ) pObj->fMarkA = 0; // mark the nodes in the volume - Vec_PtrForEachEntry( vVolume, pObj, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vVolume, pObj, k ) pObj->fMarkA = 1; // expand the cut without increasing its size while ( 1 ) { - Vec_PtrForEachEntry( vLeaves, pObj, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vLeaves, pObj, k ) if ( Ivy_ManFindBoolCutCost(pObj) < 2 ) break; if ( k == Vec_PtrSize(vLeaves) ) @@ -448,7 +451,7 @@ int Ivy_ManFindBoolCut( Ivy_Man_t * p, Ivy_Obj_t * pRoot, Vec_Ptr_t * vFront, Ve } } // unmark the nodes in the volume - Vec_PtrForEachEntry( vVolume, pObj, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vVolume, pObj, k ) pObj->fMarkA = 0; return 1; } @@ -491,7 +494,7 @@ void Ivy_ManTestCutsBool( Ivy_Man_t * p ) printf( "%d ", Vec_PtrSize(vLeaves) ); /* printf( "( " ); - Vec_PtrForEachEntry( vFront, pTemp, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pTemp, k ) printf( "%d ", Ivy_ObjRefs(Ivy_Regular(pTemp)) ); printf( ")\n" ); */ @@ -988,3 +991,5 @@ void Ivy_ManTestCutsAll( Ivy_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyCutTrav.c b/src/aig/ivy/ivyCutTrav.c index a52bbcf9..3cdca141 100644 --- a/src/aig/ivy/ivyCutTrav.c +++ b/src/aig/ivy/ivyCutTrav.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -70,7 +73,7 @@ Ivy_Store_t * Ivy_NodeFindCutsTravAll( Ivy_Man_t * p, Ivy_Obj_t * pObj, int nLea // set elementary cuts for the leaves nWords = Extra_BitWordNum( nNodes ); - Vec_PtrForEachEntry( vFront, pLeaf, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pLeaf, i ) { assert( Ivy_ObjTravId(pLeaf) < nNodes ); // get the new bitcut @@ -80,10 +83,10 @@ Ivy_Store_t * Ivy_NodeFindCutsTravAll( Ivy_Man_t * p, Ivy_Obj_t * pObj, int nLea } // compute the cuts for each node - Vec_PtrForEachEntry( vNodes, pLeaf, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vNodes, pLeaf, i ) { // skip the leaves - vCuts = Vec_VecEntry( vBitCuts, Ivy_ObjTravId(pLeaf) ); + vCuts = (Vec_Ptr_t *)Vec_VecEntry( vBitCuts, Ivy_ObjTravId(pLeaf) ); if ( Vec_PtrSize(vCuts) > 0 ) continue; // add elementary cut @@ -91,8 +94,8 @@ Ivy_Store_t * Ivy_NodeFindCutsTravAll( Ivy_Man_t * p, Ivy_Obj_t * pObj, int nLea // set it as the cut of this leaf Vec_VecPush( vBitCuts, Ivy_ObjTravId(pLeaf), pBitCut ); // get the fanin cuts - vCuts0 = Vec_VecEntry( vBitCuts, Ivy_ObjTravId( Ivy_ObjFanin0(pLeaf) ) ); - vCuts1 = Vec_VecEntry( vBitCuts, Ivy_ObjTravId( Ivy_ObjFanin1(pLeaf) ) ); + vCuts0 = (Vec_Ptr_t *)Vec_VecEntry( vBitCuts, Ivy_ObjTravId( Ivy_ObjFanin0(pLeaf) ) ); + vCuts1 = (Vec_Ptr_t *)Vec_VecEntry( vBitCuts, Ivy_ObjTravId( Ivy_ObjFanin1(pLeaf) ) ); assert( Vec_PtrSize(vCuts0) > 0 ); assert( Vec_PtrSize(vCuts1) > 0 ); // merge the cuts @@ -103,8 +106,8 @@ Ivy_Store_t * Ivy_NodeFindCutsTravAll( Ivy_Man_t * p, Ivy_Obj_t * pObj, int nLea pCutStore->nCuts = 0; pCutStore->nCutsMax = IVY_CUT_LIMIT; // collect the cuts of the root node - vCuts = Vec_VecEntry( vBitCuts, Ivy_ObjTravId(pObj) ); - Vec_PtrForEachEntry( vCuts, pBitCut, i ) + vCuts = (Vec_Ptr_t *)Vec_VecEntry( vBitCuts, Ivy_ObjTravId(pObj) ); + Vec_PtrForEachEntry( unsigned *, vCuts, pBitCut, i ) { pCut = pCutStore->pCuts + pCutStore->nCuts++; pCut->nSize = 0; @@ -112,14 +115,14 @@ Ivy_Store_t * Ivy_NodeFindCutsTravAll( Ivy_Man_t * p, Ivy_Obj_t * pObj, int nLea pCut->uHash = 0; for ( k = 0; k < nNodes; k++ ) if ( Extra_TruthHasBit(pBitCut, k) ) - pCut->pArray[ pCut->nSize++ ] = Ivy_ObjId( Vec_PtrEntry(vNodes, k) ); + pCut->pArray[ pCut->nSize++ ] = Ivy_ObjId( (Ivy_Obj_t *)Vec_PtrEntry(vNodes, k) ); assert( pCut->nSize <= nLeaves ); if ( pCutStore->nCuts == pCutStore->nCutsMax ) break; } // clean the travIds - Vec_PtrForEachEntry( vNodes, pLeaf, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vNodes, pLeaf, i ) pLeaf->TravId = 0; return pCutStore; } @@ -228,7 +231,7 @@ void Ivy_NodeComputeVolume( Ivy_Obj_t * pObj, int nNodeLimit, Vec_Ptr_t * vNodes Ivy_NodeComputeVolumeTrav2_rec( pObj, vFront ); // find the fanins that are not marked Vec_PtrClear( vNodes ); - Vec_PtrForEachEntry( vFront, pTemp, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pTemp, i ) { pFanin = Ivy_ObjFanin0(pTemp); if ( !pFanin->fMarkA ) @@ -246,17 +249,17 @@ void Ivy_NodeComputeVolume( Ivy_Obj_t * pObj, int nNodeLimit, Vec_Ptr_t * vNodes // remember the number of nodes in the frontier nNodes = Vec_PtrSize( vNodes ); // add the remaining nodes - Vec_PtrForEachEntry( vFront, pTemp, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pTemp, i ) Vec_PtrPush( vNodes, pTemp ); // unmark the nodes - Vec_PtrForEachEntry( vNodes, pTemp, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vNodes, pTemp, i ) { pTemp->fMarkA = 0; pTemp->TravId = i; } // collect the frontier nodes Vec_PtrClear( vFront ); - Vec_PtrForEachEntryStop( vNodes, pTemp, i, nNodes ) + Vec_PtrForEachEntryStop( Ivy_Obj_t *, vNodes, pTemp, i, nNodes ) Vec_PtrPush( vFront, pTemp ); // printf( "%d ", Vec_PtrSize(vNodes) ); } @@ -289,7 +292,7 @@ void Ivy_NodeComputeVolume2( Ivy_Obj_t * pObj, int nNodeLimit, Vec_Ptr_t * vNode do { // get the node to expand pPivot = NULL; - Vec_PtrForEachEntryReverse( vFront, pLeaf, i ) + Vec_PtrForEachEntryReverse( Ivy_Obj_t *, vFront, pLeaf, i ) { if ( (int)pLeaf->Level == LevelMax ) { @@ -326,14 +329,14 @@ void Ivy_NodeComputeVolume2( Ivy_Obj_t * pObj, int nNodeLimit, Vec_Ptr_t * vNode } while ( Vec_PtrSize(vNodes) < nNodeLimit ); // sort nodes by level - Vec_PtrSort( vNodes, Ivy_CompareNodesByLevel ); + Vec_PtrSort( vNodes, (int (*)(void))Ivy_CompareNodesByLevel ); // make sure the nodes are ordered in the increasing number of levels - pFanin = Vec_PtrEntry( vNodes, 0 ); - pPivot = Vec_PtrEntryLast( vNodes ); + pFanin = (Ivy_Obj_t *)Vec_PtrEntry( vNodes, 0 ); + pPivot = (Ivy_Obj_t *)Vec_PtrEntryLast( vNodes ); assert( pFanin->Level <= pPivot->Level ); // clean the marks and remember node numbers in the TravId - Vec_PtrForEachEntry( vNodes, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vNodes, pFanin, i ) { pFanin->fMarkA = 0; pFanin->TravId = i; @@ -383,8 +386,8 @@ void Ivy_NodeFindCutsMerge( Vec_Ptr_t * vCuts0, Vec_Ptr_t * vCuts1, Vec_Ptr_t * unsigned * pBitCut, * pBitCut0, * pBitCut1, * pBitCutTest; int i, k, c, w, Counter; // iterate through the cut pairs - Vec_PtrForEachEntry( vCuts0, pBitCut0, i ) - Vec_PtrForEachEntry( vCuts1, pBitCut1, k ) + Vec_PtrForEachEntry( unsigned *, vCuts0, pBitCut0, i ) + Vec_PtrForEachEntry( unsigned *, vCuts1, pBitCut1, k ) { // skip infeasible cuts Counter = 0; @@ -401,7 +404,7 @@ void Ivy_NodeFindCutsMerge( Vec_Ptr_t * vCuts0, Vec_Ptr_t * vCuts1, Vec_Ptr_t * Extra_TruthOrWords( pBitCutTest, pBitCut0, pBitCut1, nWords ); // filter contained cuts; try to find containing cut w = 0; - Vec_PtrForEachEntry( vCuts, pBitCut, c ) + Vec_PtrForEachEntry( unsigned *, vCuts, pBitCut, c ) { if ( Extra_TruthIsImplyWords( pBitCut, pBitCutTest, nWords ) ) break; @@ -471,3 +474,5 @@ void Ivy_ManTestCutsTravAll( Ivy_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyDfs.c b/src/aig/ivy/ivyDfs.c index 9594c0d2..611dd854 100644 --- a/src/aig/ivy/ivyDfs.c +++ b/src/aig/ivy/ivyDfs.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -196,14 +199,14 @@ void Ivy_ManCollectCone( Ivy_Obj_t * pObj, Vec_Ptr_t * vFront, Vec_Ptr_t * vCone assert( !Ivy_IsComplement(pObj) ); assert( Ivy_ObjIsNode(pObj) ); // mark the nodes - Vec_PtrForEachEntry( vFront, pTemp, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pTemp, i ) Ivy_Regular(pTemp)->fMarkA = 1; assert( pObj->fMarkA == 0 ); // collect the cone Vec_PtrClear( vCone ); Ivy_ManCollectCone_rec( pObj, vCone ); // unmark the nodes - Vec_PtrForEachEntry( vFront, pTemp, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pTemp, i ) Ivy_Regular(pTemp)->fMarkA = 0; } @@ -255,7 +258,7 @@ Vec_Int_t * Ivy_ManRequiredLevels( Ivy_Man_t * p ) vLevelsR = Vec_IntStart( Ivy_ManObjIdMax(p) + 1 ); // iterate through the nodes in the reverse order vNodes = Ivy_ManLevelize( p ); - Vec_VecForEachEntryReverseReverse( vNodes, pObj, i, k ) + Vec_VecForEachEntryReverseReverse( Ivy_Obj_t *, vNodes, pObj, i, k ) { Level = Vec_IntEntry( vLevelsR, pObj->Id ) + 1 + Ivy_ObjIsExor(pObj); if ( Vec_IntEntry( vLevelsR, Ivy_ObjFaninId0(pObj) ) < Level ) @@ -491,3 +494,5 @@ int Ivy_ManSetLevels( Ivy_Man_t * p, int fHaig ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyDsd.c b/src/aig/ivy/ivyDsd.c index 3b8a2e68..71c4863a 100644 --- a/src/aig/ivy/ivyDsd.c +++ b/src/aig/ivy/ivyDsd.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -50,9 +53,13 @@ struct Ivy_Dec_t_ unsigned Fan5 : 4; // fanin 5 }; -static inline int Ivy_DecToInt( Ivy_Dec_t Node ) { return *((int *)&Node); } -static inline Ivy_Dec_t Ivy_IntToDec( int Node ) { return *((Ivy_Dec_t *)&Node); } -static inline void Ivy_DecClear( Ivy_Dec_t * pNode ) { *((int *)pNode) = 0; } +static inline int Ivy_DecToInt( Ivy_Dec_t m ) { union { Ivy_Dec_t x; int y; } v; v.x = m; return v.y; } +static inline Ivy_Dec_t Ivy_IntToDec( int m ) { union { Ivy_Dec_t x; int y; } v; v.y = m; return v.x; } +static inline void Ivy_DecClear( Ivy_Dec_t * pNode ) { *pNode = Ivy_IntToDec(0); } + +//static inline int Ivy_DecToInt( Ivy_Dec_t Node ) { return *((int *)&Node); } +//static inline Ivy_Dec_t Ivy_IntToDec( int Node ) { return *((Ivy_Dec_t *)&Node); } +//static inline void Ivy_DecClear( Ivy_Dec_t * pNode ) { *((int *)pNode) = 0; } static unsigned s_Masks[6][2] = { @@ -817,3 +824,5 @@ void Ivy_TruthTest5() //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyFanout.c b/src/aig/ivy/ivyFanout.c index 3930186a..9ff4f4bc 100644 --- a/src/aig/ivy/ivyFanout.c +++ b/src/aig/ivy/ivyFanout.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -307,3 +310,5 @@ int Ivy_ObjFanoutNum( Ivy_Man_t * p, Ivy_Obj_t * pObj ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyFastMap.c b/src/aig/ivy/ivyFastMap.c index 0c0102c0..05db377d 100644 --- a/src/aig/ivy/ivyFastMap.c +++ b/src/aig/ivy/ivyFastMap.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -168,7 +171,7 @@ clk = clock(); { Vec_Ptr_t * vNodes; vNodes = Vec_PtrAlloc( 100 ); - Vec_VecForEachEntry( pMan->vLuts, pObj, i, k ) + Vec_VecForEachEntry( Ivy_Obj_t *, pMan->vLuts, pObj, i, k ) Vec_PtrPush( vNodes, pObj ); Ivy_ManShow( pAig, 0, vNodes ); Vec_PtrFree( vNodes ); @@ -189,7 +192,7 @@ clk = clock(); ***********************************************************************/ void Ivy_FastMapStop( Ivy_Man_t * pAig ) { - Ivy_SuppMan_t * p = pAig->pData; + Ivy_SuppMan_t * p = (Ivy_SuppMan_t *)pAig->pData; Vec_VecFree( p->vLuts ); ABC_FREE( p->pMem ); ABC_FREE( p ); @@ -886,7 +889,7 @@ void Ivy_FastMapRequired( Ivy_Man_t * pAig, int Delay, int fSetInter ) vLuts = ((Ivy_SuppMan_t *)pAig->pData)->vLuts; // propagate the required times Vec_VecForEachLevelReverse( vLuts, vNodes, i ) - Vec_PtrForEachEntry( vNodes, pObj, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vNodes, pObj, k ) { pSupp = Ivy_ObjSupp( pAig, pObj ); assert( pSupp->nRefs > 0 ); @@ -911,7 +914,7 @@ void Ivy_FastMapRequired( Ivy_Man_t * pAig, int Delay, int fSetInter ) { // set the required times of the intermediate nodes Vec_VecForEachLevelReverse( vLuts, vNodes, i ) - Vec_PtrForEachEntry( vNodes, pObj, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vNodes, pObj, k ) { pSupp = Ivy_ObjSupp( pAig, pObj ); Ivy_FastMapRequired_rec( pAig, pObj, pObj, pSupp->DelayR ); @@ -1117,7 +1120,7 @@ int Ivy_FastMapCutCost( Ivy_Man_t * pAig, Vec_Ptr_t * vFront ) Ivy_Supp_t * pSuppF; Ivy_Obj_t * pFanin; int i, Counter = 0; - Vec_PtrForEachEntry( vFront, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pFanin, i ) { pSuppF = Ivy_ObjSupp( pAig, pFanin ); if ( pSuppF->nRefs == 0 ) @@ -1246,7 +1249,7 @@ int Ivy_FastMapNodeFaninCompact0( Ivy_Man_t * pAig, Ivy_Obj_t * pObj, int nLimit { Ivy_Obj_t * pFanin; int i; - Vec_PtrForEachEntry( vFront, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pFanin, i ) { if ( Ivy_ObjIsCi(pFanin) ) continue; @@ -1276,7 +1279,7 @@ int Ivy_FastMapNodeFaninCompact1( Ivy_Man_t * pAig, Ivy_Obj_t * pObj, int nLimit { Ivy_Obj_t * pFanin; int i; - Vec_PtrForEachEntry( vFront, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pFanin, i ) { if ( Ivy_ObjIsCi(pFanin) ) continue; @@ -1304,7 +1307,7 @@ int Ivy_FastMapNodeFaninCompact2( Ivy_Man_t * pAig, Ivy_Obj_t * pObj, int nLimit { Ivy_Obj_t * pFanin; int i; - Vec_PtrForEachEntry( vFront, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pFanin, i ) { if ( Ivy_ObjIsCi(pFanin) ) continue; @@ -1409,7 +1412,7 @@ void Ivy_FastMapNodeUpdate( Ivy_Man_t * pAig, Ivy_Obj_t * pObj, Vec_Ptr_t * vFro Ivy_FastMapNodeDeref( pAig, pObj ); // update the node's cut pSupp->nSize = Vec_PtrSize(vFront); - Vec_PtrForEachEntry( vFront, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pFanin, i ) pSupp->pArray[i] = pFanin->Id; // ref the new cut Ivy_FastMapNodeRef( pAig, pObj ); @@ -1587,3 +1590,5 @@ void Ivy_FastMapNodeRecover4( Ivy_Man_t * pAig, Ivy_Obj_t * pObj, int nLimit, Ve //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyFraig.c b/src/aig/ivy/ivyFraig.c index 68726501..77b64700 100644 --- a/src/aig/ivy/ivyFraig.c +++ b/src/aig/ivy/ivyFraig.c @@ -22,6 +22,8 @@ #include "extra.h" #include "ivy.h" +ABC_NAMESPACE_IMPL_START + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -249,7 +251,7 @@ void Ivy_FraigParamsDefault( Ivy_FraigParams_t * pParams ) ***********************************************************************/ int Ivy_FraigProve( Ivy_Man_t ** ppManAig, void * pPars ) { - Prove_Params_t * pParams = pPars; + Prove_Params_t * pParams = (Prove_Params_t *)pPars; Ivy_FraigParams_t Params, * pIvyParams = &Params; Ivy_Man_t * pManAig, * pManTemp; int RetValue, nIter, clk;//, Counter; @@ -1536,7 +1538,7 @@ void Ivy_FraigSavePattern( Ivy_FraigMan_t * p ) int i; memset( p->pPatWords, 0, sizeof(unsigned) * p->nPatWords ); Ivy_ManForEachPi( p->pManFraig, pObj, i ) -// Vec_PtrForEachEntry( p->vPiVars, pObj, i ) +// Vec_PtrForEachEntry( Ivy_Obj_t *, p->vPiVars, pObj, i ) if ( p->pSat->model.ptr[Ivy_ObjSatNum(pObj)] == l_True ) Ivy_InfoSetBit( p->pPatWords, i ); // Ivy_InfoSetBit( p->pPatWords, pObj->Id - 1 ); @@ -1559,7 +1561,7 @@ void Ivy_FraigSavePattern2( Ivy_FraigMan_t * p ) int i; memset( p->pPatWords, 0, sizeof(unsigned) * p->nPatWords ); // Ivy_ManForEachPi( p->pManFraig, pObj, i ) - Vec_PtrForEachEntry( p->vPiVars, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vPiVars, pObj, i ) if ( p->pSat->model.ptr[Ivy_ObjSatNum(pObj)] == l_True ) // Ivy_InfoSetBit( p->pPatWords, i ); Ivy_InfoSetBit( p->pPatWords, pObj->Id - 1 ); @@ -1582,7 +1584,7 @@ void Ivy_FraigSavePattern3( Ivy_FraigMan_t * p ) int i; for ( i = 0; i < p->nPatWords; i++ ) p->pPatWords[i] = Ivy_ObjRandomSim(); - Vec_PtrForEachEntry( p->vPiVars, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vPiVars, pObj, i ) if ( Ivy_InfoHasBit( p->pPatWords, pObj->Id - 1 ) ^ (p->pSat->model.ptr[Ivy_ObjSatNum(pObj)] == l_True) ) Ivy_InfoXorBit( p->pPatWords, pObj->Id - 1 ); } @@ -1820,12 +1822,14 @@ int Ivy_FraigMiterStatus( Ivy_Man_t * pMan ) CountConst0++; continue; } +/* // check if the output is a primary input if ( Ivy_ObjIsPi(Ivy_Regular(pObjNew)) ) { CountNonConst0++; continue; } +*/ // check if the output can be constant 0 if ( Ivy_Regular(pObjNew)->fPhase != (unsigned)Ivy_IsComplement(pObjNew) ) { @@ -2398,7 +2402,7 @@ void Ivy_FraigAddClausesSuper( Ivy_FraigMan_t * p, Ivy_Obj_t * pNode, Vec_Ptr_t pLits = ABC_ALLOC( int, nLits ); // suppose AND-gate is A & B = C // add !A => !C or A + !C - Vec_PtrForEachEntry( vSuper, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vSuper, pFanin, i ) { pLits[0] = toLitCond(Ivy_ObjSatNum(Ivy_Regular(pFanin)), Ivy_IsComplement(pFanin)); pLits[1] = toLitCond(Ivy_ObjSatNum(pNode), 1); @@ -2406,7 +2410,7 @@ void Ivy_FraigAddClausesSuper( Ivy_FraigMan_t * p, Ivy_Obj_t * pNode, Vec_Ptr_t assert( RetValue ); } // add A & B => C or !A + !B + C - Vec_PtrForEachEntry( vSuper, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vSuper, pFanin, i ) pLits[i] = toLitCond(Ivy_ObjSatNum(Ivy_Regular(pFanin)), !Ivy_IsComplement(pFanin)); pLits[nLits-1] = toLitCond(Ivy_ObjSatNum(pNode), 0); RetValue = sat_solver_addclause( p->pSat, pLits, pLits + nLits ); @@ -2511,7 +2515,7 @@ void Ivy_FraigNodeAddToSolver( Ivy_FraigMan_t * p, Ivy_Obj_t * pOld, Ivy_Obj_t * if ( pOld ) Ivy_FraigObjAddToFrontier( p, pOld, vFrontier ); if ( pNew ) Ivy_FraigObjAddToFrontier( p, pNew, vFrontier ); // explore nodes in the frontier - Vec_PtrForEachEntry( vFrontier, pNode, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFrontier, pNode, i ) { // create the supergate assert( Ivy_ObjSatNum(pNode) ); @@ -2523,14 +2527,14 @@ void Ivy_FraigNodeAddToSolver( Ivy_FraigMan_t * p, Ivy_Obj_t * pOld, Ivy_Obj_t * Vec_PtrPushUnique( vFanins, Ivy_ObjFanin0( Ivy_ObjFanin1(pNode) ) ); Vec_PtrPushUnique( vFanins, Ivy_ObjFanin1( Ivy_ObjFanin0(pNode) ) ); Vec_PtrPushUnique( vFanins, Ivy_ObjFanin1( Ivy_ObjFanin1(pNode) ) ); - Vec_PtrForEachEntry( vFanins, pFanin, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFanins, pFanin, k ) Ivy_FraigObjAddToFrontier( p, Ivy_Regular(pFanin), vFrontier ); Ivy_FraigAddClausesMux( p, pNode ); } else { vFanins = Ivy_FraigCollectSuper( pNode, fUseMuxes ); - Vec_PtrForEachEntry( vFanins, pFanin, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFanins, pFanin, k ) Ivy_FraigObjAddToFrontier( p, Ivy_Regular(pFanin), vFrontier ); Ivy_FraigAddClausesSuper( p, pNode, vFanins ); } @@ -2572,7 +2576,7 @@ int Ivy_FraigSetActivityFactors_rec( Ivy_FraigMan_t * p, Ivy_Obj_t * pObj, int L veci_push(&p->pSat->act_vars, Ivy_ObjSatNum(pObj)); // explore the fanins vFanins = Ivy_ObjFaninVec( pObj ); - Vec_PtrForEachEntry( vFanins, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFanins, pFanin, i ) Counter += Ivy_FraigSetActivityFactors_rec( p, Ivy_Regular(pFanin), LevelMin, LevelMax ); return 1 + Counter; } @@ -2611,10 +2615,13 @@ p->timeTrav += clock() - clk; return 1; } - +ABC_NAMESPACE_IMPL_END #include "cuddInt.h" +ABC_NAMESPACE_IMPL_START + + /**Function************************************************************* Synopsis [Checks equivalence using BDDs.] @@ -2635,7 +2642,7 @@ DdNode * Ivy_FraigNodesAreEquivBdd_int( DdManager * dd, DdNode * bFunc, Vec_Ptr_ int i, NewSize; // create new frontier vTemp = Vec_PtrAlloc( 100 ); - Vec_PtrForEachEntry( vFront, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pObj, i ) { if ( (int)pObj->Level != Level ) { @@ -2664,7 +2671,7 @@ DdNode * Ivy_FraigNodesAreEquivBdd_int( DdManager * dd, DdNode * bFunc, Vec_Ptr_ // collect the permutation NewSize = IVY_MAX(dd->size, Vec_PtrSize(vTemp)); pFuncs = ABC_ALLOC( DdNode *, NewSize ); - Vec_PtrForEachEntry( vFront, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pObj, i ) { if ( (int)pObj->Level != Level ) pFuncs[i] = Cudd_bddIthVar( dd, pObj->TravId ); @@ -2685,7 +2692,7 @@ DdNode * Ivy_FraigNodesAreEquivBdd_int( DdManager * dd, DdNode * bFunc, Vec_Ptr_ // create new bFuncNew = Cudd_bddVectorCompose( dd, bFunc, pFuncs ); Cudd_Ref( bFuncNew ); // clean trav Id - Vec_PtrForEachEntry( vTemp, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vTemp, pObj, i ) { pObj->fMarkB = 0; pObj->TravId = 0; @@ -2739,7 +2746,7 @@ int Ivy_FraigNodesAreEquivBdd( Ivy_Obj_t * pObj1, Ivy_Obj_t * pObj2 ) { // find max level Level = 0; - Vec_PtrForEachEntry( vFront, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pObj, i ) if ( Level < (int)pObj->Level ) Level = (int)pObj->Level; if ( Level == 0 ) @@ -2771,3 +2778,5 @@ int Ivy_FraigNodesAreEquivBdd( Ivy_Obj_t * pObj1, Ivy_Obj_t * pObj2 ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyHaig.c b/src/aig/ivy/ivyHaig.c index 87021600..a4fda7d8 100644 --- a/src/aig/ivy/ivyHaig.c +++ b/src/aig/ivy/ivyHaig.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -158,7 +161,7 @@ void Ivy_ManHaigStop( Ivy_Man_t * p ) Ivy_Obj_t * pObj; int i; assert( p->pHaig != NULL ); - Vec_IntFree( p->pHaig->pData ); + Vec_IntFree( (Vec_Int_t *)p->pHaig->pData ); Ivy_ManStop( p->pHaig ); p->pHaig = NULL; // remove dangling pointers to the HAIG objects @@ -189,7 +192,7 @@ void Ivy_ManHaigCreateObj( Ivy_Man_t * p, Ivy_Obj_t * pObj ) // pObj->pEquiv = Ivy_Latch( p->pHaig, Ivy_ObjChild0Equiv(pObj), pObj->Init ); pEquiv0 = Ivy_ObjChild0Equiv(pObj); pEquiv0 = Ivy_NotCond( Ivy_HaigObjRepr(Ivy_Regular(pEquiv0)), Ivy_IsComplement(pEquiv0) ); - pObj->pEquiv = Ivy_Latch( p->pHaig, pEquiv0, pObj->Init ); + pObj->pEquiv = Ivy_Latch( p->pHaig, pEquiv0, (Ivy_Init_t)pObj->Init ); } else if ( Ivy_ObjType(pObj) == IVY_AND ) { @@ -469,7 +472,7 @@ printf( "Collected node %d with fanins %d and %d\n", pObj->Id, Ivy_ObjFanin0(pOb Ivy_ManForEachNodeVec( p, vLatches, pObj, i ) pObj->Init = IVY_INIT_DC; // set the latches of D to be determinate - vLatchesD = p->pData; + vLatchesD = (Vec_Int_t *)p->pData; Ivy_ManForEachNodeVec( p, vLatchesD, pObj, i ) pObj->Init = IVY_INIT_0; @@ -487,21 +490,21 @@ printf( "Collected node %d with fanins %d and %d\n", pObj->Id, Ivy_ObjFanin0(pOb { if ( fVerbose ) printf( "Processing node %d with fanins %d and %d\n", pObj->Id, Ivy_ObjFanin0(pObj)->Id, Ivy_ObjFanin1(pObj)->Id ); - In0 = Ivy_InitNotCond( Ivy_ObjFanin0(pObj)->Init, Ivy_ObjFaninC0(pObj) ); - In1 = Ivy_InitNotCond( Ivy_ObjFanin1(pObj)->Init, Ivy_ObjFaninC1(pObj) ); + In0 = Ivy_InitNotCond( (Ivy_Init_t)Ivy_ObjFanin0(pObj)->Init, Ivy_ObjFaninC0(pObj) ); + In1 = Ivy_InitNotCond( (Ivy_Init_t)Ivy_ObjFanin1(pObj)->Init, Ivy_ObjFaninC1(pObj) ); pObj->Init = Ivy_ManHaigSimulateAnd( In0, In1 ); // simulate the equivalence class if the node is a representative if ( pObj->pEquiv && Ivy_ObjRefs(pObj) > 0 ) { if ( fVerbose ) printf( "Processing choice node %d\n", pObj->Id ); - In0 = pObj->Init; + In0 = (Ivy_Init_t)pObj->Init; assert( !Ivy_IsComplement(pObj->pEquiv) ); for ( pTemp = pObj->pEquiv; pTemp != pObj; pTemp = Ivy_Regular(pTemp->pEquiv) ) { if ( fVerbose ) printf( "Processing secondary node %d\n", pTemp->Id ); - In1 = Ivy_InitNotCond( pTemp->Init, Ivy_IsComplement(pTemp->pEquiv) ); + In1 = Ivy_InitNotCond( (Ivy_Init_t)pTemp->Init, Ivy_IsComplement(pTemp->pEquiv) ); In0 = Ivy_ManHaigSimulateChoice( In0, In1 ); } pObj->Init = In0; @@ -528,3 +531,5 @@ printf( "Using latch %d with fanin %d\n", pObj->Id, Ivy_ObjFanin0(pObj)->Id ); //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyMan.c b/src/aig/ivy/ivyMan.c index 909548d1..6fa34144 100644 --- a/src/aig/ivy/ivyMan.c +++ b/src/aig/ivy/ivyMan.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -333,10 +336,10 @@ int Ivy_ManCleanupSeq( Ivy_Man_t * p ) return 0; } // disconnect the marked objects - Vec_PtrForEachEntry( vNodes, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vNodes, pObj, i ) Ivy_ObjDisconnect( p, pObj ); // remove the dangling objects - Vec_PtrForEachEntry( vNodes, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vNodes, pObj, i ) { assert( Ivy_ObjIsNode(pObj) || Ivy_ObjIsLatch(pObj) || Ivy_ObjIsBuf(pObj) ); assert( Ivy_ObjRefs(pObj) == 0 ); @@ -416,7 +419,7 @@ int Ivy_ManPropagateBuffers( Ivy_Man_t * p, int fUpdateLevel ) int nSteps; for ( nSteps = 0; Vec_PtrSize(p->vBufs) > 0; nSteps++ ) { - pNode = Vec_PtrEntryLast(p->vBufs); + pNode = (Ivy_Obj_t *)Vec_PtrEntryLast(p->vBufs); while ( Ivy_ObjIsBuf(pNode) ) pNode = Ivy_ObjReadFirstFanout( p, pNode ); // check if this buffer should remain @@ -494,7 +497,7 @@ void Ivy_ManMakeSeq( Ivy_Man_t * p, int nLatches, int * pInits ) for ( i = 0; i < nLatches; i++ ) { // get the latch value - Init = pInits? pInits[i] : IVY_INIT_0; + Init = pInits? (Ivy_Init_t)pInits[i] : IVY_INIT_0; // create latch pObj = Ivy_ManPo( p, Ivy_ManPoNum(p) - nLatches + i ); pLatch = Ivy_Latch( p, Ivy_ObjChild0(pObj), Init ); @@ -545,3 +548,5 @@ void Ivy_ManMakeSeq( Ivy_Man_t * p, int nLatches, int * pInits ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyMem.c b/src/aig/ivy/ivyMem.c index 4ea6d891..d5e6e545 100644 --- a/src/aig/ivy/ivyMem.c +++ b/src/aig/ivy/ivyMem.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -64,7 +67,7 @@ void Ivy_ManStopMemory( Ivy_Man_t * p ) { void * pMemory; int i; - Vec_PtrForEachEntry( p->vChunks, pMemory, i ) + Vec_PtrForEachEntry( void *, p->vChunks, pMemory, i ) ABC_FREE( pMemory ); Vec_PtrFree( p->vChunks ); Vec_PtrFree( p->vPages ); @@ -114,3 +117,5 @@ void Ivy_ManAddMemory( Ivy_Man_t * p ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyMulti.c b/src/aig/ivy/ivyMulti.c index 882c2c87..c137a659 100644 --- a/src/aig/ivy/ivyMulti.c +++ b/src/aig/ivy/ivyMulti.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -74,7 +77,7 @@ int Ivy_MultiPlus( Ivy_Man_t * p, Vec_Ptr_t * vLeaves, Vec_Ptr_t * vCone, Ivy_Ty // set the leaf entries uMaskAll = ((1 << nLeaves) - 1); nEvals = 0; - Vec_PtrForEachEntry( vLeaves, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vLeaves, pObj, i ) { pEval = pEvals + nEvals; pEval->pArg = pObj; @@ -86,7 +89,7 @@ int Ivy_MultiPlus( Ivy_Man_t * p, Vec_Ptr_t * vLeaves, Vec_Ptr_t * vCone, Ivy_Ty } // propagate masks through the cone - Vec_PtrForEachEntry( vCone, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vCone, pObj, i ) { pObj->TravId = nEvals + i; if ( Ivy_ObjIsBuf(pObj) ) @@ -96,7 +99,7 @@ int Ivy_MultiPlus( Ivy_Man_t * p, Vec_Ptr_t * vLeaves, Vec_Ptr_t * vCone, Ivy_Ty } // set the internal entries - Vec_PtrForEachEntry( vCone, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vCone, pObj, i ) { if ( i == Vec_PtrSize(vCone) - 1 ) break; @@ -129,7 +132,7 @@ int Ivy_MultiPlus( Ivy_Man_t * p, Vec_Ptr_t * vLeaves, Vec_Ptr_t * vCone, Ivy_Ty continue; // skip the leaves for ( x = 0; x < nLeaves; x++ ) - if ( pTemp == Ivy_Regular(vLeaves->pArray[x]) ) + if ( pTemp == Ivy_Regular((Ivy_Obj_t *)vLeaves->pArray[x]) ) break; if ( x < nLeaves ) continue; @@ -305,3 +308,5 @@ int Ivy_MultiCover( Ivy_Man_t * p, Ivy_Eva_t * pEvals, int nLeaves, int nEvals, //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyMulti8.c b/src/aig/ivy/ivyMulti8.c index 059d1500..23af0e38 100644 --- a/src/aig/ivy/ivyMulti8.c +++ b/src/aig/ivy/ivyMulti8.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -425,3 +428,5 @@ Ivy_Obj_t * Ivy_Multi2( Ivy_Obj_t ** pArgs, int nArgs, Ivy_Type_t Type ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyObj.c b/src/aig/ivy/ivyObj.c index 59dda19c..becf69d1 100644 --- a/src/aig/ivy/ivyObj.c +++ b/src/aig/ivy/ivyObj.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -474,3 +477,5 @@ void Ivy_NodeFixBufferFanins( Ivy_Man_t * p, Ivy_Obj_t * pNode, int fUpdateLevel //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyOper.c b/src/aig/ivy/ivyOper.c index 8115ce4f..ea61924d 100644 --- a/src/aig/ivy/ivyOper.c +++ b/src/aig/ivy/ivyOper.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -265,7 +268,7 @@ Ivy_Obj_t * Ivy_Miter( Ivy_Man_t * p, Vec_Ptr_t * vPairs ) assert( vPairs->nSize % 2 == 0 ); // go through the cubes of the node's SOP for ( i = 0; i < vPairs->nSize; i += 2 ) - vPairs->pArray[i/2] = Ivy_Not( Ivy_Exor( p, vPairs->pArray[i], vPairs->pArray[i+1] ) ); + vPairs->pArray[i/2] = Ivy_Not( Ivy_Exor( p, (Ivy_Obj_t *)vPairs->pArray[i], (Ivy_Obj_t *)vPairs->pArray[i+1] ) ); vPairs->nSize = vPairs->nSize/2; return Ivy_Not( Ivy_Multi_rec( p, (Ivy_Obj_t **)vPairs->pArray, vPairs->nSize, IVY_AND ) ); } @@ -291,3 +294,5 @@ Ivy_Obj_t * Ivy_Latch( Ivy_Man_t * p, Ivy_Obj_t * pObj, Ivy_Init_t Init ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyResyn.c b/src/aig/ivy/ivyResyn.c index 35ecb122..8d571110 100644 --- a/src/aig/ivy/ivyResyn.c +++ b/src/aig/ivy/ivyResyn.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -194,3 +197,5 @@ if ( fVerbose ) Ivy_ManPrintStats( pMan ); //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyRwr.c b/src/aig/ivy/ivyRwr.c index af425079..b7cb500c 100644 --- a/src/aig/ivy/ivyRwr.c +++ b/src/aig/ivy/ivyRwr.c @@ -22,6 +22,9 @@ #include "deco.h" #include "rwt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -83,14 +86,14 @@ int Ivy_ManRewritePre( Ivy_Man_t * p, int fUpdateLevel, int fUseZeroCost, int fV nGain = Ivy_NodeRewrite( p, pManRwt, pNode, fUpdateLevel, fUseZeroCost ); if ( nGain > 0 || (nGain == 0 && fUseZeroCost) ) { - Dec_Graph_t * pGraph = Rwt_ManReadDecs(pManRwt); + Dec_Graph_t * pGraph = (Dec_Graph_t *)Rwt_ManReadDecs(pManRwt); int fCompl = Rwt_ManReadCompl(pManRwt); /* { Ivy_Obj_t * pObj; int i; printf( "USING: (" ); - Vec_PtrForEachEntry( Rwt_ManReadLeaves(pManRwt), pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, Rwt_ManReadLeaves(pManRwt), pObj, i ) printf( "%d ", Ivy_ObjFanoutNum(Ivy_Regular(pObj)) ); printf( ") Gain = %d.\n", nGain ); } @@ -208,18 +211,18 @@ p->timeTruth += clock() - clk2; clk2 = clock(); /* printf( "Considering: (" ); - Vec_PtrForEachEntry( p->vFaninsCur, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vFaninsCur, pFanin, i ) printf( "%d ", Ivy_ObjFanoutNum(Ivy_Regular(pFanin)) ); printf( ")\n" ); */ // mark the fanin boundary - Vec_PtrForEachEntry( p->vFaninsCur, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vFaninsCur, pFanin, i ) Ivy_ObjRefsInc( Ivy_Regular(pFanin) ); // label MFFC with current ID Ivy_ManIncrementTravId( pMan ); nNodesSaved = Ivy_ObjMffcLabel( pMan, pNode ); // unmark the fanin boundary - Vec_PtrForEachEntry( p->vFaninsCur, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vFaninsCur, pFanin, i ) Ivy_ObjRefsDec( Ivy_Regular(pFanin) ); p->timeMffc += clock() - clk2; @@ -239,7 +242,7 @@ p->timeEval += clock() - clk2; uTruthBest = uTruth; // collect fanins in the Vec_PtrClear( p->vFanins ); - Vec_PtrForEachEntry( p->vFaninsCur, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vFaninsCur, pFanin, i ) Vec_PtrPush( p->vFanins, pFanin ); } } @@ -257,7 +260,7 @@ p->timeRes += clock() - clk; else { printf( "Node %d : ", pNode->Id ); - Vec_PtrForEachEntry( p->vFanins, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vFanins, pFanin, i ) printf( "%d ", Ivy_Regular(pFanin)->Id ); printf( "a" ); } @@ -272,8 +275,8 @@ p->timeRes += clock() - clk; */ // copy the leaves - Vec_PtrForEachEntry( p->vFanins, pFanin, i ) - Dec_GraphNode(p->pGraph, i)->pFunc = pFanin; + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vFanins, pFanin, i ) + Dec_GraphNode((Dec_Graph_t *)p->pGraph, i)->pFunc = pFanin; p->nScores[p->pMap[uTruthBest]]++; p->nNodesGained += GainBest; @@ -288,7 +291,7 @@ p->timeRes += clock() - clk; printf( "Save = %d. ", nNodesSaveCur ); printf( "Add = %d. ", nNodesSaveCur-GainBest ); printf( "GAIN = %d. ", GainBest ); - printf( "Cone = %d. ", p->pGraph? Dec_GraphNodeNum(p->pGraph) : 0 ); + printf( "Cone = %d. ", p->pGraph? Dec_GraphNodeNum((Dec_Graph_t *)p->pGraph) : 0 ); printf( "Class = %d. ", p->pMap[uTruthBest] ); printf( "\n" ); } @@ -363,16 +366,16 @@ Dec_Graph_t * Rwt_CutEvaluate( Ivy_Man_t * pMan, Rwt_Man_t * p, Ivy_Obj_t * pRoo Rwt_Node_t * pNode, * pFanin; int nNodesAdded, GainBest, i, k; // find the matching class of subgraphs - vSubgraphs = Vec_VecEntry( p->vClasses, p->pMap[uTruth] ); + vSubgraphs = (Vec_Ptr_t *)Vec_VecEntry( p->vClasses, p->pMap[uTruth] ); p->nSubgraphs += vSubgraphs->nSize; // determine the best subgraph GainBest = -1; - Vec_PtrForEachEntry( vSubgraphs, pNode, i ) + Vec_PtrForEachEntry( Rwt_Node_t *, vSubgraphs, pNode, i ) { // get the current graph pGraphCur = (Dec_Graph_t *)pNode->pNext; // copy the leaves - Vec_PtrForEachEntry( vFaninsCur, pFanin, k ) + Vec_PtrForEachEntry( Rwt_Node_t *, vFaninsCur, pFanin, k ) Dec_GraphNode(pGraphCur, k)->pFunc = pFanin; // detect how many unlabeled nodes will be reused nNodesAdded = Ivy_GraphToNetworkCount( pMan, pRoot, pGraphCur, nNodesSaved, LevelMax ); @@ -417,7 +420,7 @@ int Ivy_GraphToNetworkCount( Ivy_Man_t * p, Ivy_Obj_t * pRoot, Dec_Graph_t * pGr return 0; // set the levels of the leaves Dec_GraphForEachLeaf( pGraph, pNode, i ) - pNode->Level = Ivy_Regular(pNode->pFunc)->Level; + pNode->Level = Ivy_Regular((Ivy_Obj_t *)pNode->pFunc)->Level; // compute the AIG size after adding the internal nodes Counter = 0; Dec_GraphForEachNode( pGraph, pNode, i ) @@ -426,8 +429,8 @@ int Ivy_GraphToNetworkCount( Ivy_Man_t * p, Ivy_Obj_t * pRoot, Dec_Graph_t * pGr pNode0 = Dec_GraphNode( pGraph, pNode->eEdge0.Node ); pNode1 = Dec_GraphNode( pGraph, pNode->eEdge1.Node ); // get the AIG nodes corresponding to the children - pAnd0 = pNode0->pFunc; - pAnd1 = pNode1->pFunc; + pAnd0 = (Ivy_Obj_t *)pNode0->pFunc; + pAnd1 = (Ivy_Obj_t *)pNode1->pFunc; if ( pAnd0 && pAnd1 ) { // if they are both present, find the resulting node @@ -489,16 +492,16 @@ Ivy_Obj_t * Ivy_GraphToNetwork( Ivy_Man_t * p, Dec_Graph_t * pGraph ) return Ivy_NotCond( Ivy_ManConst1(p), Dec_GraphIsComplement(pGraph) ); // check for a literal if ( Dec_GraphIsVar(pGraph) ) - return Ivy_NotCond( Dec_GraphVar(pGraph)->pFunc, Dec_GraphIsComplement(pGraph) ); + return Ivy_NotCond( (Ivy_Obj_t *)Dec_GraphVar(pGraph)->pFunc, Dec_GraphIsComplement(pGraph) ); // build the AIG nodes corresponding to the AND gates of the graph Dec_GraphForEachNode( pGraph, pNode, i ) { - pAnd0 = Ivy_NotCond( Dec_GraphNode(pGraph, pNode->eEdge0.Node)->pFunc, pNode->eEdge0.fCompl ); - pAnd1 = Ivy_NotCond( Dec_GraphNode(pGraph, pNode->eEdge1.Node)->pFunc, pNode->eEdge1.fCompl ); + pAnd0 = Ivy_NotCond( (Ivy_Obj_t *)Dec_GraphNode(pGraph, pNode->eEdge0.Node)->pFunc, pNode->eEdge0.fCompl ); + pAnd1 = Ivy_NotCond( (Ivy_Obj_t *)Dec_GraphNode(pGraph, pNode->eEdge1.Node)->pFunc, pNode->eEdge1.fCompl ); pNode->pFunc = Ivy_And( p, pAnd0, pAnd1 ); } // complement the result if necessary - return Ivy_NotCond( pNode->pFunc, Dec_GraphIsComplement(pGraph) ); + return Ivy_NotCond( (Ivy_Obj_t *)pNode->pFunc, Dec_GraphIsComplement(pGraph) ); } /**Function************************************************************* @@ -561,7 +564,7 @@ void Ivy_GraphUpdateNetwork3( Ivy_Man_t * p, Ivy_Obj_t * pRoot, Dec_Graph_t * pG //printf( "Before = %d. ", Ivy_ManNodeNum(p) ); // mark the cut - Vec_PtrForEachEntry( ((Rwt_Man_t *)p->pData)->vFanins, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, ((Rwt_Man_t *)p->pData)->vFanins, pFanin, i ) Ivy_ObjRefsInc( Ivy_Regular(pFanin) ); // deref the old cone nRefsOld = pRoot->nRefs; @@ -569,7 +572,7 @@ void Ivy_GraphUpdateNetwork3( Ivy_Man_t * p, Ivy_Obj_t * pRoot, Dec_Graph_t * pG Ivy_ObjDelete_rec( p, pRoot, 0 ); pRoot->nRefs = nRefsOld; // unmark the cut - Vec_PtrForEachEntry( ((Rwt_Man_t *)p->pData)->vFanins, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, ((Rwt_Man_t *)p->pData)->vFanins, pFanin, i ) Ivy_ObjRefsDec( Ivy_Regular(pFanin) ); //printf( "Deref = %d. ", Ivy_ManNodeNum(p) ); @@ -591,7 +594,7 @@ void Ivy_GraphUpdateNetwork3( Ivy_Man_t * p, Ivy_Obj_t * pRoot, Dec_Graph_t * pG //printf( "Replace = %d. ", Ivy_ManNodeNum(p) ); // delete remaining dangling nodes - Vec_PtrForEachEntry( ((Rwt_Man_t *)p->pData)->vFanins, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, ((Rwt_Man_t *)p->pData)->vFanins, pFanin, i ) { pFanin = Ivy_Regular(pFanin); if ( !Ivy_ObjIsNone(pFanin) && Ivy_ObjRefs(pFanin) == 0 ) @@ -611,3 +614,5 @@ void Ivy_GraphUpdateNetwork3( Ivy_Man_t * p, Ivy_Obj_t * pRoot, Dec_Graph_t * pG //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyRwrAlg.c b/src/aig/ivy/ivyRwrAlg.c index fc48deb0..ce605003 100644 --- a/src/aig/ivy/ivyRwrAlg.c +++ b/src/aig/ivy/ivyRwrAlg.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -136,7 +139,7 @@ Ivy_Obj_t * Ivy_NodeRewriteAlg( Ivy_Obj_t * pObj, Vec_Ptr_t * vFront, Vec_Ptr_t /* printf( "%d ", Vec_PtrSize(vFront) ); printf( "( " ); - Vec_PtrForEachEntry( vFront, pTemp, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pTemp, k ) printf( "%d ", Ivy_ObjRefs(Ivy_Regular(pTemp)) ); printf( ")\n" ); */ @@ -147,7 +150,7 @@ Ivy_Obj_t * Ivy_NodeRewriteAlg( Ivy_Obj_t * pObj, Vec_Ptr_t * vFront, Vec_Ptr_t Ivy_ManCollectCone( pObj, vLeaves, vCone ); // deref nodes in the cone - Vec_PtrForEachEntry( vCone, pTemp, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vCone, pTemp, k ) { Ivy_ObjRefsDec( Ivy_ObjFanin0(pTemp) ); Ivy_ObjRefsDec( Ivy_ObjFanin1(pTemp) ); @@ -155,27 +158,27 @@ Ivy_Obj_t * Ivy_NodeRewriteAlg( Ivy_Obj_t * pObj, Vec_Ptr_t * vFront, Vec_Ptr_t } // count the MFFC size - Vec_PtrForEachEntry( vFront, pTemp, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pTemp, k ) Ivy_Regular(pTemp)->fMarkA = 1; nMffc = Ivy_NodeCountMffc( pObj ); - Vec_PtrForEachEntry( vFront, pTemp, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vFront, pTemp, k ) Ivy_Regular(pTemp)->fMarkA = 0; if ( fVerbose ) { Counter = 0; - Vec_PtrForEachEntry( vCone, pTemp, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vCone, pTemp, k ) Counter += (Ivy_ObjRefs(pTemp) > 0); printf( "%5d : Leaves = %2d. Cone = %2d. ConeRef = %2d. Mffc = %d. Lev = %d. LevR = %d.\n", pObj->Id, Vec_PtrSize(vFront), Vec_PtrSize(vCone), Counter-1, nMffc, Ivy_ObjLevel(pObj), LevelR ); } /* printf( "Leaves:" ); - Vec_PtrForEachEntry( vLeaves, pTemp, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vLeaves, pTemp, k ) printf( " %d%s", Ivy_Regular(pTemp)->Id, Ivy_IsComplement(pTemp)? "\'" : "" ); printf( "\n" ); printf( "Cone:\n" ); - Vec_PtrForEachEntry( vCone, pTemp, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vCone, pTemp, k ) printf( " %5d = %d%s %d%s\n", pTemp->Id, Ivy_ObjFaninId0(pTemp), Ivy_ObjFaninC0(pTemp)? "\'" : "", Ivy_ObjFaninId1(pTemp), Ivy_ObjFaninC1(pTemp)? "\'" : "" ); @@ -184,7 +187,7 @@ Ivy_Obj_t * Ivy_NodeRewriteAlg( Ivy_Obj_t * pObj, Vec_Ptr_t * vFront, Vec_Ptr_t RetValue = Ivy_MultiPlus( vLeaves, vCone, Ivy_ObjType(pObj), nMffc + fUseZeroCost, vSols ); // ref nodes in the cone - Vec_PtrForEachEntry( vCone, pTemp, k ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vCone, pTemp, k ) { Ivy_ObjRefsInc( Ivy_ObjFanin0(pTemp) ); Ivy_ObjRefsInc( Ivy_ObjFanin1(pTemp) ); @@ -356,7 +359,7 @@ int Ivy_ManFindAlgCut( Ivy_Obj_t * pRoot, Vec_Ptr_t * vFront, Vec_Ptr_t * vLeave Vec_PtrClear( vLeaves ); RetValue = Ivy_ManFindAlgCut_rec( pRoot, Ivy_ObjType(pRoot), vFront, vCone ); // clean the marks - Vec_PtrForEachEntry( vCone, pObj, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vCone, pObj, i ) pObj->fMarkA = pObj->fMarkB = 0; // quit if the same node is found in both polarities if ( RetValue == -1 ) @@ -368,11 +371,11 @@ int Ivy_ManFindAlgCut( Ivy_Obj_t * pRoot, Vec_Ptr_t * vFront, Vec_Ptr_t * vLeave if ( Vec_PtrSize(vFront) <= 2 ) return 1; // sort the entries in increasing order - Vec_PtrSort( vFront, Ivy_ManFindAlgCutCompare ); + Vec_PtrSort( vFront, (int (*)(void))Ivy_ManFindAlgCutCompare ); // remove duplicates from vFront and save the nodes in vLeaves pPrev = Vec_PtrEntry(vFront, 0); Vec_PtrPush( vLeaves, pPrev ); - Vec_PtrForEachEntryStart( vFront, pObj, i, 1 ) + Vec_PtrForEachEntryStart( Ivy_Obj_t *, vFront, pObj, i, 1 ) { // compare current entry and the previous entry if ( pObj == pPrev ) @@ -406,3 +409,5 @@ int Ivy_ManFindAlgCut( Ivy_Obj_t * pRoot, Vec_Ptr_t * vFront, Vec_Ptr_t * vLeave //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivySeq.c b/src/aig/ivy/ivySeq.c index 0971a548..69d05463 100644 --- a/src/aig/ivy/ivySeq.c +++ b/src/aig/ivy/ivySeq.c @@ -22,6 +22,9 @@ #include "deco.h" #include "rwt.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -93,7 +96,7 @@ int Ivy_ManRewriteSeq( Ivy_Man_t * p, int fUseZeroCost, int fVerbose ) nGain = Ivy_NodeRewriteSeq( p, pManRwt, pNode, fUseZeroCost ); if ( nGain > 0 || (nGain == 0 && fUseZeroCost) ) { - Dec_Graph_t * pGraph = Rwt_ManReadDecs(pManRwt); + Dec_Graph_t * pGraph = (Dec_Graph_t *)Rwt_ManReadDecs(pManRwt); int fCompl = Rwt_ManReadCompl(pManRwt); // complement the FF if needed clk = clock(); @@ -199,7 +202,7 @@ p->timeTruth += clock() - clk2; } clk2 = clock(); // mark the fanin boundary - Vec_PtrForEachEntry( p->vFaninsCur, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vFaninsCur, pFanin, i ) Ivy_ObjRefsInc( Ivy_Regular(pFanin) ); // label MFFC with current ID Ivy_ManIncrementTravId( pMan ); @@ -208,7 +211,7 @@ clk2 = clock(); // Ivy_ObjForEachFanout( pMan, pNode, vFanout, pFanout, i ) // Ivy_ObjSetTravIdCurrent( pMan, pFanout ); // unmark the fanin boundary - Vec_PtrForEachEntry( p->vFaninsCur, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vFaninsCur, pFanin, i ) Ivy_ObjRefsDec( Ivy_Regular(pFanin) ); p->timeMffc += clock() - clk2; @@ -231,7 +234,7 @@ p->timeEval += clock() - clk2; uTruthBest = uTruth; // collect fanins in the Vec_PtrClear( p->vFanins ); - Vec_PtrForEachEntry( p->vFaninsCur, pFanin, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, p->vFaninsCur, pFanin, i ) Vec_PtrPush( p->vFanins, pFanin ); } } @@ -260,7 +263,7 @@ p->timeRes += clock() - clk; // nMovesS++; // copy the leaves - Ivy_GraphPrepare( p->pGraph, p->pCut, p->vFanins, p->pPerm ); + Ivy_GraphPrepare( (Dec_Graph_t *)p->pGraph, (Ivy_Cut_t *)p->pCut, p->vFanins, p->pPerm ); p->nScores[p->pMap[uTruthBest]]++; p->nNodesGained += GainBest; @@ -286,7 +289,7 @@ p->timeRes += clock() - clk; printf( "Save = %d. ", nNodesSaveCur ); printf( "Add = %d. ", nNodesSaveCur-GainBest ); printf( "GAIN = %d. ", GainBest ); - printf( "Cone = %d. ", p->pGraph? Dec_GraphNodeNum(p->pGraph) : 0 ); + printf( "Cone = %d. ", p->pGraph? Dec_GraphNodeNum((Dec_Graph_t *)p->pGraph) : 0 ); printf( "Class = %d. ", p->pMap[uTruthBest] ); printf( "\n" ); } @@ -313,11 +316,11 @@ Dec_Graph_t * Rwt_CutEvaluateSeq( Ivy_Man_t * pMan, Rwt_Man_t * p, Ivy_Obj_t * p Rwt_Node_t * pNode; int nNodesAdded, GainBest, i; // find the matching class of subgraphs - vSubgraphs = Vec_VecEntry( p->vClasses, p->pMap[uTruth] ); + vSubgraphs = (Vec_Ptr_t *)Vec_VecEntry( p->vClasses, p->pMap[uTruth] ); p->nSubgraphs += vSubgraphs->nSize; // determine the best subgraph GainBest = -1; - Vec_PtrForEachEntry( vSubgraphs, pNode, i ) + Vec_PtrForEachEntry( Rwt_Node_t *, vSubgraphs, pNode, i ) { // get the current graph pGraphCur = (Dec_Graph_t *)pNode->pNext; @@ -325,7 +328,7 @@ Dec_Graph_t * Rwt_CutEvaluateSeq( Ivy_Man_t * pMan, Rwt_Man_t * p, Ivy_Obj_t * p // if ( pRoot->Id == 8648 ) // Dec_GraphPrint( stdout, pGraphCur, NULL, NULL ); // copy the leaves -// Vec_PtrForEachEntry( vFaninsCur, pFanin, k ) +// Vec_PtrForEachEntry( Ivy_Obj_t *, vFaninsCur, pFanin, k ) // Dec_GraphNode(pGraphCur, k)->pFunc = pFanin; Ivy_GraphPrepare( pGraphCur, pCut, vFaninsCur, pPerm ); @@ -413,8 +416,8 @@ int Ivy_GraphToNetworkSeqCountSeq( Ivy_Man_t * p, Ivy_Obj_t * pRoot, Dec_Graph_t pNode0 = Dec_GraphNode( pGraph, pNode->eEdge0.Node ); pNode1 = Dec_GraphNode( pGraph, pNode->eEdge1.Node ); // get the AIG nodes corresponding to the children - pAnd0 = pNode0->pFunc; - pAnd1 = pNode1->pFunc; + pAnd0 = (Ivy_Obj_t *)pNode0->pFunc; + pAnd1 = (Ivy_Obj_t *)pNode1->pFunc; // skip the latches for ( k = 0; pAnd0 && k < (int)pNode->nLat0; k++ ) { @@ -486,14 +489,14 @@ Ivy_Obj_t * Ivy_GraphToNetworkSeq( Ivy_Man_t * p, Dec_Graph_t * pGraph ) pNode = Dec_GraphVar(pGraph); // add the remaining latches for ( k = 0; k < (int)pNode->nLat2; k++ ) - pNode->pFunc = Ivy_Latch( p, pNode->pFunc, IVY_INIT_DC ); - return Ivy_NotCond( pNode->pFunc, Dec_GraphIsComplement(pGraph) ); + pNode->pFunc = Ivy_Latch( p, (Ivy_Obj_t *)pNode->pFunc, IVY_INIT_DC ); + return Ivy_NotCond( (Ivy_Obj_t *)pNode->pFunc, Dec_GraphIsComplement(pGraph) ); } // build the AIG nodes corresponding to the AND gates of the graph Dec_GraphForEachNode( pGraph, pNode, i ) { - pAnd0 = Ivy_NotCond( Dec_GraphNode(pGraph, pNode->eEdge0.Node)->pFunc, pNode->eEdge0.fCompl ); - pAnd1 = Ivy_NotCond( Dec_GraphNode(pGraph, pNode->eEdge1.Node)->pFunc, pNode->eEdge1.fCompl ); + pAnd0 = Ivy_NotCond( (Ivy_Obj_t *)Dec_GraphNode(pGraph, pNode->eEdge0.Node)->pFunc, pNode->eEdge0.fCompl ); + pAnd1 = Ivy_NotCond( (Ivy_Obj_t *)Dec_GraphNode(pGraph, pNode->eEdge1.Node)->pFunc, pNode->eEdge1.fCompl ); // add the latches for ( k = 0; k < (int)pNode->nLat0; k++ ) pAnd0 = Ivy_Latch( p, pAnd0, IVY_INIT_DC ); @@ -504,9 +507,9 @@ Ivy_Obj_t * Ivy_GraphToNetworkSeq( Ivy_Man_t * p, Dec_Graph_t * pGraph ) } // add the remaining latches for ( k = 0; k < (int)pNode->nLat2; k++ ) - pNode->pFunc = Ivy_Latch( p, pNode->pFunc, IVY_INIT_DC ); + pNode->pFunc = Ivy_Latch( p, (Ivy_Obj_t *)pNode->pFunc, IVY_INIT_DC ); // complement the result if necessary - return Ivy_NotCond( pNode->pFunc, Dec_GraphIsComplement(pGraph) ); + return Ivy_NotCond( (Ivy_Obj_t *)pNode->pFunc, Dec_GraphIsComplement(pGraph) ); } /**Function************************************************************* @@ -1135,3 +1138,5 @@ void Ivy_CutComputeAll( Ivy_Man_t * p, int nInputs ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyShow.c b/src/aig/ivy/ivyShow.c index 4fac2709..3aa1e041 100644 --- a/src/aig/ivy/ivyShow.c +++ b/src/aig/ivy/ivyShow.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -94,7 +97,7 @@ void Ivy_WriteDotAig( Ivy_Man_t * pMan, char * pFileName, int fHaig, Vec_Ptr_t * // mark the nodes if ( vBold ) - Vec_PtrForEachEntry( vBold, pNode, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vBold, pNode, i ) pNode->fMarkB = 1; // compute levels @@ -326,7 +329,7 @@ void Ivy_WriteDotAig( Ivy_Man_t * pMan, char * pFileName, int fHaig, Vec_Ptr_t * // unmark nodes if ( vBold ) - Vec_PtrForEachEntry( vBold, pNode, i ) + Vec_PtrForEachEntry( Ivy_Obj_t *, vBold, pNode, i ) pNode->fMarkB = 0; } @@ -336,3 +339,5 @@ void Ivy_WriteDotAig( Ivy_Man_t * pMan, char * pFileName, int fHaig, Vec_Ptr_t * //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyTable.c b/src/aig/ivy/ivyTable.c index fdcc4bfb..0fe5c7ba 100644 --- a/src/aig/ivy/ivyTable.c +++ b/src/aig/ivy/ivyTable.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -299,3 +302,5 @@ unsigned int Cudd_PrimeAig( unsigned int p) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivyUtil.c b/src/aig/ivy/ivyUtil.c index ab62a276..4df67517 100644 --- a/src/aig/ivy/ivyUtil.c +++ b/src/aig/ivy/ivyUtil.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -816,3 +819,5 @@ int Ivy_CutTruthPrint( Ivy_Man_t * p, Ivy_Cut_t * pCut, unsigned uTruth ) //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + diff --git a/src/aig/ivy/ivy_.c b/src/aig/ivy/ivy_.c index 65689689..ccad8a46 100644 --- a/src/aig/ivy/ivy_.c +++ b/src/aig/ivy/ivy_.c @@ -20,6 +20,9 @@ #include "ivy.h" +ABC_NAMESPACE_IMPL_START + + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -46,3 +49,5 @@ //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + |