48 static unsigned PMasks[4][3] = {
49 { 0x99999999, 0x22222222, 0x44444444 },
50 { 0xC3C3C3C3, 0x0C0C0C0C, 0x30303030 },
51 { 0xF00FF00F, 0x00F000F0, 0x0F000F00 },
52 { 0xFF0000FF, 0x0000FF00, 0x00FF0000 }
55 int i, k, Step, Shift;
57 assert( iVar < nVars - 1 );
61 for ( i = 0; i <
nWords; i++ )
62 pOut[i] = (pIn[i] & PMasks[iVar][0]) | ((pIn[i] & PMasks[iVar][1]) << Shift) | ((pIn[i] & PMasks[iVar][2]) >> Shift);
66 Step = (1 << (iVar - 5));
67 for ( k = 0; k <
nWords; k += 4*Step )
69 for ( i = 0; i < Step; i++ )
71 for ( i = 0; i < Step; i++ )
72 pOut[Step+i] = pIn[2*Step+i];
73 for ( i = 0; i < Step; i++ )
74 pOut[2*Step+i] = pIn[Step+i];
75 for ( i = 0; i < Step; i++ )
76 pOut[3*Step+i] = pIn[3*Step+i];
83 for ( i = 0; i <
nWords; i += 2 )
85 pOut[i] = (pIn[i] & 0x0000FFFF) | ((pIn[i+1] & 0x0000FFFF) << 16);
86 pOut[i+1] = (pIn[i+1] & 0xFFFF0000) | ((pIn[i] & 0xFFFF0000) >> 16);
105 int nWords = (nVars <= 5)? 1 : (1 << (nVars-5));
108 assert( Start < nVars - 1 );
112 for ( i = 0; i <
nWords; i++ )
113 pOut[i] = (pIn[i] & 0x99999999) | ((pIn[i] & 0x22222222) << 1) | ((pIn[i] & 0x44444444) >> 1);
116 for ( i = 0; i <
nWords; i++ )
117 pOut[i] = (pIn[i] & 0xC3C3C3C3) | ((pIn[i] & 0x0C0C0C0C) << 2) | ((pIn[i] & 0x30303030) >> 2);
120 for ( i = 0; i <
nWords; i++ )
121 pOut[i] = (pIn[i] & 0xF00FF00F) | ((pIn[i] & 0x00F000F0) << 4) | ((pIn[i] & 0x0F000F00) >> 4);
124 for ( i = 0; i <
nWords; i++ )
125 pOut[i] = (pIn[i] & 0xFF0000FF) | ((pIn[i] & 0x0000FF00) << 8) | ((pIn[i] & 0x00FF0000) >> 8);
128 for ( i = 0; i <
nWords; i += 2 )
130 pOut[i] = (pIn[i] & 0x0000FFFF) | ((pIn[i+1] & 0x0000FFFF) << 16);
131 pOut[i+1] = (pIn[i+1] & 0xFFFF0000) | ((pIn[i] & 0xFFFF0000) >> 16);
135 Step = (1 << (Start - 5));
136 for ( k = 0; k <
nWords; k += 4*Step )
138 for ( i = 0; i < Step; i++ )
140 for ( i = 0; i < Step; i++ )
141 pOut[Step+i] = pIn[2*Step+i];
142 for ( i = 0; i < Step; i++ )
143 pOut[2*Step+i] = pIn[Step+i];
144 for ( i = 0; i < Step; i++ )
145 pOut[3*Step+i] = pIn[3*Step+i];
166 void Kit_TruthStretch(
unsigned * pOut,
unsigned * pIn,
int nVars,
int nVarsAll,
unsigned Phase,
int fReturnIn )
170 for ( i = nVarsAll - 1; i >= 0; i-- )
171 if ( Phase & (1 << i) )
173 for ( k = Var; k < i; k++ )
176 pTemp = pIn; pIn = pOut; pOut = pTemp;
183 if ( fReturnIn ^ !(Counter & 1) )
200 void Kit_TruthShrink(
unsigned * pOut,
unsigned * pIn,
int nVars,
int nVarsAll,
unsigned Phase,
int fReturnIn )
204 for ( i = 0; i < nVarsAll; i++ )
205 if ( Phase & (1 << i) )
207 for ( k = i-1; k >=
Var; k-- )
210 pTemp = pIn; pIn = pOut; pOut = pTemp;
217 if ( fReturnIn ^ !(
Counter & 1) )
236 int i, Temp, fChange,
Counter = 0;
239 for ( i = 0; i < nVars-1; i++ )
241 assert( pPerm[i] != pPerm[i+1] );
242 if ( pPerm[i] <= pPerm[i+1] )
248 pPerm[i] = pPerm[i+1];
252 pTemp = pIn; pIn = pOut; pOut = pTemp;
255 if ( fReturnIn ^ !(Counter & 1) )
279 for ( i = 0; i <
nWords; i++ )
280 if ( (pTruth[i] & 0x55555555) != ((pTruth[i] & 0xAAAAAAAA) >> 1) )
284 for ( i = 0; i <
nWords; i++ )
285 if ( (pTruth[i] & 0x33333333) != ((pTruth[i] & 0xCCCCCCCC) >> 2) )
289 for ( i = 0; i <
nWords; i++ )
290 if ( (pTruth[i] & 0x0F0F0F0F) != ((pTruth[i] & 0xF0F0F0F0) >> 4) )
294 for ( i = 0; i <
nWords; i++ )
295 if ( (pTruth[i] & 0x00FF00FF) != ((pTruth[i] & 0xFF00FF00) >> 8) )
299 for ( i = 0; i <
nWords; i++ )
300 if ( (pTruth[i] & 0x0000FFFF) != ((pTruth[i] & 0xFFFF0000) >> 16) )
304 Step = (1 << (iVar - 5));
305 for ( k = 0; k <
nWords; k += 2*Step )
307 for ( i = 0; i < Step; i++ )
308 if ( pTruth[i] != pTruth[Step+i] )
330 for ( i = 0; i < nVars; i++ )
349 for ( i = 0; i < nVars; i++ )
377 for ( i = 0; i <
nWords; i++ )
378 pTruth[i] = (pTruth[i] & 0x55555555) | ((pTruth[i] & 0x55555555) << 1);
381 for ( i = 0; i <
nWords; i++ )
382 pTruth[i] = (pTruth[i] & 0x33333333) | ((pTruth[i] & 0x33333333) << 2);
385 for ( i = 0; i <
nWords; i++ )
386 pTruth[i] = (pTruth[i] & 0x0F0F0F0F) | ((pTruth[i] & 0x0F0F0F0F) << 4);
389 for ( i = 0; i <
nWords; i++ )
390 pTruth[i] = (pTruth[i] & 0x00FF00FF) | ((pTruth[i] & 0x00FF00FF) << 8);
393 for ( i = 0; i <
nWords; i++ )
394 pTruth[i] = (pTruth[i] & 0x0000FFFF) | ((pTruth[i] & 0x0000FFFF) << 16);
397 Step = (1 << (iVar - 5));
398 for ( k = 0; k <
nWords; k += 2*Step )
400 for ( i = 0; i < Step; i++ )
401 pTruth[Step+i] = pTruth[i];
428 for ( i = 0; i <
nWords; i++ )
432 for ( i = 0; i <
nWords; i++ )
436 for ( i = 0; i <
nWords; i++ )
440 for ( i = 0; i <
nWords; i++ )
444 for ( i = 0; i <
nWords; i++ )
448 Step = (1 << (iVar - 5));
449 for ( k = 0; k <
nWords; k += 2*Step )
451 for ( i = 0; i < Step; i++ )
479 for ( i = 0; i <
nWords; i++ )
480 pTruth[i] = (pTruth[i] & 0xAAAAAAAA) | ((pTruth[i] & 0xAAAAAAAA) >> 1);
483 for ( i = 0; i <
nWords; i++ )
484 pTruth[i] = (pTruth[i] & 0xCCCCCCCC) | ((pTruth[i] & 0xCCCCCCCC) >> 2);
487 for ( i = 0; i <
nWords; i++ )
488 pTruth[i] = (pTruth[i] & 0xF0F0F0F0) | ((pTruth[i] & 0xF0F0F0F0) >> 4);
491 for ( i = 0; i <
nWords; i++ )
492 pTruth[i] = (pTruth[i] & 0xFF00FF00) | ((pTruth[i] & 0xFF00FF00) >> 8);
495 for ( i = 0; i <
nWords; i++ )
496 pTruth[i] = (pTruth[i] & 0xFFFF0000) | ((pTruth[i] & 0xFFFF0000) >> 16);
499 Step = (1 << (iVar - 5));
500 for ( k = 0; k <
nWords; k += 2*Step )
502 for ( i = 0; i < Step; i++ )
503 pTruth[i] = pTruth[Step+i];
530 for ( i = 0; i <
nWords; i++ )
531 pOut[i] = (pIn[i] & 0x55555555) | ((pIn[i] & 0x55555555) << 1);
534 for ( i = 0; i <
nWords; i++ )
535 pOut[i] = (pIn[i] & 0x33333333) | ((pIn[i] & 0x33333333) << 2);
538 for ( i = 0; i <
nWords; i++ )
539 pOut[i] = (pIn[i] & 0x0F0F0F0F) | ((pIn[i] & 0x0F0F0F0F) << 4);
542 for ( i = 0; i <
nWords; i++ )
543 pOut[i] = (pIn[i] & 0x00FF00FF) | ((pIn[i] & 0x00FF00FF) << 8);
546 for ( i = 0; i <
nWords; i++ )
547 pOut[i] = (pIn[i] & 0x0000FFFF) | ((pIn[i] & 0x0000FFFF) << 16);
550 Step = (1 << (iVar - 5));
551 for ( k = 0; k <
nWords; k += 2*Step )
553 for ( i = 0; i < Step; i++ )
554 pOut[i] = pOut[Step+i] = pIn[i];
582 for ( i = 0; i <
nWords; i++ )
583 pOut[i] = (pIn[i] & 0xAAAAAAAA) | ((pIn[i] & 0xAAAAAAAA) >> 1);
586 for ( i = 0; i <
nWords; i++ )
587 pOut[i] = (pIn[i] & 0xCCCCCCCC) | ((pIn[i] & 0xCCCCCCCC) >> 2);
590 for ( i = 0; i <
nWords; i++ )
591 pOut[i] = (pIn[i] & 0xF0F0F0F0) | ((pIn[i] & 0xF0F0F0F0) >> 4);
594 for ( i = 0; i <
nWords; i++ )
595 pOut[i] = (pIn[i] & 0xFF00FF00) | ((pIn[i] & 0xFF00FF00) >> 8);
598 for ( i = 0; i <
nWords; i++ )
599 pOut[i] = (pIn[i] & 0xFFFF0000) | ((pIn[i] & 0xFFFF0000) >> 16);
602 Step = (1 << (iVar - 5));
603 for ( k = 0; k <
nWords; k += 2*Step )
605 for ( i = 0; i < Step; i++ )
606 pOut[i] = pOut[Step+i] = pIn[Step+i];
634 for ( i = 0; i <
nWords; i++ )
635 if ( ((pOnset[i] & (pOffset[i] >> 1)) | (pOffset[i] & (pOnset[i] >> 1))) & 0x55555555 )
639 for ( i = 0; i <
nWords; i++ )
640 if ( ((pOnset[i] & (pOffset[i] >> 2)) | (pOffset[i] & (pOnset[i] >> 2))) & 0x33333333 )
644 for ( i = 0; i <
nWords; i++ )
645 if ( ((pOnset[i] & (pOffset[i] >> 4)) | (pOffset[i] & (pOnset[i] >> 4))) & 0x0F0F0F0F )
649 for ( i = 0; i <
nWords; i++ )
650 if ( ((pOnset[i] & (pOffset[i] >> 8)) | (pOffset[i] & (pOnset[i] >> 8))) & 0x00FF00FF )
654 for ( i = 0; i <
nWords; i++ )
655 if ( ((pOnset[i] & (pOffset[i] >> 16)) | (pOffset[i] & (pOnset[i] >> 16))) & 0x0000FFFF )
659 Step = (1 << (iVar - 5));
660 for ( k = 0; k <
nWords; k += 2*Step )
662 for ( i = 0; i < Step; i++ )
663 if ( (pOnset[i] & pOffset[Step+i]) | (pOffset[i] & pOnset[Step+i]) )
693 for ( i = 0; i <
nWords; i++ )
694 pTruth[i] |= ((pTruth[i] & 0xAAAAAAAA) >> 1) | ((pTruth[i] & 0x55555555) << 1);
697 for ( i = 0; i <
nWords; i++ )
698 pTruth[i] |= ((pTruth[i] & 0xCCCCCCCC) >> 2) | ((pTruth[i] & 0x33333333) << 2);
701 for ( i = 0; i <
nWords; i++ )
702 pTruth[i] |= ((pTruth[i] & 0xF0F0F0F0) >> 4) | ((pTruth[i] & 0x0F0F0F0F) << 4);
705 for ( i = 0; i <
nWords; i++ )
706 pTruth[i] |= ((pTruth[i] & 0xFF00FF00) >> 8) | ((pTruth[i] & 0x00FF00FF) << 8);
709 for ( i = 0; i <
nWords; i++ )
710 pTruth[i] |= ((pTruth[i] & 0xFFFF0000) >> 16) | ((pTruth[i] & 0x0000FFFF) << 16);
713 Step = (1 << (iVar - 5));
714 for ( k = 0; k <
nWords; k += 2*Step )
716 for ( i = 0; i < Step; i++ )
718 pTruth[i] |= pTruth[Step+i];
719 pTruth[Step+i] = pTruth[i];
747 for ( i = 0; i <
nWords; i++ )
748 pRes[i] = pTruth[i] | ((pTruth[i] & 0xAAAAAAAA) >> 1) | ((pTruth[i] & 0x55555555) << 1);
751 for ( i = 0; i <
nWords; i++ )
752 pRes[i] = pTruth[i] | ((pTruth[i] & 0xCCCCCCCC) >> 2) | ((pTruth[i] & 0x33333333) << 2);
755 for ( i = 0; i <
nWords; i++ )
756 pRes[i] = pTruth[i] | ((pTruth[i] & 0xF0F0F0F0) >> 4) | ((pTruth[i] & 0x0F0F0F0F) << 4);
759 for ( i = 0; i <
nWords; i++ )
760 pRes[i] = pTruth[i] | ((pTruth[i] & 0xFF00FF00) >> 8) | ((pTruth[i] & 0x00FF00FF) << 8);
763 for ( i = 0; i <
nWords; i++ )
764 pRes[i] = pTruth[i] | ((pTruth[i] & 0xFFFF0000) >> 16) | ((pTruth[i] & 0x0000FFFF) << 16);
767 Step = (1 << (iVar - 5));
768 for ( k = 0; k <
nWords; k += 2*Step )
770 for ( i = 0; i < Step; i++ )
772 pRes[i] = pTruth[i] | pTruth[Step+i];
773 pRes[Step+i] = pRes[i];
797 for ( v = 0; v < nVars; v++ )
798 if ( uMask & (1 << v) )
822 for ( i = 0; i <
nWords; i++ )
823 pTruth[i] &= ((pTruth[i] & 0xAAAAAAAA) >> 1) | ((pTruth[i] & 0x55555555) << 1);
826 for ( i = 0; i <
nWords; i++ )
827 pTruth[i] &= ((pTruth[i] & 0xCCCCCCCC) >> 2) | ((pTruth[i] & 0x33333333) << 2);
830 for ( i = 0; i <
nWords; i++ )
831 pTruth[i] &= ((pTruth[i] & 0xF0F0F0F0) >> 4) | ((pTruth[i] & 0x0F0F0F0F) << 4);
834 for ( i = 0; i <
nWords; i++ )
835 pTruth[i] &= ((pTruth[i] & 0xFF00FF00) >> 8) | ((pTruth[i] & 0x00FF00FF) << 8);
838 for ( i = 0; i <
nWords; i++ )
839 pTruth[i] &= ((pTruth[i] & 0xFFFF0000) >> 16) | ((pTruth[i] & 0x0000FFFF) << 16);
842 Step = (1 << (iVar - 5));
843 for ( k = 0; k <
nWords; k += 2*Step )
845 for ( i = 0; i < Step; i++ )
847 pTruth[i] &= pTruth[Step+i];
848 pTruth[Step+i] = pTruth[i];
876 for ( i = 0; i <
nWords; i++ )
877 pRes[i] = pTruth[i] & (((pTruth[i] & 0xAAAAAAAA) >> 1) | ((pTruth[i] & 0x55555555) << 1));
880 for ( i = 0; i <
nWords; i++ )
881 pRes[i] = pTruth[i] & (((pTruth[i] & 0xCCCCCCCC) >> 2) | ((pTruth[i] & 0x33333333) << 2));
884 for ( i = 0; i <
nWords; i++ )
885 pRes[i] = pTruth[i] & (((pTruth[i] & 0xF0F0F0F0) >> 4) | ((pTruth[i] & 0x0F0F0F0F) << 4));
888 for ( i = 0; i <
nWords; i++ )
889 pRes[i] = pTruth[i] & (((pTruth[i] & 0xFF00FF00) >> 8) | ((pTruth[i] & 0x00FF00FF) << 8));
892 for ( i = 0; i <
nWords; i++ )
893 pRes[i] = pTruth[i] & (((pTruth[i] & 0xFFFF0000) >> 16) | ((pTruth[i] & 0x0000FFFF) << 16));
896 Step = (1 << (iVar - 5));
897 for ( k = 0; k <
nWords; k += 2*Step )
899 for ( i = 0; i < Step; i++ )
901 pRes[i] = pTruth[i] & pTruth[Step+i];
902 pRes[Step+i] = pRes[i];
931 for ( i = 0; i <
nWords; i++ )
932 pRes[i] = pTruth[i] ^ (((pTruth[i] & 0xAAAAAAAA) >> 1) | ((pTruth[i] & 0x55555555) << 1));
935 for ( i = 0; i <
nWords; i++ )
936 pRes[i] = pTruth[i] ^ (((pTruth[i] & 0xCCCCCCCC) >> 2) | ((pTruth[i] & 0x33333333) << 2));
939 for ( i = 0; i <
nWords; i++ )
940 pRes[i] = pTruth[i] ^ (((pTruth[i] & 0xF0F0F0F0) >> 4) | ((pTruth[i] & 0x0F0F0F0F) << 4));
943 for ( i = 0; i <
nWords; i++ )
944 pRes[i] = pTruth[i] ^ (((pTruth[i] & 0xFF00FF00) >> 8) | ((pTruth[i] & 0x00FF00FF) << 8));
947 for ( i = 0; i <
nWords; i++ )
948 pRes[i] = pTruth[i] ^ (((pTruth[i] & 0xFFFF0000) >> 16) | ((pTruth[i] & 0x0000FFFF) << 16));
951 Step = (1 << (iVar - 5));
952 for ( k = 0; k <
nWords; k += 2*Step )
954 for ( i = 0; i < Step; i++ )
956 pRes[i] = pTruth[i] ^ pTruth[Step+i];
957 pRes[Step+i] = pRes[i];
986 for ( i = 0; i <
nWords; i++ )
990 for ( i = 0; i <
nWords; i++ )
994 for ( i = 0; i <
nWords; i++ )
998 for ( i = 0; i <
nWords; i++ )
1002 for ( i = 0; i <
nWords; i++ )
1006 Step = (1 << (iVar - 5));
1007 for ( k = 0; k <
nWords; k += 2*Step )
1009 for ( i = 0; i < Step; i++ )
1032 for ( i = 0; i <
nWords; i++ )
1052 for ( v = 0; v < nVars; v++ )
1053 if ( uMask & (1 << v) )
1069 void Kit_TruthMuxVar(
unsigned * pOut,
unsigned * pCof0,
unsigned * pCof1,
int nVars,
int iVar )
1078 for ( i = 0; i <
nWords; i++ )
1079 pOut[i] = (pCof0[i] & 0x55555555) | (pCof1[i] & 0xAAAAAAAA);
1082 for ( i = 0; i <
nWords; i++ )
1083 pOut[i] = (pCof0[i] & 0x33333333) | (pCof1[i] & 0xCCCCCCCC);
1086 for ( i = 0; i <
nWords; i++ )
1087 pOut[i] = (pCof0[i] & 0x0F0F0F0F) | (pCof1[i] & 0xF0F0F0F0);
1090 for ( i = 0; i <
nWords; i++ )
1091 pOut[i] = (pCof0[i] & 0x00FF00FF) | (pCof1[i] & 0xFF00FF00);
1094 for ( i = 0; i <
nWords; i++ )
1095 pOut[i] = (pCof0[i] & 0x0000FFFF) | (pCof1[i] & 0xFFFF0000);
1098 Step = (1 << (iVar - 5));
1099 for ( k = 0; k <
nWords; k += 2*Step )
1101 for ( i = 0; i < Step; i++ )
1104 pOut[Step+i] = pCof1[Step+i];
1140 for ( i = 0; i <
nWords; i++ )
1141 pOut[i] = (~pCof0[i] & 0x55555555) | (pCof1[i] & 0xAAAAAAAA);
1144 for ( i = 0; i <
nWords; i++ )
1145 pOut[i] = (~pCof0[i] & 0x33333333) | (pCof1[i] & 0xCCCCCCCC);
1148 for ( i = 0; i <
nWords; i++ )
1149 pOut[i] = (~pCof0[i] & 0x0F0F0F0F) | (pCof1[i] & 0xF0F0F0F0);
1152 for ( i = 0; i <
nWords; i++ )
1153 pOut[i] = (~pCof0[i] & 0x00FF00FF) | (pCof1[i] & 0xFF00FF00);
1156 for ( i = 0; i <
nWords; i++ )
1157 pOut[i] = (~pCof0[i] & 0x0000FFFF) | (pCof1[i] & 0xFFFF0000);
1160 Step = (1 << (iVar - 5));
1161 for ( k = 0; k <
nWords; k += 2*Step )
1163 for ( i = 0; i < Step; i++ )
1165 pOut[i] = ~pCof0[i];
1166 pOut[Step+i] = pCof1[Step+i];
1187 int Kit_TruthVarsSymm(
unsigned * pTruth,
int nVars,
int iVar0,
int iVar1,
unsigned * pCof0,
unsigned * pCof1 )
1189 static unsigned uTemp0[32], uTemp1[32];
1190 if ( pCof0 == NULL )
1195 if ( pCof1 == NULL )
1225 static unsigned uTemp0[32], uTemp1[32];
1226 if ( pCof0 == NULL )
1231 if ( pCof1 == NULL )
1269 for ( i = 0; i <
nWords; i++ )
1270 pTruth[i] = ((pTruth[i] & 0x55555555) << 1) | ((pTruth[i] & 0xAAAAAAAA) >> 1);
1273 for ( i = 0; i <
nWords; i++ )
1274 pTruth[i] = ((pTruth[i] & 0x33333333) << 2) | ((pTruth[i] & 0xCCCCCCCC) >> 2);
1277 for ( i = 0; i <
nWords; i++ )
1278 pTruth[i] = ((pTruth[i] & 0x0F0F0F0F) << 4) | ((pTruth[i] & 0xF0F0F0F0) >> 4);
1281 for ( i = 0; i <
nWords; i++ )
1282 pTruth[i] = ((pTruth[i] & 0x00FF00FF) << 8) | ((pTruth[i] & 0xFF00FF00) >> 8);
1285 for ( i = 0; i <
nWords; i++ )
1286 pTruth[i] = ((pTruth[i] & 0x0000FFFF) << 16) | ((pTruth[i] & 0xFFFF0000) >> 16);
1289 Step = (1 << (iVar - 5));
1290 for ( k = 0; k <
nWords; k += 2*Step )
1292 for ( i = 0; i < Step; i++ )
1295 pTruth[i] = pTruth[Step+i];
1296 pTruth[Step+i] = Temp;
1317 static unsigned uCofactor[16];
1318 int i, ValueCur, ValueMin, VarMin;
1319 unsigned uSupp0, uSupp1;
1324 for ( i = 0; i < nVars; i++ )
1340 if ( ValueMin > ValueCur && nVars0 <= 5 && nVars1 <= 5 )
1342 ValueMin = ValueCur;
1345 if ( ValueMin == 0 )
1367 int i, iBestVar, nSuppSizeCur0, nSuppSizeCur1, nSuppSizeCur, nSuppSizeMin;
1373 for ( i = 0; i < nVars; i++ )
1380 nSuppSizeCur = nSuppSizeCur0 + nSuppSizeCur1;
1382 if ( nSuppSizeMin > nSuppSizeCur )
1384 nSuppSizeMin = nSuppSizeCur;
1388 assert( iBestVar != -1 );
1414 memset( pStore, 0,
sizeof(
int) * 2 * nVars );
1446 for ( k = 0; k <
nWords; k++ )
1449 for ( i = 5; i < nVars; i++ )
1450 if ( k & (1 << (i-5)) )
1456 for ( k = 0; k < nWords/2; k++ )
1458 pStore[2*0+0] +=
Kit_WordCountOnes( (pTruth[0] & 0x55555555) | ((pTruth[1] & 0x55555555) << 1) );
1459 pStore[2*0+1] +=
Kit_WordCountOnes( (pTruth[0] & 0xAAAAAAAA) | ((pTruth[1] & 0xAAAAAAAA) >> 1) );
1460 pStore[2*1+0] +=
Kit_WordCountOnes( (pTruth[0] & 0x33333333) | ((pTruth[1] & 0x33333333) << 2) );
1461 pStore[2*1+1] +=
Kit_WordCountOnes( (pTruth[0] & 0xCCCCCCCC) | ((pTruth[1] & 0xCCCCCCCC) >> 2) );
1462 pStore[2*2+0] +=
Kit_WordCountOnes( (pTruth[0] & 0x0F0F0F0F) | ((pTruth[1] & 0x0F0F0F0F) << 4) );
1463 pStore[2*2+1] +=
Kit_WordCountOnes( (pTruth[0] & 0xF0F0F0F0) | ((pTruth[1] & 0xF0F0F0F0) >> 4) );
1464 pStore[2*3+0] +=
Kit_WordCountOnes( (pTruth[0] & 0x00FF00FF) | ((pTruth[1] & 0x00FF00FF) << 8) );
1465 pStore[2*3+1] +=
Kit_WordCountOnes( (pTruth[0] & 0xFF00FF00) | ((pTruth[1] & 0xFF00FF00) >> 8) );
1466 pStore[2*4+0] +=
Kit_WordCountOnes( (pTruth[0] & 0x0000FFFF) | ((pTruth[1] & 0x0000FFFF) << 16) );
1467 pStore[2*4+1] +=
Kit_WordCountOnes( (pTruth[0] & 0xFFFF0000) | ((pTruth[1] & 0xFFFF0000) >> 16) );
1490 memset( pStore, 0,
sizeof(
int) * nVars );
1507 for ( k = 0; k <
nWords; k++ )
1510 for ( i = 5; i < nVars; i++ )
1511 if ( (k & (1 << (i-5))) == 0 )
1515 for ( k = 0; k < nWords/2; k++ )
1517 pStore[0] +=
Kit_WordCountOnes( (pTruth[0] & 0x55555555) | ((pTruth[1] & 0x55555555) << 1) );
1518 pStore[1] +=
Kit_WordCountOnes( (pTruth[0] & 0x33333333) | ((pTruth[1] & 0x33333333) << 2) );
1519 pStore[2] +=
Kit_WordCountOnes( (pTruth[0] & 0x0F0F0F0F) | ((pTruth[1] & 0x0F0F0F0F) << 4) );
1520 pStore[3] +=
Kit_WordCountOnes( (pTruth[0] & 0x00FF00FF) | ((pTruth[1] & 0x00FF00FF) << 8) );
1521 pStore[4] +=
Kit_WordCountOnes( (pTruth[0] & 0x0000FFFF) | ((pTruth[1] & 0x0000FFFF) << 16) );
1540 for ( i = 0; i < nVars; i++ )
1564 static int HashPrimes[1024] = { 2, 3, 5,
1565 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,
1566 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191,
1567 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283,
1568 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401,
1569 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509,
1570 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631,
1571 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751,
1572 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877,
1573 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997,
1574 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091,
1575 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193,
1576 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291,
1577 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423,
1578 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493,
1579 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601,
1580 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699,
1581 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811,
1582 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931,
1583 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029,
1584 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137,
1585 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267,
1586 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357,
1587 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459,
1588 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593,
1589 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693,
1590 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791,
1591 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903,
1592 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023,
1593 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167,
1594 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271,
1595 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373,
1596 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511,
1597 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607,
1598 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709,
1599 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833,
1600 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931,
1601 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057,
1602 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177,
1603 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283,
1604 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423,
1605 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547,
1606 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657,
1607 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789,
1608 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931,
1609 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011,
1610 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147,
1611 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279,
1612 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413,
1613 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507,
1614 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647,
1615 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743,
1616 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857,
1617 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007,
1618 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121,
1619 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247,
1620 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343,
1621 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473,
1622 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607,
1623 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733,
1624 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857,
1625 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971,
1626 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103,
1627 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229,
1628 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369,
1629 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517,
1630 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603,
1631 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723,
1632 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873,
1633 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009,
1634 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, 8117, 8123,
1638 assert( nWords <= 1024 );
1640 for ( i = 0; i <
nWords; i++ )
1641 uHashKey ^= HashPrimes[i] * pIn[i];
1660 unsigned * pIn = pInOut, * pOut = pAux, * pTemp;
1662 int i, Temp, fChange,
Counter, nOnes;
1663 unsigned uCanonPhase;
1667 for ( i = 0; i < nVars; i++ )
1672 if ( (nOnes > nWords * 16) )
1674 uCanonPhase |= (1 << nVars);
1688 for ( i = 0; i < nVars; i++ )
1690 if ( pStore[2*i+0] >= pStore[2*i+1] )
1692 uCanonPhase |= (1 << i);
1693 Temp = pStore[2*i+0];
1694 pStore[2*i+0] = pStore[2*i+1];
1695 pStore[2*i+1] = Temp;
1706 for ( i = 0; i < nVars-1; i++ )
1708 if ( pStore[2*i] >= pStore[2*(i+1)] )
1713 Temp = pCanonPerm[i];
1714 pCanonPerm[i] = pCanonPerm[i+1];
1715 pCanonPerm[i+1] = Temp;
1718 pStore[2*i] = pStore[2*(i+1)];
1719 pStore[2*(i+1)] = Temp;
1721 Temp = pStore[2*i+1];
1722 pStore[2*i+1] = pStore[2*(i+1)+1];
1723 pStore[2*(i+1)+1] = Temp;
1726 if ( ((uCanonPhase & (1 << i)) > 0) != ((uCanonPhase & (1 << (i+1))) > 0) )
1728 uCanonPhase ^= (1 << i);
1729 uCanonPhase ^= (1 << (i+1));
1733 pTemp = pIn; pIn = pOut; pOut = pTemp;
1735 }
while ( fChange );
1842 static unsigned Table[256] = {
1843 0x00000000, 0x01010101, 0x01010001, 0x02020102, 0x01000101, 0x02010202, 0x02010102, 0x03020203,
1844 0x01000001, 0x02010102, 0x02010002, 0x03020103, 0x02000102, 0x03010203, 0x03010103, 0x04020204,
1845 0x00010101, 0x01020202, 0x01020102, 0x02030203, 0x01010202, 0x02020303, 0x02020203, 0x03030304,
1846 0x01010102, 0x02020203, 0x02020103, 0x03030204, 0x02010203, 0x03020304, 0x03020204, 0x04030305,
1847 0x00010001, 0x01020102, 0x01020002, 0x02030103, 0x01010102, 0x02020203, 0x02020103, 0x03030204,
1848 0x01010002, 0x02020103, 0x02020003, 0x03030104, 0x02010103, 0x03020204, 0x03020104, 0x04030205,
1849 0x00020102, 0x01030203, 0x01030103, 0x02040204, 0x01020203, 0x02030304, 0x02030204, 0x03040305,
1850 0x01020103, 0x02030204, 0x02030104, 0x03040205, 0x02020204, 0x03030305, 0x03030205, 0x04040306,
1851 0x00000101, 0x01010202, 0x01010102, 0x02020203, 0x01000202, 0x02010303, 0x02010203, 0x03020304,
1852 0x01000102, 0x02010203, 0x02010103, 0x03020204, 0x02000203, 0x03010304, 0x03010204, 0x04020305,
1853 0x00010202, 0x01020303, 0x01020203, 0x02030304, 0x01010303, 0x02020404, 0x02020304, 0x03030405,
1854 0x01010203, 0x02020304, 0x02020204, 0x03030305, 0x02010304, 0x03020405, 0x03020305, 0x04030406,
1855 0x00010102, 0x01020203, 0x01020103, 0x02030204, 0x01010203, 0x02020304, 0x02020204, 0x03030305,
1856 0x01010103, 0x02020204, 0x02020104, 0x03030205, 0x02010204, 0x03020305, 0x03020205, 0x04030306,
1857 0x00020203, 0x01030304, 0x01030204, 0x02040305, 0x01020304, 0x02030405, 0x02030305, 0x03040406,
1858 0x01020204, 0x02030305, 0x02030205, 0x03040306, 0x02020305, 0x03030406, 0x03030306, 0x04040407,
1859 0x00000001, 0x01010102, 0x01010002, 0x02020103, 0x01000102, 0x02010203, 0x02010103, 0x03020204,
1860 0x01000002, 0x02010103, 0x02010003, 0x03020104, 0x02000103, 0x03010204, 0x03010104, 0x04020205,
1861 0x00010102, 0x01020203, 0x01020103, 0x02030204, 0x01010203, 0x02020304, 0x02020204, 0x03030305,
1862 0x01010103, 0x02020204, 0x02020104, 0x03030205, 0x02010204, 0x03020305, 0x03020205, 0x04030306,
1863 0x00010002, 0x01020103, 0x01020003, 0x02030104, 0x01010103, 0x02020204, 0x02020104, 0x03030205,
1864 0x01010003, 0x02020104, 0x02020004, 0x03030105, 0x02010104, 0x03020205, 0x03020105, 0x04030206,
1865 0x00020103, 0x01030204, 0x01030104, 0x02040205, 0x01020204, 0x02030305, 0x02030205, 0x03040306,
1866 0x01020104, 0x02030205, 0x02030105, 0x03040206, 0x02020205, 0x03030306, 0x03030206, 0x04040307,
1867 0x00000102, 0x01010203, 0x01010103, 0x02020204, 0x01000203, 0x02010304, 0x02010204, 0x03020305,
1868 0x01000103, 0x02010204, 0x02010104, 0x03020205, 0x02000204, 0x03010305, 0x03010205, 0x04020306,
1869 0x00010203, 0x01020304, 0x01020204, 0x02030305, 0x01010304, 0x02020405, 0x02020305, 0x03030406,
1870 0x01010204, 0x02020305, 0x02020205, 0x03030306, 0x02010305, 0x03020406, 0x03020306, 0x04030407,
1871 0x00010103, 0x01020204, 0x01020104, 0x02030205, 0x01010204, 0x02020305, 0x02020205, 0x03030306,
1872 0x01010104, 0x02020205, 0x02020105, 0x03030206, 0x02010205, 0x03020306, 0x03020206, 0x04030307,
1873 0x00020204, 0x01030305, 0x01030205, 0x02040306, 0x01020305, 0x02030406, 0x02030306, 0x03040407,
1874 0x01020205, 0x02030306, 0x02030206, 0x03040307, 0x02020306, 0x03030407, 0x03030307, 0x04040408
1877 unsigned char * pTruthC, * pLimit;
1878 int * pBytes = pBytesInit;
1884 memset( pRes, 0,
sizeof(
int) * nVars );
1889 nBytes = nWords * 4;
1890 pTruthC = (
unsigned char *)pTruth;
1891 pLimit = pTruthC + nBytes;
1892 for ( ; pTruthC < pLimit; pTruthC++ )
1894 uSum += Table[*pTruthC];
1895 *pBytes++ = (Table[*pTruthC] & 0xff);
1896 if ( (uSum & 0xff) > 246 )
1898 nTotal += (uSum & 0xff);
1899 pRes[0] += ((uSum >> 8) & 0xff);
1900 pRes[2] += ((uSum >> 16) & 0xff);
1901 pRes[3] += ((uSum >> 24) & 0xff);
1907 nTotal += (uSum & 0xff);
1908 pRes[0] += ((uSum >> 8) & 0xff);
1909 pRes[1] += ((uSum >> 16) & 0xff);
1910 pRes[2] += ((uSum >> 24) & 0xff);
1914 for ( iVar = 3, Step = 1; Step < nBytes; Step *= 2, iVar++ )
1915 for ( i = 0; i < nBytes; i += Step + Step )
1917 pRes[iVar] += pBytesInit[i];
1918 pBytesInit[i] += pBytesInit[i+Step];
1920 assert( pBytesInit[0] == nTotal );
1923 for ( i = 0; i < nVars; i++ )
1941 int nDigits, Digit, k;
1943 nDigits = (1 << nVars) / 4;
1944 for ( k = nDigits - 1; k >= 0; k-- )
1946 Digit = ((Sign[k/8] >> ((k%8) * 4)) & 15);
1948 fprintf( pFile,
"%d", Digit );
1950 fprintf( pFile,
"%c",
'a' + Digit-10 );
1969 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
1970 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
1971 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
1972 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
1973 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
1974 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
1975 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
1976 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8
1979 for ( i = 0; i < 256; i++ )
1983 uWord = bit_count[i];
1984 uWord |= (bit_count[i & 0x55] << 8);
1985 uWord |= (bit_count[i & 0x33] << 16);
1986 uWord |= (bit_count[i & 0x0f] << 24);
2006 static char pFileName[100];
2008 sprintf( pFileName,
"tt\\s%04d", nFile );
2009 pFile = fopen( pFileName,
"w" );
2010 fprintf( pFile,
"rt " );
2012 fprintf( pFile,
"; bdd; sop; ps\n" );
2036 int Unique2[20][20];
2037 int Common2[20][20];
2039 int * pBytes =
ABC_ALLOC(
int, nWords * 4 );
2040 unsigned * pIn =
ABC_ALLOC(
unsigned, nWords );
2041 unsigned * pOut =
ABC_ALLOC(
unsigned, nWords );
2042 unsigned * pCof00 =
ABC_ALLOC(
unsigned, nWords );
2043 unsigned * pCof01 =
ABC_ALLOC(
unsigned, nWords );
2044 unsigned * pCof10 =
ABC_ALLOC(
unsigned, nWords );
2045 unsigned * pCof11 =
ABC_ALLOC(
unsigned, nWords );
2047 int nTotalMints, nTotalMints0, nTotalMints1;
2048 int v, u, i, iVar, nMints1;
2049 int Cof00, Cof01, Cof10, Cof11;
2050 int Coz00, Coz01, Coz10, Coz11;
2055 for ( v = 0; v < nVars; v++ )
2058 for ( v = 0; v < nVars; v++ )
2059 for ( u = 0; u < nVars; u++ )
2060 Total2[v][u] = Unique2[v][u] = Common2[v][u] = -1;
2062 nMints1 = (1<<(nVars-2));
2063 for ( v = 0; v < nVars; v++ )
2068 for ( i = v; i < nVars - 1; i++ )
2071 pTemp = pIn; pIn = pOut; pOut = pTemp;
2080 assert( nTotalMints == nTotalMints0 + nTotalMints1 );
2090 for ( u = 0; u < nVars-1; u++ )
2098 Cof00 = Mints0[u]; Coz00 = nMints1 - Cof00;
2099 Cof01 = nTotalMints0-Mints0[u]; Coz01 = nMints1 - Cof01;
2100 Cof10 = Mints1[u]; Coz10 = nMints1 - Cof10;
2101 Cof11 = nTotalMints1-Mints1[u]; Coz11 = nMints1 - Cof11;
2103 assert( Cof00 >= 0 && Cof00 <= nMints1 );
2104 assert( Cof01 >= 0 && Cof01 <= nMints1 );
2105 assert( Cof10 >= 0 && Cof10 <= nMints1 );
2106 assert( Cof11 >= 0 && Cof11 <= nMints1 );
2108 assert( Coz00 >= 0 && Coz00 <= nMints1 );
2109 assert( Coz01 >= 0 && Coz01 <= nMints1 );
2110 assert( Coz10 >= 0 && Coz10 <= nMints1 );
2111 assert( Coz11 >= 0 && Coz11 <= nMints1 );
2113 Common2[v][iVar] = Common2[iVar][v] = Cof00 * Coz11 + Coz00 * Cof11 + Cof01 * Coz10 + Coz01 * Cof10;
2115 Total2[v][iVar] = Total2[iVar][v] =
2116 Cof00 * Coz01 + Coz00 * Cof01 +
2117 Cof00 * Coz10 + Coz00 * Cof10 +
2118 Cof00 * Coz11 + Coz00 * Cof11 +
2119 Cof01 * Coz10 + Coz01 * Cof10 +
2120 Cof01 * Coz11 + Coz01 * Cof11 +
2121 Cof10 * Coz11 + Coz10 * Cof11 ;
2129 Unique2[v][iVar] = Unique2[iVar][v] =
2141 for ( v = 0; v < nVars; v++ )
2142 printf(
"%8c ", v+
'a' );
2146 for ( v = 0; v < nVars; v++ )
2147 printf(
"%8d ", Mints[v] );
2151 for ( v = 0; v < nVars; v++ )
2152 printf(
"%8d ", Unique1[v] );
2156 printf(
"Unique:\n" );
2157 for ( i = 0; i < nVars; i++ )
2159 printf(
" %2d ", i );
2160 for ( v = 0; v < nVars; v++ )
2161 printf(
"%8d ", Unique2[i][v] );
2165 printf(
"Common:\n" );
2166 for ( i = 0; i < nVars; i++ )
2168 printf(
" %2d ", i );
2169 for ( v = 0; v < nVars; v++ )
2170 printf(
"%8d ", Common2[i][v] );
2174 printf(
"Total:\n" );
2175 for ( i = 0; i < nVars; i++ )
2177 printf(
" %2d ", i );
2178 for ( v = 0; v < nVars; v++ )
2179 printf(
"%8d ", Total2[i][v] );
2212 uTruth[0] = pTruth[0];
2213 uTruth[1] = pTruth[0];
char * Kit_TruthDumpToFile(unsigned *pTruth, int nVars, int nFile)
int Kit_TruthVarsAntiSymm(unsigned *pTruth, int nVars, int iVar0, int iVar1, unsigned *pCof0, unsigned *pCof1)
void Kit_PrintHexadecimal(FILE *pFile, unsigned Sign[], int nVars)
static int Kit_TruthWordNum(int nVars)
void Kit_TruthExistSet(unsigned *pRes, unsigned *pTruth, int nVars, unsigned uMask)
unsigned Kit_TruthSemiCanonicize(unsigned *pInOut, unsigned *pAux, int nVars, char *pCanonPerm)
int Kit_TruthBooleanDiffCount(unsigned *pTruth, int nVars, int iVar)
int Kit_TruthVarInSupport(unsigned *pTruth, int nVars, int iVar)
#define ABC_ALLOC(type, num)
ABC_NAMESPACE_IMPL_START void Kit_TruthSwapAdjacentVars(unsigned *pOut, unsigned *pIn, int nVars, int iVar)
DECLARATIONS ///.
void Kit_TruthCofactor1(unsigned *pTruth, int nVars, int iVar)
static int Kit_TruthIsEqual(unsigned *pIn0, unsigned *pIn1, int nVars)
static int Kit_TruthIsConst0(unsigned *pIn, int nVars)
void Kit_TruthStretch(unsigned *pOut, unsigned *pIn, int nVars, int nVarsAll, unsigned Phase, int fReturnIn)
void Kit_TruthCofactor1New(unsigned *pOut, unsigned *pIn, int nVars, int iVar)
static int bit_count[256]
void Kit_TruthSwapAdjacentVars2(unsigned *pIn, unsigned *pOut, int nVars, int Start)
void Kit_TruthCountMintermsPrecomp()
int Kit_TruthSupportSize(unsigned *pTruth, int nVars)
void Kit_TruthPrintProfile_int(unsigned *pTruth, int nVars)
void Kit_TruthCountOnesInCofsSlow(unsigned *pTruth, int nVars, int *pStore, unsigned *pAux)
void Kit_TruthExistNew(unsigned *pRes, unsigned *pTruth, int nVars, int iVar)
void Kit_TruthMuxVar(unsigned *pOut, unsigned *pCof0, unsigned *pCof1, int nVars, int iVar)
static int Kit_TruthIsConst1(unsigned *pIn, int nVars)
void Kit_TruthPermute(unsigned *pOut, unsigned *pIn, int nVars, char *pPerm, int fReturnIn)
int Kit_TruthXorCount(unsigned *pTruth0, unsigned *pTruth1, int nVars)
void Kit_TruthMuxVarPhase(unsigned *pOut, unsigned *pCof0, unsigned *pCof1, int nVars, int iVar, int fCompl0)
int Kit_TruthBestCofVar(unsigned *pTruth, int nVars, unsigned *pCof0, unsigned *pCof1)
void Kit_TruthUniqueNew(unsigned *pRes, unsigned *pTruth, int nVars, int iVar)
void Kit_TruthExist(unsigned *pTruth, int nVars, int iVar)
#define ABC_NAMESPACE_IMPL_END
static int Kit_TruthCountOnes(unsigned *pIn, int nVars)
int Kit_TruthVarIsVacuous(unsigned *pOnset, unsigned *pOffset, int nVars, int iVar)
int Kit_TruthMinCofSuppOverlap(unsigned *pTruth, int nVars, int *pVarMin)
static void Kit_TruthNot(unsigned *pOut, unsigned *pIn, int nVars)
void Kit_TruthForallSet(unsigned *pRes, unsigned *pTruth, int nVars, unsigned uMask)
void Kit_TruthShrink(unsigned *pOut, unsigned *pIn, int nVars, int nVarsAll, unsigned Phase, int fReturnIn)
void Kit_TruthCofactor0New(unsigned *pOut, unsigned *pIn, int nVars, int iVar)
void Kit_TruthForall(unsigned *pTruth, int nVars, int iVar)
void Kit_TruthChangePhase(unsigned *pTruth, int nVars, int iVar)
void Kit_TruthCofactor0(unsigned *pTruth, int nVars, int iVar)
#define ABC_NAMESPACE_IMPL_START
void Kit_TruthPrintProfile(unsigned *pTruth, int nVars)
int Kit_TruthVarsSymm(unsigned *pTruth, int nVars, int iVar0, int iVar1, unsigned *pCof0, unsigned *pCof1)
static void Kit_TruthCopy(unsigned *pOut, unsigned *pIn, int nVars)
static int Kit_WordCountOnes(unsigned uWord)
void Kit_TruthCountOnesInCofs0(unsigned *pTruth, int nVars, int *pStore)
unsigned Kit_TruthHash(unsigned *pIn, int nWords)
unsigned Kit_TruthSupport(unsigned *pTruth, int nVars)
void Kit_TruthCountOnesInCofs(unsigned *pTruth, int nVars, int *pStore)
void Kit_TruthForallNew(unsigned *pRes, unsigned *pTruth, int nVars, int iVar)
int Kit_TruthCountMinterms(unsigned *pTruth, int nVars, int *pRes, int *pBytesInit)
int nTotal
DECLARATIONS ///.
int Kit_TruthCofactor0Count(unsigned *pTruth, int nVars, int iVar)