41#define OF_NO_FUNC 0x7FFFFFF
91static inline int Of_Flt2Int(
float f ) {
return (
int)(
OF_NUM*f); }
92static inline float Of_Int2Flt(
int i ) {
return OF_NUMINV*i; }
94static inline int * Of_ManCutSet(
Of_Man_t *
p,
int i ) {
return (
int *)Vec_PtrEntry(&
p->vPages, i >> 16) + (i & 0xFFFF); }
95static inline int Of_ObjCutSetId(
Of_Man_t *
p,
int i ) {
return Vec_IntEntry( &
p->vCutSets, i ); }
96static inline int * Of_ObjCutSet(
Of_Man_t *
p,
int i ) {
return Of_ManCutSet(
p, Of_ObjCutSetId(
p, i)); }
97static inline int Of_ObjHasCuts(
Of_Man_t *
p,
int i ) {
return (
int)(Vec_IntEntry(&
p->vCutSets, i) > 0); }
99static inline int Of_ObjCutFlow(
Of_Man_t *
p,
int i ) {
return Vec_IntEntry(&
p->vCutFlows, i); }
100static inline int Of_ObjCutDelay(
Of_Man_t *
p,
int i ) {
return Vec_IntEntry(&
p->vCutDelays, i); }
101static inline void Of_ObjSetCutFlow(
Of_Man_t *
p,
int i,
int a ) { Vec_IntWriteEntry(&
p->vCutFlows, i, a); }
102static inline void Of_ObjSetCutDelay(
Of_Man_t *
p,
int i,
int d ) { Vec_IntWriteEntry(&
p->vCutDelays, i, d); }
104static inline int Of_CutSize(
int * pCut ) {
return pCut[0] &
OF_NO_LEAF; }
105static inline int Of_CutFunc(
int * pCut ) {
return ((
unsigned)pCut[0] >> 5); }
106static inline int * Of_CutLeaves(
int * pCut ) {
return pCut + 1; }
107static inline int Of_CutSetBoth(
int n,
int f ) {
return n | (f << 5); }
108static inline int Of_CutHandle(
int * pCutSet,
int * pCut ) {
assert( pCut > pCutSet );
return pCut - pCutSet; }
109static inline int * Of_CutFromHandle(
int * pCutSet,
int h ) {
assert( h > 0 );
return pCutSet + h; }
111static inline int Of_CutDelay1(
int * pCut ) {
return pCut[1 + Of_CutSize(pCut)]; }
112static inline int Of_CutDelay2(
int * pCut ) {
return pCut[2 + Of_CutSize(pCut)]; }
113static inline int Of_CutAreaFlow(
int * pCut ) {
return pCut[3 + Of_CutSize(pCut)]; }
114static inline void Of_CutSetDelay1(
int * pCut,
int d ) { pCut[1 + Of_CutSize(pCut)] = d; }
115static inline void Of_CutSetDelay2(
int * pCut,
int d ) { pCut[2 + Of_CutSize(pCut)] = d; }
116static inline void Of_CutSetAreaFlow(
int * pCut,
int d ) { pCut[3 + Of_CutSize(pCut)] = d; }
118static inline int Of_CutVar(
int * pCut,
int v ) {
return Abc_Lit2Var(Of_CutLeaves(pCut)[v]); }
119static inline int Of_CutFlag(
int * pCut,
int v ) {
return Abc_LitIsCompl(Of_CutLeaves(pCut)[v]); }
120static inline void Of_CutCleanFlag(
int * pCut,
int v ) { Of_CutLeaves(pCut)[v] = Abc_LitRegular(Of_CutLeaves(pCut)[v]); }
121static inline void Of_CutSetFlag(
int * pCut,
int v,
int x ) { Of_CutLeaves(pCut)[v] = Abc_Var2Lit(Of_CutVar(pCut, v), x); }
125static inline int Of_ObjCutBest(
Of_Man_t *
p,
int i ) {
return Of_ObjData(
p, i)->iCutH; }
126static inline int Of_ObjCutBest2(
Of_Man_t *
p,
int i ) {
return Of_ObjData(
p, i)->iCutH2; }
127static inline int Of_ObjDelay1(
Of_Man_t *
p,
int i ) {
return Of_ObjData(
p, i)->Delay1; }
128static inline int Of_ObjDelay2(
Of_Man_t *
p,
int i ) {
return Of_ObjData(
p, i)->Delay2; }
129static inline int Of_ObjRequired(
Of_Man_t *
p,
int i ) {
return Of_ObjData(
p, i)->Required; }
130static inline int Of_ObjRefNum(
Of_Man_t *
p,
int i ) {
return Of_ObjData(
p, i)->nRefs; }
131static inline int Of_ObjFlow(
Of_Man_t *
p,
int i ) {
return Of_ObjData(
p, i)->Flow; }
133static inline void Of_ObjSetCutBest(
Of_Man_t *
p,
int i,
int x ) { Of_ObjData(
p, i)->iCutH = x; }
134static inline void Of_ObjSetCutBest2(
Of_Man_t *
p,
int i,
int x ) { Of_ObjData(
p, i)->iCutH2 = x; }
135static inline void Of_ObjSetDelay1(
Of_Man_t *
p,
int i,
int x ) { Of_ObjData(
p, i)->Delay1 = x; }
136static inline void Of_ObjSetDelay2(
Of_Man_t *
p,
int i,
int x ) { Of_ObjData(
p, i)->Delay2 = x; }
137static inline void Of_ObjSetRequired(
Of_Man_t *
p,
int i,
int x ) { Of_ObjData(
p, i)->Required = x; }
138static inline void Of_ObjSetRefNum(
Of_Man_t *
p,
int i,
int x ) { Of_ObjData(
p, i)->nRefs = x; }
139static inline void Of_ObjSetFlow(
Of_Man_t *
p,
int i,
int x ) { Of_ObjData(
p, i)->Flow = x; }
140static inline void Of_ObjUpdateRequired(
Of_Man_t *
p,
int i,
int x ) {
if ( Of_ObjRequired(
p, i) > x ) Of_ObjSetRequired(
p, i, x); }
141static inline int Of_ObjRefInc(
Of_Man_t *
p,
int i ) {
return Of_ObjData(
p, i)->nRefs++; }
142static inline int Of_ObjRefDec(
Of_Man_t *
p,
int i ) {
return --Of_ObjData(
p, i)->nRefs; }
144static inline int * Of_ObjCutBestP(
Of_Man_t *
p,
int iObj ) {
assert(iObj>0 && iObj<Gia_ManObjNum(
p->pGia));
return Of_ManCutSet(
p, Of_ObjCutBest(
p, iObj) ); }
145static inline void Of_ObjSetCutBestP(
Of_Man_t *
p,
int * pCutSet,
int iObj,
int * pCut ) { Of_ObjSetCutBest(
p, iObj, Of_ObjCutSetId(
p, iObj) + Of_CutHandle(pCutSet, pCut) ); }
147static inline int * Of_ObjCutBestP2(
Of_Man_t *
p,
int iObj ) {
assert(iObj>0 && iObj<Gia_ManObjNum(
p->pGia));
return Of_ManCutSet(
p, Of_ObjCutBest2(
p, iObj) ); }
148static inline void Of_ObjSetCutBestP2(
Of_Man_t *
p,
int * pCutSet,
int iObj,
int * pCut ) { Of_ObjSetCutBest2(
p, iObj, Of_ObjCutSetId(
p, iObj) + Of_CutHandle(pCutSet, pCut) ); }
150#define Of_SetForEachCut( pList, pCut, i ) for ( i = 0, pCut = pList + 1; i < pList[0]; i++, pCut += Of_CutSize(pCut) + OF_CUT_EXTRA )
151#define Of_ObjForEachCut( pCuts, i, nCuts ) for ( i = 0, i < nCuts; i++ )
152#define Of_CutForEachVar( pCut, iVar, i ) for ( i = 0; i < Of_CutSize(pCut) && (iVar = Of_CutVar(pCut,i)); i++ )
153#define Of_CutForEachVarFlag( pCut, iVar, Flag, i ) for ( i = 0; i < Of_CutSize(pCut) && (iVar = Of_CutVar(pCut,i)) && ((Flag = Of_CutFlag(pCut,i)), 1); i++ )
173 int i, Id, Total = 0;
175 assert(
p->pGia->pRefs == NULL );
177 Of_ObjSetFlow(
p, 0, 0 );
179 Of_ObjSetFlow(
p, Id, 0 );
181 Of_ObjSetFlow(
p, Id, (Gia_ObjFanin0(pObj)->Value + Gia_ObjFanin1(pObj)->Value + AreaUnit) / Gia_ObjRefNum(
p->pGia, pObj) );
183 Total += Gia_ObjFanin0(pObj)->Value;
187 printf(
"CI = %5d. ", Gia_ManCiNum(
p->pGia) );
188 printf(
"CO = %5d. ", Gia_ManCoNum(
p->pGia) );
189 printf(
"And = %8d. ", Gia_ManAndNum(
p->pGia) );
190 printf(
"Area = %8d. ", Total/AreaUnit );
215 if ( Gia_ManHasChoices(pGia) )
219 vFlowRefs = Vec_IntAlloc(0);
221 pGia->
pRefs= Vec_IntReleaseArray(vFlowRefs);
222 Vec_IntFree(vFlowRefs);
225 p->clkStart = Abc_Clock();
231 Vec_PtrGrow( &
p->vPages, 256 );
232 Vec_IntFill( &
p->vCutSets, Gia_ManObjNum(pGia), 0 );
233 Vec_IntFill( &
p->vCutFlows, Gia_ManObjNum(pGia), 0 );
234 Vec_IntFill( &
p->vCutDelays,Gia_ManObjNum(pGia), 0 );
235 Vec_IntGrow( &
p->vCutRefs, 1000 );
237 p->vTtMem = Vec_MemAllocForTT( 6, 0 );
246 Vec_PtrFreeData( &
p->vPages );
247 Vec_PtrErase( &
p->vPages );
248 Vec_IntErase( &
p->vCutSets );
249 Vec_IntErase( &
p->vCutFlows );
250 Vec_IntErase( &
p->vCutDelays );
251 Vec_IntErase( &
p->vCutRefs );
254 if (
p->pPars->fCutMin )
255 Vec_MemHashFree(
p->vTtMem );
256 if (
p->pPars->fCutMin )
257 Vec_MemFree(
p->vTtMem );
278 int nOldSupp = pCutR->
nLeaves, truthId, fCompl;
word t;
279 word t0 = *Vec_MemReadEntry(
p->vTtMem, Abc_Lit2Var(pCut0->
iFunc));
280 word t1 = *Vec_MemReadEntry(
p->vTtMem, Abc_Lit2Var(pCut1->
iFunc));
281 if ( Abc_LitIsCompl(pCut0->
iFunc) ^ fCompl0 ) t0 = ~t0;
282 if ( Abc_LitIsCompl(pCut1->
iFunc) ^ fCompl1 ) t1 = ~t1;
285 t = fIsXor ? t0 ^ t1 : t0 & t1;
286 if ( (fCompl = (
int)(t & 1)) ) t = ~t;
288 assert( (
int)(t & 1) == 0 );
289 truthId = Vec_MemHashInsert(
p->vTtMem, &t);
290 pCutR->
iFunc = Abc_Var2Lit( truthId, fCompl );
292 return (
int)pCutR->
nLeaves < nOldSupp;
296 int nOldSupp = pCutR->
nLeaves, truthId, fCompl;
word t;
297 word t0 = *Vec_MemReadEntry(
p->vTtMem, Abc_Lit2Var(pCut0->
iFunc));
298 word t1 = *Vec_MemReadEntry(
p->vTtMem, Abc_Lit2Var(pCut1->
iFunc));
299 word tC = *Vec_MemReadEntry(
p->vTtMem, Abc_Lit2Var(pCutC->
iFunc));
300 if ( Abc_LitIsCompl(pCut0->
iFunc) ^ fCompl0 ) t0 = ~t0;
301 if ( Abc_LitIsCompl(pCut1->
iFunc) ^ fCompl1 ) t1 = ~t1;
302 if ( Abc_LitIsCompl(pCutC->
iFunc) ^ fComplC ) tC = ~tC;
306 t = (tC & t1) | (~tC & t0);
307 if ( (fCompl = (
int)(t & 1)) ) t = ~t;
309 assert( (
int)(t & 1) == 0 );
310 truthId = Vec_MemHashInsert(
p->vTtMem, &t);
311 pCutR->
iFunc = Abc_Var2Lit( truthId, fCompl );
313 return (
int)pCutR->
nLeaves < nOldSupp;
328static inline int Of_CutCountBits(
word i )
330 i = i - ((i >> 1) & 0x5555555555555555);
331 i = (i & 0x3333333333333333) + ((i >> 2) & 0x3333333333333333);
332 i = ((i + (i >> 4)) & 0x0F0F0F0F0F0F0F0F);
333 return (i*(0x0101010101010101))>>56;
335static inline word Of_CutGetSign(
int * pLeaves,
int nLeaves )
337 word Sign = 0;
int i;
338 for ( i = 0; i < nLeaves; i++ )
339 Sign |= ((
word)1) << (pLeaves[i] & 0x3F);
342static inline int Of_CutCreateUnit(
Of_Cut_t *
p,
int i )
349 p->Sign = ((
word)1) << (i & 0x3F);
354 int i, nDigits = Abc_Base10Log(Gia_ManObjNum(
p->pGia));
355 printf(
"%d {", pCut->
nLeaves );
356 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
357 printf(
" %*d", nDigits, pCut->
pLeaves[i] );
358 for ( ; i < (int)
p->pPars->nLutSize; i++ )
359 printf(
" %*s", nDigits,
" " );
360 printf(
" } D = %4d A = %9d F = %6d ",
367static inline int Of_ManPrepareCuts(
Of_Cut_t * pCuts,
Of_Man_t *
p,
int iObj,
int fAddUnit )
369 if ( Of_ObjHasCuts(
p, iObj) )
372 int i, * pCut, * pList = Of_ObjCutSet(
p, iObj);
377 pMfCut->
iFunc = Of_CutFunc( pCut );
378 pMfCut->
nLeaves = Of_CutSize( pCut );
379 pMfCut->
Sign = Of_CutGetSign( pCut+1, Of_CutSize(pCut) );
380 memcpy( pMfCut->
pLeaves, pCut+1,
sizeof(
int) * Of_CutSize(pCut) );
383 if ( fAddUnit && pCuts->
nLeaves > 1 )
384 return pList[0] + Of_CutCreateUnit( pMfCut, iObj );
387 return Of_CutCreateUnit( pCuts, iObj );
391 int i, * pPlace, iCur, nInts = 1, nCutsNew = 0;
392 for ( i = 0; i < nCuts; i++ )
394 if ( (
p->iCur & 0xFFFF) + nInts > 0xFFFF )
395 p->iCur = ((
p->iCur >> 16) + 1) << 16;
396 if ( Vec_PtrSize(&
p->vPages) == (
p->iCur >> 16) )
397 Vec_PtrPush( &
p->vPages,
ABC_CALLOC(
int, (1<<16)) );
398 iCur =
p->iCur;
p->iCur += nInts;
399 pPlace = Of_ManCutSet(
p, iCur );
400 *pPlace++ = nCutsNew;
401 for ( i = 0; i < nCuts; i++ )
403 *pPlace++ = Of_CutSetBoth( pCuts[i]->nLeaves, pCuts[i]->iFunc );
404 memcpy( pPlace, pCuts[i]->pLeaves,
sizeof(
int) * pCuts[i]->nLeaves );
411static inline void Of_ManLiftCuts(
Of_Man_t *
p,
int iObj )
413 int i, k, * pCut, * pList = Of_ObjCutSet(
p, iObj);
414 assert( Of_ObjHasCuts(
p, iObj) );
417 for ( k = 1; k <= Of_CutSize(pCut); k++ )
418 pCut[k] = Abc_Var2Lit(pCut[k], 0);
421static inline void Of_CutPrint(
int * pCut )
424 printf(
"Cut with %d inputs and function %3d : { ", Of_CutSize(pCut), Of_CutFunc(pCut) ==
OF_NO_FUNC ? 0 : Of_CutFunc(pCut) );
426 printf(
"%d ", iVar );
447 for ( i = 0; i < nSizeC; i++ )
449 for ( k = 0; k < nSizeB; k++ )
450 if ( pC[i] == pB[k] )
457static inline int Of_SetCheckArray(
Of_Cut_t ** ppCuts,
int nCuts )
460 int i, k, m, n, Value;
462 for ( i = 0; i < nCuts; i++ )
468 for ( m = 0; m < (int)pCut0->
nLeaves; m++ )
469 for ( n = m + 1; n < (int)pCut0->
nLeaves; n++ )
472 for ( k = 0; k < nCuts; k++ )
475 if ( pCut0 == pCut1 )
478 Value = Of_CutCheck( pCut0, pCut1 );
505 if ( nSize0 == nLutSize && nSize1 == nLutSize )
507 for ( i = 0; i < nSize0; i++ )
509 if ( pC0[i] != pC1[i] )
return 0;
519 if ( nSize0 == 0 )
goto FlushCut1;
520 if ( nSize1 == 0 )
goto FlushCut0;
523 if ( c == nLutSize )
return 0;
524 if ( pC0[i] < pC1[k] )
527 if ( i >= nSize0 )
goto FlushCut1;
529 else if ( pC0[i] > pC1[k] )
532 if ( k >= nSize1 )
goto FlushCut0;
536 pC[c++] = pC0[i++]; k++;
537 if ( i >= nSize0 )
goto FlushCut1;
538 if ( k >= nSize1 )
goto FlushCut0;
543 if ( c + nSize0 > nLutSize + i )
return 0;
552 if ( c + nSize1 > nLutSize + k )
return 0;
565 int xMin, c = 0, * pC = pCut->
pLeaves;
571 xMin = Abc_MinInt( Abc_MinInt(x0, x1), x2 );
573 if ( c == nLutSize )
return 0;
575 if (x0 == xMin) i0++;
576 if (x1 == xMin) i1++;
577 if (x2 == xMin) i2++;
584static inline int Of_SetCutIsContainedOrder(
Of_Cut_t * pBase,
Of_Cut_t * pCut )
586 int i, nSizeB = pBase->
nLeaves;
588 if ( nSizeB == nSizeC )
590 for ( i = 0; i < nSizeB; i++ )
595 assert( nSizeB > nSizeC );
598 for ( i = k = 0; i < nSizeB; i++ )
610static inline int Of_SetLastCutIsContained(
Of_Cut_t ** pCuts,
int nCuts )
613 for ( i = 0; i < nCuts; i++ )
614 if ( pCuts[i]->nLeaves <= pCuts[nCuts]->nLeaves && (pCuts[i]->Sign & pCuts[nCuts]->Sign) == pCuts[i]->Sign && Of_SetCutIsContainedOrder(pCuts[nCuts], pCuts[i]) )
618static inline int Of_SetLastCutContainsArea(
Of_Cut_t ** pCuts,
int nCuts )
620 int i, k, fChanges = 0;
621 for ( i = 0; i < nCuts; i++ )
622 if ( pCuts[nCuts]->nLeaves < pCuts[i]->nLeaves && (pCuts[nCuts]->Sign & pCuts[i]->Sign) == pCuts[nCuts]->Sign && Of_SetCutIsContainedOrder(pCuts[i], pCuts[nCuts]) )
626 for ( i = k = 0; i <= nCuts; i++ )
640 if ( pCut0->
Flow < pCut1->
Flow )
return -1;
641 if ( pCut0->
Flow > pCut1->
Flow )
return 1;
646static inline void Of_SetSortByArea(
Of_Cut_t ** pCuts,
int nCuts )
649 for ( i = nCuts; i > 0; i-- )
651 if ( Of_CutCompareArea(pCuts[i - 1], pCuts[i]) < 0 )
656static inline int Of_SetAddCut(
Of_Cut_t ** pCuts,
int nCuts,
int nCutNum )
660 nCuts = Of_SetLastCutContainsArea(pCuts, nCuts);
661 Of_SetSortByArea( pCuts, nCuts );
662 return Abc_MinInt( nCuts + 1, nCutNum - 1 );
664static inline int Of_CutArea(
Of_Man_t *
p,
int nLeaves )
668 return nLeaves +
p->pPars->nAreaTuner;
672 int i, nLeaves = pCut->
nLeaves;
673 assert( nLeaves <= p->pPars->nLutSize );
676 for ( i = 0; i < nLeaves; i++ )
681 pCut->
Delay += (int)(nLeaves > 1);
682 pCut->
Flow = (pCut->
Flow + 100 * Of_CutArea(
p, nLeaves)) / (nGiaRefs ? nGiaRefs : 1);
688 int nGiaRefs = 2*Gia_ObjRefNumId(
p->pGia, iObj);
689 int nLutSize =
p->pPars->nLutSize;
690 int nCutNum =
p->pPars->nCutNum;
691 int nCuts0 = Of_ManPrepareCuts(pCuts0,
p, Gia_ObjFaninId0(pObj, iObj), 1);
692 int nCuts1 = Of_ManPrepareCuts(pCuts1,
p, Gia_ObjFaninId1(pObj, iObj), 1);
693 int fComp0 = Gia_ObjFaninC0(pObj);
694 int fComp1 = Gia_ObjFaninC1(pObj);
695 int iSibl = Gia_ObjSibl(
p->pGia, iObj);
696 Of_Cut_t * pCut0, * pCut1, * pCut0Lim = pCuts0 + nCuts0, * pCut1Lim = pCuts1 + nCuts1;
698 assert( !Gia_ObjIsBuf(pObj) );
699 for ( i = 0; i < nCutNum; i++ )
700 pCutsR[i] = pCuts + i;
704 Gia_Obj_t * pObjE = Gia_ObjSiblObj(
p->pGia, iObj);
705 int fCompE = Gia_ObjPhase(pObj) ^ Gia_ObjPhase(pObjE);
706 int nCuts2 = Of_ManPrepareCuts(pCuts2,
p, iSibl, 0);
707 Of_Cut_t * pCut2, * pCut2Lim = pCuts2 + nCuts2;
708 for ( pCut2 = pCuts2; pCut2 < pCut2Lim; pCut2++ )
710 *pCutsR[nCutsR] = *pCut2;
711 if (
p->pPars->fCutMin )
712 pCutsR[nCutsR]->
iFunc = Abc_LitNotCond( pCutsR[nCutsR]->iFunc, fCompE );
713 Of_CutParams(
p, pCutsR[nCutsR], nGiaRefs );
714 nCutsR = Of_SetAddCut( pCutsR, nCutsR, nCutNum );
717 if ( Gia_ObjIsMuxId(
p->pGia, iObj) )
720 int nCuts2 = Of_ManPrepareCuts(pCuts2,
p, Gia_ObjFaninId2(
p->pGia, iObj), 1);
721 int fComp2 = Gia_ObjFaninC2(
p->pGia, pObj);
722 Of_Cut_t * pCut2, * pCut2Lim = pCuts2 + nCuts2;
723 p->CutCount[0] += nCuts0 * nCuts1 * nCuts2;
724 for ( pCut0 = pCuts0; pCut0 < pCut0Lim; pCut0++ )
725 for ( pCut1 = pCuts1; pCut1 < pCut1Lim; pCut1++ )
726 for ( pCut2 = pCuts2; pCut2 < pCut2Lim; pCut2++ )
728 if ( Of_CutCountBits(pCut0->
Sign | pCut1->
Sign | pCut2->
Sign) > nLutSize )
731 if ( !Of_CutMergeOrderMux(pCut0, pCut1, pCut2, pCutsR[nCutsR], nLutSize) )
733 if ( Of_SetLastCutIsContained(pCutsR, nCutsR) )
736 if (
p->pPars->fCutMin && Of_CutComputeTruthMux6(
p, pCut0, pCut1, pCut2, fComp0, fComp1, fComp2, pCutsR[nCutsR]) )
737 pCutsR[nCutsR]->
Sign = Of_CutGetSign(pCutsR[nCutsR]->pLeaves, pCutsR[nCutsR]->nLeaves);
738 Of_CutParams(
p, pCutsR[nCutsR], nGiaRefs );
739 nCutsR = Of_SetAddCut( pCutsR, nCutsR, nCutNum );
744 int fIsXor = Gia_ObjIsXor(pObj);
745 p->CutCount[0] += nCuts0 * nCuts1;
746 for ( pCut0 = pCuts0; pCut0 < pCut0Lim; pCut0++ )
747 for ( pCut1 = pCuts1; pCut1 < pCut1Lim; pCut1++ )
749 if ( (
int)(pCut0->
nLeaves + pCut1->
nLeaves) > nLutSize && Of_CutCountBits(pCut0->
Sign | pCut1->
Sign) > nLutSize )
752 if ( !Of_CutMergeOrder(pCut0, pCut1, pCutsR[nCutsR], nLutSize) )
754 if ( Of_SetLastCutIsContained(pCutsR, nCutsR) )
757 if (
p->pPars->fCutMin && Of_CutComputeTruth6(
p, pCut0, pCut1, fComp0, fComp1, pCutsR[nCutsR], fIsXor) )
758 pCutsR[nCutsR]->
Sign = Of_CutGetSign(pCutsR[nCutsR]->pLeaves, pCutsR[nCutsR]->nLeaves);
759 Of_CutParams(
p, pCutsR[nCutsR], nGiaRefs );
760 nCutsR = Of_SetAddCut( pCutsR, nCutsR, nCutNum );
766 printf(
"*** Obj = %d\n", iObj );
767 for ( i = 0; i < nCutsR; i++ )
768 Of_Cutprintf(
p, pCutsR[i] );
772 assert( nCutsR > 0 && nCutsR < nCutNum );
775 Of_ObjSetCutFlow(
p, iObj, pCutsR[0]->Flow );
776 Of_ObjSetCutDelay(
p, iObj, pCutsR[0]->Delay );
777 *Vec_IntEntryP(&
p->vCutSets, iObj) = Of_ManSaveCuts(
p, pCutsR, nCutsR);
778 p->CutCount[3] += nCutsR;
784 if ( Gia_ObjIsBuf(pObj) )
786 iFanin = Gia_ObjFaninId0(pObj, i);
787 Of_ObjSetCutFlow(
p, i, Of_ObjCutFlow(
p, iFanin) );
788 Of_ObjSetCutDelay(
p, i, Of_ObjCutDelay(
p, iFanin) );
793 if ( !Gia_ObjIsBuf(pObj) )
794 Of_ManLiftCuts(
p, i );
813 if ( !
p->pPars->fVerbose )
815 printf(
"%s : ", pTitle );
816 printf(
"Delay =%8.2f ", Of_Int2Flt((
int)
p->pPars->Delay) );
817 printf(
"Area =%8d ", (
int)
p->pPars->Area );
818 printf(
"Edge =%9d ", (
int)
p->pPars->Edge );
819 Abc_PrintTime( 1,
"Time", Abc_Clock() -
p->clkStart );
825 if ( !
p->pPars->fVerbose )
827 printf(
"LutSize = %d ",
p->pPars->nLutSize );
828 printf(
"CutNum = %d ",
p->pPars->nCutNum );
829 printf(
"Iter = %d ",
p->pPars->nRounds +
p->pPars->nRoundsEla );
830 printf(
"Coarse = %d ",
p->pPars->fCoarsen );
831 if (
p->pPars->fCutMin )
832 printf(
"Funcs = %d ", Vec_MemEntryNum(
p->vTtMem) );
833 nChoices = Gia_ManChoiceNum(
p->pGia );
835 printf(
"Choices = %d ", nChoices );
837 printf(
"Computing cuts...\r" );
843 float MemMan = 1.0 *
sizeof(
Of_Obj_t) * Gia_ManObjNum(
p->pGia) / (1<<20);
844 float MemCuts = 1.0 *
sizeof(int) * (1 << 16) * Vec_PtrSize(&
p->vPages) / (1<<20);
845 float MemTt =
p->vTtMem ? Vec_MemMemory(
p->vTtMem) / (1<<20) : 0;
846 if (
p->CutCount[0] == 0 )
848 if ( !
p->pPars->fVerbose )
850 printf(
"CutPair = %.0f ",
p->CutCount[0] );
851 printf(
"Merge = %.0f (%.1f) ",
p->CutCount[1], 1.0*
p->CutCount[1]/Gia_ManAndNum(
p->pGia) );
852 printf(
"Eval = %.0f (%.1f) ",
p->CutCount[2], 1.0*
p->CutCount[2]/Gia_ManAndNum(
p->pGia) );
853 printf(
"Cut = %.0f (%.1f) ",
p->CutCount[3], 1.0*
p->CutCount[3]/Gia_ManAndNum(
p->pGia) );
858 printf(
"Gia = %.2f MB ", MemGia );
859 printf(
"Man = %.2f MB ", MemMan );
860 printf(
"Cut = %.2f MB ", MemCuts );
861 if (
p->pPars->fCutMin )
862 printf(
"TT = %.2f MB ", MemTt );
863 printf(
"Total = %.2f MB ", MemGia + MemMan + MemCuts + MemTt );
865 Abc_PrintTime( 1,
"Time", Abc_Clock() -
p->clkStart );
998static inline int Of_ManComputeForwardCut(
Of_Man_t *
p,
int iObj,
int * pCut )
1000 int k, iVar, Delay = 0;
1001 int DelayLut1 =
p->pPars->nDelayLut1;
1003 Delay = Abc_MaxInt( Delay, Of_ObjDelay1(
p, iVar) + DelayLut1 );
1004 Of_CutSetDelay1( pCut, Delay );
1007static inline int Of_ManComputeForwardCutArea(
Of_Man_t *
p,
int iObj,
int * pCut )
1009 int k, iVar, Area = 100 * Of_CutArea(
p, Of_CutSize(pCut));
1011 Area += Of_ObjFlow(
p, iVar);
1012 return Area / Abc_MaxInt(1, Of_ObjRefNum(
p, iObj));
1014static inline void Of_ManComputeForwardObj(
Of_Man_t *
p,
int iObj )
1017 int i, * pCut, * pCutMin = NULL, * pList = Of_ObjCutSet(
p, iObj);
1021 int Delay1This = Of_ManComputeForwardCut(
p, iObj, pCut);
1022 if ( Delay1 > Delay1This )
1024 Delay1 = Delay1This;
1029 if ( Of_ObjRefNum(
p, iObj) )
1030 pCutMin = Of_ObjCutBestP(
p, iObj);
1031 Of_ObjSetCutBestP(
p, pList, iObj, pCutMin );
1032 Of_ObjSetDelay1(
p, iObj, Of_CutDelay1(pCutMin) );
1034 Of_ObjSetFlow(
p, iObj, Of_ManComputeForwardCutArea(
p, iObj, pCutMin) );
1040 if ( Gia_ObjIsBuf(pObj) )
1041 Of_ObjSetDelay1(
p, i, Of_ObjDelay1(
p, Gia_ObjFaninId0(pObj, i)) );
1043 Of_ManComputeForwardObj(
p, i );
1049 int i,
Var, Count = (
p->Iter & 1) ? 1 : Of_CutArea(
p, Of_CutSize(pCut));
1051 if ( Of_ObjCutBest(
p,
Var) && !Of_ObjRefInc(
p,
Var) )
1057 int i,
Var, Count = (
p->Iter & 1) ? 1 : Of_CutArea(
p, Of_CutSize(pCut));
1059 if ( Of_ObjCutBest(
p,
Var) && !Of_ObjRefDec(
p,
Var) )
1063static inline int Of_CutAreaDerefed(
Of_Man_t *
p,
int * pCut )
1073 int i,
Var, Count = (
p->Iter & 1) ? 1 : Of_CutArea(
p, Of_CutSize(pCut));
1076 if ( !Of_ObjCutBest(
p,
Var) )
1078 Vec_IntPush( &
p->vCutRefs,
Var );
1079 if ( Of_ObjRefInc(
p,
Var) )
1085static inline int Of_CutAreaDerefed2(
Of_Man_t *
p,
int * pCut )
1088 assert( Vec_IntSize(&
p->vCutRefs) == 0 );
1091 Of_ObjRefDec(
p, iObj);
1092 Vec_IntClear( &
p->vCutRefs );
1097static inline void Of_ManComputeForwardObj2(
Of_Man_t *
p,
int iObj )
1099 int Delay, Required = Of_ObjRequired(
p, iObj);
1100 int AreaBef = 0, AreaAft = 0, Area, AreaMin =
ABC_INFINITY;
1101 int k, * pCut, * pCutMin = NULL, * pList = Of_ObjCutSet(
p, iObj);
1102 if ( Of_ObjRefNum(
p, iObj) )
1106 Delay = Of_ManComputeForwardCut(
p, iObj, pCut);
1107 if ( Delay > Required )
1109 Area = Of_CutAreaDerefed2(
p, pCut );
1110 if ( AreaMin > Area )
1116 assert( pCutMin != NULL );
1117 Of_ObjSetCutBestP(
p, pList, iObj, pCutMin );
1118 if ( Of_ObjRefNum(
p, iObj) )
1120 assert( AreaAft <= AreaBef );
1121 Delay = Of_CutDelay1(pCutMin);
1122 assert( Delay <= Required );
1123 Of_ObjSetDelay1(
p, iObj, Delay );
1129 if ( Gia_ObjIsBuf(pObj) )
1130 Of_ObjSetDelay1(
p, i, Of_ObjDelay1(
p, Gia_ObjFaninId0(pObj, i)) );
1132 Of_ManComputeForwardObj2(
p, i );
1136static inline int Of_ManComputeOutputRequired(
Of_Man_t *
p,
int fCleanRefs )
1138 int i, Id, Delay = 0;
1139 for ( i = 0; i < Gia_ManObjNum(
p->pGia); i++ )
1143 Of_ObjSetRefNum(
p, i, 0 );
1146 Delay = Abc_MaxInt( Delay, Of_ObjDelay1(
p, Id) );
1149 Of_ObjUpdateRequired(
p, Id, Delay );
1151 Of_ObjRefInc(
p, Id );
1153 if (
p->pPars->Delay &&
p->pPars->Delay < Delay )
1154 printf(
"Error: Delay violation.\n" );
1155 p->pPars->Delay = Delay;
1158static inline int Of_ManComputeBackwardCut(
Of_Man_t *
p,
int * pCut )
1160 int k, iVar, Cost = 0;
1162 if ( !Of_ObjRefNum(
p, iVar) )
1163 Cost += Of_ObjFlow(
p, iVar );
1169 int DelayLut1 =
p->pPars->nDelayLut1;
1170 int i, k, iVar, * pList, * pCut, * pCutMin;
1171 Of_ManComputeOutputRequired(
p, 1 );
1173 p->pPars->Area =
p->pPars->Edge = 0;
1176 int CostMin, Cost, Required = Of_ObjRequired(
p, i);
1177 if ( Gia_ObjIsBuf(pObj) )
1179 int FaninId = Gia_ObjFaninId0(pObj, i);
1180 Of_ObjUpdateRequired(
p, FaninId, Required );
1181 Of_ObjRefInc(
p, FaninId );
1184 if ( !Of_ObjRefNum(
p, i) )
1189 pList = Of_ObjCutSet(
p, i );
1192 if ( Of_CutDelay1(pCut) > Required )
1194 Cost = Of_ManComputeBackwardCut(
p, pCut );
1195 if ( CostMin > Cost )
1202 assert( pCutMin != NULL );
1203 Of_ObjSetCutBestP(
p, pList, i, pCutMin );
1206 Of_ObjUpdateRequired(
p, iVar, Required - DelayLut1 );
1207 Of_ObjRefInc(
p, iVar );
1210 p->pPars->Edge += Of_CutSize(pCutMin);
1217 int DelayLut1 =
p->pPars->nDelayLut1;
1218 int i, k, iVar, * pCutMin;
1219 Of_ManComputeOutputRequired(
p, 0 );
1221 p->pPars->Area =
p->pPars->Edge = 0;
1224 int Required = Of_ObjRequired(
p, i);
1225 if ( Gia_ObjIsBuf(pObj) )
1227 int FaninId = Gia_ObjFaninId0(pObj, i);
1228 Of_ObjUpdateRequired(
p, FaninId, Required );
1231 if ( !Of_ObjRefNum(
p, i) )
1234 pCutMin = Of_ObjCutBestP(
p, i );
1236 Of_ObjUpdateRequired(
p, iVar, Required - DelayLut1 );
1238 p->pPars->Edge += Of_CutSize(pCutMin);
1245 int DelayLut1 =
p->pPars->nDelayLut1;
1246 int i, k, iVar, * pList, * pCut, * pCutMin;
1247 int AreaBef = 0, AreaAft = 0;
1248 Of_ManComputeOutputRequired(
p, 0 );
1250 p->pPars->Area =
p->pPars->Edge = 0;
1253 int CostMin, Cost, Required = Of_ObjRequired(
p, i);
1254 if ( Gia_ObjIsBuf(pObj) )
1256 int FaninId = Gia_ObjFaninId0(pObj, i);
1257 Of_ObjUpdateRequired(
p, FaninId, Required );
1260 if ( !Of_ObjRefNum(
p, i) )
1267 pList = Of_ObjCutSet(
p, i );
1270 if ( Of_CutDelay1(pCut) > Required )
1272 Cost = Of_CutAreaDerefed2(
p, pCut );
1273 if ( CostMin > Cost )
1280 assert( pCutMin != NULL );
1281 Of_ObjSetCutBestP(
p, pList, i, pCutMin );
1283 Of_ObjUpdateRequired(
p, iVar, Required - DelayLut1 );
1286 assert( AreaAft <= AreaBef );
1288 p->pPars->Edge += Of_CutSize(pCutMin);
1307 int Delays[6], Perm[6] = {0, 1, 2, 3, 4, 5};
1308 int DelayLut1 =
p->pPars->nDelayLut1;
1309 int DelayLut2 =
p->pPars->nDelayLut2;
1310 int nSize = Of_CutSize(pCut);
1311 int k, iVar, Flag, SlowCon, Delay, DelayAfter, fDirConWorks;
1314 Delays[k] = Of_ObjDelay1(
p, iVar) + DelayLut1;
1317 for ( ; k <
p->pPars->nLutSize; k++ )
1322 Vec_IntSelectSortCost2Reverse( Perm, nSize, Delays );
1323 assert( nSize < 2 || Delays[0] >= Delays[nSize-1] );
1324 assert( Delays[0] >= 0 && Delays[nSize-1] >= 0 );
1327 *pDelay1 = *pDelay2 = 0;
1328 SlowCon =
p->pPars->nFastEdges < nSize ? Delays[
p->pPars->nFastEdges] : 0;
1329 for ( k = 0; k < nSize; k++ )
1337 iVar = Of_CutVar( pCut, Perm[k] );
1338 assert( Delays[k] == Of_ObjDelay1(
p, iVar) + DelayLut1 );
1339 DelayAfter = Of_ObjDelay2(
p, iVar) + DelayLut2;
1340 if ( k < p->pPars->nFastEdges && Delays[k] > SlowCon && DelayAfter < Delays[k] && fDirConWorks && Gia_ObjIsAndNotBuf(Gia_ManObj(
p->pGia, iVar)) )
1343 Of_CutSetFlag( pCut, Perm[k], 1 );
1348 Of_CutSetFlag( pCut, Perm[k], 0 );
1351 *pDelay1 = Abc_MaxInt( *pDelay1, Delay );
1352 *pDelay2 = Abc_MaxInt( *pDelay2, Delays[k] );
1357 if ( *pDelay1 > *pDelay2 )
1359 for ( k = 0; k < nSize; k++ )
1360 Of_CutSetFlag( pCut, k, 0 );
1361 *pDelay1 = *pDelay2;
1363 assert( *pDelay1 <= *pDelay2 );
1364 Of_CutSetDelay1( pCut, *pDelay1 );
1365 Of_CutSetDelay2( pCut, *pDelay2 );
1370 assert( Of_ObjDelay2(
p, iVar) + DelayLut2 <= *pDelay1 );
1372 assert( Of_ObjDelay1(
p, iVar) + DelayLut1 <= *pDelay1 );
1373 assert( Of_ObjDelay1(
p, iVar) + DelayLut1 <= *pDelay2 );
1379 int i, * pCut, * pCutMin = NULL, * pCutMin2 = NULL, * pList = Of_ObjCutSet(
p, iObj);
1382 int Delay1This, Delay2This;
1384 if ( Delay1 > Delay1This )
1386 if ( Delay2 > Delay2This )
1388 Delay1 = Abc_MinInt( Delay1, Delay1This );
1389 Delay2 = Abc_MinInt( Delay2, Delay2This );
1391 Of_ObjSetDelay1(
p, iObj, Delay1 );
1392 Of_ObjSetDelay2(
p, iObj, Delay2 );
1393 Of_ObjSetCutBestP(
p, pList, iObj, pCutMin );
1394 Of_ObjSetCutBestP2(
p, pList, iObj, pCutMin2 );
1401 if ( Gia_ObjIsBuf(pObj) )
1403 Of_ObjSetDelay1(
p, i, Of_ObjDelay1(
p, Gia_ObjFaninId0(pObj, i)) );
1404 Of_ObjSetDelay2(
p, i, Of_ObjDelay2(
p, Gia_ObjFaninId0(pObj, i)) );
1413 int DelayLut1 =
p->pPars->nDelayLut1;
1414 int DelayLut2 =
p->pPars->nDelayLut2;
1415 int i, k, iVar, Flag, * pList, * pCutMin;
1416 int CountNodes = 0, CountEdges = 0;
1417 Of_ManComputeOutputRequired(
p, 1 );
1418 printf(
"Global delay =%8.2f\n", Of_Int2Flt((
int)
p->pPars->Delay) );
1421 vPointed = Vec_BitStart( Gia_ManObjNum(
p->pGia) );
1422 p->pPars->Area =
p->pPars->Edge = 0;
1425 int CostMin, fPointed, Required = Of_ObjRequired(
p, i);
1426 if ( Gia_ObjIsBuf(pObj) )
1428 int FaninId = Gia_ObjFaninId0(pObj, i);
1429 Of_ObjUpdateRequired(
p, FaninId, Required );
1430 Of_ObjRefInc(
p, FaninId );
1433 if ( !Of_ObjRefNum(
p, i) )
1436 fPointed = Vec_BitEntry(vPointed, i);
1437 CountNodes += fPointed;
1463 pCutMin = Of_ObjCutBestP2(
p, i );
1464 CostMin = Of_CutDelay2(pCutMin);
1469 pCutMin = Of_ObjCutBestP(
p, i );
1470 CostMin = Of_CutDelay1(pCutMin);
1480 assert( pCutMin != NULL );
1481 pList = Of_ObjCutSet(
p, i );
1482 Of_ObjSetCutBestP(
p, pList, i, pCutMin );
1485 Of_ObjUpdateRequired(
p, iVar, Required - ((Flag && !fPointed) ? DelayLut2 : DelayLut1) );
1486 Of_ObjRefInc(
p, iVar );
1487 if ( Flag && !fPointed )
1489 Vec_BitWriteEntry( vPointed, iVar, 1 );
1494 p->pPars->Edge += Of_CutSize(pCutMin);
1497 Vec_BitFree( vPointed );
1517 int * pCutSet, * pCut;
1518 int i, k, v, c,
Var, Lit, pLits[2], status, RetValue, nCutCount, nClauses;
1519 Vec_Int_t * vLits = Vec_IntAlloc( 100 );
1527 Vec_IntAppend( vBestNode, vBestCut );
1529 sat_solver_set_polarity( pSat, Vec_IntArray(vBestNode), Vec_IntSize(vBestNode) );
1530 Vec_IntShrink( vBestNode, Vec_IntSize(vBestNode) - Vec_IntSize(vBestCut) );
1535 int iFirst = Vec_IntEntry(vFirst, i);
1536 int nCuts = Vec_IntEntry(vCutNum, i);
1537 Vec_IntClear( vLits );
1538 Vec_IntPush( vLits, Abc_Var2Lit(pObj->
Value, 1) );
1539 for ( c = 0; c < nCuts; c++ )
1540 Vec_IntPush( vLits, Abc_Var2Lit(iFirst + c, 0) );
1549 pCutSet = Of_ObjCutSet(
p, i);
1552 pLits[0] = Abc_Var2Lit( Gia_ManAndNum(
p->pGia) + nCutCount, 1 );
1553 pLits[1] = Abc_Var2Lit( pObj->
Value, 0 );
1558 pVar = Gia_ManObj(
p->pGia,
Var);
1559 if ( !Gia_ObjIsAnd(pVar) )
1561 pLits[1] = Abc_Var2Lit( pVar->
Value, 0 );
1568 assert( nCutCount == nCutsAll );
1572 Gia_ObjFanin0(pObj)->fMark0 = 1;
1577 Lit = Abc_Var2Lit( pObj->
Value, 0 );
1583 Gia_ObjFanin0(pObj)->fMark0 = 0;
1589 Vec_IntClear( vLits );
1590 Vec_IntFillNatural( vLits, Gia_ManAndNum(
p->pGia) );
1592 printf(
"Problem clauses = %d. Cardinality clauses = %d.\n", nClauses, pSat->
stats.
clauses - nClauses );
1597 printf(
"Undecided. " );
1599 printf(
"Satisfiable. " );
1601 printf(
"Unsatisfiable. " );
1602 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
1607 for ( v = 0; v < Gia_ManAndNum(
p->pGia); v++ )
1609 printf(
"%d", sat_solver_var_value(pSat, v) );
1610 nOnes += sat_solver_var_value(pSat, v);
1612 printf(
" Nodes = %d\n", nOnes );
1615 for ( ; v < Gia_ManAndNum(
p->pGia) + nCutsAll; v++ )
1617 printf(
"%d", sat_solver_var_value(pSat, v) );
1618 nOnes += sat_solver_var_value(pSat, v);
1620 printf(
" LUTs = %d\n", nOnes );
1625 Vec_IntFree( vLits );
1631 int * pCutSet, * pCut, * pCutBest;
1632 int i, k, v,
Var, nCuts;
1633 Vec_Int_t * vFirst = Vec_IntStartFull( Gia_ManObjNum(
p->pGia) );
1634 Vec_Int_t * vCutNum = Vec_IntStartFull( Gia_ManObjNum(
p->pGia) );
1635 Vec_Int_t * vBestNode = Vec_IntAlloc( 100 );
1636 Vec_Int_t * vBestCut = Vec_IntAlloc( 100 );
1637 int nAndsAll = 0, nCutsAll = 0, Shift = Gia_ManAndNum(
p->pGia);
1643 if ( Of_ObjRefNum(
p, i) )
1645 Vec_IntPush( vBestNode, nAndsAll );
1646 pCutBest = Of_ObjCutBestP(
p, i );
1648 pObj->
Value = nAndsAll++;
1650 pCutSet = Of_ObjCutSet(
p, i);
1656 Vec_IntWriteEntry( vFirst, i, Shift + nCutsAll );
1657 Vec_IntWriteEntry( vCutNum, i, nCuts );
1660 printf(
"Node %d. Cuts %d.\n", i, nCuts );
1667 printf(
"%d ",
Var );
1668 printf(
"} %s\n", pCutBest == pCut ?
"best" :
"" );
1670 if ( pCutBest == pCut )
1671 Vec_IntPush( vBestCut, Shift + nCutsAll );
1675 assert( nAndsAll == Shift );
1676 printf(
"Total: Ands = %d. Luts = %d. Cuts = %d.\n", nAndsAll, Vec_IntSize(vBestNode), nCutsAll );
1681 Vec_IntFree( vFirst );
1682 Vec_IntFree( vCutNum );
1683 Vec_IntFree( vBestNode );
1684 Vec_IntFree( vBestCut );
1727 Vec_Int_t * vMapping, * vPacking = NULL;
1729 int i, k, iVar, * pCut, Place, Flag;
1730 assert( !
p->pPars->fCutMin &&
p->pGia->vMapping == NULL );
1731 vMapping = Vec_IntAlloc( Gia_ManObjNum(
p->pGia) + (
int)
p->pPars->Edge + (
int)
p->pPars->Area * 2 );
1732 Vec_IntFill( vMapping, Gia_ManObjNum(
p->pGia), 0 );
1733 if (
p->pPars->nFastEdges )
1735 vPacking = Vec_IntAlloc( 1000 );
1736 Vec_IntPush( vPacking, 0 );
1738 vPointed = Vec_BitStart( Gia_ManObjNum(
p->pGia) );
1741 if ( !Of_ObjRefNum(
p, i) )
1743 assert( !Gia_ObjIsBuf(Gia_ManObj(
p->pGia,i)) );
1744 pCut = Of_ObjCutBestP(
p, i );
1745 Vec_IntWriteEntry( vMapping, i, Vec_IntSize(vMapping) );
1746 Vec_IntPush( vMapping, Of_CutSize(pCut) );
1748 Vec_IntPush( vMapping, iVar );
1749 Vec_IntPush( vMapping, i );
1750 if ( vPacking == NULL || Vec_BitEntry(vPointed, i) )
1752 Place = Vec_IntSize( vPacking );
1753 Vec_IntPush( vPacking, 0 );
1754 Vec_IntPush( vPacking, i );
1758 Vec_IntPush( vPacking, iVar );
1759 Vec_BitWriteEntry( vPointed, iVar, 1 );
1761 Vec_IntAddToEntry( vPacking, Place, Vec_IntSize(vPacking)-Place-1 );
1762 Vec_IntAddToEntry( vPacking, 0, 1 );
1764 assert( Vec_IntCap(vMapping) == 16 || Vec_IntSize(vMapping) == Vec_IntCap(vMapping) );
1765 p->pGia->vMapping = vMapping;
1766 p->pGia->vPacking = vPacking;
1767 Vec_BitFree( vPointed );
1774 if ( Gia_ManHasChoices(pGia) )
1789 int Time = Of_Flt2Int(
p->pGia->vInArrs ? Abc_MaxFloat(0.0, Vec_FltEntry(
p->pGia->vInArrs, i)) : 0.0);
1790 Of_ObjSetDelay1(
p, Id, Time );
1791 Of_ObjSetDelay2(
p, Id, Time );
1794 if (
p->pPars->nFastEdges )
1796 p->pPars->nRounds = 1;
1797 for (
p->Iter = 0;
p->Iter <
p->pPars->nRounds;
p->Iter++ )
1815 for (
p->Iter = 0;
p->Iter <
p->pPars->nRounds;
p->Iter++ )
1830 for ( ;
p->Iter <
p->pPars->nRounds +
p->pPars->nRoundsEla;
p->Iter++ )
1832 if (
p->Iter <
p->pPars->nRounds +
p->pPars->nRoundsEla - 1 )
#define ABC_SWAP(Type, a, b)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Cnf_AddCardinConstrPairWise(sat_solver *p, Vec_Int_t *vVars, int K, int fStrict)
#define sat_solver_addclause
void Dau_DsdPrintFromTruth(word *pTruth, int nVarsInit)
void Mf_ManSetFlowRefs(Gia_Man_t *p, Vec_Int_t *vRefs)
Gia_Man_t * Of_ManDeriveMapping(Of_Man_t *p)
void Of_ManComputeForwardDirconCut(Of_Man_t *p, int iObj, int *pCut, int *pDelay1, int *pDelay2)
int Of_CutRef_rec(Of_Man_t *p, int *pCut)
void Of_ManComputeCuts(Of_Man_t *p)
void Of_ManPrintCuts(Of_Man_t *p)
void Of_ManSetDefaultPars(Jf_Par_t *pPars)
void Of_ManComputeBackward3(Of_Man_t *p)
void Of_ObjMergeOrder(Of_Man_t *p, int iObj)
void Of_ManPrintStats(Of_Man_t *p, char *pTitle)
int Of_ManComputeForwardDirconObj(Of_Man_t *p, int iObj)
struct Of_Cut_t_ Of_Cut_t
#define Of_SetForEachCut(pList, pCut, i)
struct Of_Obj_t_ Of_Obj_t
void Of_ManComputeBackwardDircon1(Of_Man_t *p)
Gia_Man_t * Of_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
void Of_ManPrintInit(Of_Man_t *p)
void Of_ManPrintQuit(Of_Man_t *p)
void Of_ManAreaFlow(Of_Man_t *p)
FUNCTION DEFINITIONS ///.
Of_Man_t * Of_StoCreate(Gia_Man_t *pGia, Jf_Par_t *pPars)
int Of_CutDeref_rec(Of_Man_t *p, int *pCut)
void Of_ManComputeBackward2(Of_Man_t *p)
void Of_ManComputeForward1(Of_Man_t *p)
void Of_ManComputeForward2(Of_Man_t *p)
void Of_ManCreateSat(Of_Man_t *p, int nCutsAll, Vec_Int_t *vFirst, Vec_Int_t *vCutNum, Vec_Int_t *vBestNode, Vec_Int_t *vBestCut)
int Of_CutRef2_rec(Of_Man_t *p, int *pCut)
void Of_StoDelete(Of_Man_t *p)
#define Of_CutForEachVar(pCut, iVar, i)
void Of_ManComputeBackward1(Of_Man_t *p)
void Of_ManComputeForwardDircon1(Of_Man_t *p)
#define OF_LEAF_MAX
DECLARATIONS ///.
#define Of_CutForEachVarFlag(pCut, iVar, Flag, i)
struct Of_Man_t_ Of_Man_t
void Gia_ManStop(Gia_Man_t *p)
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Gia_Man_t * Gia_ManDupMuxes(Gia_Man_t *p, int Limit)
double Gia_ManMemory(Gia_Man_t *p)
void Gia_ManConvertPackingToEdges(Gia_Man_t *p)
#define Gia_ManForEachAnd(p, pObj, i)
#define Gia_ManForEachAndReverse(p, pObj, i)
#define Gia_ManForEachCoDriverId(p, DriverId, i)
struct Gia_Obj_t_ Gia_Obj_t
void Gia_ManFillValue(Gia_Man_t *p)
struct Gia_Man_t_ Gia_Man_t
void Gia_ManPrintMuxStats(Gia_Man_t *p)
void Gia_ManMappingVerify(Gia_Man_t *p)
void Gia_ManCreateRefs(Gia_Man_t *p)
struct Jf_Par_t_ Jf_Par_t
#define Gia_ManForEachCo(p, pObj, i)
void Gia_ManSetPhase(Gia_Man_t *p)
#define Gia_ManForEachAndId(p, i)
#define Gia_ManForEachCiId(p, Id, i)
unsigned __int64 word
DECLARATIONS ///.
sat_solver * sat_solver_new(void)
void sat_solver_setnvars(sat_solver *s, int n)
void sat_solver_delete(sat_solver *s)
void Sat_SolverPrintStats(FILE *pFile, sat_solver *p)
int pLeaves[OF_LEAF_MAX+1]
typedefABC_NAMESPACE_IMPL_START struct Vec_Mem_t_ Vec_Mem_t
DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.