59 if ( pTtElems[0] == NULL )
63 pTtElems[v] = TtElems[v];
85 for ( v = 0; p[v]; v++ )
88 if ( p[v] ==
'(' || p[v] ==
'[' || p[v] ==
'<' || p[v] ==
'{' )
89 pNested[nNested++] = v;
90 else if ( p[v] ==
')' || p[v] ==
']' || p[v] ==
'>' || p[v] ==
'}' )
91 pMatches[pNested[--nNested]] = v;
114 if ( *pDsd >=
'a' && *pDsd <=
'z' )
121 for ( v = 0; v < nVars; v++ )
123 for ( v = 0; v < nVars; v++ )
125 vNew = rand() % nVars;
126 ABC_SWAP(
int, pPerm[v], pPerm[vNew] );
136 if ( *pDsd >=
'a' && *pDsd <
'a' + nVars )
137 *pDsd =
'a' + pPerm[*pDsd -
'a'];
154 for ( s = pMarks[i]; s < pMarks[i+1]; s++ )
160 char * pStr1 = pStr + pMarks[i];
161 char * pStr2 = pStr + pMarks[j];
162 char * pLimit1 = pStr + pMarks[i+1];
163 char * pLimit2 = pStr + pMarks[j+1];
164 for ( ; pStr1 < pLimit1 && pStr2 < pLimit2; pStr1++, pStr2++ )
166 if ( !(*pStr1 >=
'a' && *pStr1 <=
'z') )
171 if ( !(*pStr2 >=
'a' && *pStr2 <=
'z') )
176 if ( *pStr1 < *pStr2 )
178 if ( *pStr1 > *pStr2 )
181 assert( pStr1 < pLimit1 || pStr2 < pLimit2 );
182 if ( pStr1 == pLimit1 )
184 if ( pStr2 == pLimit2 )
193 for ( i = 0; i < nMarks; i++ )
195 for ( i = 0; i < nMarks; i++ )
198 for ( k = i + 1; k < nMarks; k++ )
201 ABC_SWAP(
int, pPerm[i], pPerm[iBest] );
210 while ( (**p >=
'A' && **p <=
'F') || (**p >=
'0' && **p <=
'9') )
214 char * q = pStr + pMatches[*p - pStr];
218 if ( **p >=
'a' && **p <=
'z' )
220 if ( **p ==
'(' || **p ==
'[' )
222 char * pStore, * pOld = *p + 1;
223 char * q = pStr + pMatches[ *p - pStr ];
225 assert( *q == **p + 1 + (**p !=
'(') );
226 for ( (*p)++; *p < q; (*p)++ )
228 pMarks[nMarks++] = *p - pStr;
231 pMarks[nMarks] = *p - pStr;
237 for ( i = 0; i < nMarks; i++ )
239 assert( pStore - pBuffer == *p - pOld );
240 memcpy( pOld, pBuffer, pStore - pBuffer );
243 if ( **p ==
'<' || **p ==
'{' )
245 char * q = pStr + pMatches[ *p - pStr ];
246 assert( *q == **p + 1 + (**p !=
'(') );
247 if ( (**p ==
'<') && (*(q+1) ==
'{') )
253 for ( (*p)++; *p < q; (*p)++ )
283 while ( (**p >=
'A' && **p <=
'F') || (**p >=
'0' && **p <=
'9') )
287 char * q = pStr + pMatches[*p - pStr];
291 if ( **p >=
'a' && **p <=
'z' )
293 if ( **p ==
'(' || **p ==
'[' )
295 int Counter = 0, AddOn = (**p ==
'(')? 1 : 3;
296 char * q = pStr + pMatches[ *p - pStr ];
297 assert( *q == **p + 1 + (**p !=
'(') );
298 for ( (*p)++; *p < q; (*p)++ )
301 return Counter - AddOn;
303 if ( **p ==
'<' || **p ==
'{' )
306 char * q = pStr + pMatches[ *p - pStr ];
307 assert( *q == **p + 1 + (**p !=
'(') );
308 for ( (*p)++; *p < q; (*p)++ )
339 if ( Func == ~(
word)0 )
345 return (Func ==
s_Truths6[0]) ? pFanins[0] : ~pFanins[0];
351 return (~pFanins[nVars] & t0) | (pFanins[nVars] & t1);
358 if ( **p >=
'a' && **p <=
'f' )
360 assert( **p -
'a' >= 0 && **p -
'a' < 6 );
361 return fCompl ? ~pTruths[**p -
'a'] : pTruths[**p -
'a'];
365 char * q = pStr + pMatches[ *p - pStr ];
367 assert( **p ==
'(' && *q ==
')' );
368 for ( (*p)++; *p < q; (*p)++ )
371 return fCompl ? ~Res : Res;
375 char * q = pStr + pMatches[ *p - pStr ];
377 assert( **p ==
'[' && *q ==
']' );
378 for ( (*p)++; *p < q; (*p)++ )
381 return fCompl ? ~Res : Res;
386 word Temp[3], * pTemp = Temp, Res;
387 word Fanins[6], * pTruths2;
389 char * q = pStr + pMatches[ *p - pStr ];
395 q2 = pStr + pMatches[ *p - pStr ];
396 assert( **p ==
'{' && *q2 ==
'}' );
397 for ( nVars = 0, (*p)++; *p < q2; (*p)++, nVars++ )
406 q = pStr + pMatches[ *p - pStr ];
407 assert( **p ==
'<' && *q ==
'>' );
410 for ( ; pOld < q; pOld++ )
411 if ( *pOld >=
'a' && *pOld <=
'z' )
412 assert( *pOld -
'a' < nVars );
414 for ( (*p)++; *p < q; (*p)++ )
416 assert( pTemp == Temp + 3 );
420 char * q = pStr + pMatches[ ++(*p) - pStr ];
421 assert( **p ==
'{' && *q ==
'}' );
424 Res = (Temp[0] & Temp[1]) | (~Temp[0] & Temp[2]);
425 return fCompl ? ~Res : Res;
427 if ( (**p >=
'A' && **p <=
'F') || (**p >=
'0' && **p <=
'9') )
429 word Func, Fanins[6], Res;
433 q = pStr + pMatches[ *p - pStr ];
434 assert( **p ==
'{' && *q ==
'}' );
435 for ( i = 0, (*p)++; *p < q; (*p)++, i++ )
440 return fCompl ? ~Res : Res;
448 if ( *p ==
'0' && *(p+1) == 0 )
450 else if ( *p ==
'1' && *(p+1) == 0 )
476 if ( Func == ~(
word)0 )
497 Abc_TtMux( pRes, pFanins[nVars], pTtTemp[1], pTtTemp[0], nWordsR );
531 Abc_TtMux( pRes, pFanins[nVars], pTtTemp[1], pTtTemp[0], nWordsR );
541 if ( **p >=
'a' && **p <=
'z' )
543 assert( **p -
'a' >= 0 && **p -
'a' < nVars );
544 Abc_TtCopy( pRes, pTtElems[**p -
'a'], nWords, fCompl );
549 char * q = pStr + pMatches[ *p - pStr ];
551 assert( **p ==
'(' && *q ==
')' );
553 for ( (*p)++; *p < q; (*p)++ )
556 Abc_TtAnd( pRes, pRes, pTtTemp, nWords, 0 );
564 char * q = pStr + pMatches[ *p - pStr ];
566 assert( **p ==
'[' && *q ==
']' );
568 for ( (*p)++; *p < q; (*p)++ )
571 Abc_TtXor( pRes, pRes, pTtTemp, nWords, 0 );
579 char * q = pStr + pMatches[ *p - pStr ];
582 assert( **p ==
'<' && *q ==
'>' );
583 for ( i = 0, (*p)++; *p < q; (*p)++, i++ )
586 Abc_TtMux( pRes, pTtTemp[0], pTtTemp[1], pTtTemp[2], nWords );
591 if ( (**p >=
'A' && **p <=
'F') || (**p >=
'0' && **p <=
'9') )
597 q = pStr + pMatches[ *p - pStr ];
598 assert( **p ==
'{' && *q ==
'}' );
599 for ( i = 0, (*p)++; *p < q; (*p)++, i++ )
662 for ( i = PosStart; i <
Pos; i++ )
663 if ( pBuffer[i] != Symb )
664 *pCur++ = pBuffer[i];
666 for ( k = 0; pNext[k]; k++ )
668 RetValue = PosStart + (pCur - pTemp);
669 for ( i = PosStart; i < RetValue; i++ )
670 pBuffer[i] = pTemp[i-PosStart];
676 word Cof0[6], Cof1[6], Cof[4];
677 int pVarsNew[6], nVarsNew, PosStart;
678 int v, u, vBest, CountBest;
682 for ( v = 0; v < nVars; v++ )
684 pVarsNew[ nVarsNew++ ] = pVars[v];
691 pBuffer[Pos++] =
'a' + pVarsNew[0];
696 pBuffer[Pos++] =
'!';
697 pBuffer[Pos++] =
'a' + pVarsNew[0];
704 for ( v = 0; v < nVarsNew; v++ )
708 assert( Cof0[v] != Cof1[v] );
711 pBuffer[Pos++] =
'(';
712 pBuffer[Pos++] =
'a' + pVarsNew[v];
714 pBuffer[Pos++] =
')';
717 if ( Cof0[v] == ~(
word)0 )
719 pBuffer[Pos++] =
'!';
720 pBuffer[Pos++] =
'(';
721 pBuffer[Pos++] =
'a' + pVarsNew[v];
723 pBuffer[Pos++] =
')';
728 pBuffer[Pos++] =
'(';
729 pBuffer[Pos++] =
'!';
730 pBuffer[Pos++] =
'a' + pVarsNew[v];
732 pBuffer[Pos++] =
')';
735 if ( Cof1[v] == ~(
word)0 )
737 pBuffer[Pos++] =
'!';
738 pBuffer[Pos++] =
'(';
739 pBuffer[Pos++] =
'!';
740 pBuffer[Pos++] =
'a' + pVarsNew[v];
742 pBuffer[Pos++] =
')';
745 if ( Cof0[v] == ~Cof1[v] )
747 pBuffer[Pos++] =
'[';
748 pBuffer[Pos++] =
'a' + pVarsNew[v];
750 pBuffer[Pos++] =
']';
755 for ( v = 0; v < nVarsNew; v++ )
756 for ( u = v+1; u < nVarsNew; u++ )
762 if ( Cof[0] == Cof[1] && Cof[0] == Cof[2] )
765 sprintf( pNest,
"(%c%c)",
'a' + pVarsNew[v],
'a' + pVarsNew[u] );
770 if ( Cof[0] == Cof[1] && Cof[0] == Cof[3] )
773 sprintf( pNest,
"(%c!%c)",
'a' + pVarsNew[v],
'a' + pVarsNew[u] );
778 if ( Cof[0] == Cof[2] && Cof[0] == Cof[3] )
781 sprintf( pNest,
"(!%c%c)",
'a' + pVarsNew[v],
'a' + pVarsNew[u] );
786 if ( Cof[1] == Cof[2] && Cof[1] == Cof[3] )
789 sprintf( pNest,
"(!%c!%c)",
'a' + pVarsNew[v],
'a' + pVarsNew[u] );
794 if ( Cof[0] == Cof[3] && Cof[1] == Cof[2] )
797 sprintf( pNest,
"[%c%c]",
'a' + pVarsNew[v],
'a' + pVarsNew[u] );
806 for ( v = 0; v < nVarsNew; v++ )
809 for ( u = 0; u < nVarsNew; u++ )
812 if ( CountBest > CountCur )
814 CountBest = CountCur;
821 pBuffer[Pos++] =
'<';
822 pBuffer[Pos++] =
'a' + pVarsNew[vBest];
825 pBuffer[Pos++] =
'>';
831 int pVarsNew[6] = {0, 1, 2, 3, 4, 5};
834 pBuffer[Pos++] =
'0';
835 else if ( t == ~(
word)0 )
836 pBuffer[Pos++] =
'1';
875 printf(
"Verification failed.\n" );
898 int nSizeNonDec, nSizeNonDec0, nSizeNonDec1;
899 int i, vBest = -2, nSumCofsBest =
ABC_INFINITY, nSumCofs;
901 if ( nSizeNonDec == 0 )
903 assert( nSizeNonDec > 0 );
905 for ( i = 0; i < nVarsInit; i++ )
911 for ( i = 0; i < nVarsInit; i++ )
921 for ( i = 0; i < nVarsInit; i++ )
923 assert( pVarPrios[i] >= 0 && pVarPrios[i] < nVarsInit );
933 if ( nSizeNonDec0 || nSizeNonDec1 )
935 if ( nSumCofsBest > nSumCofs )
937 vBest = pVarPrios[i];
938 nSumCofsBest = nSumCofs;
988 assert( nVarsInit >= 0 && nVarsInit <= 16 );
989 p->nVarsInit = nVarsInit;
990 p->nVarsUsed = nVarsInit;
995 for ( i = 0; i < nVarsInit; i++ )
996 p->pVarDefs[i][0] =
'a' + i, p->pVarDefs[i][1] = 0;
997 for ( v = 0; v < nVarsInit; v++ )
998 for ( u = 0; u < nVarsInit; u++ )
1005 p->pOutput[ p->nPos++ ] = *pStr++;
1011 p->pOutput[ p->nPos++ ] =
'!';
1012 for ( pStr = p->pVarDefs[iVar]; *pStr; pStr++ )
1013 if ( *pStr >=
'a' + p->nVarsInit && *pStr < 'a' + p->nVarsUsed )
1016 p->pOutput[ p->nPos++ ] = *pStr;
1022 int LevelMax = 0, Level;
1023 for ( pStr = p->pVarDefs[iVar]; *pStr; pStr++ )
1025 if ( *pStr >=
'a' + p->nVarsInit && *pStr < 'a' + p->nVarsUsed )
1028 Level = p->pVarLevels[*pStr -
'a'];
1035 for ( ; *pStr; pStr++ )
1036 if ( *pStr >=
'a' && *pStr <
'a' + nVars )
1039 p->pOutput[ p->nPos++ ] = *pStr;
1043 int v, RetValue = 2;
1045 if ( p->fSplitPrime )
1062 nNonDecSize =
Dau_DsdDecompose( pCofTemp, nVars, 0, p->fWriteTruth, pRes );
1063 assert( nNonDecSize == 0 );
1067 nNonDecSize =
Dau_DsdDecompose( pCofTemp, nVars, 0, p->fWriteTruth, pRes );
1068 assert( nNonDecSize == 0 );
1074 else if ( p->fWriteTruth )
1077 for ( v = 0; v < nVars; v++ )
1080 p->nSizeNonDec = nVars;
1086 for ( i = 0; i < p->nConsts; i++ )
1087 p->pOutput[ p->nPos++ ] = ((p->uConstMask >> (p->nConsts-1-i)) & 1) ?
']' :
')';
1088 p->pOutput[ p->nPos++ ] = 0;
1094 assert( p->nVarsUsed < 32 );
1095 for ( u = 0; u < p->nVarsUsed; u++ )
1096 p->Cache[p->nVarsUsed][u] = 0;
1097 for ( u = 0; u < p->nVarsUsed; u++ )
1098 p->Cache[u][p->nVarsUsed] = 0;
1099 sprintf( p->pVarDefs[p->nVarsUsed++],
"%s", pStr );
1100 return p->nVarsUsed - 1;
1105 for ( v = 0; v < nVars; v++ )
1106 if ( pVars[v] == VarDef )
1114 assert( Status > 0 && Status < 4 );
1115 assert( p->Cache[v][u] == 0 );
1116 p->Cache[v][u] = Status;
1120 return p->Cache[v][u];
1137 if ( pTruth[0] & 1 )
1156 if ( pTruth[0] >> 63 )
1179 p->uConstMask |= (1 << p->nConsts);
1187 pVars[v] = pVars[nVars-1];
1198 for ( v = nVars - 1; v >= 0 && nVars > 1; v-- )
1204 if ( v == -1 || nVars == 1 )
1226 unsigned uSupports = 0;
1231 for ( u = 0; u < nVars; u++ )
1239 printf(
"Cofactor supports: " );
1240 for ( v = nVars - 1; v >= 0; v-- )
1242 Value = ((uSupp >> (2*v)) & 3);
1245 else if ( Value == 2 )
1247 else if ( Value == 3 )
1259 char pBuffer[10] = { 0 };
1273 sprintf( pBuffer,
"[%c%c]",
'a' + pVars[v],
'a' + pVars[u] );
1277 else if ( Status == 2 )
1282 sprintf( pBuffer,
"(%c%c)",
'a' + pVars[v],
'a' + pVars[u] );
1288 sprintf( pBuffer,
"(%c!%c)",
'a' + pVars[v],
'a' + pVars[u] );
1293 else if ( Status == 1 )
1298 sprintf( pBuffer,
"(!%c%c)",
'a' + pVars[v],
'a' + pVars[u] );
1304 sprintf( pBuffer,
"(!%c!%c)",
'a' + pVars[v],
'a' + pVars[u] );
1314 pVars[v] = pVars[nVars-1];
1326 for ( v = nVars - 1; v > 0; v-- )
1328 for ( u = v - 1; u >= 0; u-- )
1339 if ( nVarsOld > nVars )
1358 p1->fSplitPrime = 0;
1359 p1->fWriteTruth = p->fWriteTruth;
1361 ABC_SWAP(
int, pVars[v], pVars[nVars-1] );
1372 p->nSizeNonDec = p1->nSizeNonDec;
1373 if ( p1->nSizeNonDec )
1379 p->nSizeNonDec =
Abc_MaxInt( p->nSizeNonDec, p1->nSizeNonDec );
1380 if ( p1->nSizeNonDec )
1394 int fEqual0 = (C00 == C10) && (C01 == C11);
1395 int fEqual1 = (C00 == C11) && (C01 == C10);
1396 if ( fEqual0 || fEqual1 )
1399 int VarId = pVars[iVar0];
1401 sprintf( pBuffer,
"<%c%c%s%c>",
'a' + pVars[v],
'a' + pVars[iVar1], fEqual1 ?
"!":
"",
'a' + pVars[iVar0] );
1404 ABC_SWAP(
int, pVars[iVar1], pVars[nVars-1] );
1408 ABC_SWAP(
int, pVars[iVar0], pVars[nVars-1] );
1426 for ( v = nVars - 1; v >= 0; v-- )
1430 if ( (uSupports & (uSupports >> 1) & 0x55555555) == 0 )
1436 if ( nVarsNew == nVars )
1438 if ( nVarsNew == 0 )
1494 if ( pTruth[0] & 1 )
1514 if ( pTruth[nWords-1] >> 63 )
1538 p->uConstMask |= (1 << p->nConsts);
1546 pVars[v] = pVars[nVars-1];
1557 for ( v = nVars - 1; v >= 0 && nVars > 1; v-- )
1563 if ( v == -1 || nVars == 1 )
1580 Status = (!
Abc_TtCheckEqualCofs(pTruth, nWords, v, u, 1, 3) << 1) | !
Abc_TtCheckEqualCofs(pTruth, nWords, v, u, 0, 2);
1582 Status = (!
Abc_TtCheckEqualCofs(pTruth, nWords, u, v, 2, 3) << 1) | !
Abc_TtCheckEqualCofs(pTruth, nWords, u, v, 0, 1);
1592 unsigned uSupports = 0;
1595 for ( u = 0; u < nVars; u++ )
1604 char pBuffer[10] = { 0 };
1613 if (
Abc_TtCheckEqualCofs(pTruth, nWords, u, v, 0, 3) &&
Abc_TtCheckEqualCofs(pTruth, nWords, u, v, 1, 2) )
1616 sprintf( pBuffer,
"[%c%c]",
'a' + pVars[v],
'a' + pVars[u] );
1626 else if ( Status == 2 )
1633 sprintf( pBuffer,
"(%c%c)",
'a' + pVars[v],
'a' + pVars[u] );
1646 sprintf( pBuffer,
"(%c!%c)",
'a' + pVars[v],
'a' + pVars[u] );
1656 else if ( Status == 1 )
1663 sprintf( pBuffer,
"(!%c%c)",
'a' + pVars[v],
'a' + pVars[u] );
1676 sprintf( pBuffer,
"(!%c!%c)",
'a' + pVars[v],
'a' + pVars[u] );
1691 pVars[v] = pVars[nVars-1];
1703 for ( v = nVars - 1; v > 0; v-- )
1705 for ( u = v - 1; u >= 0; u-- )
1716 if ( nVarsOld > nVars )
1736 p1->fSplitPrime = 0;
1737 p1->fWriteTruth = p->fWriteTruth;
1739 ABC_SWAP(
int, pVars[v], pVars[nVars-1] );
1752 p->nSizeNonDec = p1->nSizeNonDec;
1753 if ( p1->nSizeNonDec )
1759 p->nSizeNonDec =
Abc_MaxInt( p->nSizeNonDec, p1->nSizeNonDec );
1760 if ( p1->nSizeNonDec )
1769 int fEqual0, fEqual1;
1786 fEqual0 =
Abc_TtEqual(pTtFour[0][0], pTtFour[1][0], nWords) &&
Abc_TtEqual(pTtFour[0][1], pTtFour[1][1], nWords);
1787 fEqual1 =
Abc_TtEqual(pTtFour[0][0], pTtFour[1][1], nWords) &&
Abc_TtEqual(pTtFour[0][1], pTtFour[1][0], nWords);
1788 if ( fEqual0 || fEqual1 )
1791 int VarId = pVars[iVar0];
1794 sprintf( pBuffer,
"<%c%c%s%c>",
'a' + pVars[v],
'a' + pVars[iVar1], fEqual1 ?
"!":
"",
'a' + pVars[iVar0] );
1797 ABC_SWAP(
int, pVars[iVar1], pVars[nVars-1] );
1801 ABC_SWAP(
int, pVars[iVar0], pVars[nVars-1] );
1819 for ( v = nVars - 1; v >= 0; v-- )
1823 if ( (uSupports & (uSupports >> 1) & 0x55555555) == 0 )
1829 if ( nVarsNew == nVars )
1831 if ( nVarsNew == 0 )
1886 for ( v = 0; v < nVars; v++ )
1888 for ( v = nVars - 1; v >= 0; v-- )
1893 pVarsNew[v] = pVarsNew[--nVars];
1899 int Status = 0, nVars, pVars[16];
1902 assert( nVars > 0 && nVars <= nVarsInit );
1905 else if ( nVars <= 6 )
1915 p->fSplitPrime = fSplitPrime;
1916 p->fWriteTruth = fWriteTruth;
1917 p->pVarLevels = NULL;
1920 {
if ( pRes ) pRes[0] =
'0', pRes[1] = 0; }
1922 {
if ( pRes ) pRes[0] =
'1', pRes[1] = 0; }
1928 strcpy( pRes, p->pOutput );
1929 assert( fSplitPrime || Status != 1 );
1930 if ( fSplitPrime && Status == 2 )
1934 return p->nSizeNonDec;
1939 p->fSplitPrime = fSplitPrime;
1940 p->fWriteTruth = fWriteTruth;
1941 p->pVarLevels = pVarLevels;
1944 {
if ( pRes ) pRes[0] =
'0', pRes[1] = 0; }
1946 {
if ( pRes ) pRes[0] =
'1', pRes[1] = 0; }
1952 strcpy( pRes, p->pOutput );
1953 assert( fSplitPrime || Status != 1 );
1954 if ( fSplitPrime && Status == 2 )
1958 return p->nSizeNonDec;
1966 fprintf( pFile,
"%s\n", pRes );
1974 fprintf( stdout,
"%s\n", pRes );
1986 char * pStr =
"[dc<a(cbd)(!c!b!d)>{abef}]";
2009 char * pStr =
"(<abc>(<def><ghi>))";
2036 char * pFileName =
"_npn/npn/dsd10.txt";
2037 FILE * pFile = fopen( pFileName,
"rb" );
2046 while ( fgets( pBuffer,
DAU_MAX_STR, pFile ) != NULL )
2048 char * pStr2 = pBuffer +
strlen(pBuffer)-1;
2049 if ( *pStr2 ==
'\n' )
2051 if ( *pStr2 ==
'\r' )
2053 if ( pBuffer[0] ==
'V' || pBuffer[0] == 0 )
2057 for ( i = 0; i < 1; i++ )
2060 pTruth =
Dau_DsdToTruth( pBuffer[0] ==
'*' ? pBuffer + 1 : pBuffer, nVars );
2068 assert( nSizeNonDec == 0 );
2075 printf(
"%s -> %s \n", pBuffer, pRes );
2076 printf(
"Verification failed.\n" );
2080 printf(
"Finished trying %d decompositions. ", Counter );
static ABC_NAMESPACE_IMPL_START int pTruths[13719]
DECLARATIONS ///.
static int Dau_DsdAddVarDef(Dau_Dsd_t *p, char *pStr)
static int Abc_TtCheckEqualCofs(word *pTruth, int nWords, int iVar, int jVar, int Num1, int Num2)
static int Abc_Tt6Cof1IsConst0(word t, int iVar)
int Dau_DsdDecomposeTripleVars(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars)
static int Dau_Dsd6DecomposeTripleVarsOuter(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars, int v)
static void Dau_DsdPrintSupports(unsigned uSupp, int nVars)
static int Abc_TtSuppFindFirst(int Supp)
typedefABC_NAMESPACE_IMPL_START struct Dau_Dsd_t_ Dau_Dsd_t
DECLARATIONS ///.
int Dau_DsdDecompose(word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes)
void Dau_DsdPrintFromTruthFile(FILE *pFile, word *pTruth, int nVarsInit)
static int Dau_DsdDecomposeTripleVarsInner(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars, int v, unsigned uSupports)
static int Dau_Dsd6FindSupportOne(Dau_Dsd_t *p, word tCof0, word tCof1, int *pVars, int nVars, int v, int u)
static void Abc_TtCofactor1p(word *pOut, word *pIn, int nWords, int iVar)
static int Abc_Tt6HasVar(word t, int iVar)
static int Dau_DsdFindVarDef(int *pVars, int nVars, int VarDef)
static int Abc_Tt6Cof0IsConst1(word t, int iVar)
int Dau_DsdLevelVar(void *pMan, int iVar)
static void Dau_DsdInsertVarCache(Dau_Dsd_t *p, int v, int u, int Status)
static int Abc_TtCof0IsConst0(word *t, int nWords, int iVar)
static int Abc_TtIsConst0(word *pIn1, int nWords)
int Dau_Dsd6DecomposeInternal(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars)
static int Dau_DsdDecomposeTripleVarsOuter(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars, int v)
void Dau_DsdTruth6Compose_rec(word Func, word pFanins[DAU_MAX_VAR][DAU_MAX_WORD], word *pRes, int nVars, int nWordsR)
void Dau_DsdRemoveBraces(char *pDsd, int *pMatches)
static int Dau_DsdFindSupportOne(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars, int v, int u)
int Dau_DsdNormalizeCompare(char *pStr, int *pMarks, int i, int j)
static abctime Abc_Clock()
static word Abc_Tt6Cofactor0(word t, int iVar)
static int Abc_MaxInt(int a, int b)
static int Dau_Dsd6DecomposeTripleVarsInner(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars, int v, unsigned uSupports)
static void Abc_TtConst1(word *pIn1, int nWords)
for(p=first;p->value< newval;p=p->next)
static int Abc_TtIsConst1(word *pIn1, int nWords)
#define ABC_SWAP(Type, a, b)
void Dau_DsdNormalize_rec(char *pStr, char **p, int *pMatches)
int Dau_DsdCountAnds(char *pDsd)
int Dau_DsdMinBase(word *pTruth, int nVars, int *pVarsNew)
static void Dau_DsdFinalize(Dau_Dsd_t *p)
static void Dau_DsdTranslate(Dau_Dsd_t *p, int *pVars, int nVars, char *pStr)
void Dau_DsdGenRandPerm(int *pPerm, int nVars)
static int Abc_TtReadHex(word *pTruth, char *pString)
static int Abc_TtCof1IsConst1(word *t, int nWords, int iVar)
static void Abc_PrintTime(int level, const char *pStr, abctime time)
static int Dau_DsdDecomposeDoubleVarsOne(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars, int v, int u)
word * Dau_DsdToTruth(char *p, int nVars)
static void Dau_DsdInitialize(Dau_Dsd_t *p, int nVarsInit)
static int Abc_TtWriteHexRev(char *pStr, word *pTruth, int nVars)
static int Abc_TtHexDigitNum(int nVars)
static void Abc_TtCopy(word *pOut, word *pIn, int nWords, int fCompl)
static word Abc_Tt6Cofactor1(word t, int iVar)
static int Abc_TtCof0IsConst1(word *t, int nWords, int iVar)
static void Abc_TtCofactor0p(word *pOut, word *pIn, int nWords, int iVar)
#define DAU_MAX_VAR
INCLUDES ///.
static int Abc_Tt6Cof0IsConst0(word t, int iVar)
int Dau_Dsd6DecomposeTripleVars(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars)
int Dau_DsdDecomposeDoubleVars(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars)
static int Dau_Dsd6DecomposeDoubleVarsOne(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars, int v, int u)
unsigned __int64 word
DECLARATIONS ///.
void Dau_DsdNormalize(char *pDsd)
#define ABC_NAMESPACE_IMPL_END
static ABC_NAMESPACE_IMPL_START word ** Dau_DsdTtElems()
DECLARATIONS ///.
static int Abc_Tt6Cof1IsConst1(word t, int iVar)
static void Vec_IntSelectSortCost2(int *pArray, int nSize, int *pCosts)
static int Dau_DsdLookupVarCache(Dau_Dsd_t *p, int v, int u)
static unsigned Dau_Dsd6FindSupports(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars, int v)
static unsigned Dau_DsdFindSupports(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars, int v)
char * Dau_DsdPerform(word t)
int * Dau_DsdNormalizePerm(char *pStr, int *pMarks, int nMarks)
static int Abc_TtHasVar(word *t, int nVars, int iVar)
static int Dau_DsdWritePrime(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars)
static word s_Truths6Neg[6]
static void Abc_TtCofactor0(word *pTruth, int nWords, int iVar)
int Dau_DsdFindVarNum(char *pDsd)
#define ABC_NAMESPACE_IMPL_START
void Dau_DsdPermute(char *pDsd)
word Dau_Dsd6ToTruth_rec(char *pStr, char **p, int *pMatches, word *pTruths)
int Dau_DsdPerform_rec(word t, char *pBuffer, int Pos, int *pVars, int nVars)
void Dau_DsdPrintFromTruth(word *pTruth, int nVarsInit)
static int Abc_Tt6CofsOpposite(word t, int iVar)
static int Dau_DsdIsConst1(char *p)
char * Dau_DsdNormalizeCopy(char *pDest, char *pSour, int *pMarks, int i)
int Dau_DsdDecomposeInt(Dau_Dsd_t *p, word *pTruth, int nVarsInit)
static int Abc_TtWordNum(int nVars)
int Dau_DsdDecomposeInternal(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars)
static void Dau_DsdWriteString(Dau_Dsd_t *p, char *pStr)
#define ABC_CONST(number)
PARAMETERS ///.
static void Abc_TtMux(word *pOut, word *pCtrl, word *pIn1, word *pIn0, int nWords)
static void Abc_TtCofactor1(word *pTruth, int nWords, int iVar)
int Dau_Dsd6DecomposeSingleVar(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars)
int Dau_DsdDecomposeSingleVar(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars)
static int Dau_DsdDecomposeSingleVarOne(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars, int v)
static int Abc_TtEqual(word *pIn1, word *pIn2, int nWords)
static void Abc_TtConst0(word *pIn1, int nWords)
static int Abc_TtCofsOpposite(word *t, int nWords, int iVar)
static void Dau_DsdWriteVar(Dau_Dsd_t *p, int iVar, int fInv)
void Dau_DsdTruthCompose_rec(word *pFunc, word pFanins[DAU_MAX_VAR][DAU_MAX_WORD], word *pRes, int nVars, int nWordsR)
static int Abc_TtSupportSize(word *t, int nVars)
static int Abc_TtSuppOnlyOne(int Supp)
static int Abc_Tt6Cof0EqualCof0(word t1, word t2, int iVar)
int Dau_DsdDecomposeLevel(word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes, int *pVarLevels)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
void Dau_DsdToTruth_rec(char *pStr, char **p, int *pMatches, word **pTtElems, word *pRes, int nVars)
static int Abc_TtCof1IsConst0(word *t, int nWords, int iVar)
char pOutput[DAU_MAX_STR]
static int Abc_Tt6Cof0EqualCof1(word t1, word t2, int iVar)
static int Dau_DsdIsConst0(char *p)
static void Abc_TtSwapVars(word *pTruth, int nVars, int iVar, int jVar)
static abctime s_Times[3]
static void Abc_TtAnd(word *pOut, word *pIn1, word *pIn2, int nWords, int fCompl)
static int Dau_Dsd6DecomposeSingleVarOne(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars, int v)
int Dau_DsdCheck1Step(void *p, word *pTruth, int nVarsInit, int *pVarLevels)
int * Dau_DsdComputeMatches(char *p)
static int Abc_Tt6Cof1EqualCof1(word t1, word t2, int iVar)
word Dau_Dsd6TruthCompose_rec(word Func, word *pFanins, int nVars)
static void Abc_TtXor(word *pOut, word *pIn1, word *pIn2, int nWords, int fCompl)
static int Dau_DsdPerformReplace(char *pBuffer, int PosStart, int Pos, int Symb, char *pNext)
int Dau_DsdCountAnds_rec(char *pStr, char **p, int *pMatches)
static void Abc_TtElemInit(word **pTtElems, int nVars)
static void Abc_TtNot(word *pOut, int nWords)
int Dau_Dsd6DecomposeDoubleVars(Dau_Dsd_t *p, word *pTruth, int *pVars, int nVars)
word Dau_Dsd6ToTruth(char *p)