28 #define AddToLinkedList( ppList, pLink ) (((pLink)->Next = *(ppList)), (*(ppList) = (pLink)))
49 int lev1 = lev0 + 1, lev2 = lev0 + 2;
53 reo_unit * pNewPlane20 = NULL, * pNewPlane21 = NULL;
55 reo_unit * pUnitE, * pUnitER, * pUnitT;
57 reo_unit * pNew1E, * pNew1T, * pNew2E, * pNew2T;
63 reo_unit * pListNew0 = NULL, ** ppListNew0 = &pListNew0;
64 reo_unit * pListNew1 = NULL, ** ppListNew1 = &pListNew1;
65 reo_unit * pListTemp = NULL, ** ppListTemp = &pListTemp;
67 int fComp, fCompT, fFound, HKey, fInteract, temp, c;
70 int nNodesUpMovedDown = 0;
71 int nNodesDownMovedUp = 0;
72 int nNodesUnrefRemoved = 0;
73 int nNodesUnrefAdded = 0;
74 int nWidthReduction = 0;
75 double AplWeightTotalLev0 = 0.0;
76 double AplWeightTotalLev1 = 0.0;
77 double AplWeightHalf = 0.0;
78 double AplWeightPrev = 0.0;
79 double AplWeightAfter = 0.0;
83 assert( lev0 >= 0 && lev1 < p->nSupp );
89 assert( pListOld0 && pListOld1 );
103 AplWeightTotalLev0 = 0.0;
104 AplWeightTotalLev1 = 0.0;
109 for ( pUnit = pListOld0; pUnit; pUnit = pUnit->
Next )
132 for ( pUnit = pListOld1; pUnit; pUnit = pUnit->
Next )
137 if ( pUnitER->
TopRef > lev0 )
141 if ( pUnitER->
TopRef == lev2 )
155 if ( pUnitT->
TopRef > lev0 )
159 if ( pUnitT->
TopRef == lev2 )
175 for ( pUnit = pListOld0; pUnit; pUnit = pUnit->
Next )
180 if ( pUnitER->
TopRef > lev0 )
192 if ( pUnitT->
TopRef > lev0 )
208 for ( pUnit = pListOld1; pUnit; pUnit = pUnit->
Next )
213 pListNew0 = pListOld1;
214 pListNew1 = pListOld0;
243 for ( pLoop = pListOld0; pLoop; )
252 if ( pUnitER->
lev != lev1 && pUnitT->
lev != lev1 )
271 AplWeightTotalLev1 += pUnit->
Weight;
288 if ( pUnitER->
TopRef > lev0 )
298 if ( pUnitT->
TopRef > lev0 )
320 for ( pLoop = pListTemp; pLoop; )
328 fComp = (int)(pUnitER != pUnitE);
332 AplWeightHalf = 0.5 * pUnit->
Weight;
335 if ( pUnitER->
lev == lev1 && pUnitT->
lev == lev1 )
386 pUnitER->
Weight -= AplWeightHalf;
387 pUnitT->
Weight -= AplWeightHalf;
388 AplWeightAfter -= pUnit->
Weight;
391 else if ( pUnitER->
lev == lev1 )
408 pNew1E = pUnitER->
pE;
411 pNew2E = pUnitER->
pT;
443 pUnitER->
Weight -= AplWeightHalf;
444 AplWeightAfter -= AplWeightHalf;
447 else if ( pUnitT->
lev == lev1 )
476 pUnitT->
Weight -= AplWeightHalf;
477 AplWeightAfter -= AplWeightHalf;
487 if ( pNew1E == pNew1T )
489 pNewPlane20 = pNew1T;
494 if ( pNew1T->
TopRef > lev0 )
533 pNewPlane20->
pE = pNew1E;
534 pNewPlane20->
pT = pNew1T;
536 pNewPlane20->
lev = lev1;
539 pNewPlane20->
TopRef = lev1;
540 pNewPlane20->
Sign = 0;
544 pNewPlane20->
Weight = 0.0;
566 if ( pNew1ER->
TopRef > lev0 )
584 if ( pNew1T->
TopRef > lev0 )
607 pNewPlane20->
Weight += AplWeightHalf;
609 AplWeightAfter += AplWeightHalf;
611 AplWeightTotalLev1 += AplWeightHalf;
615 pNewPlane20 =
Unit_Not(pNewPlane20);
618 if ( pNew2E == pNew2T )
620 pNewPlane21 = pNew2T;
625 if ( pNew2T->
TopRef > lev0 )
649 assert( pNewPlane21->lev == lev1 );
658 pNewPlane21->pE = pNew2E;
659 pNewPlane21->
pT = pNew2T;
661 pNewPlane21->lev = lev1;
664 pNewPlane21->TopRef = lev1;
665 pNewPlane21->Sign = 0;
669 pNewPlane21->Weight = 0.0;
693 if ( pNew2ER->
TopRef > lev0 )
711 if ( pNew2T->
TopRef > lev0 )
734 pNewPlane21->Weight += AplWeightHalf;
736 AplWeightAfter += AplWeightHalf;
738 AplWeightTotalLev1 += AplWeightHalf;
748 pUnit->
pE = pNewPlane20;
749 pUnit->
pT = pNewPlane21;
761 AplWeightTotalLev0 += pUnit->
Weight;
766 for ( pLoop = pListOld1; pLoop; )
778 AplWeightTotalLev0 += pUnit->
Weight;
788 if ( pUnitER->
TopRef > lev0 )
797 if ( pUnitT->
TopRef > lev0 )
818 nNodesUnrefRemoved++;
843 p->
pPlanes[lev1].
statsNodes -= (nNodesDownMovedUp - nNodesUpMovedDown) + nNodesUnrefRemoved - nNodesUnrefAdded;
844 p->
nNodesCur -= nNodesUnrefRemoved - nNodesUnrefAdded;
849 for ( c = 0; c < nWidthCofs; c++ )
867 nCostGain = (nNodesDownMovedUp - nNodesUpMovedDown + nNodesUnrefRemoved - nNodesUnrefAdded) + nWidthReduction;
876 nCostGain = AplWeightPrev - AplWeightAfter;
890 nCostGain = nNodesUnrefRemoved - nNodesUnrefAdded;
#define AddToLinkedList(ppList, pLink)
DECLARATIONS ///.
reo_unit * reoUnitsGetNextUnit(reo_man *p)
FUNCTION DEFINITIONS ///.
#define Cudd_IsComplement(node)
void reoProfileWidthVerifyLevel(reo_plane *pPlane, int Level)
#define ABC_NAMESPACE_IMPL_END
#define ABC_NAMESPACE_IMPL_START
void reoUnitsRecycleUnit(reo_man *p, reo_unit *pUnit)
double reoReorderSwapAdjacentVars(reo_man *p, int lev0, int fMovingUp)
FUNCTION DEFINITIONS ///.