41 #define NF_INFINITY FLT_MAX
146 static inline int Nf_CutFunc(
int * pCut ) {
return ((
unsigned)pCut[0] >> 5); }
150 static inline int Nf_CutHandle(
int * pCutSet,
int * pCut ) {
assert( pCut > pCutSet );
return pCut - pCutSet; }
152 static inline int Nf_CutConfLit(
int Conf,
int i ) {
return 15 & (Conf >> (i << 2)); }
156 #define Nf_SetForEachCut( pList, pCut, i ) for ( i = 0, pCut = pList + 1; i < pList[0]; i++, pCut += Nf_CutSize(pCut) + 1 )
157 #define Nf_ObjForEachCut( pCuts, i, nCuts ) for ( i = 0, i < nCuts; i++ )
158 #define Nf_CutForEachLit( pCut, Conf, iLit, i ) for ( i = 0; i < Nf_CutSize(pCut) && (iLit = Abc_Lit2LitV(Nf_CutLeaves(pCut), Nf_CutConfLit(Conf, i))); i++ )
159 #define Nf_CutForEachVar( pCut, Conf, iVar, c, i ) for ( i = 0; i < Nf_CutSize(pCut) && (iVar = Nf_CutLeaves(pCut)[Nf_CutConfVar(Conf, i)]) && ((c = Nf_CutConfC(Conf, i)), 1); i++ )
192 for ( i = 0; i < nSize-1; i++ )
195 for ( j = i+1; j < nSize; j++ )
199 ABC_SWAP(
int, pArray[i], pArray[best_i] );
205 for ( i = 0; i < nSize-1; i++ )
208 for ( j = i+1; j < nSize; j++ )
214 ABC_SWAP(
int, pArray[i], pArray[best_i] );
220 int i, fCompl = (int)(uTruth & 1);
221 word uFunc = fCompl ? ~uTruth : uTruth;
226 Vec_IntPush( vArray, (CellId << 8) | (Type << 4) | fCompl );
230 for ( i = 0; i < nFans; i++ )
251 if ( **p >=
'a' && **p <
'a' + NF_LEAF_MAX )
256 char * q = pStr + pMatches[ *p - pStr ];
258 assert( **p ==
'(' && *q ==
')' );
259 for ( (*p)++; *p < q; (*p)++ )
264 pFans[nFans++] = Value;
269 memcpy( pGroups[*pnGroups], pFans,
sizeof(
int) * nFans );
270 nGroupSizes[*pnGroups] = nFans;
283 int nGroups = 0, nVars = 0, nConfigs = 1;
284 int i, k, c, Res, fCompl = 0;
295 for ( i = 0; i < nGroups; i++ )
297 nVars += nGroupSizes[i];
298 nConfigs *= (1 << nGroupSizes[i]);
302 for ( c = 0; c < nConfigs; c++ )
305 for ( i = nGroups - 1; i >= 0; i-- )
307 Phases[i] = Start % (1 << nGroupSizes[i]);
308 Start /= (1 << nGroupSizes[i]);
309 memcpy( pGroups2[i], pGroups[i],
sizeof(
int) * nGroupSizes[i] );
316 for ( i = 0; i < nGroups; i++ )
319 for ( k = 0; k < nGroupSizes[i]; k++ )
320 if ( (Phases[i] >> k) & 1 )
348 for ( i = 0; i < nGroups; i++ )
349 for ( k = 0; k < nGroupSizes[i]; k++ )
353 for ( k = 0; k < nGroupSizes[i]; k++ )
368 char * q = pStr + pMatches[ *p - pStr ];
369 assert( **p ==
'(' && *q ==
')' );
370 for ( (*p)++; *p < q; (*p)++ )
389 int Value, fCompl = 0;
396 char * q = pStr + pMatches[ *p - pStr ];
397 assert( **p ==
'[' && *q ==
']' );
398 for ( (*p)++; *p < q; (*p)++ )
433 int nPerms = pnPerms[pCell->
nFanins];
434 int nMints = (1 << pCell->
nFanins);
435 word tCur, tTemp1, tTemp2;
437 for ( i = 0; i < (int)pCell->
nFanins; i++ )
439 tCur = tTemp1 = pCell->
uTruth;
440 for ( p = 0; p < nPerms; p++ )
443 for ( c = 0; c < nMints; c++ )
448 Perm1 = Perm + pComp[pCell->
nFanins][c];
454 Perm1 = Perm + pPerm[pCell->
nFanins][
p];
494 for ( i = 2; i <= 6; i++ )
496 for ( i = 2; i <= 6; i++ )
498 for ( i = 2; i <= 6; i++ )
501 for ( i = 4; i < p->
nCells; i++ )
503 for ( i = 2; i <= 6; i++ )
505 for ( i = 2; i <= 6; i++ )
513 printf(
"%6d : ", Count++ );
514 printf(
"%6d : ", t );
515 printf(
"%6d : ", i/2 );
516 printf(
"Gate %16s ", pC->
pName );
517 printf(
"Inputs = %d ", pC->
nFanins );
520 else if ( Type ==
NF_XOR )
531 for ( k = 0; k < (int)pC->
nFanins; k++ )
535 printf(
"%c",
'a' + iFanin - fComplF * (
'a' -
'A') );
540 int g, nGroups = (int)*pInfo++;
541 for ( g = 0; g < nGroups; g++ )
543 int nSizeAll = (int)*pInfo++;
544 int nSizeNeg = (int)*pInfo++;
546 for ( k = 0; k < nSizeAll; k++ )
550 printf(
"%c",
'a' + iFanin - fComplF * (
'a' -
'A') );
553 pInfo += nSizeAll; nSizeNeg = 0;
562 int t, i, Info, Offset, Count = 0, CountMux = 0;
569 int Type = (Info >> 4) & 15;
570 int fCompl = (Info & 1);
586 printf(
"Gates = %d. Truths = %d. Matches = %d. MatchesPrime = %d. Size = %d.\n",
707 int nOldSupp = pCutR->
nLeaves, truthId, fCompl;
word t;
714 t = fIsXor ? t0 ^ t1 : t0 & t1;
715 if ( (fCompl = (
int)(t & 1)) ) t = ~t;
717 assert( (
int)(t & 1) == 0 );
722 return (
int)pCutR->
nLeaves < nOldSupp;
726 int nOldSupp = pCutR->
nLeaves, truthId, fCompl;
word t;
736 t = (tC & t1) | (~tC & t0);
737 if ( (fCompl = (
int)(t & 1)) ) t = ~t;
739 assert( (
int)(t & 1) == 0 );
744 return (
int)pCutR->
nLeaves < nOldSupp;
761 i = i - ((i >> 1) & 0x5555555555555555);
762 i = (i & 0x3333333333333333) + ((i >> 2) & 0x3333333333333333);
763 i = ((i + (i >> 4)) & 0x0F0F0F0F0F0F0F0F);
764 return (i*(0x0101010101010101))>>56;
768 word Sign = 0;
int i;
769 for ( i = 0; i < nLeaves; i++ )
770 Sign |= ((
word)1) << (pLeaves[i] & 0x3F);
786 printf(
"%d {", pCut->
nLeaves );
787 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
788 printf(
" %*d", nDigits, pCut->
pLeaves[i] );
790 printf(
" %*s", nDigits,
" " );
791 printf(
" } Useless = %d. D = %4d A = %9.4f F = %6d ",
814 if ( fAddUnit && pCuts->
nLeaves > 1 )
822 int i, * pPlace, iCur, nInts = 1, nCutsNew = 0;
823 for ( i = 0; i < nCuts; i++ )
824 if ( !fUseful || !pCuts[i]->Useless )
825 nInts += pCuts[i]->
nLeaves + 1, nCutsNew++;
826 if ( (p->
iCur & 0xFFFF) + nInts > 0xFFFF )
827 p->
iCur = ((p->
iCur >> 16) + 1) << 16;
832 *pPlace++ = nCutsNew;
833 for ( i = 0; i < nCuts; i++ )
834 if ( !fUseful || !pCuts[i]->Useless )
836 *pPlace++ =
Nf_CutSetBoth( pCuts[i]->nLeaves, pCuts[i]->iFunc );
837 memcpy( pPlace, pCuts[i]->pLeaves,
sizeof(
int) * pCuts[i]->nLeaves );
845 for ( i = 0; i < nCuts; i++ )
846 Count += !pCuts[i]->Useless;
852 for ( i = 0; i < nCuts; i++ )
853 if ( !pCuts[i]->Useless )
875 for ( i = 0; i < nSizeC; i++ )
877 for ( k = 0; k < nSizeB; k++ )
878 if ( pC[i] == pB[k] )
888 int i, k, m, n, Value;
890 for ( i = 0; i < nCuts; i++ )
896 for ( m = 0; m < (int)pCut0->
nLeaves; m++ )
897 for ( n = m + 1; n < (int)pCut0->
nLeaves; n++ )
900 for ( k = 0; k < nCuts; k++ )
903 if ( pCut0 == pCut1 )
933 if ( nSize0 == nLutSize && nSize1 == nLutSize )
935 for ( i = 0; i < nSize0; i++ )
937 if ( pC0[i] != pC1[i] )
return 0;
947 if ( nSize0 == 0 )
goto FlushCut1;
948 if ( nSize1 == 0 )
goto FlushCut0;
951 if ( c == nLutSize )
return 0;
952 if ( pC0[i] < pC1[k] )
955 if ( i >= nSize0 )
goto FlushCut1;
957 else if ( pC0[i] > pC1[k] )
960 if ( k >= nSize1 )
goto FlushCut0;
964 pC[c++] = pC0[i++]; k++;
965 if ( i >= nSize0 )
goto FlushCut1;
966 if ( k >= nSize1 )
goto FlushCut0;
971 if ( c + nSize0 > nLutSize + i )
return 0;
980 if ( c + nSize1 > nLutSize + k )
return 0;
993 int xMin, c = 0, * pC = pCut->
pLeaves;
1001 if ( c == nLutSize )
return 0;
1003 if (x0 == xMin) i0++;
1004 if (x1 == xMin) i1++;
1005 if (x2 == xMin) i2++;
1014 int i, nSizeB = pBase->
nLeaves;
1015 int k, nSizeC = pCut->
nLeaves;
1016 if ( nSizeB == nSizeC )
1018 for ( i = 0; i < nSizeB; i++ )
1023 assert( nSizeB > nSizeC );
1026 for ( i = k = 0; i < nSizeB; i++ )
1032 if ( ++k == nSizeC )
1041 for ( i = 0; i < nCuts; i++ )
1042 if ( pCuts[i]->nLeaves <= pCuts[nCuts]->nLeaves && (pCuts[i]->Sign & pCuts[nCuts]->Sign) == pCuts[i]->Sign &&
Nf_SetCutIsContainedOrder(pCuts[nCuts], pCuts[i]) )
1048 int i, k, fChanges = 0;
1049 for ( i = 0; i < nCuts; i++ )
1050 if ( pCuts[nCuts]->nLeaves < pCuts[i]->nLeaves && (pCuts[nCuts]->Sign & pCuts[i]->Sign) == pCuts[nCuts]->Sign &&
Nf_SetCutIsContainedOrder(pCuts[i], pCuts[nCuts]) )
1054 for ( i = k = 0; i <= nCuts; i++ )
1068 if ( pCut0->
Flow < pCut1->
Flow )
return -1;
1069 if ( pCut0->
Flow > pCut1->
Flow )
return 1;
1070 if ( pCut0->
Delay < pCut1->
Delay )
return -1;
1079 for ( i = nCuts; i > 0; i-- )
1102 int i, nLeaves = pCut->
nLeaves;
1103 assert( nLeaves <= p->pPars->nLutSize );
1106 for ( i = 0; i < nLeaves; i++ )
1111 pCut->
Delay += (int)(nLeaves > 1);
1127 Nf_Cut_t * pCut0, * pCut1, * pCut0Lim = pCuts0 + nCuts0, * pCut1Lim = pCuts1 + nCuts1;
1128 int i, nCutsUse, nCutsR = 0;
1130 for ( i = 0; i < nCutNum; i++ )
1131 pCutsR[i] = pCuts + i;
1138 Nf_Cut_t * pCut2, * pCut2Lim = pCuts2 + nCuts2;
1139 for ( pCut2 = pCuts2; pCut2 < pCut2Lim; pCut2++ )
1141 *pCutsR[nCutsR] = *pCut2;
1152 Nf_Cut_t * pCut2, * pCut2Lim = pCuts2 + nCuts2;
1153 p->
CutCount[0] += nCuts0 * nCuts1 * nCuts2;
1154 for ( pCut0 = pCuts0; pCut0 < pCut0Lim; pCut0++ )
1155 for ( pCut1 = pCuts1; pCut1 < pCut1Lim; pCut1++ )
1156 for ( pCut2 = pCuts2; pCut2 < pCut2Lim; pCut2++ )
1167 pCutsR[nCutsR]->
Sign =
Nf_CutGetSign(pCutsR[nCutsR]->pLeaves, pCutsR[nCutsR]->nLeaves);
1176 for ( pCut0 = pCuts0; pCut0 < pCut0Lim; pCut0++ )
1177 for ( pCut1 = pCuts1; pCut1 < pCut1Lim; pCut1++ )
1188 pCutsR[nCutsR]->
Sign =
Nf_CutGetSign(pCutsR[nCutsR]->pLeaves, pCutsR[nCutsR]->nLeaves);
1198 printf(
"*** Obj = %d Useful = %d\n", iObj,
Nf_ManCountUseful(pCutsR, nCutsR) );
1199 for ( i = 0; i < nCutsR; i++ )
1204 assert( nCutsR > 0 && nCutsR < nCutNum );
1248 printf(
"%s : ", pTitle );
1251 printf(
"Gate =%6d ", (
int)p->
pPars->
Area );
1252 printf(
"Inv =%6d ", (
int)p->
nInvs );
1253 printf(
"Edge =%7d ", (
int)p->
pPars->
Edge );
1266 printf(
"Cells = %d ", p->
nCells );
1271 printf(
"Choices = %d ", nChoices );
1273 printf(
"Computing cuts...\r" );
1280 float MemCuts = 1.0 *
sizeof(int) * (1 << 16) *
Vec_PtrSize(&p->
vPages) / (1<<20);
1286 printf(
"CutPair = %.0f ", p->
CutCount[0] );
1294 printf(
"Gia = %.2f MB ", MemGia );
1295 printf(
"Man = %.2f MB ", MemMan );
1296 printf(
"Cut = %.2f MB ", MemCuts );
1297 printf(
"TT = %.2f MB ", MemTt );
1298 printf(
"Total = %.2f MB ", MemGia + MemMan + MemCuts + MemTt );
1318 int k, iVar, fCompl, * pCut;
1340 int k, iVar, fCompl, * pCut;
1366 float Area;
int iLit, k;
1392 printf(
"%5d %d : ", iObj, fCompl );
1393 if ( pM->
CutH == 0 )
1395 printf(
"Unassigned\n" );
1400 printf(
"D = %8.2f ", pM->
D );
1401 printf(
"A = %8.2f ", pM->
A );
1402 printf(
"C = %d ", pM->
fCompl );
1405 printf(
"Cut = {" );
1406 for ( i = 0; i < (int)pCell->
nFanins; i++ )
1408 for ( ; i < 6; i++ )
1411 printf(
"%12s ", pCell->
pName );
1412 printf(
"%d ", pCell->
nFanins );
1414 for ( i = 0; i < (int)pCell->
nFanins; i++ )
1415 printf(
"%7.2f ", pCell->
Delays[i] );
1416 for ( ; i < 6; i++ )
1419 for ( i = 0; i < (int)pCell->
nFanins; i++ )
1421 for ( ; i < 6; i++ )
1434 int i, k, c, Info, Offset, iFanin, fComplF;
1435 float ArrivalD, ArrivalA;
1439 for ( i = 0; i < nFans; i++ )
1444 int Const = (iFuncLit == 1);
1445 assert( iFuncLit == 0 || iFuncLit == 1 );
1446 for ( c = 0; c < 2; c++ )
1460 int Const = (iFuncLit == 3);
1461 assert( iFuncLit == 2 || iFuncLit == 3 );
1462 for ( c = 0; c < 2; c++ )
1466 pD->
D = pA->
D = pBestF[0]->
M[c ^ !Const][0].
D + p->
pCells[2 + (c ^ Const)].Delays[0];
1467 pD->
A = pA->
A = pBestF[0]->
M[c ^ !Const][0].
A + p->
pCells[2 + (c ^ Const)].Area;
1469 pD->
Gate = pA->
Gate = 2 + (c ^ Const);
1478 int Type = (Info >> 4) & 15;
1479 int fCompl = (Info & 1) ^ fComplExt;
1489 float Area = pC->
Area, Delay = 0;
1490 for ( k = 0; k < nFans; k++ )
1494 ArrivalD = pBestF[k]->
M[fComplF][0].
D;
1495 ArrivalA = pBestF[k]->
M[fComplF][1].
D;
1496 if ( ArrivalA + pC->
Delays[iFanin] < Required + Epsilon && Required !=
NF_INFINITY )
1499 Area += pBestF[k]->
M[fComplF][1].
A;
1507 Area += pBestF[k]->
M[fComplF][0].
A;
1521 for ( k = 0; k < nFans; k++ )
1527 if ( pD->
D > Delay )
1534 for ( k = 0; k < nFans; k++ )
1545 for ( k = 0; k < nFans; k++ )
1550 else if ( Type ==
NF_XOR )
1552 int m, nMints = 1 << nFans;
1553 for ( m = 0; m < nMints; m++ )
1555 int fComplAll = fCompl;
1557 float Area = pC->
Area, Delay = 0;
1558 for ( k = 0; k < nFans; k++ )
1562 fComplF = ((m >> k) & 1);
1563 ArrivalD = pBestF[k]->
M[fComplF][0].
D;
1564 ArrivalA = pBestF[k]->
M[fComplF][1].
D;
1568 Area += pBestF[k]->
M[fComplF][1].
A;
1572 assert( ArrivalD + pC->
Delays[iFanin] < Required + Epsilon );
1574 Area += pBestF[k]->
M[fComplF][0].
A;
1576 fComplAll ^= fComplF;
1578 pD = &pBest->
M[fComplAll][0];
1579 pA = &pBest->
M[fComplAll][1];
1580 if ( pD->
D > Delay )
1587 for ( k = 0; k < nFans; k++ )
1598 for ( k = 0; k < nFans; k++ )
1606 float Area = pC->
Area, Delay = 0;
1607 int g, Conf = 0, nGroups = (int)*pInfo++;
1608 for ( g = 0; g < nGroups; g++ )
1610 int nSizeAll = (int)*pInfo++;
1611 int nSizeNeg = (int)*pInfo++;
1612 float ArrivalD, ArrivalA;
1613 for ( k = 0; k < nSizeAll; k++ )
1617 ArrivalD = pBestF[k]->
M[fComplF][0].
D;
1618 ArrivalA = pBestF[k]->
M[fComplF][1].
D;
1619 if ( ArrivalA + pC->
Delays[iFanin] < Required + Epsilon && Required !=
NF_INFINITY )
1622 Area += pBestF[k]->
M[fComplF][1].
A;
1626 assert( ArrivalD + pC->
Delays[iFanin] < Required + Epsilon );
1628 Area += pBestF[k]->
M[fComplF][0].
A;
1633 pInfo += nSizeAll; nSizeNeg = 0;
1636 if ( pD->
D > Delay )
1689 pDp->
D = pAp->
D = pDf->
D;
1690 pDp->
A = pAp->
A = pDf->
A;
1704 float Arrival = 0, Required = 0;
1705 for ( i = 0; i < nFans; i++ )
1722 for ( c = 0; c < 2; c++ )
1736 int i, Index, * pCut, * pCutSet =
Nf_ObjCutSet( p, iObj );
1737 float ValueBeg[2] = {0}, ValueEnd[2] = {0}, Required[2] = {0};
1783 if ( pDp->
D > pDn->
D + p->
InvDelay + Epsilon )
1793 else if ( pDn->
D > pDp->
D + p->
InvDelay + Epsilon )
1830 printf(
"Object %d has pDp unassigned.\n", iObj );
1832 printf(
"Object %d has pDn unassigned.\n", iObj );
1834 printf(
"Object %d has pAp unassigned.\n", iObj );
1836 printf(
"Object %d has pAn unassigned.\n", iObj );
1861 pBest->
M[0][Index].
fBest = 1;
1866 pBest->
M[1][Index].
fBest = 1;
1901 int k, iVar, fCompl;
1920 float Coef = 1.0 / (1.0 + (p->
Iter + 1) * (p->
Iter + 1));
1925 int i, c, Id, nRefs[2];
1927 Nf_Mat_t * pDs[2], * pAs[2], * pMs[2];
1929 float Required = 0, Requireds[2];
1932 memset( pMapRefs, 0,
sizeof(
int) * nLits );
1987 for ( c = 0; c < 2; c++ )
1996 if ( !nRefs[0] && !nRefs[1] )
2000 if ( nRefs[0] && nRefs[1] )
2003 for ( c = 0; c < 2; c++ )
2009 pMs[c] = (pAs[c]->
D < Requireds[c] + Epsilon) ? pAs[c] : pDs[c];
2012 if ( pMs[0]->fCompl && pMs[1]->fCompl )
2018 if ( !pMs[0]->fCompl && !pMs[1]->fCompl )
2021 for ( c = 0; c < 2; c++ )
2027 assert( !pMs[0]->fCompl || !pMs[1]->fCompl );
2029 assert( pMs[c]->fCompl && !pMs[!c]->fCompl );
2035 Required = Requireds[c];
2046 pM = (pA->
D < Required + Epsilon) ? pA : pD;
2061 c = (int)(nRefs[1] > 0);
2062 assert( nRefs[c] && !nRefs[!c] );
2068 pM = (pA->
D < Required + Epsilon) ? pA : pD;
2083 pM = (pA->
D < Required + Epsilon) ? pA : pD;
2113 for ( i = 0; i < nLits; i++ )
2124 int i, k, c, Id, iLit, * pCut;
2143 for ( c = 0; c < 2; c++ )
2173 int i, c, Id, * pCut;
2183 for ( c = 0; c < 2; c++ )
int Nf_ManSetMapRefs(Nf_Man_t *p)
static int * Vec_IntArray(Vec_Int_t *p)
static word Abc_Tt6Expand(word t, int *pCut0, int nCutSize0, int *pCut, int nCutSize)
#define NF_LEAF_MAX
DECLARATIONS ///.
static int Gia_ObjFaninC2(Gia_Man_t *p, Gia_Obj_t *pObj)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static Nf_Mat_t * Nf_ObjMatchD(Nf_Man_t *p, int i, int c)
static Vec_Wec_t * Vec_WecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
#define Nf_SetForEachCut(pList, pCut, i)
static int Gia_ObjPhase(Gia_Obj_t *pObj)
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
static int Nf_CutCreateUnit(Nf_Cut_t *p, int i)
static float Abc_MinFloat(float a, float b)
static Gia_Obj_t * Gia_ObjSiblObj(Gia_Man_t *p, int Id)
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
void Nf_StoPrint(Nf_Man_t *p, int fVerbose)
struct Nf_Obj_t_ Nf_Obj_t
void Gia_ManStop(Gia_Man_t *p)
int Nf_StoCheckDsdAnd_rec(char *pStr, char **p, int *pMatches)
static int Nf_SetLastCutIsContained(Nf_Cut_t **pCuts, int nCuts)
static void Vec_FltWriteEntry(Vec_Flt_t *p, int i, float Entry)
#define Gia_ManForEachCo(p, pObj, i)
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
void Nf_StoCreateGateNonDsd(Nf_Man_t *pMan, Mio_Cell_t *pCell, int **pComp, int **pPerm, int *pnPerms)
int Nf_StoCheckDsdAnd(char *p)
static int Gia_ManChoiceNum(Gia_Man_t *p)
static int Nf_ManPrepareCuts(Nf_Cut_t *pCuts, Nf_Man_t *p, int iObj, int fAddUnit)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static int * Nf_ManCutSet(Nf_Man_t *p, int i)
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
static void Nf_CutParams(Nf_Man_t *p, Nf_Cut_t *pCut, float FlowRefs)
static void Vec_WecFree(Vec_Wec_t *p)
void Nf_ManPrintStats(Nf_Man_t *p, char *pTitle)
static Vec_Int_t * Vec_WecPushLevel(Vec_Wec_t *p)
static void Nf_Cutprintf(Nf_Man_t *p, Nf_Cut_t *pCut)
static int Abc_Var2Lit(int Var, int fCompl)
#define Nf_CutForEachLit(pCut, Conf, iLit, i)
Gia_Man_t * Nf_ManDeriveMapping(Nf_Man_t *p)
static int Nf_CutArea(Nf_Man_t *p, int nLeaves)
static int Nf_ManCountUseful(Nf_Cut_t **pCuts, int nCuts)
static int Nf_CutConfC(int Conf, int i)
typedefABC_NAMESPACE_IMPL_START struct Vec_Mem_t_ Vec_Mem_t
DECLARATIONS ///.
void Dau_DsdPrintFromTruth(word *pTruth, int nVarsInit)
static int Vec_MemEntryNum(Vec_Mem_t *p)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
static void Nf_ObjComputeRequired(Nf_Man_t *p, int iObj)
#define ABC_ALLOC(type, num)
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
static float * Vec_FltArray(Vec_Flt_t *p)
Nf_Man_t * Nf_StoCreate(Gia_Man_t *pGia, Jf_Par_t *pPars)
static float Nf_ObjFlowRefs(Nf_Man_t *p, int i, int c)
static Vec_Str_t * Vec_StrAlloc(int nCap)
static void Nf_SetSortByArea(Nf_Cut_t **pCuts, int nCuts)
static abctime Abc_Clock()
static int Abc_MaxInt(int a, int b)
static void Vec_StrPush(Vec_Str_t *p, char Entry)
static int Vec_PtrSize(Vec_Ptr_t *p)
static int Nf_ObjCutSetId(Nf_Man_t *p, int i)
static void Vec_FltFill(Vec_Flt_t *p, int nSize, float Entry)
static int Nf_SetAddCut(Nf_Cut_t **pCuts, int nCuts, int nCutNum)
void Nf_ManPrintInit(Nf_Man_t *p)
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
static float Abc_MaxFloat(float a, float b)
static void Nf_ObjSetCutFlow(Nf_Man_t *p, int i, float a)
#define Nf_CutForEachVar(pCut, Conf, iVar, c, i)
static int Abc_LitNotCond(int Lit, int c)
void Nf_ManCutMatchprintf(Nf_Man_t *p, int iObj, int fCompl, Nf_Mat_t *pM)
static int Vec_WecSize(Vec_Wec_t *p)
#define ABC_SWAP(Type, a, b)
static int Abc_Tt6MinBase(word *pTruth, int *pVars, int nVars)
static int Nf_SetCheckArray(Nf_Cut_t **ppCuts, int nCuts)
static int Gia_ManHasChoices(Gia_Man_t *p)
static Mio_Cell_t * Nf_ManCell(Nf_Man_t *p, int i)
float Nf_MatchDeref2_rec(Nf_Man_t *p, int i, int c, Nf_Mat_t *pM)
static void Nf_ObjSetRequired(Nf_Man_t *p, int i, int c, float f)
static int Nf_SetCutIsContainedOrder(Nf_Cut_t *pBase, Nf_Cut_t *pCut)
#define Gia_ManForEachCiId(p, Id, i)
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
static void Abc_PrintTime(int level, const char *pStr, abctime time)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Gia_ManAndNum(Gia_Man_t *p)
static int Abc_MinInt(int a, int b)
static int Gia_ObjSibl(Gia_Man_t *p, int Id)
static word Abc_Tt6SwapAdjacent(word Truth, int iVar)
static int Abc_LitIsCompl(int Lit)
static int Gia_ObjIsMuxId(Gia_Man_t *p, int iObj)
void Nf_ManUpdateStats(Nf_Man_t *p)
int * Dau_DsdComputeMatches(char *p)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int Nf_ObjHasCuts(Nf_Man_t *p, int i)
static int Nf_CutCountBits(word i)
static void Vec_StrFree(Vec_Str_t *p)
static int * Nf_ObjCutSet(Nf_Man_t *p, int i)
static Vec_Mem_t * Vec_MemAllocForTT(int nVars, int fCompl)
void Nf_StoPrintOne(Nf_Man_t *p, int Count, int t, int i, Mio_Cell_t *pC, int Type, int fCompl, char *pInfo)
void Nf_ManComputeCuts(Nf_Man_t *p)
#define Gia_ManForEachAndReverse(p, pObj, i)
static int Nf_CutFunc(int *pCut)
static int Nf_ObjCutUseless(Nf_Man_t *p, int TruthId)
static int Vec_IntEntry(Vec_Int_t *p, int i)
unsigned __int64 word
DECLARATIONS ///.
static void Nf_ObjPrepareBuf(Nf_Man_t *p, Gia_Obj_t *pObj)
float Nf_MatchRef2Area(Nf_Man_t *p, int i, int c, Nf_Mat_t *pM)
static int Abc_Base10Log(unsigned n)
#define ABC_NAMESPACE_IMPL_END
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
static double Vec_MemMemory(Vec_Mem_t *p)
static int Nf_ManCountMatches(Nf_Man_t *p, Nf_Cut_t **pCuts, int nCuts)
Gia_Man_t * Gia_ManDupMuxes(Gia_Man_t *p, int Limit)
void Nf_ManComputeMapping(Nf_Man_t *p)
static int Gia_ObjIsXor(Gia_Obj_t *pObj)
#define Gia_ManForEachAnd(p, pObj, i)
static void Nf_StoSelectSortLit(int *pArray, int nSize, Mio_Cell_t *pCell)
static int Nf_ObjMapRefInc(Nf_Man_t *p, int i, int c)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
static float Nf_ObjCutFlow(Nf_Man_t *p, int i)
static int Nf_ObjMapRefNum(Nf_Man_t *p, int i, int c)
void Nf_StoCreateGateDsd(Nf_Man_t *pMan, Mio_Cell_t *pCell, int **pComp, int **pPerm, int *pnPerms)
static void Vec_IntFreeP(Vec_Int_t **p)
static Nf_Obj_t * Nf_ManObj(Nf_Man_t *p, int i)
int Nf_StoBuildDsdAnd(Nf_Man_t *pMan, Mio_Cell_t *pCell, char *p)
static void Nf_ObjSetCutDelay(Nf_Man_t *p, int i, int d)
static int Nf_CutConfVar(int Conf, int i)
static word Abc_Tt6Flip(word Truth, int iVar)
static void Vec_MemFree(Vec_Mem_t *p)
static void Abc_Print(int level, const char *format,...)
static void Nf_ObjUpdateRequired(Nf_Man_t *p, int i, int c, float f)
static float Nf_CutRequired(Nf_Man_t *p, Nf_Mat_t *pM, int *pCutSet)
void Gia_ManPrintMuxStats(Gia_Man_t *p)
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
static int Nf_CutComputeTruthMux6(Nf_Man_t *p, Nf_Cut_t *pCut0, Nf_Cut_t *pCut1, Nf_Cut_t *pCutC, int fCompl0, int fCompl1, int fComplC, Nf_Cut_t *pCutR)
void Nf_ManSetDefaultPars(Jf_Par_t *pPars)
#define ABC_NAMESPACE_IMPL_START
static int Nf_CutComputeTruth6(Nf_Man_t *p, Nf_Cut_t *pCut0, Nf_Cut_t *pCut1, int fCompl0, int fCompl1, Nf_Cut_t *pCutR, int fIsXor)
static Vec_Int_t * Vec_WecEntry(Vec_Wec_t *p, int i)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static int Vec_StrSize(Vec_Str_t *p)
static int Abc_LitNot(int Lit)
int pLeaves[NF_LEAF_MAX+1]
static int Vec_IntSize(Vec_Int_t *p)
static int Nf_ObjMapRefDec(Nf_Man_t *p, int i, int c)
static int Nf_CutCheck(Nf_Cut_t *pBase, Nf_Cut_t *pCut)
void Nf_StoCreateGateAdd(Nf_Man_t *pMan, word uTruth, int *pFans, int nFans, int CellId, int Type)
void Nf_StoDeriveMatches(Nf_Man_t *p, int fVerbose)
int Nf_StoCheckDsdXor_rec(char *pStr, char **p, int *pMatches)
static int Nf_CutSetBoth(int n, int f)
void Nf_ManPrintQuit(Nf_Man_t *p)
static int * Nf_ObjCutBest(Nf_Man_t *p, int i)
static int Nf_CutIsTriv(int *pCut, int i)
static Nf_Mat_t * Nf_ObjMatchBest(Nf_Man_t *p, int i, int c)
#define ABC_CALLOC(type, num)
static int Abc_Lit2Var(int Lit)
static int Abc_TtSupportSize(word *t, int nVars)
static int Nf_CutMergeOrderMux(Nf_Cut_t *pCut0, Nf_Cut_t *pCut1, Nf_Cut_t *pCut2, Nf_Cut_t *pCut, int nLutSize)
static int Nf_CutSize(int *pCut)
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
void Nf_ManSetMapRefsGate(Nf_Man_t *p, int iObj, float Required, Nf_Mat_t *pM)
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
int Nf_StoCheckDsdXor(char *p)
static word Nf_CutGetSign(int *pLeaves, int nLeaves)
Mio_Cell_t * Mio_CollectRootsNewDefault(int nInputs, int *pnGates, int fVerbose)
static int Nf_CutMergeOrder(Nf_Cut_t *pCut0, Nf_Cut_t *pCut1, Nf_Cut_t *pCut, int nLutSize)
static Nf_Mat_t * Nf_ObjMatchA(Nf_Man_t *p, int i, int c)
static int Vec_MemHashInsert(Vec_Mem_t *p, word *pEntry)
static void Nf_StoSelectSort(int *pArray, int nSize, Mio_Cell_t *pCell)
FUNCTION DEFINITIONS ///.
#define ABC_INFINITY
MACRO DEFINITIONS ///.
static void Vec_MemHashFree(Vec_Mem_t *p)
static int * Nf_CutLeaves(int *pCut)
Gia_Man_t * Nf_ManPerformMapping(Gia_Man_t *pGia, Jf_Par_t *pPars)
static int Nf_SetLastCutContainsArea(Nf_Cut_t **pCuts, int nCuts)
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
double Gia_ManMemory(Gia_Man_t *p)
void Gia_ManSetPhase(Gia_Man_t *p)
void Mf_ManSetFlowRefs(Gia_Man_t *p, Vec_Int_t *vRefs)
static int Gia_ObjFaninId2(Gia_Man_t *p, int ObjId)
static int Nf_ManSaveCuts(Nf_Man_t *p, Nf_Cut_t **pCuts, int nCuts, int fUseful)
static float Vec_FltEntry(Vec_Flt_t *p, int i)
void Nf_StoDelete(Nf_Man_t *p)
void Nf_ObjMergeOrder(Nf_Man_t *p, int iObj)
#define Gia_ManForEachAndId(p, i)
static int Nf_CutConfLit(int Conf, int i)
static word * Vec_MemReadEntry(Vec_Mem_t *p, int i)
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
static void Nf_ObjPrepareCi(Nf_Man_t *p, int iObj)
static void Vec_IntFree(Vec_Int_t *p)
static void Vec_IntClear(Vec_Int_t *p)
static int Nf_CutCompareArea(Nf_Cut_t *pCut0, Nf_Cut_t *pCut1)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
void Nf_ManCutMatch(Nf_Man_t *p, int iObj)
float Nf_MatchRef2_rec(Nf_Man_t *p, int i, int c, Nf_Mat_t *pM, Vec_Int_t *vBackup)
void Nf_ManCutMatchOne(Nf_Man_t *p, int iObj, int *pCut, int *pCutSet)
static void Vec_PtrFreeData(Vec_Ptr_t *p)
static int * Nf_CutFromHandle(int *pCutSet, int h)
static float Nf_ObjRequired(Nf_Man_t *p, int i, int c)
int Nf_StoBuildDsdAnd_rec(Nf_Man_t *pMan, Mio_Cell_t *pCell, char *pStr, char **p, int *pMatches, int pGroups[NF_LEAF_MAX][NF_LEAF_MAX], int *nGroupSizes, int *pnGroups)
static int Nf_ObjCutDelay(Nf_Man_t *p, int i)
static char * Vec_StrEntryP(Vec_Str_t *p, int i)
static int Gia_ManObjNum(Gia_Man_t *p)
static int Vec_WecSizeSize(Vec_Wec_t *p)
static int Nf_CutHandle(int *pCutSet, int *pCut)
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)