37#define LF_CUT_WORDS (4+LF_LEAF_MAX/2)
38#define LF_TT_WORDS ((LF_LEAF_MAX > 6) ? 1 << (LF_LEAF_MAX-6) : 1)
39#define LF_EPSILON 0.005
120static inline int Lf_ObjOff(
Lf_Man_t *
p,
int i ) {
return Vec_IntEntry(&
p->vOffsets, i); }
121static inline int Lf_ObjRequired(
Lf_Man_t *
p,
int i ) {
return Vec_IntEntry(&
p->vRequired, i); }
122static inline void Lf_ObjSetRequired(
Lf_Man_t *
p,
int i,
int t ) { Vec_IntDowndateEntry(&
p->vRequired, i, t); }
123static inline Lf_Bst_t * Lf_ObjReadBest(
Lf_Man_t *
p,
int i ) {
return p->pObjBests + Lf_ObjOff(
p,i); }
124static inline float Lf_ObjFlowRefs(
Lf_Man_t *
p,
int i ) {
return Vec_FltEntry(&
p->vFlowRefs, Lf_ObjOff(
p,i)); }
125static inline int Lf_ObjMapRefNum(
Lf_Man_t *
p,
int i ) {
return Vec_IntEntry(&
p->vMapRefs, Lf_ObjOff(
p,i)); }
126static inline int Lf_ObjMapRefInc(
Lf_Man_t *
p,
int i ) {
return (*Vec_IntEntryP(&
p->vMapRefs, Lf_ObjOff(
p,i)))++; }
127static inline int Lf_ObjMapRefDec(
Lf_Man_t *
p,
int i ) {
return --(*Vec_IntEntryP(&
p->vMapRefs, Lf_ObjOff(
p,i))); }
128static inline float Lf_ObjSwitches(
Lf_Man_t *
p,
int i ) {
return Vec_FltEntry(&
p->vSwitches, i); }
129static inline int Lf_BestDiffCuts(
Lf_Bst_t *
p ) {
return p->Cut[0].Handle !=
p->Cut[1].Handle; }
130static inline int Lf_BestIsMapped(
Lf_Bst_t *
p ) {
return (
int)(
p->Cut[0].fUsed ^
p->Cut[1].fUsed); }
131static inline int Lf_BestIndex(
Lf_Bst_t *
p ) {
return p->Cut[1].fUsed; }
132static inline int Lf_BestCutIndex(
Lf_Bst_t *
p ) {
if (
p->Cut[0].fUsed)
return 0;
if (
p->Cut[1].fUsed)
return 1;
return 2; }
134#define Lf_CutSetForEachCut( nWords, pCutSet, pCut, i, nCuts ) for ( i = 0, pCut = pCutSet; i < nCuts; pCut = Lf_CutNext(pCut, nWords), i++ )
135#define Lf_CutForEachVar( pCut, Var, i ) for ( i = 0; i < (int)pCut->nLeaves && (Var = pCut->pLeaves[i]); i++ ) if ( Lf_ObjOff(p, Var) < 0 ) {} else
154static inline void Lf_ObjSetCiArrival(
Lf_Man_t *
p,
int iCi,
int Time )
156 Vec_IntWriteEntry( &
p->vCiArrivals, iCi, Time );
158static inline int Lf_ObjCiArrival(
Lf_Man_t *
p,
int iCi )
160 return Vec_IntEntry( &
p->vCiArrivals, iCi );
164 if ( Gia_ObjIsBuf(pDriver) )
166 if ( Gia_ObjIsAnd(pDriver) )
167 return Lf_ObjReadBest(
p, Gia_ObjId(
p->pGia, pDriver))->Delay[0];
168 if ( Gia_ObjIsCi(pDriver) )
169 return Lf_ObjCiArrival(
p, Gia_ObjCioId(pDriver));
172static inline int Lf_ObjCoArrival(
Lf_Man_t *
p,
int iCo )
175 Gia_Obj_t * pDriver = Gia_ObjFanin0(pObj);
185 if ( Gia_ObjIsBuf(pDriver) )
187 if ( Gia_ObjIsAnd(pDriver) )
189 Lf_Bst_t * pBest = Lf_ObjReadBest(
p, Gia_ObjId(
p->pGia, pDriver));
190 int Index = Lf_BestCutIndex( pBest );
191 assert( Index < 2 || Gia_ObjIsMux(
p->pGia, pDriver) );
192 return pBest->
Delay[Index];
194 if ( Gia_ObjIsCi(pDriver) )
195 return Lf_ObjCiArrival(
p, Gia_ObjCioId(pDriver));
198static inline int Lf_ObjCoArrival2(
Lf_Man_t *
p,
int iCo )
201 Gia_Obj_t * pDriver = Gia_ObjFanin0(pObj);
229 int i, nCutMax = 0, nCutCur = 0;
235 if ( Gia_ObjIsAnd(Gia_ObjFanin0(pObj)) )
236 Gia_ObjFanin0(pObj)->Value++;
237 if ( Gia_ObjIsAnd(Gia_ObjFanin1(pObj)) )
238 Gia_ObjFanin1(pObj)->Value++;
244 if ( nCutMax < nCutCur )
246 if ( Gia_ObjIsAnd(Gia_ObjFanin0(pObj)) && --Gia_ObjFanin0(pObj)->Value == 0 )
248 if ( Gia_ObjIsAnd(Gia_ObjFanin1(pObj)) && --Gia_ObjFanin1(pObj)->Value == 0 )
253 printf(
"Cutset is not 0\n" );
256 printf(
"CutMax = %d\n", nCutMax );
273 static unsigned s_Muxes[24] = {
274 (~0xAAAAAAAA & ~0xCCCCCCCC) | ( 0xAAAAAAAA & ~0xF0F0F0F0),
275 (~0xAAAAAAAA & ~0xCCCCCCCC) | ( 0xAAAAAAAA & 0xF0F0F0F0),
276 (~0xAAAAAAAA & 0xCCCCCCCC) | ( 0xAAAAAAAA & ~0xF0F0F0F0),
277 (~0xAAAAAAAA & 0xCCCCCCCC) | ( 0xAAAAAAAA & 0xF0F0F0F0),
278 ( 0xAAAAAAAA & ~0xCCCCCCCC) | (~0xAAAAAAAA & ~0xF0F0F0F0),
279 ( 0xAAAAAAAA & ~0xCCCCCCCC) | (~0xAAAAAAAA & 0xF0F0F0F0),
280 ( 0xAAAAAAAA & 0xCCCCCCCC) | (~0xAAAAAAAA & ~0xF0F0F0F0),
281 ( 0xAAAAAAAA & 0xCCCCCCCC) | (~0xAAAAAAAA & 0xF0F0F0F0),
283 (~0xCCCCCCCC & ~0xAAAAAAAA) | ( 0xCCCCCCCC & ~0xF0F0F0F0),
284 (~0xCCCCCCCC & ~0xAAAAAAAA) | ( 0xCCCCCCCC & 0xF0F0F0F0),
285 (~0xCCCCCCCC & 0xAAAAAAAA) | ( 0xCCCCCCCC & ~0xF0F0F0F0),
286 (~0xCCCCCCCC & 0xAAAAAAAA) | ( 0xCCCCCCCC & 0xF0F0F0F0),
287 ( 0xCCCCCCCC & ~0xAAAAAAAA) | (~0xCCCCCCCC & ~0xF0F0F0F0),
288 ( 0xCCCCCCCC & ~0xAAAAAAAA) | (~0xCCCCCCCC & 0xF0F0F0F0),
289 ( 0xCCCCCCCC & 0xAAAAAAAA) | (~0xCCCCCCCC & ~0xF0F0F0F0),
290 ( 0xCCCCCCCC & 0xAAAAAAAA) | (~0xCCCCCCCC & 0xF0F0F0F0),
292 (~0xF0F0F0F0 & ~0xCCCCCCCC) | ( 0xF0F0F0F0 & ~0xAAAAAAAA),
293 (~0xF0F0F0F0 & ~0xCCCCCCCC) | ( 0xF0F0F0F0 & 0xAAAAAAAA),
294 (~0xF0F0F0F0 & 0xCCCCCCCC) | ( 0xF0F0F0F0 & ~0xAAAAAAAA),
295 (~0xF0F0F0F0 & 0xCCCCCCCC) | ( 0xF0F0F0F0 & 0xAAAAAAAA),
296 ( 0xF0F0F0F0 & ~0xCCCCCCCC) | (~0xF0F0F0F0 & ~0xAAAAAAAA),
297 ( 0xF0F0F0F0 & ~0xCCCCCCCC) | (~0xF0F0F0F0 & 0xAAAAAAAA),
298 ( 0xF0F0F0F0 & 0xCCCCCCCC) | (~0xF0F0F0F0 & ~0xAAAAAAAA),
299 ( 0xF0F0F0F0 & 0xCCCCCCCC) | (~0xF0F0F0F0 & 0xAAAAAAAA)
302 for ( i = 0; i < 24; i++ )
303 if ( ((
unsigned)t) == s_Muxes[i] )
322 int i, Entry, nDrivers, nInverts;
323 Vec_Int_t * vMarks = Vec_IntStart( Gia_ManObjNum(
p) );
324 nDrivers = nInverts = 0;
326 *Vec_IntEntryP( vMarks, Gia_ObjFaninId0p(
p, pObj) ) |= Gia_ObjFaninC0(pObj) ? 2 : 1;
328 nDrivers += (int)(Entry != 0), nInverts += (int)(Entry == 3);
329 Vec_IntFree( vMarks );
330 *pnDrivers = nDrivers;
331 *pnInverts = nInverts;
337 assert( Vec_FltCap(vSwitches) == 0 );
338 *vSwitches = *vSwitching;
354static inline int Lf_CutCreateUnit(
Lf_Cut_t *
p,
int i )
361 p->Sign = ((
word)1) << (i & 0x3F);
368 int iOffSet = Vec_IntEntry( &
p->vOffsets, i );
369 int Entry = Vec_IntEntry( &
p->vCutSets, iOffSet );
370 assert( Gia_ObjIsAndNotBuf(pObj) );
374 if ( Vec_IntSize(&
p->vFreeSets) == 0 )
377 int uMaskShift = Vec_PtrSize(&
p->vMemSets) <<
LF_LOG_PAGE;
378 Vec_PtrPush( &
p->vMemSets, pCut );
379 for ( Entry = uMaskPage; Entry >= 0; Entry-- )
381 Vec_IntPush( &
p->vFreeSets, uMaskShift | Entry );
385 Entry = Vec_IntPop( &
p->vFreeSets );
386 Vec_IntWriteEntry( &
p->vCutSets, iOffSet, Entry );
387 p->nFrontMax = Abc_MaxInt(
p->nFrontMax, Entry + 1 );
389 else if ( --pObj->
Value == 0 )
391 Vec_IntPush( &
p->vFreeSets, Entry );
392 Vec_IntWriteEntry( &
p->vCutSets, iOffSet, -1 );
396static inline int Lf_ManPrepareSet(
Lf_Man_t *
p,
int iObj,
int Index,
Lf_Cut_t ** ppCutSet )
399 if ( Vec_IntEntry(&
p->vOffsets, iObj) == -1 )
400 return Lf_CutCreateUnit( (*ppCutSet = (
Lf_Cut_t *)CutTemp[Index]), iObj );
403 int i, nCutNum =
p->pPars->nCutNum;
404 *ppCutSet = Lf_ManFetchSet(
p, iObj);
425 word Sign = 0;
int i;
426 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
430static inline int Lf_CutCountBits(
word i )
432 i = i - ((i >> 1) & 0x5555555555555555);
433 i = (i & 0x3333333333333333) + ((i >> 2) & 0x3333333333333333);
434 i = ((i + (i >> 4)) & 0x0F0F0F0F0F0F0F0F);
435 return (i*(0x0101010101010101))>>56;
444 for ( i = 0; i < (int)pCut0->
nLeaves; i++ )
451 float Switches = 0;
int i;
452 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
453 Switches += Lf_ObjSwitches(
p, pCut->
pLeaves[i]);
459 int i, nDigits = Abc_Base10Log(Gia_ManObjNum(
p->pGia));
460 printf(
"%d {", pCut->
nLeaves );
461 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
462 printf(
" %*d", nDigits, pCut->
pLeaves[i] );
463 for ( ; i < (int)
p->pPars->nLutSize; i++ )
464 printf(
" %*s", nDigits,
" " );
465 printf(
" } Late = %d D = %4d A = %9.4f F = %6d\n",
472 if (
p->pPars->fPower )
473 return 1.0 * pCut->
nLeaves + Lf_CutSwitches(
p, pCut );
474 if (
p->pPars->fOptEdge )
475 return (pCut->
nLeaves +
p->pPars->nAreaTuner) * (1 + (
p->pPars->fCutGroup && (int)pCut->
nLeaves >
p->pPars->nLutSize/2));
476 return 1 + (
p->pPars->fCutGroup && (int)pCut->
nLeaves >
p->pPars->nLutSize/2);
483 assert( Gia_ObjIsMux(
p->pGia, pMux) );
484 if ( Gia_ObjIsCi(Gia_ObjFanin0(pMux)) || Gia_ObjIsCi(Gia_ObjFanin1(pMux)) )
486 Id = Gia_ObjFaninId0p(
p->pGia, pMux );
487 for ( i = 0; i < 3; i++ )
492 Id = Gia_ObjFaninId1p(
p->pGia, pMux );
493 for ( i = 0; i < 3; i++ )
498 Id = Gia_ObjFaninId2p(
p->pGia, pMux );
499 for ( i = 0; i < 3; i++ )
518static inline void Lf_MemAlloc(
Lf_Mem_t *
p,
int LogPage,
Vec_Ptr_t * vFree,
int nCutWords )
521 p->LogPage = LogPage;
522 p->MaskPage = (1 << LogPage) - 1;
523 p->nCutWords = nCutWords;
528 unsigned char * pPlace;
529 int i, iPlace, Prev = iObj, iCur =
p->iCur;
531 if ( Vec_PtrSize(&
p->vPages) == (
p->iCur >>
p->LogPage) )
532 Vec_PtrPush( &
p->vPages, Vec_PtrSize(
p->vFree) ? Vec_PtrPop(
p->vFree) :
ABC_ALLOC(
char,
p->MaskPage+1) );
534 iPlace = iCur &
p->MaskPage;
535 pPlace = (
unsigned char *)Vec_PtrEntry(&
p->vPages,
p->iCur >>
p->LogPage);
536 iPlace = Gia_AigerWriteUnsignedBuffer( pPlace, iPlace, pCut->
nLeaves );
537 for ( i = pCut->
nLeaves - 1; i >= 0; i-- )
538 iPlace = Gia_AigerWriteUnsignedBuffer( pPlace, iPlace, Prev - pCut->
pLeaves[i] ), Prev = pCut->
pLeaves[i];
540 if ( pCut->
iFunc >= 0 )
541 iPlace = Gia_AigerWriteUnsignedBuffer( pPlace, iPlace, pCut->
iFunc );
542 if (
p->MaskPage - (iPlace &
p->MaskPage) < 4 * (
LF_LEAF_MAX + 2) )
543 p->iCur = ((
p->iCur >>
p->LogPage) + 1) <<
p->LogPage;
545 p->iCur = (
p->iCur &
~p->MaskPage) | iPlace;
550 unsigned char * pPlace;
551 int i, Prev = iObj, Page = iCur >>
p->LogPage;
552 assert( Page < Vec_PtrSize(&
p->vPages) );
553 pPlace = (
unsigned char *)Vec_PtrEntry(&
p->vPages, Page) + (iCur &
p->MaskPage);
554 pCut->
nLeaves = Gia_AigerReadUnsigned(&pPlace);
556 for ( i = pCut->
nLeaves - 1; i >= 0; i-- )
557 pCut->
pLeaves[i] = Prev - Gia_AigerReadUnsigned(&pPlace), Prev = pCut->
pLeaves[i];
558 pCut->
iFunc = fTruth ? Gia_AigerReadUnsigned(&pPlace) : -1;
560 if ( fRecycle && Page && Vec_PtrEntry(&
p->vPages, Page-1) )
562 Vec_PtrPush(
p->vFree, Vec_PtrEntry(&
p->vPages, Page-1) );
563 Vec_PtrWriteEntry( &
p->vPages, Page-1, NULL );
565 pCut->
Sign = fRecycle ? Lf_CutGetSign(pCut) : 0;
569static inline void Lf_MemRecycle(
Lf_Mem_t *
p )
571 void * pPlace;
int i;
574 Vec_PtrPush(
p->vFree, pPlace );
575 Vec_PtrClear( &
p->vPages );
580 Gia_Obj_t * pMux = Gia_ManObj(
p->pGia, iObj );
581 assert( Gia_ObjIsMux(
p->pGia, pMux) );
582 pCut->
iFunc =
p->pPars->fCutMin ? 4 : -1;
583 pCut->
pLeaves[0] = Gia_ObjFaninId0( pMux, iObj );
584 pCut->
pLeaves[1] = Gia_ObjFaninId1( pMux, iObj );
585 pCut->
pLeaves[2] = Gia_ObjFaninId2(
p->pGia, iObj );
593 return Lf_MemLoadMuxCut(
p, i, (
Lf_Cut_t *)CutSet );
598 Lf_Bst_t * pBest = Lf_ObjReadBest(
p, i );
600 int Index = Lf_BestCutIndex( pBest );
604 return Lf_MemLoadMuxCut(
p, i, pCut );
605 return Lf_MemLoadCut( &
p->vStoreOld, pBest->
Cut[Index].
Handle, i, pCut,
p->pPars->fCutMin, 0 );
609 Lf_Bst_t * pBest = Lf_ObjReadBest(
p, i );
610 int Index = Lf_BestCutIndex( pBest );
614 return Lf_MemLoadMuxCut(
p, i, pCut );
615 return Lf_MemLoadCut( &
p->vStoreNew, pBest->
Cut[Index].
Handle, i, pCut, 0, 0 );
635 for ( i = 0; i < nSizeC; i++ )
637 for ( k = 0; k < nSizeB; k++ )
638 if ( pC[i] == pB[k] )
645static inline int Lf_SetCheckArray(
Lf_Cut_t ** ppCuts,
int nCuts )
648 int i, k, m, n, Value;
650 for ( i = 0; i < nCuts; i++ )
655 assert( pCut0->
Sign == Lf_CutGetSign(pCut0) );
657 for ( m = 0; m < (int)pCut0->
nLeaves; m++ )
658 for ( n = m + 1; n < (int)pCut0->
nLeaves; n++ )
661 for ( k = 0; k < nCuts; k++ )
664 if ( pCut0 == pCut1 )
667 Value = Lf_CutCheck( pCut0, pCut1 );
693 if ( nSize0 == nLutSize && nSize1 == nLutSize )
695 for ( i = 0; i < nSize0; i++ )
697 if ( pC0[i] != pC1[i] )
return 0;
707 if ( nSize0 == 0 )
goto FlushCut1;
708 if ( nSize1 == 0 )
goto FlushCut0;
711 if ( c == nLutSize )
return 0;
712 if ( pC0[i] < pC1[k] )
715 if ( i >= nSize0 )
goto FlushCut1;
717 else if ( pC0[i] > pC1[k] )
720 if ( k >= nSize1 )
goto FlushCut0;
724 pC[c++] = pC0[i++]; k++;
725 if ( i >= nSize0 )
goto FlushCut1;
726 if ( k >= nSize1 )
goto FlushCut0;
731 if ( c + nSize0 > nLutSize + i )
return 0;
741 if ( c + nSize1 > nLutSize + k )
return 0;
754 int xMin, c = 0, * pC = pCut->
pLeaves;
759 xMin = Abc_MinInt(x0, x1);
761 if ( c == nLutSize )
return 0;
763 if (x0 == xMin) i0++;
764 if (x1 == xMin) i1++;
777 int xMin, c = 0, * pC = pCut->
pLeaves;
783 xMin = Abc_MinInt( Abc_MinInt(x0, x1), x2 );
785 if ( c == nLutSize )
return 0;
787 if (x0 == xMin) i0++;
788 if (x1 == xMin) i1++;
789 if (x2 == xMin) i2++;
798static inline int Lf_SetCutIsContainedOrder(
Lf_Cut_t * pBase,
Lf_Cut_t * pCut )
800 int i, nSizeB = pBase->
nLeaves;
802 if ( nSizeB == nSizeC )
804 for ( i = 0; i < nSizeB; i++ )
809 assert( nSizeB > nSizeC );
812 for ( i = k = 0; i < nSizeB; i++ )
824static inline int Lf_SetLastCutIsContained(
Lf_Cut_t ** pCuts,
int nCuts )
827 for ( i = 0; i < nCuts; i++ )
828 if ( pCuts[i]->nLeaves <= pCuts[nCuts]->nLeaves && (pCuts[i]->Sign & pCuts[nCuts]->Sign) == pCuts[i]->Sign && Lf_SetCutIsContainedOrder(pCuts[nCuts], pCuts[i]) )
867static inline int Lf_SetLastCutContainsArea(
Lf_Cut_t ** pCuts,
int nCuts )
869 int i, k, fChanges = 0;
870 for ( i = 1; i < nCuts; i++ )
871 if ( pCuts[nCuts]->nLeaves < pCuts[i]->nLeaves && (pCuts[nCuts]->Sign & pCuts[i]->Sign) == pCuts[nCuts]->Sign && Lf_SetCutIsContainedOrder(pCuts[i], pCuts[nCuts]) )
875 for ( i = k = 1; i <= nCuts; i++ )
885static inline void Lf_SetSortByArea(
Lf_Cut_t ** pCuts,
int nCuts )
888 for ( i = nCuts; i > 1; i-- )
890 if ( Lf_CutCompareArea(pCuts[i - 1], pCuts[i]) < 0 )
895static inline int Lf_SetAddCut(
Lf_Cut_t ** pCuts,
int nCuts,
int nCutNum )
899 nCuts = Lf_SetLastCutContainsArea(pCuts, nCuts);
901 if ( Lf_CutCompareDelay(pCuts[0], pCuts[nCuts]) == 1 )
905 if ( pCuts[0]->nLeaves < pCuts[nCuts]->nLeaves && (pCuts[0]->Sign & pCuts[nCuts]->Sign) == pCuts[0]->Sign && Lf_SetCutIsContainedOrder(pCuts[nCuts], pCuts[0]) )
909 Lf_SetSortByArea( pCuts, nCuts );
911 return Abc_MinInt( nCuts + 1, nCutNum - 1 );
913static inline void Lf_SetSortBySize(
Lf_Cut_t ** pCutsR,
int nCutsR )
916 for ( i = 1; i < nCutsR-1; i++ )
919 for ( j = i+1; j < nCutsR; j++ )
920 if ( pCutsR[j]->nLeaves > pCutsR[best_i]->nLeaves )
937static inline int Lf_ManFindCofVar(
word * pTruth,
int nWords,
int nVars )
940 for ( iVar = 0; iVar < nVars; iVar++ )
942 Abc_TtCofactor0p( uTruthCof, pTruth,
nWords, iVar );
943 if ( Abc_TtSupportSize(uTruthCof, nVars) < 2 )
945 Abc_TtCofactor1p( uTruthCof, pTruth,
nWords, iVar );
946 if ( Abc_TtSupportSize(uTruthCof, nVars) < 2 )
967 int nOldSupp = pCutR->
nLeaves, truthId, fCompl;
word t;
968 word t0 = *Lf_CutTruth(
p, pCut0);
969 word t1 = *Lf_CutTruth(
p, pCut1);
970 if ( Abc_LitIsCompl(pCut0->
iFunc) ^ fCompl0 ) t0 = ~t0;
971 if ( Abc_LitIsCompl(pCut1->
iFunc) ^ fCompl1 ) t1 = ~t1;
974 t = fIsXor ? t0 ^ t1 : t0 & t1;
975 if ( (fCompl = (
int)(t & 1)) ) t = ~t;
977 assert( (
int)(t & 1) == 0 );
978 truthId = Vec_MemHashInsert(
p->vTtMem, &t);
979 pCutR->
iFunc = Abc_Var2Lit( truthId, fCompl );
983 return (
int)pCutR->
nLeaves < nOldSupp;
987 if (
p->pPars->nLutSize <= 6 )
988 return Lf_CutComputeTruth6(
p, pCut0, pCut1, fCompl0, fCompl1, pCutR, fIsXor );
991 int nOldSupp = pCutR->
nLeaves, truthId;
992 int LutSize =
p->pPars->nLutSize, fCompl;
993 int nWords = Abc_Truth6WordNum(LutSize);
994 word * pTruth0 = Lf_CutTruth(
p, pCut0);
995 word * pTruth1 = Lf_CutTruth(
p, pCut1);
996 Abc_TtCopy( uTruth0, pTruth0,
nWords, Abc_LitIsCompl(pCut0->
iFunc) ^ fCompl0 );
997 Abc_TtCopy( uTruth1, pTruth1,
nWords, Abc_LitIsCompl(pCut1->
iFunc) ^ fCompl1 );
1001 Abc_TtXor( uTruth, uTruth0, uTruth1,
nWords, (fCompl = (
int)((uTruth0[0] ^ uTruth1[0]) & 1)) );
1003 Abc_TtAnd( uTruth, uTruth0, uTruth1,
nWords, (fCompl = (
int)((uTruth0[0] & uTruth1[0]) & 1)) );
1005 assert( (uTruth[0] & 1) == 0 );
1007 truthId = Vec_MemHashInsert(
p->vTtMem, uTruth);
1008 pCutR->
iFunc = Abc_Var2Lit( truthId, fCompl );
1010 return (
int)pCutR->
nLeaves < nOldSupp;
1015 int nOldSupp = pCutR->
nLeaves, truthId, fCompl;
word t;
1016 word t0 = *Lf_CutTruth(
p, pCut0);
1017 word t1 = *Lf_CutTruth(
p, pCut1);
1018 word tC = *Lf_CutTruth(
p, pCutC);
1019 if ( Abc_LitIsCompl(pCut0->
iFunc) ^ fCompl0 ) t0 = ~t0;
1020 if ( Abc_LitIsCompl(pCut1->
iFunc) ^ fCompl1 ) t1 = ~t1;
1021 if ( Abc_LitIsCompl(pCutC->
iFunc) ^ fComplC ) tC = ~tC;
1025 t = (tC & t1) | (~tC & t0);
1026 if ( (fCompl = (
int)(t & 1)) ) t = ~t;
1028 assert( (
int)(t & 1) == 0 );
1029 truthId = Vec_MemHashInsert(
p->vTtMem, &t);
1030 pCutR->
iFunc = Abc_Var2Lit( truthId, fCompl );
1032 return (
int)pCutR->
nLeaves < nOldSupp;
1036 if (
p->pPars->nLutSize <= 6 )
1037 return Lf_CutComputeTruthMux6(
p, pCut0, pCut1, pCutC, fCompl0, fCompl1, fComplC, pCutR );
1040 int nOldSupp = pCutR->
nLeaves, truthId;
1041 int LutSize =
p->pPars->nLutSize, fCompl;
1042 int nWords = Abc_Truth6WordNum(LutSize);
1043 word * pTruth0 = Lf_CutTruth(
p, pCut0);
1044 word * pTruth1 = Lf_CutTruth(
p, pCut1);
1045 word * pTruthC = Lf_CutTruth(
p, pCutC);
1046 Abc_TtCopy( uTruth0, pTruth0,
nWords, Abc_LitIsCompl(pCut0->
iFunc) ^ fCompl0 );
1047 Abc_TtCopy( uTruth1, pTruth1,
nWords, Abc_LitIsCompl(pCut1->
iFunc) ^ fCompl1 );
1048 Abc_TtCopy( uTruthC, pTruthC,
nWords, Abc_LitIsCompl(pCutC->
iFunc) ^ fComplC );
1052 Abc_TtMux( uTruth, uTruthC, uTruth1, uTruth0,
nWords );
1053 fCompl = (int)(uTruth[0] & 1);
1054 if ( fCompl ) Abc_TtNot( uTruth,
nWords );
1056 assert( (uTruth[0] & 1) == 0 );
1057 truthId = Vec_MemHashInsert(
p->vTtMem, uTruth);
1058 pCutR->
iFunc = Abc_Var2Lit( truthId, fCompl );
1060 return (
int)pCutR->
nLeaves < nOldSupp;
1078 float Count = Lf_CutArea(
p, pCut);
1081 if ( !Lf_ObjMapRefInc(
p,
Var) )
1088 float Count = Lf_CutArea(
p, pCut);
1091 if ( !Lf_ObjMapRefDec(
p,
Var) )
1118 int i, Arr, Req, Arrival = 0, Required = 0;
1119 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
1121 if ( Lf_ObjOff(
p, pCut->
pLeaves[i]) < 0 )
1125 Arr = Lf_ObjReadBest(
p, pCut->
pLeaves[i])->Delay[0];
1126 Arrival = Abc_MaxInt( Arrival, Arr );
1127 Req = Lf_ObjRequired(
p, pCut->
pLeaves[i]);
1129 Required = Abc_MaxInt( Required, Req );
1131 return Abc_MaxInt( Required + 2, Arrival + 1 );
1136 int i, Index, Delay;
1142 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
1144 if ( Lf_ObjOff(
p, pCut->
pLeaves[i]) < 0 )
1149 pBest = Lf_ObjReadBest(
p, pCut->
pLeaves[i]);
1153 Index = Lf_BestIndex(pBest);
1158 if ( pCut->
Flow >= (
float)1e32 || pBest->
Flow[Index] >= (
float)1e32 )
1159 pCut->
Flow = (float)1e32;
1163 if ( pCut->
Flow > (
float)1e32 )
1164 pCut->
Flow = (float)1e32;
1167 Delay = pBest->
Delay[Index];
1171 pCut->
Delay = Abc_MaxInt( pCut->
Delay, Delay );
1174 if ( pCut->
Delay > Required )
1177 pCut->
Flow = Lf_CutAreaDerefed(
p, pCut) / FlowRefs;
1180 pCut->
Flow = (pCut->
Flow + Lf_CutArea(
p, pCut)) / FlowRefs;
1181 if ( pCut->
Flow > (
float)1e32 )
1182 pCut->
Flow = (float)1e32;
1189 Lf_Cut_t * pCutSet0, * pCutSet1, * pCutSet2, * pCut0, * pCut1, * pCut2;
1191 Gia_Obj_t * pObj = Gia_ManObj(
p->pGia, iObj);
1192 Lf_Bst_t * pBest = Lf_ObjReadBest(
p, iObj);
1193 float FlowRefs = Lf_ObjFlowRefs(
p, iObj);
1194 int Required = Lf_ObjRequired(
p, iObj);
1195 int nLutSize =
p->pPars->fCutGroup ?
p->pPars->nLutSize/2 :
p->pPars->nLutSize;
1196 int nCutNum =
p->pPars->nCutNum;
1197 int nCutWords =
p->nCutWords;
1198 int fComp0 = Gia_ObjFaninC0(pObj);
1199 int fComp1 = Gia_ObjFaninC1(pObj);
1200 int nCuts0 = Lf_ManPrepareSet(
p, Gia_ObjFaninId0(pObj, iObj), 0, &pCutSet0 );
1201 int nCuts1 = Lf_ManPrepareSet(
p, Gia_ObjFaninId1(pObj, iObj), 1, &pCutSet1 );
1202 int iSibl = Gia_ObjSibl(
p->pGia, iObj);
1203 int i, k, n, iCutUsed, nCutsR = 0;
1204 float Value1 = -1, Value2 = -1;
1205 assert( !Gia_ObjIsBuf(pObj) );
1212 Lf_MemLoadCut( &
p->vStoreOld, pBest->
Cut[0].
Handle, iObj, pCutsR[0],
p->pPars->fCutMin, 1 );
1213 if ( Lf_BestDiffCuts(pBest) )
1214 Lf_MemLoadCut( &
p->vStoreOld, pBest->
Cut[1].
Handle, iObj, pCutsR[1],
p->pPars->fCutMin, 1 );
1216 if (
p->fUseEla && Lf_ObjMapRefNum(
p, iObj) > 0 )
1220 Required = Lf_CutRequired(
p, pCutsR[0] );
1222 Lf_CutParams(
p, pCutsR[nCutsR++], Required, FlowRefs, pObj );
1223 if ( Lf_BestDiffCuts(pBest) )
1226 Lf_CutParams(
p, pCutsR[nCutsR], Required, FlowRefs, pObj );
1227 nCutsR = Lf_SetAddCut( pCutsR, nCutsR, nCutNum );
1229 if ( pCutsR[0]->fLate )
1234 Gia_Obj_t * pObjE = Gia_ObjSiblObj(
p->pGia, iObj);
1235 int fCompE = Gia_ObjPhase(pObj) ^ Gia_ObjPhase(pObjE);
1236 int nCutsE = Lf_ManPrepareSet(
p, iSibl, 2, &pCutSet2 );
1239 if ( pCut2->
pLeaves[0] == iSibl )
1241 Lf_CutCopy( pCutsR[nCutsR], pCut2, nCutWords );
1242 if ( pCutsR[nCutsR]->iFunc >= 0 )
1243 pCutsR[nCutsR]->
iFunc = Abc_LitNotCond( pCutsR[nCutsR]->iFunc, fCompE );
1244 Lf_CutParams(
p, pCutsR[nCutsR], Required, FlowRefs, pObj );
1245 nCutsR = Lf_SetAddCut( pCutsR, nCutsR, nCutNum );
1248 if ( Gia_ObjIsMuxId(
p->pGia, iObj) )
1251 int fComp2 = Gia_ObjFaninC2(
p->pGia, pObj);
1252 int nCuts2 = Lf_ManPrepareSet(
p, Gia_ObjFaninId2(
p->pGia, iObj), 2, &pCutSet2 );
1253 p->CutCount[0] += nCuts0 * nCuts1 * nCuts2;
1259 if ( Lf_CutCountBits(pCut0->
Sign | pCut1->
Sign | pCut2->
Sign) > nLutSize )
1262 if ( !Lf_CutMergeOrderMux(pCut0, pCut1, pCut2, pCutsR[nCutsR], nLutSize) )
1264 if ( Lf_SetLastCutIsContained(pCutsR, nCutsR) )
1267 if (
p->pPars->fCutMin && Lf_CutComputeTruthMux(
p, pCut0, pCut1, pCut2, fComp0, fComp1, fComp2, pCutsR[nCutsR]) )
1268 pCutsR[nCutsR]->
Sign = Lf_CutGetSign(pCutsR[nCutsR]);
1269 if (
p->pPars->nLutSizeMux &&
p->pPars->nLutSizeMux == (
int)pCutsR[nCutsR]->
nLeaves &&
1270 Lf_ManFindCofVar(Lf_CutTruth(
p,pCutsR[nCutsR]), Abc_Truth6WordNum(nLutSize), pCutsR[nCutsR]->nLeaves) == -1 )
1272 Lf_CutParams(
p, pCutsR[nCutsR], Required, FlowRefs, pObj );
1273 nCutsR = Lf_SetAddCut( pCutsR, nCutsR, nCutNum );
1275 if (
p->pPars->fCutGroup )
1278 assert( pCutSave->
pLeaves[0] == Gia_ObjFaninId2(
p->pGia, iObj) );
1286 if ( !Lf_CutMergeOrderMux(pCut0, pCut1, pCutSave, pCutsR[nCutsR],
p->pPars->nLutSize) )
1288 if ( Lf_SetLastCutIsContained(pCutsR, nCutsR) )
1291 if (
p->pPars->fCutMin && Lf_CutComputeTruthMux(
p, pCut0, pCut1, pCutSave, fComp0, fComp1, fComp2, pCutsR[nCutsR]) )
1292 pCutsR[nCutsR]->
Sign = Lf_CutGetSign(pCutsR[nCutsR]);
1296 Lf_CutParams(
p, pCutsR[nCutsR], Required, FlowRefs, pObj );
1297 nCutsR = Lf_SetAddCut( pCutsR, nCutsR, nCutNum );
1303 int fIsXor = Gia_ObjIsXor(pObj);
1304 p->CutCount[0] += nCuts0 * nCuts1;
1308 if ( (
int)(pCut0->
nLeaves + pCut1->
nLeaves) > nLutSize && Lf_CutCountBits(pCut0->
Sign | pCut1->
Sign) > nLutSize )
1311 if ( !Lf_CutMergeOrder(pCut0, pCut1, pCutsR[nCutsR], nLutSize) )
1313 if ( Lf_SetLastCutIsContained(pCutsR, nCutsR) )
1316 if (
p->pPars->fCutMin && Lf_CutComputeTruth(
p, pCut0, pCut1, fComp0, fComp1, pCutsR[nCutsR], fIsXor) )
1317 pCutsR[nCutsR]->
Sign = Lf_CutGetSign(pCutsR[nCutsR]);
1318 if (
p->pPars->nLutSizeMux &&
p->pPars->nLutSizeMux == (
int)pCutsR[nCutsR]->
nLeaves &&
1319 Lf_ManFindCofVar(Lf_CutTruth(
p,pCutsR[nCutsR]), Abc_Truth6WordNum(nLutSize), pCutsR[nCutsR]->nLeaves) == -1 )
1321 Lf_CutParams(
p, pCutsR[nCutsR], Required, FlowRefs, pObj );
1322 nCutsR = Lf_SetAddCut( pCutsR, nCutsR, nCutNum );
1328 printf(
"*** Obj = %d FlowRefs = %.2f MapRefs = %2d Required = %2d\n", iObj, FlowRefs, Lf_ObjMapRefNum(
p, iObj), Required );
1329 for ( i = 0; i < nCutsR; i++ )
1330 Lf_CutPrint(
p, pCutsR[i] );
1334 assert( nCutsR > 0 && nCutsR < nCutNum );
1337 assert( nCutsR == 1 || pCutsR[0]->Delay <= pCutsR[1]->Delay );
1339 pBest->
Cut[0].
Handle = pBest->
Cut[1].
Handle = Lf_MemSaveCut(&
p->vStoreNew, pCutsR[0], iObj);
1342 p->nCutCounts[pCutsR[0]->
nLeaves]++;
1343 p->CutCount[3] += nCutsR;
1347 if ( nCutsR > 1 && pCutsR[0]->Flow > pCutsR[1]->Flow +
LF_EPSILON )
1349 pBest->
Cut[1].
Handle = Lf_MemSaveCut(&
p->vStoreNew, pCutsR[1], iObj);
1352 p->nCutCounts[pCutsR[1]->
nLeaves]++;
1354 if ( !pCutsR[1]->fLate )
1358 if (
p->pPars->fUseMux7 && Gia_ObjIsMuxId(
p->pGia, iObj) )
1360 pCut2 = Lf_ObjCutMux(
p, iObj );
1361 Lf_CutParams(
p, pCut2, Required, FlowRefs, pObj );
1372 if ( Lf_ObjMapRefNum(
p, iObj) > 0 )
1380 if ( pObj->
Value == 0 )
1383 pCutSet = Lf_ManFetchSet(
p, iObj);
1388 Lf_CutCopy( pCut0, pCutsR[i], nCutWords );
1389 else if ( i == nCutsR && pCutsR[0]->nLeaves > 1 && (nCutsR == 1 || pCutsR[1]->nLeaves > 1) )
1390 Lf_CutCreateUnit( pCut0, iObj );
1409 if ( Gia_ObjIsAndNotBuf(Gia_ManObj(
p, i)) )
1410 Vec_FltAddToEntry( vRefs, Vec_IntEntry(vOffsets, i), 1 );
1415 Gia_Obj_t * pObj, * pCtrl, * pData0, * pData1;
1417 Vec_FltFill( vRefs, Gia_ManAndNotBufNum(
p), 0 );
1420 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin0(pObj)) )
1421 Vec_FltAddToEntry( vRefs, Vec_IntEntry(vOffsets, Gia_ObjFaninId0(pObj, i)), 1 );
1422 if ( Gia_ObjIsBuf(pObj) )
1424 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin1(pObj)) )
1425 Vec_FltAddToEntry( vRefs, Vec_IntEntry(vOffsets, Gia_ObjFaninId1(pObj, i)), 1 );
1428 if ( Gia_ObjIsMuxId(
p, i) && Gia_ObjIsAndNotBuf(Gia_ObjFanin2(
p, pObj)) )
1429 Vec_FltAddToEntry( vRefs, Vec_IntEntry(vOffsets, Gia_ObjFaninId2(
p, i)), 1 );
1434 pData0 = Gia_Regular(pData0);
1435 pData1 = Gia_Regular(pData1);
1436 if ( Gia_ObjIsAndNotBuf(pCtrl) )
1437 Vec_FltAddToEntry( vRefs, Vec_IntEntry(vOffsets, Gia_ObjId(
p, pCtrl)), -1 );
1438 if ( pData0 == pData1 && Gia_ObjIsAndNotBuf(pData0) )
1439 Vec_FltAddToEntry( vRefs, Vec_IntEntry(vOffsets, Gia_ObjId(
p, pData0)), -1 );
1443 if ( Gia_ObjIsAndNotBuf(Gia_ManObj(
p, Id)) )
1444 Vec_FltAddToEntry( vRefs, Vec_IntEntry(vOffsets, Id), 1 );
1445 for ( i = 0; i < Vec_FltSize(vRefs); i++ )
1446 Vec_FltUpdateEntry( vRefs, i, 1 );
1451 if ( Vec_PtrSize(&
p->vMemSets) * (1 <<
LF_LOG_PAGE) != Vec_IntSize(&
p->vFreeSets) )
1452 printf(
"The number of used cutsets = %d.\n", Vec_PtrSize(&
p->vMemSets) * (1 <<
LF_LOG_PAGE) - Vec_IntSize(&
p->vFreeSets) );
1456 if ( Gia_ObjIsBuf(pObj) )
1458 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin0(pObj)) )
1459 Gia_ObjFanin0(pObj)->Value++;
1460 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin1(pObj)) )
1461 Gia_ObjFanin1(pObj)->Value++;
1462 if ( Gia_ObjIsMuxId(
p->pGia, i) && Gia_ObjIsAndNotBuf(Gia_ObjFanin2(
p->pGia, pObj)) )
1463 Gia_ObjFanin2(
p->pGia, pObj)->Value++;
1464 if ( Gia_ObjSibl(
p->pGia, i) && Gia_ObjIsAndNotBuf(Gia_ObjSiblObj(
p->pGia, i)) )
1465 Gia_ObjSiblObj(
p->pGia, i)->Value++;
1469static inline int Lf_ManSetMuxCut(
Lf_Man_t *
p,
Lf_Bst_t * pBest,
int iObj,
int Required )
1472 if ( !Gia_ObjIsMuxId(
p->pGia, iObj) )
1474 if ( pBest->
Delay[2] > Required )
1476 if ( pBest->
Flow[2] > 1.1 * pBest->
Flow[1] )
1478 pMux = Gia_ManObj(
p->pGia, iObj);
1479 if ( pMux->
fMark0 || Gia_ObjFanin0(pMux)->fMark0 || Gia_ObjFanin1(pMux)->fMark0 )
1481 Gia_ObjFanin0(pMux)->fMark0 = 1;
1482 Gia_ObjFanin1(pMux)->fMark0 = 1;
1488 Lf_Bst_t * pBest = Lf_ObjReadBest(
p, iObj );
1489 int k, Index, Required = Lf_ObjRequired(
p, iObj );
1490 assert( Lf_ObjMapRefNum(
p, iObj) > 0 );
1492 if ( !
p->pPars->fUseMux7 || !Lf_ManSetMuxCut(
p, pBest, iObj, Required) )
1494 Index = (int)(Lf_BestDiffCuts(pBest) && pBest->
Delay[1] <= Required);
1497 pCut = Lf_ObjCutBest(
p, iObj );
1500 for ( k = 0; k < (int)pCut->
nLeaves; k++ )
1505 Lf_ObjSetRequired(
p, pCut->
pLeaves[k], Required - 1 );
1506 if ( Gia_ObjIsAndNotBuf(Gia_ManObj(
p->pGia, pCut->
pLeaves[k])) )
1507 Lf_ObjMapRefInc(
p, pCut->
pLeaves[k] );
1515 if ( Vec_FltSize(&
p->vSwitches) )
1516 p->Switches += Lf_CutSwitches(
p, pCut);
1522 float Coef = 1.0 / (1.0 + (
p->Iter + 1) * (
p->Iter + 1));
1528 for ( i = 0; i < Gia_ManCoNum(
p->pGia); i++ )
1529 Delay = Abc_MaxInt( Delay, Lf_ObjCoArrival(
p, i) );
1531 if (
p->pPars->DelayTarget == -1 &&
p->pPars->nRelaxRatio )
1532 p->pPars->DelayTarget = (int)((
float)Delay * (100.0 +
p->pPars->nRelaxRatio) / 100.0);
1533 if (
p->pPars->DelayTarget != -1 )
1535 if ( Delay < p->pPars->DelayTarget + 0.01 )
1536 Delay =
p->pPars->DelayTarget;
1537 else if (
p->pPars->nRelaxRatio == 0 )
1538 Abc_Print( 0,
"Relaxing user-specified delay target from %d to %d.\n",
p->pPars->DelayTarget, Delay );
1540 p->pPars->Delay = Delay;
1542 p->pPars->Mux7 =
p->pPars->Area =
p->pPars->Edge =
p->Switches = 0;
1543 Vec_IntFill( &
p->vMapRefs, Gia_ManAndNotBufNum(
p->pGia), 0 );
1544 Vec_IntFill( &
p->vRequired, Gia_ManObjNum(
p->pGia),
ABC_INFINITY );
1545 if (
p->pPars->fUseMux7 )
1551 if (
p->pGia->pManTime != NULL )
1553 assert( !Gia_ManBufNum(
p->pGia) );
1555 if (
p->pPars->fDoAverage )
1556 for ( i = 0; i < Gia_ManCoNum(
p->pGia); i++ )
1562 if ( Gia_ObjIsBuf(pObj) )
1563 Lf_ObjSetRequired(
p, Gia_ObjFaninId0(pObj, i), Lf_ObjRequired(
p, i) );
1564 else if ( Gia_ObjIsAnd(pObj) )
1566 if ( Lf_ObjMapRefNum(
p, i) )
1569 else if ( Gia_ObjIsCi(pObj) )
1571 else if ( Gia_ObjIsCo(pObj) )
1573 int iDriverId = Gia_ObjFaninId0(pObj, i);
1575 Lf_ObjSetRequired(
p, iDriverId, reqTime );
1576 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin0(pObj)) )
1577 Lf_ObjMapRefInc(
p, iDriverId );
1586 int iDriverId = Gia_ObjFaninId0p(
p->pGia, pObj);
1587 int reqTime =
p->pPars->fDoAverage ? (int)(Lf_ObjCoArrival(
p, i) * (100.0 +
p->pPars->nRelaxRatio) / 100.0) : Delay;
1588 Lf_ObjSetRequired(
p, iDriverId, reqTime );
1589 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin0(pObj)) )
1590 Lf_ObjMapRefInc(
p, iDriverId );
1594 if ( Gia_ObjIsBuf(pObj) )
1596 Lf_ObjSetRequired(
p, Gia_ObjFaninId0(pObj, i), Lf_ObjRequired(
p, i) );
1597 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin0(pObj)) )
1598 Lf_ObjMapRefInc(
p, Gia_ObjFaninId0(pObj, i) );
1600 else if ( Lf_ObjMapRefNum(
p, i) )
1604 if (
p->pPars->fUseMux7 )
1607 assert( Vec_IntSize(&
p->vMapRefs) == Gia_ManAndNotBufNum(
p->pGia) );
1608 assert( Vec_FltSize(&
p->vFlowRefs) == Gia_ManAndNotBufNum(
p->pGia) );
1609 pMapRefs = Vec_IntArray(&
p->vMapRefs);
1610 pFlowRefs = Vec_FltArray(&
p->vFlowRefs);
1611 for ( i = 0; i < Vec_IntSize(&
p->vMapRefs); i++ )
1612 pFlowRefs[i] = Coef * pFlowRefs[i] + (1.0 - Coef) * Abc_MaxFloat(1, pMapRefs[i]);
1614 return p->pPars->Area;
1619 Lf_Bst_t * pBest = Lf_ObjReadBest(
p, iObj );
1620 Lf_Cut_t * pCut = Lf_ObjCutBest(
p, iObj );
1621 int k ,Required = Lf_ObjRequired(
p, iObj );
1622 assert( Lf_ObjMapRefNum(
p, iObj) > 0 );
1623 assert( Lf_BestIsMapped(pBest) );
1626 for ( k = 0; k < (int)pCut->
nLeaves; k++ )
1627 Lf_ObjSetRequired(
p, pCut->
pLeaves[k], Required - 1 );
1628 if ( Vec_FltSize(&
p->vSwitches) )
1629 p->Switches += Lf_CutSwitches(
p, pCut);
1637 int i, Id, Delay = 0;
1638 for ( i = 0; i < Gia_ManCoNum(
p->pGia); i++ )
1639 Delay = Abc_MaxInt( Delay, Lf_ObjCoArrival2(
p, i) );
1641 if (
p->pPars->DelayTarget == -1 &&
p->pPars->nRelaxRatio )
1642 p->pPars->DelayTarget = (int)((
float)Delay * (100.0 +
p->pPars->nRelaxRatio) / 100.0);
1643 if (
p->pPars->DelayTarget != -1 )
1645 if ( Delay < p->pPars->DelayTarget + 0.01 )
1646 Delay =
p->pPars->DelayTarget;
1647 else if (
p->pPars->nRelaxRatio == 0 )
1648 Abc_Print( 0,
"Relaxing user-specified delay target from %d to %d.\n",
p->pPars->DelayTarget, Delay );
1650 p->pPars->Delay = Delay;
1652 p->pPars->Mux7 =
p->pPars->Area =
p->pPars->Edge =
p->Switches = 0;
1653 Vec_IntFill( &
p->vRequired, Gia_ManObjNum(
p->pGia),
ABC_INFINITY );
1654 if (
p->pPars->fUseMux7 )
1656 if (
p->pGia->pManTime != NULL )
1659 if (
p->pPars->fDoAverage )
1660 for ( i = 0; i < Gia_ManCoNum(
p->pGia); i++ )
1666 if ( Gia_ObjIsBuf(pObj) )
1667 Lf_ObjSetRequired(
p, Gia_ObjFaninId0(pObj, i), Lf_ObjRequired(
p, i) );
1668 else if ( Gia_ObjIsAnd(pObj) )
1670 if ( Lf_ObjMapRefNum(
p, i) )
1673 else if ( Gia_ObjIsCi(pObj) )
1675 else if ( Gia_ObjIsCo(pObj) )
1678 Lf_ObjSetRequired(
p, Gia_ObjFaninId0(pObj, i), reqTime );
1686 Lf_ObjSetRequired(
p, Id,
p->pPars->fDoAverage ? (
int)(Lf_ObjCoArrival(
p, i) * (100.0 +
p->pPars->nRelaxRatio) / 100.0) : Delay );
1688 if ( Gia_ObjIsBuf(pObj) )
1689 Lf_ObjSetRequired(
p, Gia_ObjFaninId0(pObj, i), Lf_ObjRequired(
p, i) );
1690 else if ( Lf_ObjMapRefNum(
p, i) )
1693 if (
p->pPars->fUseMux7 )
1714 assert( !
p->pPars->fCutMin &&
p->pGia->vMapping == NULL );
1715 vMapping = Vec_IntAlloc( Gia_ManObjNum(
p->pGia) + (
int)
p->pPars->Edge + (
int)
p->pPars->Area * 2 );
1716 Vec_IntFill( vMapping, Gia_ManObjNum(
p->pGia), 0 );
1719 if ( !Lf_ObjMapRefNum(
p, i) )
1721 assert( !Gia_ObjIsBuf(Gia_ManObj(
p->pGia,i)) );
1722 pCut = Lf_ObjCutBest(
p, i );
1724 Vec_IntWriteEntry( vMapping, i, Vec_IntSize(vMapping) );
1725 Vec_IntPush( vMapping, pCut->
nLeaves );
1726 for ( k = 0; k < (int)pCut->
nLeaves; k++ )
1727 Vec_IntPush( vMapping, pCut->
pLeaves[k] );
1728 Vec_IntPush( vMapping, i );
1730 assert( Vec_IntCap(vMapping) == 16 || Vec_IntSize(vMapping) == Vec_IntCap(vMapping) );
1731 p->pGia->vMapping = vMapping;
1746 pNew->
vMapping = Vec_IntAlloc( Gia_ManObjNum(pGia) + 2*Gia_ManXorNum(pGia) + 2*Gia_ManMuxNum(pGia) + (
int)
p->pPars->Edge + 2*(
int)
p->pPars->Area + 4*(
int)
p->pPars->Mux7 );
1747 Vec_IntFill( pNew->
vMapping, Gia_ManObjNum(pGia) + 2*Gia_ManXorNum(pGia) + 2*Gia_ManMuxNum(pGia), 0 );
1749 Gia_ManConst0(pGia)->Value = 0;
1752 if ( Gia_ObjIsCi(pObj) )
1753 { pObj->
Value = Gia_ManAppendCi( pNew );
continue; }
1754 if ( Gia_ObjIsCo(pObj) )
1755 { pObj->
Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
continue; }
1756 if ( Gia_ObjIsBuf(pObj) )
1757 { pObj->
Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
continue; }
1758 if ( Gia_ObjIsMuxId(pGia, i) )
1759 pObj->
Value = Gia_ManAppendMux( pNew, Gia_ObjFanin2Copy(pGia, pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin0Copy(pObj) );
1760 else if ( Gia_ObjIsXor(pObj) )
1761 pObj->
Value = Gia_ManAppendXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1763 pObj->
Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1764 if ( !Lf_ObjMapRefNum(
p, i) )
1766 pCut = Lf_ObjCutBest(
p, i );
1769 for ( k = 0; k < (int)pCut->
nLeaves; k++ )
1770 Vec_IntPush( pNew->
vMapping, Abc_Lit2Var(Gia_ManObj(pGia, pCut->
pLeaves[k])->Value) );
1781 if (
p->pPars->nLutSizeMux &&
p->pPars->nLutSizeMux == (
int)pCut->
nLeaves )
1785 int LutSize =
p->pPars->nLutSize;
1786 int nWords = Abc_Truth6WordNum(LutSize);
1787 int c, iVar = Lf_ManFindCofVar( pTruth,
nWords, pCut->
nLeaves );
1789 for ( c = 0; c < 2; c++ )
1791 for ( k = 0; k < (int)pCut->
nLeaves; k++ )
1794 Abc_TtCofactor1p( pTruthCof, pTruth,
nWords, iVar );
1796 Abc_TtCofactor0p( pTruthCof, pTruth,
nWords, iVar );
1797 nVarsNew = Abc_TtMinBase( pTruthCof, pVarsNew, pCut->
nLeaves, LutSize );
1800 Vec_IntClear( vLeaves );
1801 for ( k = 0; k < nVarsNew; k++ )
1802 Vec_IntPush( vLeaves, Vec_IntEntry(vCopies, pCut->
pLeaves[pVarsNew[k]]) );
1803 iLitCofs[c] =
Kit_TruthToGia( pNew, (
unsigned *)pTruthCof, nVarsNew, vCover, vLeaves, 0 );
1805 Vec_IntSetEntry( vMapping, Abc_Lit2Var(iLitCofs[c]), Vec_IntSize(vMapping2) );
1806 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves) );
1808 Vec_IntPush( vMapping2, Abc_Lit2Var(iTemp) );
1809 Vec_IntPush( vMapping2, Abc_Lit2Var(iLitCofs[c]) );
1812 pTruthCof[0] =
ABC_CONST(0xCACACACACACACACA);
1813 Vec_IntClear( vLeaves );
1814 Vec_IntPush( vLeaves, iLitCofs[0] );
1815 Vec_IntPush( vLeaves, iLitCofs[1] );
1816 Vec_IntPush( vLeaves, Vec_IntEntry(vCopies, pCut->
pLeaves[iVar]) );
1817 iLit =
Kit_TruthToGia( pNew, (
unsigned *)pTruthCof, Vec_IntSize(vLeaves), vCover, vLeaves, 0 );
1819 Vec_IntSetEntry( vMapping, Abc_Lit2Var(iLit), Vec_IntSize(vMapping2) );
1820 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves) );
1822 Vec_IntPush( vMapping2, Abc_Lit2Var(iTemp) );
1823 Vec_IntPush( vMapping2, -Abc_Lit2Var(iLit) );
1826 Vec_IntClear( vLeaves );
1830 Vec_IntPush( vLeaves, Abc_LitNotCond(Vec_IntEntry(vCopies, pCut->
pLeaves[0]), Gia_ObjFaninC0(pObj)) );
1831 Vec_IntPush( vLeaves, Abc_LitNotCond(Vec_IntEntry(vCopies, pCut->
pLeaves[1]), Gia_ObjFaninC1(pObj)) );
1832 Vec_IntPush( vLeaves, Abc_LitNotCond(Vec_IntEntry(vCopies, pCut->
pLeaves[2]), Gia_ObjFaninC2(
p->pGia,pObj)) );
1836 for ( k = 0; k < (int)pCut->
nLeaves; k++ )
1837 Vec_IntPush( vLeaves, Vec_IntEntry(vCopies, pCut->
pLeaves[k]) );
1839 pTruth = Lf_CutTruth(
p, pCut );
1840 iLit =
Kit_TruthToGia( pNew, (
unsigned *)pTruth, Vec_IntSize(vLeaves), vCover, vLeaves, 0 );
1842 Vec_IntSetEntry( vMapping, Abc_Lit2Var(iLit), Vec_IntSize(vMapping2) );
1843 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves) );
1845 Vec_IntPush( vMapping2, Abc_Lit2Var(iTemp) );
1846 Vec_IntPush( vMapping2, pCut->
fMux7 ? -Abc_Lit2Var(iLit) : Abc_Lit2Var(iLit) );
1853 Vec_Int_t * vCopies = Vec_IntStartFull( Gia_ManObjNum(
p->pGia) );
1854 Vec_Int_t * vMapping = Vec_IntStart( 2*Gia_ManObjNum(
p->pGia) + (
int)
p->pPars->Edge + 2*(
int)
p->pPars->Area + 4*(
int)
p->pPars->Mux7 );
1855 Vec_Int_t * vMapping2 = Vec_IntStart( (
int)
p->pPars->Edge + 2*(
int)
p->pPars->Area + 1000 );
1856 Vec_Int_t * vCover = Vec_IntAlloc( 1 << 16 );
1857 Vec_Int_t * vLeaves = Vec_IntAlloc( 16 );
1863 pNew->
pName = Abc_UtilStrsav(
p->pGia->pName );
1864 pNew->
pSpec = Abc_UtilStrsav(
p->pGia->pSpec );
1865 Vec_IntWriteEntry( vCopies, 0, 0 );
1868 if ( Gia_ObjIsCi(pObj) )
1870 Vec_IntWriteEntry( vCopies, i, Gia_ManAppendCi(pNew) );
1873 if ( Gia_ObjIsCo(pObj) )
1875 iLit = Vec_IntEntry( vCopies, Gia_ObjFaninId0p(
p->pGia, pObj) );
1876 iLit = Gia_ManAppendCo( pNew, Abc_LitNotCond(iLit, Gia_ObjFaninC0(pObj)) );
1879 if ( Gia_ObjIsBuf(pObj) )
1881 iLit = Vec_IntEntry( vCopies, Gia_ObjFaninId0p(
p->pGia, pObj) );
1882 iLit = Gia_ManAppendBuf( pNew, Abc_LitNotCond(iLit, Gia_ObjFaninC0(pObj)) );
1883 Vec_IntWriteEntry( vCopies, i, iLit );
1886 if ( !Lf_ObjMapRefNum(
p, i) )
1888 pCut = Lf_ObjCutBest(
p, i );
1893 Vec_IntWriteEntry( vCopies, i, pCut->
iFunc );
1899 iLit = Vec_IntEntry( vCopies, pCut->
pLeaves[0] );
1900 Vec_IntWriteEntry( vCopies, i, Abc_LitNotCond(iLit, Abc_LitIsCompl(pCut->
iFunc)) );
1903 iLit = Lf_ManDerivePart(
p, pNew, vMapping, vMapping2, vCopies, pCut, vLeaves, vCover, pObj );
1904 Vec_IntWriteEntry( vCopies, i, Abc_LitNotCond(iLit, Abc_LitIsCompl(pCut->
iFunc)) );
1906 Vec_IntFree( vCopies );
1907 Vec_IntFree( vCover );
1908 Vec_IntFree( vLeaves );
1910 if ( Vec_IntSize(vMapping) > Gia_ManObjNum(pNew) )
1911 Vec_IntShrink( vMapping, Gia_ManObjNum(pNew) );
1913 Vec_IntFillExtra( vMapping, Gia_ManObjNum(pNew), 0 );
1914 assert( Vec_IntSize(vMapping) == Gia_ManObjNum(pNew) );
1917 Vec_IntAddToEntry( vMapping, i, Gia_ManObjNum(pNew) );
1918 Vec_IntAppend( vMapping, vMapping2 );
1919 Vec_IntFree( vMapping2 );
1946 if ( Gia_ManHasChoices(pGia) )
1952 p->clkStart = Abc_Clock();
1956 p->nSetWords =
p->nCutWords * pPars->
nCutNum;
1957 p->vTtMem = pPars->
fCutMin ? Vec_MemAllocForTT( pPars->
nLutSize, 0 ) : NULL;
1959 Vec_MemAddMuxTT(
p->vTtMem, pPars->
nLutSize );
1961 Vec_IntGrow( &
p->vFreeSets, (1<<14) );
1962 Vec_PtrGrow( &
p->vFreePages, 256 );
1963 Lf_MemAlloc( &
p->vStoreOld, 16, &
p->vFreePages,
p->nCutWords );
1964 Lf_MemAlloc( &
p->vStoreNew, 16, &
p->vFreePages,
p->nCutWords );
1965 Vec_IntFill( &
p->vOffsets, Gia_ManObjNum(pGia), -1 );
1966 Vec_IntFill( &
p->vRequired, Gia_ManObjNum(pGia),
ABC_INFINITY );
1967 Vec_IntFill( &
p->vCutSets, Gia_ManAndNotBufNum(pGia), -1 );
1968 Vec_FltFill( &
p->vFlowRefs, Gia_ManAndNotBufNum(pGia), 0 );
1969 Vec_IntFill( &
p->vMapRefs, Gia_ManAndNotBufNum(pGia), 0 );
1970 Vec_IntFill( &
p->vCiArrivals, Gia_ManCiNum(pGia), 0 );
1972 if ( !Gia_ObjIsBuf(Gia_ManObj(pGia, i)) )
1973 Vec_IntWriteEntry( &
p->vOffsets, i, k++ );
1974 assert( k == Gia_ManAndNotBufNum(pGia) );
1977 for ( i = 0; i < Gia_ManPiNum(pGia); i++ )
1978 Vec_IntWriteEntry( &
p->vCiArrivals, i, pPars->
pTimesArr[i] );
1985 if (
p->pPars->fCutMin )
1986 Vec_MemHashFree(
p->vTtMem );
1987 if (
p->pPars->fCutMin )
1988 Vec_MemFree(
p->vTtMem );
1989 Vec_PtrFreeData( &
p->vMemSets );
1990 Vec_PtrFreeData( &
p->vFreePages );
1991 Vec_PtrFreeData( &
p->vStoreOld.vPages );
1992 Vec_PtrFreeData( &
p->vStoreNew.vPages );
2052 if ( !
p->pPars->fVerbose )
2054 printf(
"%s : ", pTitle );
2055 printf(
"Level =%6lu ", (
long)
p->pPars->Delay );
2056 printf(
"Area =%9lu ", (
long)
p->pPars->Area );
2057 printf(
"Edge =%9lu ", (
long)
p->pPars->Edge );
2058 printf(
"LUT =%9lu ", (
long)
p->pPars->Area+
p->nInverters );
2059 if ( Vec_FltSize(&
p->vSwitches) )
2060 printf(
"Swt =%8.1f ",
p->Switches );
2061 if (
p->pPars->fUseMux7 )
2062 printf(
"Mux7 =%7lu ", (
long)
p->pPars->Mux7 );
2063 Abc_PrintTime( 1,
"Time", Abc_Clock() -
p->clkStart );
2068 if ( !
p->pPars->fVerbose )
2070 printf(
"LutSize = %d ",
p->pPars->nLutSize );
2071 printf(
"CutNum = %d ",
p->pPars->nCutNum );
2072 printf(
"Iter = %d ",
p->pPars->nRounds +
p->pPars->nRoundsEla );
2073 if (
p->pPars->nRelaxRatio )
2074 printf(
"Ratio = %d ",
p->pPars->nRelaxRatio );
2075 printf(
"Edge = %d ",
p->pPars->fOptEdge );
2076 if (
p->pPars->DelayTarget != -1 )
2077 printf(
"Delay = %d ",
p->pPars->DelayTarget );
2078 printf(
"CutMin = %d ",
p->pPars->fCutMin );
2079 printf(
"Coarse = %d ",
p->pPars->fCoarsen );
2080 printf(
"Cut/Set = %d/%d Bytes", 8*
p->nCutWords, 8*
p->nSetWords );
2082 printf(
"Computing cuts...\r" );
2088 float MemMan = 1.0 *
sizeof(int) * (2 * Gia_ManObjNum(
p->pGia) + 3 * Gia_ManAndNotBufNum(
p->pGia)) / (1<<20);
2089 float MemCutsB = 1.0 * (
p->vStoreOld.MaskPage + 1) * (Vec_PtrSize(&
p->vFreePages) + Vec_PtrSize(&
p->vStoreOld.vPages)) / (1<<20) + 1.0 *
sizeof(
Lf_Bst_t) * Gia_ManAndNotBufNum(
p->pGia) / (1<<20);
2090 float MemCutsF = 1.0 *
sizeof(
word) *
p->nSetWords * (1<<
LF_LOG_PAGE) * Vec_PtrSize(&
p->vMemSets) / (1<<20);
2091 float MemTt =
p->vTtMem ? Vec_MemMemory(
p->vTtMem) / (1<<20) : 0;
2092 float MemMap = Vec_IntMemory(pNew->
vMapping) / (1<<20);
2093 if (
p->CutCount[0] == 0 )
2095 if ( !
p->pPars->fVerbose )
2097 int i, CountOver[2] = {0};
2098 int nLutSize =
p->pPars->fCutGroup ?
p->pPars->nLutSize/2 :
p->pPars->nLutSize;
2100 CountOver[Gia_ObjLutSize(pNew, i) > nLutSize]++;
2101 if (
p->pPars->fCutGroup )
2102 printf(
"Created %d regular %d-LUTs and %d dual %d-LUTs. The total of %d %d-LUTs.\n",
2103 CountOver[0], nLutSize, CountOver[1], nLutSize, CountOver[0] + 2*CountOver[1], nLutSize );
2106 printf(
"CutPair = %.0f ",
p->CutCount[0] );
2107 printf(
"Merge = %.0f (%.2f %%) ",
p->CutCount[1], 100.0*
p->CutCount[1]/
p->CutCount[0] );
2108 printf(
"Eval = %.0f (%.2f %%) ",
p->CutCount[2], 100.0*
p->CutCount[2]/
p->CutCount[0] );
2109 printf(
"Cut = %.0f (%.2f %%) ",
p->CutCount[3], 100.0*
p->CutCount[3]/
p->CutCount[0] );
2111 printf(
"Gia = %.2f MB ", MemGia );
2112 printf(
"Man = %.2f MB ", MemMan );
2113 printf(
"Best = %.2f MB ", MemCutsB );
2114 printf(
"Front = %.2f MB ", MemCutsF );
2115 printf(
"Map = %.2f MB ", MemMap );
2116 printf(
"TT = %.2f MB ", MemTt );
2117 printf(
"Total = %.2f MB", MemGia + MemMan + MemCutsB + MemCutsF + MemMap + MemTt );
2122 for ( i = 0; i <=
p->pPars->nLutSize; i++ )
2123 printf(
"%d:%d ", i,
p->nCutCounts[i] );
2124 printf(
"Equal = %d (%.0f %%) ",
p->nCutEqual, 100.0 *
p->nCutEqual /
p->Iter / Gia_ManAndNotBufNum(
p->pGia) );
2126 printf(
"TT = %d (%.2f %%) ", Vec_MemEntryNum(
p->vTtMem), 100.0 * Vec_MemEntryNum(
p->vTtMem) /
p->CutCount[2] );
2127 if (
p->pGia->pMuxes &&
p->nCutMux )
2128 printf(
"MuxTT = %d (%.0f %%) ",
p->nCutMux, 100.0 *
p->nCutMux /
p->Iter / Gia_ManMuxNum(
p->pGia) );
2131 printf(
"CoDrvs = %d (%.2f %%) ",
p->nCoDrivers, 100.0*
p->nCoDrivers/Gia_ManCoNum(
p->pGia) );
2132 printf(
"CoInvs = %d (%.2f %%) ",
p->nInverters, 100.0*
p->nInverters/Gia_ManCoNum(
p->pGia) );
2133 printf(
"Front = %d (%.2f %%) ",
p->nFrontMax, 100.0*
p->nFrontMax/Gia_ManAndNum(
p->pGia) );
2134 printf(
"TimeFails = %d ",
p->nTimeFails );
2135 Abc_PrintTime( 1,
"Time", Abc_Clock() -
p->clkStart );
2142 assert(
p->vStoreNew.iCur == 0 );
2144 if (
p->pGia->pManTime != NULL )
2146 assert( !Gia_ManBufNum(
p->pGia) );
2150 if ( Gia_ObjIsBuf(pObj) )
2152 if ( Gia_ObjIsAnd(pObj) )
2154 else if ( Gia_ObjIsCi(pObj) )
2157 Lf_ObjSetCiArrival(
p, Gia_ObjCioId(pObj), arrTime );
2159 else if ( Gia_ObjIsCo(pObj) )
2161 arrTime = Lf_ObjCoArrival(
p, Gia_ObjCioId(pObj) );
2171 if ( !Gia_ObjIsBuf(pObj) )
2174 Lf_MemRecycle( &
p->vStoreOld );
2184 int fUsePowerMode = 0;
2189 if ( Gia_ManHasChoices(pGia) || pPars->
nLutSizeMux )
2206 if ( fUsePowerMode && Vec_FltSize(&
p->vSwitches) )
2210 for (
p->Iter = 0;
p->Iter <
p->pPars->nRounds;
p->Iter++ )
2213 for ( ;
p->Iter <
p->pPars->nRounds + pPars->
nRoundsEla;
p->Iter++ )
2217 if ( fUsePowerMode && Vec_FltSize(&
p->vSwitches) )
2220 for ( ;
p->Iter <
p->pPars->nRounds + pPars->
nRoundsEla + 2;
p->Iter++ )
2225 Vec_MemDumpTruthTables(
p->vTtMem, Gia_ManName(
p->pGia), pPars->
nLutSize );
2324 pNew->
pName = Abc_UtilStrsav(
p->pName );
2325 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
#define ABC_SWAP(Type, a, b)
#define ABC_ALLOC(type, num)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_CALLOC(type, num)
#define ABC_CONST(number)
PARAMETERS ///.
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Gia_Man_t * Lf_ManPerformMappingInt(Gia_Man_t *pGia, Jf_Par_t *pPars)
int Lf_ManComputeCrossCut(Gia_Man_t *p)
struct Lf_Plc_t_ Lf_Plc_t
void Lf_ManFree(Lf_Man_t *p)
void Lf_ManPrintStats(Lf_Man_t *p, char *pTitle)
struct Lf_Cut_t_ Lf_Cut_t
void Lf_ManComputeSwitching(Gia_Man_t *p, Vec_Flt_t *vSwitches)
void Lf_ManCountMapRefsOne(Lf_Man_t *p, int iObj)
float Lf_CutDeref_rec(Lf_Man_t *p, Lf_Cut_t *pCut)
void Lf_ObjMergeOrder(Lf_Man_t *p, int iObj)
void Lf_ManSetFlowRefs(Gia_Man_t *p, Vec_Flt_t *vRefs, Vec_Int_t *vOffsets)
int Lf_ObjCoArrival2_rec(Lf_Man_t *p, Gia_Obj_t *pDriver)
void Lf_ManSetCutRefs(Lf_Man_t *p)
struct Lf_Mem_t_ Lf_Mem_t
Gia_Man_t * Lf_ManDeriveMapping(Lf_Man_t *p)
Gia_Man_t * Lf_ManPerformMapping(Gia_Man_t *p, Jf_Par_t *pPars)
Gia_Man_t * Gia_ManPerformLfMapping(Gia_Man_t *p, Jf_Par_t *pPars, int fNormalized)
void Lf_ManCountMapRefs(Lf_Man_t *p)
void Lf_ManSetMapRefsOne(Lf_Man_t *p, int iObj)
void Lf_ManComputeMapping(Lf_Man_t *p)
void Lf_ManSetDefaultPars(Jf_Par_t *pPars)
#define Lf_CutForEachVar(pCut, Var, i)
int Lf_ManSetMapRefs(Lf_Man_t *p)
#define Lf_CutSetForEachCut(nWords, pCutSet, pCut, i, nCuts)
int Kit_TruthToGia(Gia_Man_t *pMan, unsigned *pTruth, int nVars, Vec_Int_t *vMemory, Vec_Int_t *vLeaves, int fHash)
DECLARATIONS ///.
float Lf_CutRef_rec(Lf_Man_t *p, Lf_Cut_t *pCut)
Gia_Man_t * Lf_ManDeriveMappingGia(Lf_Man_t *p)
void Lf_ManPrintInit(Lf_Man_t *p)
int Lf_ManTtIsMux(word t)
Lf_Man_t * Lf_ManAlloc(Gia_Man_t *pGia, Jf_Par_t *pPars)
void Lf_ManAnalyzeCoDrivers(Gia_Man_t *p, int *pnDrivers, int *pnInverts)
Gia_Man_t * Lf_ManDeriveMappingCoarse(Lf_Man_t *p)
int Lf_ObjArrival_rec(Lf_Man_t *p, Gia_Obj_t *pDriver)
struct Lf_Bst_t_ Lf_Bst_t
#define LF_LEAF_MAX
DECLARATIONS ///.
void Lf_ManPrintQuit(Lf_Man_t *p, Gia_Man_t *pNew)
struct Lf_Man_t_ Lf_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)
Gia_Obj_t * Gia_ObjRecognizeMux(Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
int Gia_ManIsNormalized(Gia_Man_t *p)
#define Gia_ManForEachAnd(p, pObj, i)
#define Gia_ManForEachAndReverse(p, pObj, i)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
#define Gia_ManForEachCoDriverId(p, DriverId, i)
#define Gia_ManForEachObjReverse1(p, pObj, i)
#define Gia_ManForEachLut(p, i)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
struct Gia_Obj_t_ Gia_Obj_t
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachObj1(p, pObj, i)
void Gia_ManPrintMuxStats(Gia_Man_t *p)
void Gia_ManCleanValue(Gia_Man_t *p)
void Gia_ManCleanMark0(Gia_Man_t *p)
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
void Gia_ManMappingVerify(Gia_Man_t *p)
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p, int fHashMapping)
struct Jf_Par_t_ Jf_Par_t
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
#define Gia_ManForEachCo(p, pObj, i)
#define Gia_ManForEachCi(p, pObj, i)
void Gia_ManSetPhase(Gia_Man_t *p)
Vec_Int_t * Gia_ManComputeSwitchProbs(Gia_Man_t *pGia, int nFrames, int nPref, int fProbOne)
Gia_Man_t * Gia_ManDupUnnormalize(Gia_Man_t *p)
void Gia_ManTransferMapping(Gia_Man_t *p, Gia_Man_t *pGia)
#define Gia_ManForEachAndId(p, i)
unsigned __int64 word
DECLARATIONS ///.
int nCutCounts[LF_LEAF_MAX+1]
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
int Tim_ManBoxNum(Tim_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
float * Tim_ManGetArrTimes(Tim_Man_t *p)
void Tim_ManStop(Tim_Man_t *p)
void Tim_ManSetCiRequired(Tim_Man_t *p, int iCi, float Delay)
float * Tim_ManGetReqTimes(Tim_Man_t *p)
void Tim_ManInitPoRequiredAll(Tim_Man_t *p, float Delay)
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
void Tim_ManSetCoRequired(Tim_Man_t *p, int iCo, float Delay)
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
float Tim_ManGetCoRequired(Tim_Man_t *p, int iCo)
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_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.