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/ivyBalance.c | |
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/ivyBalance.c')
-rw-r--r-- | src/aig/ivy/ivyBalance.c | 37 |
1 files changed, 21 insertions, 16 deletions
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 + |