30static int Cut_NodeMapping(
Cut_Man_t *
p,
Cut_Cut_t * pCuts,
int Node,
int Node0,
int Node1 );
31static int Cut_NodeMapping2(
Cut_Man_t *
p,
Cut_Cut_t * pCuts,
int Node,
int Node0,
int Node1 );
51 for ( i = 0; i < (int)pDom->
nLeaves; i++ )
53 for ( k = 0; k < (int)pCut->
nLeaves; k++ )
77 Cut_Cut_t * pCut, * pCut2, * pDom, * pPrev;
79 *ppListR = pList, ppListR = &pList->
pNext;
92 if ( Cut_CutCheckDominance( pDom, pCut ) )
104 *ppListR = pCut, ppListR = &pCut->
pNext;
131 if ( Cut_CutCheckDominance( pTemp, pCut ) )
158 for ( a = 2; a <= (int)pCut->
nLeaves; a++ )
166 if ( Cut_CutCheckDominance( pTemp, pCut ) )
178 ppTail = pSuperList->pHead + a;
184 ppTail = &pTemp->
pNext;
188 if ( Cut_CutCheckDominance( pCut, pTemp ) )
193 if ( pSuperList->pHead[a] == pTemp )
194 pSuperList->pHead[a] = pTemp->
pNext;
196 if ( pSuperList->ppTail[a] == &pTemp->
pNext )
197 pSuperList->ppTail[a] = ppTail;
199 *ppTail = pTemp->
pNext;
204 ppTail = &pTemp->
pNext;
206 assert( ppTail == pSuperList->ppTail[a] );
207 assert( *ppTail == NULL );
229 for ( a = 0; a < (int)pCut->
nLeaves; a++ )
230 if ( Vec_IntEntry(
p->vNodeAttrs, pCut->
pLeaves[a] ) )
252 Cut_Cut_t * pPrev, * pTemp, * pTemp2, ** ppTail;
265 if ( Cut_CutCheckDominance( pTemp, pCut ) )
275 ppTail = &pPrev->
pNext;
281 ppTail = &pTemp->
pNext;
285 if ( Cut_CutCheckDominance( pCut, pTemp ) )
290 *ppTail = pTemp->
pNext;
295 ppTail = &pTemp->
pNext;
297 assert( *ppTail == NULL );
325 if (
p->pParams->fRecord )
328 if (
p->pParams->fFilter )
330 if ( Cut_CutFilterOne(
p, pSuperList, pCut) )
333 if (
p->pParams->fSeq )
335 if (
p->pCompareOld && Cut_CutFilterOld(
p,
p->pCompareOld, pCut) )
337 if (
p->pCompareNew && Cut_CutFilterOld(
p,
p->pCompareNew, pCut) )
342 if (
p->pParams->fGlobal )
344 assert(
p->vNodeAttrs != NULL );
345 if ( Cut_CutFilterGlobal(
p, pCut ) )
350 if (
p->pParams->fTruth )
353 Cut_ListAdd( pSuperList, pCut );
355 return ++
p->nNodeCuts ==
p->pParams->nKeepMax;
378 if (
p->pParams->fRecord )
385 Cut_ListStart( pSuper );
386 Cut_NodeDoComputeCuts(
p, pSuper, Node, fCompl0, fCompl1,
Cut_NodeReadCutsNew(
p, Node0),
Cut_NodeReadCutsNew(
p, Node1), fTriv, TreeCode );
387 pList = Cut_ListFinish( pSuper );
388p->timeMerge += Abc_Clock() - clk;
392 if (
p->pParams->fRecord )
394 Vec_IntWriteEntry(
p->vNodeStarts, Node, Vec_IntSize(
p->vCutPairs) );
396 Vec_IntPush(
p->vCutPairs, ((pCut->
Num1 << 16) | pCut->
Num0) );
397 Vec_IntWriteEntry(
p->vNodeCuts, Node, Vec_IntSize(
p->vCutPairs) - Vec_IntEntry(
p->vNodeStarts, Node) );
399 if (
p->pParams->fRecordAig )
403 if ( Cut_CutReadLeaveNum(pCut) > 4 )
404 Aig_RManRecord( Cut_CutReadTruth(pCut), Cut_CutReadLeaveNum(pCut) );
407 if (
p->nNodeCuts ==
p->pParams->nKeepMax )
410 Vec_PtrFillExtra(
p->vCutsNew, Node + 1, NULL );
423 if (
p->pParams->fMap && !
p->pParams->fSeq )
429 Cut_NodeMapping(
p, pList, Node, Node0, Node1 );
431p->timeMap += Abc_Clock() - clk;
449 int DelayMin, DelayCur, i;
452 if (
p->nDelayMin == -1 )
460 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
461 if ( DelayCur < Vec_IntEntry(
p->vDelays, pCut->
pLeaves[i]) )
462 DelayCur = Vec_IntEntry(
p->vDelays, pCut->
pLeaves[i]);
463 if ( DelayMin > DelayCur )
466 if ( DelayMin == 1000000 )
472 Vec_IntWriteEntry(
p->vDelays, Node, DelayMin );
473 if (
p->nDelayMin < DelayMin )
474 p->nDelayMin = DelayMin;
492 int Delay0, Delay1, Delay;
494 Delay0 = Vec_IntEntry(
p->vDelays2, Node0 );
495 Delay1 = Vec_IntEntry(
p->vDelays2, Node1 );
496 pCut0 = (Delay0 == 0) ? (
Cut_Cut_t *)Vec_PtrEntry(
p->vCutsNew, Node0 ) : (
Cut_Cut_t *)Vec_PtrEntry(
p->vCutsMax, Node0 );
497 pCut1 = (Delay1 == 0) ? (
Cut_Cut_t *)Vec_PtrEntry(
p->vCutsNew, Node1 ) : (
Cut_Cut_t *)Vec_PtrEntry(
p->vCutsMax, Node1 );
498 if ( Delay0 == Delay1 )
499 Delay = (Delay0 == 0) ? Delay0 + 1: Delay0;
500 else if ( Delay0 > Delay1 )
503 pCut1 = (
Cut_Cut_t *)Vec_PtrEntry(
p->vCutsNew, Node1 );
509 pCut0 = (
Cut_Cut_t *)Vec_PtrEntry(
p->vCutsNew, Node0 );
522 pCut->
pLeaves[0] = Node0 < Node1 ? Node0 : Node1;
523 pCut->
pLeaves[1] = Node0 < Node1 ? Node1 : Node0;
526 Vec_IntWriteEntry(
p->vDelays2, Node, Delay );
527 Vec_PtrWriteEntry(
p->vCutsMax, Node, pCut );
528 if (
p->nDelayMin < Delay )
529 p->nDelayMin = Delay;
548 if (
p->vCutsMax == NULL )
550 pCut = (
Cut_Cut_t *)Vec_PtrEntry(
p->vCutsMax, Node );
551 if ( pCut == NULL || pCut->
nLeaves == 1 )
554 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
556 Vec_PtrWriteEntry(
p->vCutsMax, Node, NULL );
574 Cut_Cut_t * pStop0, * pStop1, * pTemp0, * pTemp1;
575 Cut_Cut_t * pStore0 = NULL, * pStore1 = NULL;
576 int i, nCutsOld, Limit;
582 Cut_ListAdd( pSuper, pTemp0 );
586 if ( pList0 == NULL || pList1 == NULL || (
p->pParams->fLocal && TreeCode) )
590 nCutsOld =
p->nCutsCur;
591 Limit =
p->pParams->nVarsMax;
593 p->fSimul = (fCompl0 ^ pList0->
fSimul) & (fCompl1 ^ pList1->
fSimul);
595 p->fCompl0 = fCompl0;
596 p->fCompl1 = fCompl1;
601 pStore0 = pList0->
pNext;
602 pList0->
pNext = NULL;
607 pStore1 = pList1->
pNext;
608 pList1->
pNext = NULL;
612 if ( pStop0->
nLeaves == (
unsigned)Limit )
615 if ( pStop1->
nLeaves == (
unsigned)Limit )
622 if ( Cut_CutProcessTwo(
p, pTemp0, pTemp1, pSuper ) )
631 if ( Cut_CutProcessTwo(
p, pTemp0, pTemp1, pSuper ) )
640 if ( Cut_CutProcessTwo(
p, pTemp0, pTemp1, pSuper ) )
650 for ( i = 0; i < Limit; i++ )
655 if ( Cut_CutProcessTwo(
p, pTemp0, pTemp1, pSuper ) )
658 if (
p->nNodeCuts == 0 )
662 pList0->
pNext = pStore0;
664 pList1->
pNext = pStore1;
681 Cut_Cut_t * pList, * pListStart, * pCut, * pCut2;
683 int i, k, Node, Root, Limit =
p->pParams->nVarsMax;
687 Cut_ListStart( pSuper );
690 Root = Vec_IntEntry( vNodes, 0 );
694 Vec_PtrClear(
p->vTemp );
702 pListStart = pList->
pNext;
706 Cut_ListAdd( pSuper, pList ), pTop = pList;
712 if ( pCut->
nLeaves == (
unsigned)Limit )
714 Vec_PtrPush(
p->vTemp, pCut );
718 if (
p->pParams->fFilter && Cut_CutFilterOne(
p, pSuper, pCut ) )
722 pListStart = pCut->
pNext;
725 Cut_ListAdd( pSuper, pCut );
726 if ( ++
p->nNodeCuts ==
p->pParams->nKeepMax )
748 if (
p->pParams->fFilter && Cut_CutFilterOne(
p, pSuper, pCut ) )
752 pListStart = pCut->
pNext;
755 Cut_ListAdd( pSuper, pCut );
756 if ( ++
p->nNodeCuts ==
p->pParams->nKeepMax )
772 pList = Cut_ListFinish( pSuper );
774p->timeUnion += Abc_Clock() - clk;
780 p->nNodes -= vNodes->nSize - 1;
798 Cut_Cut_t * pList, * pListStart, * pCut, * pCut2, * pTop;
799 int i, k, Node, Root, Limit =
p->pParams->nVarsMax;
803 Cut_ListStart( pSuper );
806 Root = Vec_IntEntry( vNodes, 0 );
820 Vec_PtrClear(
p->vTemp );
824 if ( i == 0 && CutSetNum >= 0 )
841 pListStart = pList->
pNext;
845 Cut_ListAdd( pSuper, pList );
855 if ( pCut->
nLeaves == (
unsigned)Limit )
857 Vec_PtrPush(
p->vTemp, pCut );
863 if (
p->pParams->fFilter )
865 if ( Cut_CutFilterOne(
p, pSuper, pCut) )
867 if (
p->pParams->fSeq )
869 if (
p->pCompareOld && Cut_CutFilterOld(
p,
p->pCompareOld, pCut) )
871 if (
p->pCompareNew && Cut_CutFilterOld(
p,
p->pCompareNew, pCut) )
878 pListStart = pCut->
pNext;
881 Cut_ListAdd( pSuper, pCut );
882 if ( ++
p->nNodeCuts ==
p->pParams->nKeepMax )
906 if (
p->pParams->fFilter )
908 if ( Cut_CutFilterOne(
p, pSuper, pCut) )
910 if (
p->pParams->fSeq )
912 if (
p->pCompareOld && Cut_CutFilterOld(
p,
p->pCompareOld, pCut) )
914 if (
p->pCompareNew && Cut_CutFilterOld(
p,
p->pCompareNew, pCut) )
921 pListStart = pCut->
pNext;
924 Cut_ListAdd( pSuper, pCut );
925 if ( ++
p->nNodeCuts ==
p->pParams->nKeepMax )
940 pList = Cut_ListFinish( pSuper );
945 if ( CutSetNum >= 0 )
956p->timeUnion += Abc_Clock() - clk;
986 if ( Cut_CutCheckDominance( pDom, pCut ) )
988 printf(
"******************* These are contained cuts:\n" );
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Aig_RManRecord(unsigned *pTruth, int nVarsInit)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Cut_CutNumberList(Cut_Cut_t *pList)
ABC_NAMESPACE_IMPL_START Cut_Cut_t * Cut_CutAlloc(Cut_Man_t *p)
DECLARATIONS ///.
Cut_Cut_t * Cut_CutCreateTriv(Cut_Man_t *p, int Node)
void Cut_CutRecycle(Cut_Man_t *p, Cut_Cut_t *pCut)
Cut_Cut_t * Cut_CutMergeTwo(Cut_Man_t *p, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1)
#define Cut_ListForEachCut(pList, pCut)
#define Cut_ListForEachCutStop(pList, pCut, pStop)
#define Cut_ListForEachCutSafe(pList, pCut, pCut2)
void Cut_TruthCompute(Cut_Man_t *p, Cut_Cut_t *pCut, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1, int fCompl0, int fCompl1)
typedefABC_NAMESPACE_HEADER_START struct Cut_ListStruct_t_ Cut_List_t
INCLUDES ///.
Cut_Cut_t * Cut_NodeComputeCuts(Cut_Man_t *p, int Node, int Node0, int Node1, int fCompl0, int fCompl1, int fTriv, int TreeCode)
void Cut_NodeDoComputeCuts(Cut_Man_t *p, Cut_List_t *pSuper, int Node, int fCompl0, int fCompl1, Cut_Cut_t *pList0, Cut_Cut_t *pList1, int fTriv, int TreeCode)
Cut_Cut_t * Cut_NodeUnionCuts(Cut_Man_t *p, Vec_Int_t *vNodes)
int Cut_CutListVerify(Cut_Cut_t *pList)
Cut_Cut_t * Cut_NodeUnionCutsSeq(Cut_Man_t *p, Vec_Int_t *vNodes, int CutSetNum, int fFirst)
int Cut_ManMappingArea_rec(Cut_Man_t *p, int Node)
Cut_Cut_t * Cut_NodeReadCutsOld(Cut_Man_t *p, int Node)
void Cut_NodeWriteCutsTemp(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
struct Cut_ManStruct_t_ Cut_Man_t
BASIC TYPES ///.
Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
MACRO DEFINITIONS ///.
void Cut_CutPrint(Cut_Cut_t *pCut, int fSeq)
void Cut_NodeFreeCuts(Cut_Man_t *p, int Node)
struct Cut_CutStruct_t_ Cut_Cut_t
Cut_Cut_t * Cut_NodeReadCutsTemp(Cut_Man_t *p, int Node)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.