52 for ( i = 0; i < nSizeC; i++ )
54 for ( k = 0; k < nSizeB; k++ )
66 int i, k, m, n, Value;
68 for ( i = 0; i < pCutSet->
nCuts; i++ )
70 pCut0 = pCutSet->
ppCuts[i];
71 assert( pCut0->
uSign == If_ObjCutSignCompute(pCut0) );
75 for ( m = 1; m < (int)pCut0->
nLeaves; m++ )
81 for ( m = 0; m < (int)pCut0->
nLeaves; m++ )
82 for ( n = m+1; n < (int)pCut0->
nLeaves; n++ )
86 for ( k = 0; k < pCutSet->
nCuts; k++ )
88 pCut1 = pCutSet->
ppCuts[k];
93 Value = If_CutVerifyCut( pCut0, pCut1 );
97 assert( pCut0->
uSign == If_ObjCutSignCompute(pCut0) );
98 assert( pCut1->
uSign == If_ObjCutSignCompute(pCut1) );
123 for ( i = 0; i < (int)pDom->
nLeaves; i++ )
125 for ( k = 0; k < (int)pCut->
nLeaves; k++ )
151 for ( i = 0; i < pCutSet->
nCuts; i++ )
153 pTemp = pCutSet->
ppCuts[i];
163 if ( If_CutCheckDominance( pCut, pTemp ) )
170 for ( k = i; k < pCutSet->
nCuts; k++ )
183 if ( If_CutCheckDominance( pTemp, pCut ) )
209 if ( nSizeC0 == nLimit && nSizeC1 == nLimit )
211 for ( i = 0; i < nSizeC0; i++ )
215 p->pPerm[0][i] =
p->pPerm[1][i] =
p->pPerm[2][i] = i;
220 p->uSharedMask = Abc_InfoMask( nLimit );
227 if ( nSizeC0 == 0 )
goto FlushCut1;
228 if ( nSizeC1 == 0 )
goto FlushCut0;
231 if ( c == nLimit )
return 0;
236 if ( i == nSizeC0 )
goto FlushCut1;
242 if ( k == nSizeC1 )
goto FlushCut0;
246 p->uSharedMask |= (1 << c);
247 p->pPerm[0][i] =
p->pPerm[1][k] =
p->pPerm[2][s++] = c;
249 if ( i == nSizeC0 )
goto FlushCut1;
250 if ( k == nSizeC1 )
goto FlushCut0;
255 if ( c + nSizeC0 > nLimit + i )
return 0;
256 while ( i < nSizeC0 )
267 if ( c + nSizeC1 > nLimit + k )
return 0;
268 while ( k < nSizeC1 )
298 if ( nSizeC0 == nLimit && nSizeC1 == nLimit )
300 for ( i = 0; i < nSizeC0; i++ )
313 if ( nSizeC0 == 0 )
goto FlushCut1;
314 if ( nSizeC1 == 0 )
goto FlushCut0;
317 if ( c == nLimit )
return 0;
321 if ( i == nSizeC0 )
goto FlushCut1;
326 if ( k == nSizeC1 )
goto FlushCut0;
331 if ( i == nSizeC0 )
goto FlushCut1;
332 if ( k == nSizeC1 )
goto FlushCut0;
337 if ( c + nSizeC0 > nLimit + i )
return 0;
338 while ( i < nSizeC0 )
345 if ( c + nSizeC1 > nLimit + k )
return 0;
346 while ( k < nSizeC1 )
366 int nLutSize = pCut0->
nLimit;
375 for ( i = 0; i < nSize1; i++ )
377 for ( k = 0; k < nSize0; k++ )
378 if ( pC1[i] == pC0[k] )
390 for ( i = 0; i < nSize0; i++ )
420 if ( pC0->
Area < pC1->
Area -
p->fEpsilon )
422 if ( pC0->
Area > pC1->
Area +
p->fEpsilon )
446 if ( pC0->
Area < pC1->
Area -
p->fEpsilon )
448 if ( pC0->
Area > pC1->
Area +
p->fEpsilon )
472 if ( pC0->
Area < pC1->
Area -
p->fEpsilon )
474 if ( pC0->
Area > pC1->
Area +
p->fEpsilon )
504 if (
p->pPars->fPower )
506 if (
p->SortMode == 1 )
508 if ( pC0->
Area < pC1->
Area -
p->fEpsilon )
510 if ( pC0->
Area > pC1->
Area +
p->fEpsilon )
518 if ( pC0->
Edge < pC1->
Edge -
p->fEpsilon )
520 if ( pC0->
Edge > pC1->
Edge +
p->fEpsilon )
536 if (
p->SortMode == 0 )
546 if ( pC0->
Area < pC1->
Area -
p->fEpsilon )
548 if ( pC0->
Area > pC1->
Area +
p->fEpsilon )
554 if ( pC0->
Edge < pC1->
Edge -
p->fEpsilon )
556 if ( pC0->
Edge > pC1->
Edge +
p->fEpsilon )
569 if ( pC0->
Edge < pC1->
Edge -
p->fEpsilon )
571 if ( pC0->
Edge > pC1->
Edge +
p->fEpsilon )
573 if ( pC0->
Area < pC1->
Area -
p->fEpsilon )
575 if ( pC0->
Area > pC1->
Area +
p->fEpsilon )
585 if (
p->SortMode == 1 )
587 if ( pC0->
Area < pC1->
Area -
p->fEpsilon )
589 if ( pC0->
Area > pC1->
Area +
p->fEpsilon )
591 if ( pC0->
Edge < pC1->
Edge -
p->fEpsilon )
593 if ( pC0->
Edge > pC1->
Edge +
p->fEpsilon )
613 if (
p->SortMode == 0 )
623 if ( pC0->
Area < pC1->
Area -
p->fEpsilon )
625 if ( pC0->
Area > pC1->
Area +
p->fEpsilon )
627 if ( pC0->
Edge < pC1->
Edge -
p->fEpsilon )
629 if ( pC0->
Edge > pC1->
Edge +
p->fEpsilon )
650 if ( pC0->
Area < pC1->
Area -
p->fEpsilon )
652 if ( pC0->
Area > pC1->
Area +
p->fEpsilon )
654 if ( pC0->
Edge < pC1->
Edge -
p->fEpsilon )
656 if ( pC0->
Edge > pC1->
Edge +
p->fEpsilon )
683 if (
p->SortMode == 1 )
685 if ( pC0->
Area < pC1->
Area -
p->fEpsilon )
687 if ( pC0->
Area > pC1->
Area +
p->fEpsilon )
703 if (
p->SortMode == 0 )
713 if ( pC0->
Area < pC1->
Area -
p->fEpsilon )
715 if ( pC0->
Area > pC1->
Area +
p->fEpsilon )
724 if ( pC0->
Area < pC1->
Area -
p->fEpsilon )
726 if ( pC0->
Area > pC1->
Area +
p->fEpsilon )
756 if ( pCutSet->
nCuts == 0 )
763 (
p->pPars->fUseDsd ||
p->pPars->pFuncCell2 ||
p->pPars->fUseBat ||
764 p->pPars->pLutStruct ||
p->pPars->fUserRecLib ||
p->pPars->fUserSesLib ||
p->pPars->fUserLutDec ||
p->pPars->fUserLut2D ||
765 p->pPars->fEnableCheck07 ||
p->pPars->fUseCofVars ||
p->pPars->fUseAndVars ||
p->pPars->fUse34Spec ||
766 p->pPars->fUseDsdTune ||
p->pPars->fEnableCheck75 ||
p->pPars->fEnableCheck75u ||
p->pPars->fUseCheck1 ||
p->pPars->fUseCheck2) )
769 if ( pFirst->
fUseless || If_ManSortCompare(
p, pFirst, pCut) == 1 )
771 pCutSet->
ppCuts[0] = pCut;
779 for ( i = pCutSet->
nCuts-1; i >= 0; i-- )
785 pCutSet->
ppCuts[i] = pCut;
807 int i, Temp, fChanges;
810 for ( i = 0; i < (int)pCut->
nLeaves - 1; i++ )
820 }
while ( fChanges );
840 for ( i = 1; i < (int)pCut->
nLeaves; i++ )
844 Abc_Print( -1,
"If_CutCheck(): Cut has wrong ordering of inputs.\n" );
868 for ( i = 0; i < pCut->
nLeaves; i++ )
869 Abc_Print( 1,
" %s%d", If_CutLeafBit(pCut, i) ?
"!":
"", pCut->
pLeaves[i] );
870 Abc_Print( 1,
" }\n" );
890 Abc_Print( 1,
" %d(%.2f/%.2f)", pLeaf->
Id, If_ObjCutBest(pLeaf)->Delay, pLeaf->
Required );
891 Abc_Print( 1,
" }\n" );
908 for ( i = 0; i < pCut->
nLeaves; i++ )
932 Flow = If_CutLutArea(
p, pCut);
935 if ( pLeaf->
nRefs == 0 || If_ObjIsConst1(pLeaf) )
936 AddOn = If_ObjCutBest(pLeaf)->Area;
940 AddOn = If_ObjCutBest(pLeaf)->Area / pLeaf->
EstRefs;
942 if ( Flow >= (
float)1e32 || AddOn >= (
float)1e32 )
947 if ( Flow > (
float)1e32 )
973 if ( pLeaf->
nRefs == 0 || If_ObjIsConst1(pLeaf) )
974 AddOn = If_ObjCutBest(pLeaf)->Edge;
978 AddOn = If_ObjCutBest(pLeaf)->Edge / pLeaf->
EstRefs;
980 if ( Flow >= (
float)1e32 || AddOn >= (
float)1e32 )
985 if ( Flow > (
float)1e32 )
1006 float * pSwitching = (
float *)
p->vSwitching->pArray;
1011 Power += pSwitching[pLeaf->
Id];
1012 if ( pLeaf->
nRefs == 0 || If_ObjIsConst1(pLeaf) )
1013 Power += If_ObjCutBest(pLeaf)->Power;
1017 Power += If_ObjCutBest(pLeaf)->Power / pLeaf->
EstRefs;
1040 nRefsTotal += pLeaf->
nRefs;
1041 return ((
float)nRefsTotal)/pCut->
nLeaves;
1061 Area = If_CutLutArea(
p, pCut);
1065 if ( --pLeaf->
nRefs > 0 || !If_ObjIsAnd(pLeaf) )
1088 Area = If_CutLutArea(
p, pCut);
1092 if ( pLeaf->
nRefs++ > 0 || !If_ObjIsAnd(pLeaf) )
1112 float aResult, aResult2;
1117 assert( aResult > aResult2 - 3*
p->fEpsilon );
1118 assert( aResult < aResult2 + 3*p->fEpsilon );
1135 float aResult, aResult2;
1166 if ( --pLeaf->
nRefs > 0 || !If_ObjIsAnd(pLeaf) )
1193 if ( pLeaf->
nRefs++ > 0 || !If_ObjIsAnd(pLeaf) )
1213 float aResult, aResult2;
1236 float aResult, aResult2;
1261 float * pSwitching = (
float *)
p->vSwitching->pArray;
1266 Power += pSwitching[pLeaf->
Id];
1268 if ( --pLeaf->
nRefs > 0 || !If_ObjIsAnd(pLeaf) )
1289 float * pSwitching = (
float *)
p->vSwitching->pArray;
1294 Power += pSwitching[pLeaf->
Id];
1296 if ( pLeaf->
nRefs++ > 0 || !If_ObjIsAnd(pLeaf) )
1316 float aResult, aResult2;
1321 assert( aResult > aResult2 -
p->fEpsilon );
1322 assert( aResult < aResult2 + p->fEpsilon );
1339 float aResult, aResult2;
1344 assert( aResult > aResult2 -
p->fEpsilon );
1345 assert( aResult < aResult2 + p->fEpsilon );
1365 nMinLevel =
IF_MIN( nMinLevel, (
int)pLeaf->
Level );
1385 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
1391 if ( If_ObjIsCi(pObj) )
1394 for ( pTemp = pObj; pTemp; pTemp = pTemp->
pEquiv )
1424 if ( If_ObjIsAnd(pObj) && pObj->
nRefs )
1430 Abc_Print( 1,
"Cound not find boundary for %d nodes.\n", Counter );
1431 Abc_PrintTime( 1,
"Cones", Abc_Clock() - clk );
1449 if ( pObj->
nRefs || If_ObjIsCi(pObj) )
1451 Vec_IntPushUnique( vLeaves, pObj->
Id );
1473 int i, nFaninsTotal = 0, Counter = 0;
1475 vLeaves = Vec_IntAlloc( 100 );
1478 if ( If_ObjIsAnd(pObj) && pObj->
nRefs )
1480 nFaninsTotal += If_ObjCutBest(pObj)->nLeaves;
1481 Vec_IntClear( vLeaves );
1484 Counter += Vec_IntSize(vLeaves);
1487 Abc_Print( 1,
"Total cut inputs = %d. Total fanins incremental = %d.\n", nFaninsTotal, Counter );
1488 Abc_PrintTime( 1,
"Fanins", Abc_Clock() - clk );
1489 Vec_IntFree( vLeaves );
1506 char * pVisited = Vec_StrEntryP(
p->vMarks, pObj->
Id);
1509 Vec_IntPush(
p->vVisited2, pObj->
Id );
1510 if ( (
int)pObj->
Level <= LevelMin )
1511 return (*pVisited = 1);
1513 return (*pVisited = 1);
1515 return (*pVisited = 1);
1516 return (*pVisited = 2);
1520 If_Obj_t * pLeaf, * pTemp;
int i, Count = 0;
1528 Vec_IntClear(
p->vVisited2 );
1531 if ( pTemp == pLeaf )
1533 nLevelMin = Abc_MinInt( nLevelMin, (
int)pTemp->
Level );
1534 assert( Vec_StrEntry(
p->vMarks, pTemp->
Id) == 0 );
1535 Vec_StrWriteEntry(
p->vMarks, pTemp->
Id, 2 );
1536 Vec_IntPush(
p->vVisited2, pTemp->
Id );
1540 Vec_StrWriteEntry(
p->vMarks, iObj, 0 );
1541 if ( RetValue == 2 )
1545 for ( k = i; k < (int)pCut->
nLeaves; k++ )
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
int If_CutMerge(If_Man_t *p, If_Cut_t *pCut0, If_Cut_t *pCut1, If_Cut_t *pCut)
void If_CutFoundFanins_rec(If_Obj_t *pObj, Vec_Int_t *vLeaves)
float If_CutEdgeRefed(If_Man_t *p, If_Cut_t *pCut)
int If_CutCompareDelayOld(If_Man_t *p, If_Cut_t **ppC0, If_Cut_t **ppC1)
int If_CutFilter2_rec(If_Man_t *p, If_Obj_t *pObj, int LevelMin)
int If_CutCheck(If_Cut_t *pCut)
float If_CutAreaDeref(If_Man_t *p, If_Cut_t *pCut)
int If_CutFilter2(If_Man_t *p, If_Obj_t *pNode, If_Cut_t *pCut)
float If_CutPowerFlow(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
float If_CutEdgeDerefed(If_Man_t *p, If_Cut_t *pCut)
void If_CutPrint(If_Cut_t *pCut)
float If_CutEdgeFlow(If_Man_t *p, If_Cut_t *pCut)
int If_CutMergeOrdered(If_Man_t *p, If_Cut_t *pC0, If_Cut_t *pC1, If_Cut_t *pC)
int If_CutFilter(If_Set_t *pCutSet, If_Cut_t *pCut, int fSaveCut0)
float If_CutPowerRefed(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
int If_CutGetCutMinLevel(If_Man_t *p, If_Cut_t *pCut)
float If_CutAverageRefs(If_Man_t *p, If_Cut_t *pCut)
float If_CutPowerRef(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
float If_CutAreaRef(If_Man_t *p, If_Cut_t *pCut)
float If_CutAreaFlow(If_Man_t *p, If_Cut_t *pCut)
int If_CutGetCone_rec(If_Man_t *p, If_Obj_t *pObj, If_Cut_t *pCut)
void If_CutPrintTiming(If_Man_t *p, If_Cut_t *pCut)
int If_CutGetCones(If_Man_t *p)
int If_CutVerifyCuts(If_Set_t *pCutSet, int fOrdered)
float If_CutEdgeDeref(If_Man_t *p, If_Cut_t *pCut)
int If_CutCompareDelay(If_Man_t *p, If_Cut_t **ppC0, If_Cut_t **ppC1)
float If_CutEdgeRef(If_Man_t *p, If_Cut_t *pCut)
void If_CutSort(If_Man_t *p, If_Set_t *pCutSet, If_Cut_t *pCut)
void If_CutOrder(If_Cut_t *pCut)
float If_CutAreaRefed(If_Man_t *p, If_Cut_t *pCut)
void If_CutLift(If_Cut_t *pCut)
float If_CutPowerDeref(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
int If_CutCountTotalFanins(If_Man_t *p)
float If_CutAreaDerefed(If_Man_t *p, If_Cut_t *pCut)
int If_CutCompareArea(If_Man_t *p, If_Cut_t **ppC0, If_Cut_t **ppC1)
float If_CutPowerDerefed(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
int If_CutMergeOrdered_(If_Man_t *p, If_Cut_t *pC0, If_Cut_t *pC1, If_Cut_t *pC)
#define If_ManForEachObj(p, pObj, i)
#define IF_MIN(a, b)
MACRO DEFINITIONS ///.
struct If_Cut_t_ If_Cut_t
struct If_Set_t_ If_Set_t
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
struct If_Man_t_ If_Man_t
BASIC TYPES ///.
struct If_Obj_t_ If_Obj_t
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.