41#define PF_NO_FUNC 0x3FFFFFF
42#define PF_INFINITY FLT_MAX
100static inline int Pf_Mat2Int(
Pf_Mat_t Mat ) {
union {
int x;
Pf_Mat_t y; } v; v.y = Mat;
return v.x; }
101static inline Pf_Mat_t Pf_Int2Mat(
int Int ) {
union {
int x;
Pf_Mat_t y; } v; v.x = Int;
return v.y; }
105static inline int * Pf_ManCutSet(
Pf_Man_t *
p,
int i ) {
return (
int *)Vec_PtrEntry(&
p->vPages, i >> 16) + (i & 0xFFFF); }
106static inline int Pf_ObjCutSetId(
Pf_Man_t *
p,
int i ) {
return Vec_IntEntry( &
p->vCutSets, i ); }
107static inline int * Pf_ObjCutSet(
Pf_Man_t *
p,
int i ) {
return Pf_ManCutSet(
p, Pf_ObjCutSetId(
p, i)); }
108static inline int Pf_ObjHasCuts(
Pf_Man_t *
p,
int i ) {
return (
int)(Vec_IntEntry(&
p->vCutSets, i) > 0); }
109static inline int Pf_ObjCutUseless(
Pf_Man_t *
p,
int TruthId ) {
return (
int)(TruthId >= Vec_WecSize(
p->vTt2Match)); }
111static inline float Pf_ObjCutFlow(
Pf_Man_t *
p,
int i ) {
return Vec_FltEntry(&
p->vCutFlows, i); }
112static inline int Pf_ObjCutDelay(
Pf_Man_t *
p,
int i ) {
return Vec_IntEntry(&
p->vCutDelays, i); }
113static inline void Pf_ObjSetCutFlow(
Pf_Man_t *
p,
int i,
float a ) { Vec_FltWriteEntry(&
p->vCutFlows, i, a); }
114static inline void Pf_ObjSetCutDelay(
Pf_Man_t *
p,
int i,
int d ) { Vec_IntWriteEntry(&
p->vCutDelays, i, d); }
116static inline int Pf_CutSize(
int * pCut ) {
return pCut[0] &
PF_NO_LEAF; }
117static inline int Pf_CutFunc(
int * pCut ) {
return ((
unsigned)pCut[0] >> 5); }
118static inline int * Pf_CutLeaves(
int * pCut ) {
return pCut + 1; }
119static inline int Pf_CutSetBoth(
int n,
int f ) {
return n | (f << 5); }
120static inline int Pf_CutIsTriv(
int * pCut,
int i ) {
return Pf_CutSize(pCut) == 1 && pCut[1] == i; }
121static inline int Pf_CutHandle(
int * pCutSet,
int * pCut ) {
assert( pCut > pCutSet );
return pCut - pCutSet; }
122static inline int * Pf_CutFromHandle(
int * pCutSet,
int h ) {
assert( h > 0 );
return pCutSet + h; }
123static inline int Pf_CutConfLit(
int Conf,
int i ) {
return 15 & (Conf >> (i << 2)); }
124static inline int Pf_CutConfVar(
int Conf,
int i ) {
return Abc_Lit2Var( Pf_CutConfLit(Conf, i) ); }
125static inline int Pf_CutConfC(
int Conf,
int i ) {
return Abc_LitIsCompl( Pf_CutConfLit(Conf, i) ); }
127#define Pf_SetForEachCut( pList, pCut, i ) for ( i = 0, pCut = pList + 1; i < pList[0]; i++, pCut += Pf_CutSize(pCut) + 1 )
128#define Pf_ObjForEachCut( pCuts, i, nCuts ) for ( i = 0, i < nCuts; i++ )
129#define Pf_CutForEachLit( pCut, Conf, iLit, i ) for ( i = 0; i < Pf_CutSize(pCut) && (iLit = Abc_Lit2LitV(Pf_CutLeaves(pCut), Pf_CutConfLit(Conf, i))); i++ )
130#define Pf_CutForEachVar( pCut, Conf, iVar, c, i ) for ( i = 0; i < Pf_CutSize(pCut) && (iVar = Pf_CutLeaves(pCut)[Pf_CutConfVar(Conf, i)]) && ((c = Pf_CutConfC(Conf, i)), 1); i++ )
151 int i, GateId, Entry, fCompl = (int)(uTruth & 1);
152 word uFunc = fCompl ? ~uTruth : uTruth;
153 int iFunc = Vec_MemHashInsert( pMan->
vTtMem, &uFunc );
154 if ( iFunc == Vec_WecSize(pMan->
vTt2Match) )
156 vArray = Vec_WecEntry( pMan->
vTt2Match, iFunc );
159 for ( i = 0; i < nFans; i++ )
161 Mat.
Perm |= (unsigned)(Abc_Lit2Var(pFans[i]) << (3*i));
162 Mat.
Phase |= (unsigned)(Abc_LitIsCompl(pFans[i]) << i);
166 if ( GateId == CellId && Pf_Int2Mat(Entry).Phase == Mat.
Phase )
168 if ( i == Vec_IntSize(vArray) )
170 Vec_IntPush( vArray, CellId );
171 Vec_IntPush( vArray, Pf_Mat2Int(Mat) );
177 int nPerms = pnPerms[pCell->
nFanins];
178 int nMints = (1 << pCell->
nFanins);
179 word tCur, tTemp1, tTemp2;
181 for ( i = 0; i < (int)pCell->
nFanins; i++ )
182 Perm[i] = Abc_Var2Lit( i, 0 );
183 tCur = tTemp1 = pCell->
uTruth;
184 for (
p = 0;
p < nPerms;
p++ )
187 for ( c = 0; c < nMints; c++ )
191 tCur = Abc_Tt6Flip( tCur, pComp[pCell->
nFanins][c] );
192 Perm1 = Perm + pComp[pCell->
nFanins][c];
193 *Perm1 = Abc_LitNot( *Perm1 );
197 tCur = Abc_Tt6SwapAdjacent( tCur, pPerm[pCell->
nFanins][
p] );
198 Perm1 = Perm + pPerm[pCell->
nFanins][
p];
210 for ( i = 2; i <= 6; i++ )
212 for ( i = 2; i <= 6; i++ )
214 for ( i = 2; i <= 6; i++ )
217 for ( i = 4; i <
p->nCells; i++ )
219 for ( i = 2; i <= 6; i++ )
221 for ( i = 2; i <= 6; i++ )
228 word * pTruth = Vec_MemReadEntry(
p->vTtMem, t);
229 int k, nSuppSize = Abc_TtSupportSize(pTruth, 6);
230 printf(
"%6d : ", Count );
231 printf(
"%6d : ", t );
232 printf(
"%6d : ", i );
233 printf(
"Gate %16s ", pC->
pName );
234 printf(
"Area =%8.2f ", pC->
Area );
235 printf(
"In = %d ", pC->
nFanins );
240 for ( k = 0; k < (int)pC->
nFanins; k++ )
242 int fComplF = (Mat.
Phase >> k) & 1;
243 int iFanin = (Mat.
Perm >> (3*k)) & 7;
244 printf(
"%c",
'a' + iFanin - fComplF * (
'a' -
'A') );
251 int t, i, GateId, Entry, Count = 0;
252 for ( t = 2; t < Vec_WecSize(
p->vTt2Match); t++ )
254 Vec_Int_t * vArr = Vec_WecEntry(
p->vTt2Match, t );
264 printf(
"Gates = %d. Truths = %d. Matches = %d.\n",
265 p->nCells, Vec_MemEntryNum(
p->vTtMem), Count );
302 if ( Gia_ManHasChoices(pGia) )
306 vFlowRefs = Vec_IntAlloc(0);
308 pGia->
pRefs= Vec_IntReleaseArray(vFlowRefs);
309 Vec_IntFree(vFlowRefs);
312 p->clkStart = Abc_Clock();
318 Vec_PtrGrow( &
p->vPages, 256 );
319 Vec_IntFill( &
p->vCutSets, Gia_ManObjNum(pGia), 0 );
320 Vec_FltFill( &
p->vCutFlows, Gia_ManObjNum(pGia), 0 );
321 Vec_IntFill( &
p->vCutDelays,Gia_ManObjNum(pGia), 0 );
323 p->vTtMem = Vec_MemAllocForTT( 6, 0 );
324 p->vTt2Match = Vec_WecAlloc( 1000 );
325 Vec_WecPushLevel(
p->vTt2Match );
326 Vec_WecPushLevel(
p->vTt2Match );
327 assert( Vec_WecSize(
p->vTt2Match) == Vec_MemEntryNum(
p->vTtMem) );
329 p->InvDelay =
p->pCells[3].Delays[0];
330 p->InvArea =
p->pCells[3].Area;
338 Vec_PtrFreeData( &
p->vPages );
345 Vec_WecFree(
p->vTt2Match );
346 Vec_MemHashFree(
p->vTtMem );
347 Vec_MemFree(
p->vTtMem );
369 int nOldSupp = pCutR->
nLeaves, truthId, fCompl;
word t;
370 word t0 = *Vec_MemReadEntry(
p->vTtMem, Abc_Lit2Var(pCut0->
iFunc));
371 word t1 = *Vec_MemReadEntry(
p->vTtMem, Abc_Lit2Var(pCut1->
iFunc));
372 if ( Abc_LitIsCompl(pCut0->
iFunc) ^ fCompl0 ) t0 = ~t0;
373 if ( Abc_LitIsCompl(pCut1->
iFunc) ^ fCompl1 ) t1 = ~t1;
376 t = fIsXor ? t0 ^ t1 : t0 & t1;
377 if ( (fCompl = (
int)(t & 1)) ) t = ~t;
379 assert( (
int)(t & 1) == 0 );
380 truthId = Vec_MemHashInsert(
p->vTtMem, &t);
381 pCutR->
iFunc = Abc_Var2Lit( truthId, fCompl );
382 pCutR->
Useless = Pf_ObjCutUseless(
p, truthId );
384 return (
int)pCutR->
nLeaves < nOldSupp;
388 int nOldSupp = pCutR->
nLeaves, truthId, fCompl;
word t;
389 word t0 = *Vec_MemReadEntry(
p->vTtMem, Abc_Lit2Var(pCut0->
iFunc));
390 word t1 = *Vec_MemReadEntry(
p->vTtMem, Abc_Lit2Var(pCut1->
iFunc));
391 word tC = *Vec_MemReadEntry(
p->vTtMem, Abc_Lit2Var(pCutC->
iFunc));
392 if ( Abc_LitIsCompl(pCut0->
iFunc) ^ fCompl0 ) t0 = ~t0;
393 if ( Abc_LitIsCompl(pCut1->
iFunc) ^ fCompl1 ) t1 = ~t1;
394 if ( Abc_LitIsCompl(pCutC->
iFunc) ^ fComplC ) tC = ~tC;
398 t = (tC & t1) | (~tC & t0);
399 if ( (fCompl = (
int)(t & 1)) ) t = ~t;
401 assert( (
int)(t & 1) == 0 );
402 truthId = Vec_MemHashInsert(
p->vTtMem, &t);
403 pCutR->
iFunc = Abc_Var2Lit( truthId, fCompl );
404 pCutR->
Useless = Pf_ObjCutUseless(
p, truthId );
406 return (
int)pCutR->
nLeaves < nOldSupp;
421static inline int Pf_CutCountBits(
word i )
423 i = i - ((i >> 1) & 0x5555555555555555);
424 i = (i & 0x3333333333333333) + ((i >> 2) & 0x3333333333333333);
425 i = ((i + (i >> 4)) & 0x0F0F0F0F0F0F0F0F);
426 return (i*(0x0101010101010101))>>56;
428static inline word Pf_CutGetSign(
int * pLeaves,
int nLeaves )
430 word Sign = 0;
int i;
431 for ( i = 0; i < nLeaves; i++ )
432 Sign |= ((
word)1) << (pLeaves[i] & 0x3F);
435static inline int Pf_CutCreateUnit(
Pf_Cut_t *
p,
int i )
442 p->Sign = ((
word)1) << (i & 0x3F);
447 int i, nDigits = Abc_Base10Log(Gia_ManObjNum(
p->pGia));
448 printf(
"%d {", pCut->
nLeaves );
449 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
450 printf(
" %*d", nDigits, pCut->
pLeaves[i] );
451 for ( ; i < (int)
p->pPars->nLutSize; i++ )
452 printf(
" %*s", nDigits,
" " );
453 printf(
" } Useless = %d. D = %4d A = %9.4f F = %6d ",
460static inline int Pf_ManPrepareCuts(
Pf_Cut_t * pCuts,
Pf_Man_t *
p,
int iObj,
int fAddUnit )
462 if ( Pf_ObjHasCuts(
p, iObj) )
465 int i, * pCut, * pList = Pf_ObjCutSet(
p, iObj);
470 pMfCut->
iFunc = Pf_CutFunc( pCut );
471 pMfCut->
nLeaves = Pf_CutSize( pCut );
472 pMfCut->
Sign = Pf_CutGetSign( pCut+1, Pf_CutSize(pCut) );
473 pMfCut->
Useless = Pf_ObjCutUseless(
p, Abc_Lit2Var(pMfCut->
iFunc) );
474 memcpy( pMfCut->
pLeaves, pCut+1,
sizeof(
int) * Pf_CutSize(pCut) );
477 if ( fAddUnit && pCuts->
nLeaves > 1 )
478 return pList[0] + Pf_CutCreateUnit( pMfCut, iObj );
481 return Pf_CutCreateUnit( pCuts, iObj );
483static inline int Pf_ManSaveCuts(
Pf_Man_t *
p,
Pf_Cut_t ** pCuts,
int nCuts,
int fUseful )
485 int i, * pPlace, iCur, nInts = 1, nCutsNew = 0;
486 for ( i = 0; i < nCuts; i++ )
487 if ( !fUseful || !pCuts[i]->Useless )
488 nInts += pCuts[i]->
nLeaves + 1, nCutsNew++;
489 if ( (
p->iCur & 0xFFFF) + nInts > 0xFFFF )
490 p->iCur = ((
p->iCur >> 16) + 1) << 16;
491 if ( Vec_PtrSize(&
p->vPages) == (
p->iCur >> 16) )
492 Vec_PtrPush( &
p->vPages,
ABC_ALLOC(
int, (1<<16)) );
493 iCur =
p->iCur;
p->iCur += nInts;
494 pPlace = Pf_ManCutSet(
p, iCur );
495 *pPlace++ = nCutsNew;
496 for ( i = 0; i < nCuts; i++ )
497 if ( !fUseful || !pCuts[i]->Useless )
499 *pPlace++ = Pf_CutSetBoth( pCuts[i]->nLeaves, pCuts[i]->iFunc );
500 memcpy( pPlace, pCuts[i]->pLeaves,
sizeof(
int) * pCuts[i]->nLeaves );
505static inline int Pf_ManCountUseful(
Pf_Cut_t ** pCuts,
int nCuts )
508 for ( i = 0; i < nCuts; i++ )
509 Count += !pCuts[i]->Useless;
512static inline int Pf_ManCountMatches(
Pf_Man_t *
p,
Pf_Cut_t ** pCuts,
int nCuts )
515 for ( i = 0; i < nCuts; i++ )
516 if ( !pCuts[i]->Useless )
517 Count += Vec_IntSize(Vec_WecEntry(
p->vTt2Match, Abc_Lit2Var(pCuts[i]->iFunc))) / 2;
538 for ( i = 0; i < nSizeC; i++ )
540 for ( k = 0; k < nSizeB; k++ )
541 if ( pC[i] == pB[k] )
548static inline int Pf_SetCheckArray(
Pf_Cut_t ** ppCuts,
int nCuts )
551 int i, k, m, n, Value;
553 for ( i = 0; i < nCuts; i++ )
559 for ( m = 0; m < (int)pCut0->
nLeaves; m++ )
560 for ( n = m + 1; n < (int)pCut0->
nLeaves; n++ )
563 for ( k = 0; k < nCuts; k++ )
566 if ( pCut0 == pCut1 )
569 Value = Pf_CutCheck( pCut0, pCut1 );
596 if ( nSize0 == nLutSize && nSize1 == nLutSize )
598 for ( i = 0; i < nSize0; i++ )
600 if ( pC0[i] != pC1[i] )
return 0;
610 if ( nSize0 == 0 )
goto FlushCut1;
611 if ( nSize1 == 0 )
goto FlushCut0;
614 if ( c == nLutSize )
return 0;
615 if ( pC0[i] < pC1[k] )
618 if ( i >= nSize0 )
goto FlushCut1;
620 else if ( pC0[i] > pC1[k] )
623 if ( k >= nSize1 )
goto FlushCut0;
627 pC[c++] = pC0[i++]; k++;
628 if ( i >= nSize0 )
goto FlushCut1;
629 if ( k >= nSize1 )
goto FlushCut0;
634 if ( c + nSize0 > nLutSize + i )
return 0;
643 if ( c + nSize1 > nLutSize + k )
return 0;
656 int xMin, c = 0, * pC = pCut->
pLeaves;
662 xMin = Abc_MinInt( Abc_MinInt(x0, x1), x2 );
664 if ( c == nLutSize )
return 0;
666 if (x0 == xMin) i0++;
667 if (x1 == xMin) i1++;
668 if (x2 == xMin) i2++;
675static inline int Pf_SetCutIsContainedOrder(
Pf_Cut_t * pBase,
Pf_Cut_t * pCut )
677 int i, nSizeB = pBase->
nLeaves;
679 if ( nSizeB == nSizeC )
681 for ( i = 0; i < nSizeB; i++ )
686 assert( nSizeB > nSizeC );
689 for ( i = k = 0; i < nSizeB; i++ )
701static inline int Pf_SetLastCutIsContained(
Pf_Cut_t ** pCuts,
int nCuts )
704 for ( i = 0; i < nCuts; i++ )
705 if ( pCuts[i]->nLeaves <= pCuts[nCuts]->nLeaves && (pCuts[i]->Sign & pCuts[nCuts]->Sign) == pCuts[i]->Sign && Pf_SetCutIsContainedOrder(pCuts[nCuts], pCuts[i]) )
709static inline int Pf_SetLastCutContainsArea(
Pf_Cut_t ** pCuts,
int nCuts )
711 int i, k, fChanges = 0;
712 for ( i = 0; i < nCuts; i++ )
713 if ( pCuts[nCuts]->nLeaves < pCuts[i]->nLeaves && (pCuts[nCuts]->Sign & pCuts[i]->Sign) == pCuts[nCuts]->Sign && Pf_SetCutIsContainedOrder(pCuts[i], pCuts[nCuts]) )
717 for ( i = k = 0; i <= nCuts; i++ )
731 if ( pCut0->
Flow < pCut1->
Flow )
return -1;
732 if ( pCut0->
Flow > pCut1->
Flow )
return 1;
739static inline void Pf_SetSortByArea(
Pf_Cut_t ** pCuts,
int nCuts )
742 for ( i = nCuts; i > 0; i-- )
744 if ( Pf_CutCompareArea(pCuts[i - 1], pCuts[i]) < 0 )
749static inline int Pf_SetAddCut(
Pf_Cut_t ** pCuts,
int nCuts,
int nCutNum )
753 nCuts = Pf_SetLastCutContainsArea(pCuts, nCuts);
754 Pf_SetSortByArea( pCuts, nCuts );
755 return Abc_MinInt( nCuts + 1, nCutNum - 1 );
757static inline int Pf_CutArea(
Pf_Man_t *
p,
int nLeaves )
761 return nLeaves +
p->pPars->nAreaTuner;
765 int i, nLeaves = pCut->
nLeaves;
766 assert( nLeaves <= p->pPars->nLutSize );
769 for ( i = 0; i < nLeaves; i++ )
774 pCut->
Delay += (int)(nLeaves > 1);
775 pCut->
Flow = (pCut->
Flow + Pf_CutArea(
p, nLeaves)) / (nGiaRefs ? nGiaRefs : 1);
781 int nGiaRefs = 2*Gia_ObjRefNumId(
p->pGia, iObj);
782 int nLutSize =
p->pPars->nLutSize;
783 int nCutNum =
p->pPars->nCutNum;
784 int nCuts0 = Pf_ManPrepareCuts(pCuts0,
p, Gia_ObjFaninId0(pObj, iObj), 1);
785 int nCuts1 = Pf_ManPrepareCuts(pCuts1,
p, Gia_ObjFaninId1(pObj, iObj), 1);
786 int fComp0 = Gia_ObjFaninC0(pObj);
787 int fComp1 = Gia_ObjFaninC1(pObj);
788 int iSibl = Gia_ObjSibl(
p->pGia, iObj);
789 Pf_Cut_t * pCut0, * pCut1, * pCut0Lim = pCuts0 + nCuts0, * pCut1Lim = pCuts1 + nCuts1;
790 int i, nCutsUse, nCutsR = 0;
791 assert( !Gia_ObjIsBuf(pObj) );
792 for ( i = 0; i < nCutNum; i++ )
793 pCutsR[i] = pCuts + i;
797 Gia_Obj_t * pObjE = Gia_ObjSiblObj(
p->pGia, iObj);
798 int fCompE = Gia_ObjPhase(pObj) ^ Gia_ObjPhase(pObjE);
799 int nCuts2 = Pf_ManPrepareCuts(pCuts2,
p, iSibl, 0);
800 Pf_Cut_t * pCut2, * pCut2Lim = pCuts2 + nCuts2;
801 for ( pCut2 = pCuts2; pCut2 < pCut2Lim; pCut2++ )
803 *pCutsR[nCutsR] = *pCut2;
804 pCutsR[nCutsR]->
iFunc = Abc_LitNotCond( pCutsR[nCutsR]->iFunc, fCompE );
805 Pf_CutParams(
p, pCutsR[nCutsR], nGiaRefs );
806 nCutsR = Pf_SetAddCut( pCutsR, nCutsR, nCutNum );
809 if ( Gia_ObjIsMuxId(
p->pGia, iObj) )
812 int nCuts2 = Pf_ManPrepareCuts(pCuts2,
p, Gia_ObjFaninId2(
p->pGia, iObj), 1);
813 int fComp2 = Gia_ObjFaninC2(
p->pGia, pObj);
814 Pf_Cut_t * pCut2, * pCut2Lim = pCuts2 + nCuts2;
815 p->CutCount[0] += nCuts0 * nCuts1 * nCuts2;
816 for ( pCut0 = pCuts0; pCut0 < pCut0Lim; pCut0++ )
817 for ( pCut1 = pCuts1; pCut1 < pCut1Lim; pCut1++ )
818 for ( pCut2 = pCuts2; pCut2 < pCut2Lim; pCut2++ )
820 if ( Pf_CutCountBits(pCut0->
Sign | pCut1->
Sign | pCut2->
Sign) > nLutSize )
823 if ( !Pf_CutMergeOrderMux(pCut0, pCut1, pCut2, pCutsR[nCutsR], nLutSize) )
825 if ( Pf_SetLastCutIsContained(pCutsR, nCutsR) )
828 if ( Pf_CutComputeTruthMux6(
p, pCut0, pCut1, pCut2, fComp0, fComp1, fComp2, pCutsR[nCutsR]) )
829 pCutsR[nCutsR]->
Sign = Pf_CutGetSign(pCutsR[nCutsR]->pLeaves, pCutsR[nCutsR]->nLeaves);
830 Pf_CutParams(
p, pCutsR[nCutsR], nGiaRefs );
831 nCutsR = Pf_SetAddCut( pCutsR, nCutsR, nCutNum );
836 int fIsXor = Gia_ObjIsXor(pObj);
837 p->CutCount[0] += nCuts0 * nCuts1;
838 for ( pCut0 = pCuts0; pCut0 < pCut0Lim; pCut0++ )
839 for ( pCut1 = pCuts1; pCut1 < pCut1Lim; pCut1++ )
841 if ( (
int)(pCut0->
nLeaves + pCut1->
nLeaves) > nLutSize && Pf_CutCountBits(pCut0->
Sign | pCut1->
Sign) > nLutSize )
844 if ( !Pf_CutMergeOrder(pCut0, pCut1, pCutsR[nCutsR], nLutSize) )
846 if ( Pf_SetLastCutIsContained(pCutsR, nCutsR) )
849 if ( Pf_CutComputeTruth6(
p, pCut0, pCut1, fComp0, fComp1, pCutsR[nCutsR], fIsXor) )
850 pCutsR[nCutsR]->
Sign = Pf_CutGetSign(pCutsR[nCutsR]->pLeaves, pCutsR[nCutsR]->nLeaves);
851 Pf_CutParams(
p, pCutsR[nCutsR], nGiaRefs );
852 nCutsR = Pf_SetAddCut( pCutsR, nCutsR, nCutNum );
860 printf(
"*** Obj = %d Useful = %d\n", iObj, Pf_ManCountUseful(pCutsR, nCutsR) );
861 for ( i = 0; i < nCutsR; i++ )
862 Pf_Cutprintf(
p, pCutsR[i] );
866 assert( nCutsR > 0 && nCutsR < nCutNum );
869 Pf_ObjSetCutFlow(
p, iObj, pCutsR[0]->Flow );
870 Pf_ObjSetCutDelay(
p, iObj, pCutsR[0]->Delay );
871 *Vec_IntEntryP(&
p->vCutSets, iObj) = Pf_ManSaveCuts(
p, pCutsR, nCutsR, 0);
872 p->CutCount[3] += nCutsR;
873 nCutsUse = Pf_ManCountUseful(pCutsR, nCutsR);
874 p->CutCount[4] += nCutsUse;
875 p->nCutUseAll += nCutsUse == nCutsR;
876 p->CutCount[5] += Pf_ManCountMatches(
p, pCutsR, nCutsR);
882 if ( Gia_ObjIsBuf(pObj) )
884 iFanin = Gia_ObjFaninId0(pObj, i);
885 Pf_ObjSetCutFlow(
p, i, Pf_ObjCutFlow(
p, iFanin) );
886 Pf_ObjSetCutDelay(
p, i, Pf_ObjCutDelay(
p, iFanin) );
908 if ( !
p->pPars->fVerbose )
910 printf(
"%s : ", pTitle );
911 printf(
"Delay =%8.2f ", (
float)
p->pPars->MapDelay );
912 printf(
"Area =%12.2f ",
p->pPars->MapArea );
913 printf(
"Gate =%6d ", (
int)
p->pPars->Area );
914 printf(
"Inv =%6d ", (
int)
p->nInvs );
915 printf(
"Edge =%7d ", (
int)
p->pPars->Edge );
916 Abc_PrintTime( 1,
"Time", Abc_Clock() -
p->clkStart );
922 if ( !
p->pPars->fVerbose )
924 printf(
"LutSize = %d ",
p->pPars->nLutSize );
925 printf(
"CutNum = %d ",
p->pPars->nCutNum );
926 printf(
"Iter = %d ",
p->pPars->nRounds +
p->pPars->nRoundsEla );
927 printf(
"Coarse = %d ",
p->pPars->fCoarsen );
928 printf(
"Cells = %d ",
p->nCells );
929 printf(
"Funcs = %d ", Vec_MemEntryNum(
p->vTtMem) );
930 printf(
"Matches = %d ", Vec_WecSizeSize(
p->vTt2Match)/2 );
931 nChoices = Gia_ManChoiceNum(
p->pGia );
933 printf(
"Choices = %d ", nChoices );
935 printf(
"Computing cuts...\r" );
941 float MemMan =(1.0 *
sizeof(
Pf_Obj_t) + 3.0 *
sizeof(int)) * Gia_ManObjNum(
p->pGia) / (1<<20);
942 float MemCuts = 1.0 *
sizeof(int) * (1 << 16) * Vec_PtrSize(&
p->vPages) / (1<<20);
943 float MemTt =
p->vTtMem ? Vec_MemMemory(
p->vTtMem) / (1<<20) : 0;
944 if (
p->CutCount[0] == 0 )
946 if ( !
p->pPars->fVerbose )
948 printf(
"CutPair = %.0f ",
p->CutCount[0] );
949 printf(
"Merge = %.0f (%.1f) ",
p->CutCount[1], 1.0*
p->CutCount[1]/Gia_ManAndNum(
p->pGia) );
950 printf(
"Eval = %.0f (%.1f) ",
p->CutCount[2], 1.0*
p->CutCount[2]/Gia_ManAndNum(
p->pGia) );
951 printf(
"Cut = %.0f (%.1f) ",
p->CutCount[3], 1.0*
p->CutCount[3]/Gia_ManAndNum(
p->pGia) );
952 printf(
"Use = %.0f (%.1f) ",
p->CutCount[4], 1.0*
p->CutCount[4]/Gia_ManAndNum(
p->pGia) );
953 printf(
"Mat = %.0f (%.1f) ",
p->CutCount[5], 1.0*
p->CutCount[5]/Gia_ManAndNum(
p->pGia) );
956 printf(
"Gia = %.2f MB ", MemGia );
957 printf(
"Man = %.2f MB ", MemMan );
958 printf(
"Cut = %.2f MB ", MemCuts );
959 printf(
"TT = %.2f MB ", MemTt );
960 printf(
"Total = %.2f MB ", MemGia + MemMan + MemCuts + MemTt );
962 Abc_PrintTime( 1,
"Time", Abc_Clock() -
p->clkStart );
1307 if ( Gia_ManHasChoices(pGia) )
#define ABC_SWAP(Type, a, b)
#define ABC_ALLOC(type, num)
#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 Dau_DsdPrintFromTruth(word *pTruth, int nVarsInit)
void Mf_ManSetFlowRefs(Gia_Man_t *p, Vec_Int_t *vRefs)
void Pf_ManPrintInit(Pf_Man_t *p)
void Pf_ObjMergeOrder(Pf_Man_t *p, int iObj)
void Pf_StoPrint(Pf_Man_t *p, int fVerbose)
void Pf_StoDelete(Pf_Man_t *p)
void Pf_ManSetDefaultPars(Jf_Par_t *pPars)
Pf_Man_t * Pf_StoCreate(Gia_Man_t *pGia, Jf_Par_t *pPars)
void Pf_StoDeriveMatches(Pf_Man_t *p, int fVerbose)
struct Pf_Cut_t_ Pf_Cut_t
#define Pf_SetForEachCut(pList, pCut, i)
void Pf_StoPrintOne(Pf_Man_t *p, int Count, int t, int i, int GateId, Pf_Mat_t Mat)
void Pf_StoCreateGate(Pf_Man_t *pMan, Mio_Cell_t *pCell, int **pComp, int **pPerm, int *pnPerms)
void Pf_ManComputeMapping(Pf_Man_t *p)
void Pf_ManPrintStats(Pf_Man_t *p, char *pTitle)
struct Pf_Man_t_ Pf_Man_t
Gia_Man_t * Pf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
struct Pf_Obj_t_ Pf_Obj_t
struct Pf_Mat_t_ Pf_Mat_t
void Pf_StoCreateGateAdd(Pf_Man_t *pMan, word uTruth, int *pFans, int nFans, int CellId)
FUNCTION DEFINITIONS ///.
#define PF_LEAF_MAX
DECLARATIONS ///.
void Pf_ManComputeCuts(Pf_Man_t *p)
void Pf_ManPrintQuit(Pf_Man_t *p)
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)
#define Gia_ManForEachAnd(p, pObj, i)
struct Gia_Obj_t_ Gia_Obj_t
struct Gia_Man_t_ Gia_Man_t
void Gia_ManPrintMuxStats(Gia_Man_t *p)
struct Jf_Par_t_ Jf_Par_t
void Gia_ManSetPhase(Gia_Man_t *p)
unsigned __int64 word
DECLARATIONS ///.
Mio_Cell_t * Mio_CollectRootsNewDefault(int nInputs, int *pnGates, int fVerbose)
struct Mio_Cell_t_ Mio_Cell_t
int pLeaves[PF_LEAF_MAX+1]
typedefABC_NAMESPACE_IMPL_START struct Vec_Mem_t_ Vec_Mem_t
DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.