48 pcube temp = cube.temp[0], *Tc_save, *Tc, *T1;
62 for(T1 = T+2; (p = *T1++) != NULL; ) {
66 if (!
cdist0(p, c))
goto false;
68 {
register int w,last;
register unsigned int x;
if((last=cube.inword)!=-1)
69 {x=p[last]&c[last];
if(~(x|x>>1)&cube.inmask)
goto false;
for(w=1;w<last;w++)
70 {x=p[w]&c[w];
if(~(x|x>>1)&
DISJOINT)
goto false;}}}{
register int w,
var,last;
71 register pcube mask;
for(var=cube.num_binary_vars;var<cube.num_vars;var++){
72 mask=cube.var_mask[
var];last=cube.last_word[
var];
for(w=cube.first_word[var
73 ];w<=last;w++)
if(p[w]&c[w]&mask[w])
goto nextvar;
goto false;nextvar:;}}
82 Tc_save[1] = (
pcube) Tc;
98 register pcube p, mask = cube.temp[1], *T1;
99 register int first = cube.first_word[
var], last = cube.last_word[
var];
112 (void)
set_and(mask, cube.var_mask[var], c);
115 for(T1 = T+2; (p = *T1++) != NULL; )
117 register int i = first;
119 if (p[i] & mask[i]) {
126 *Tc++ = (
pcube) NULL;
127 Tc_save[1] = (
pcube) Tc;
134 int *count = cdata.part_zeros;
139 for(i = cube.size - 1; i >= 0; i--)
144 {
register int i, *cnt;
145 register unsigned int val;
146 register pcube p, cof = T[0], full = cube.fullset;
147 for(T1 = T+2; (p = *T1++) != NULL; )
148 for(i =
LOOP(p); i > 0; i--)
149 if ((val = full[i] & ~ (p[i] | cof[i]))) {
150 cnt = count + ((i-1) <<
LOGBPI);
152 if (val & 0xFF000000) {
153 if (val & 0x80000000) cnt[31]++;
154 if (val & 0x40000000) cnt[30]++;
155 if (val & 0x20000000) cnt[29]++;
156 if (val & 0x10000000) cnt[28]++;
157 if (val & 0x08000000) cnt[27]++;
158 if (val & 0x04000000) cnt[26]++;
159 if (val & 0x02000000) cnt[25]++;
160 if (val & 0x01000000) cnt[24]++;
162 if (val & 0x00FF0000) {
163 if (val & 0x00800000) cnt[23]++;
164 if (val & 0x00400000) cnt[22]++;
165 if (val & 0x00200000) cnt[21]++;
166 if (val & 0x00100000) cnt[20]++;
167 if (val & 0x00080000) cnt[19]++;
168 if (val & 0x00040000) cnt[18]++;
169 if (val & 0x00020000) cnt[17]++;
170 if (val & 0x00010000) cnt[16]++;
174 if (val & 0x8000) cnt[15]++;
175 if (val & 0x4000) cnt[14]++;
176 if (val & 0x2000) cnt[13]++;
177 if (val & 0x1000) cnt[12]++;
178 if (val & 0x0800) cnt[11]++;
179 if (val & 0x0400) cnt[10]++;
180 if (val & 0x0200) cnt[ 9]++;
181 if (val & 0x0100) cnt[ 8]++;
184 if (val & 0x0080) cnt[ 7]++;
185 if (val & 0x0040) cnt[ 6]++;
186 if (val & 0x0020) cnt[ 5]++;
187 if (val & 0x0010) cnt[ 4]++;
188 if (val & 0x0008) cnt[ 3]++;
189 if (val & 0x0004) cnt[ 2]++;
190 if (val & 0x0002) cnt[ 1]++;
191 if (val & 0x0001) cnt[ 0]++;
209 {
register int var, i, lastbit, active, maxactive;
210 int best = -1, mostactive = 0, mostzero = 0, mostbalanced = 32000;
211 cdata.vars_unate = cdata.vars_active = 0;
213 for(var = 0; var < cube.num_vars; var++) {
214 if (var < cube.num_binary_vars) {
216 lastbit = count[var*2 + 1];
217 active = (i > 0) + (lastbit > 0);
218 cdata.var_zeros[
var] = i + lastbit;
219 maxactive =
MAX(i, lastbit);
221 maxactive = active = cdata.var_zeros[
var] = 0;
222 lastbit = cube.last_part[
var];
223 for(i = cube.first_part[var]; i <= lastbit; i++) {
224 cdata.var_zeros[
var] += count[i];
225 active += (count[i] > 0);
226 if (active > maxactive) maxactive = active;
232 if (active > mostactive)
233 best =
var, mostactive = active, mostzero = cdata.var_zeros[
best],
234 mostbalanced = maxactive;
235 else if (active == mostactive)
239 if (cdata.var_zeros[var] > mostzero)
240 best =
var, mostzero = cdata.var_zeros[
best],
241 mostbalanced = maxactive;
242 else if (cdata.var_zeros[var] == mostzero)
245 if (maxactive < mostbalanced)
246 best =
var, mostbalanced = maxactive;
249 cdata.parts_active[
var] = active;
250 cdata.is_unate[
var] = (active == 1);
251 cdata.vars_active += (active > 0);
252 cdata.vars_unate += (active == 1);
260 IN register
pcube cleft, cright;
263 int best = cdata.best;
264 register int i, lastbit = cube.last_part[
best], halfbit = 0;
265 register pcube cof=T[0];
268 (void)
set_diff(cleft, cube.fullset, cube.var_mask[best]);
269 (void)
set_diff(cright, cube.fullset, cube.var_mask[best]);
270 for(i = cube.first_part[best]; i <= lastbit; i++)
273 for(i = cube.first_part[best], halfbit = halfbit/2; halfbit > 0; i++)
276 for(; i <= lastbit; i++)
280 if (
debug & debug_flag) {
281 (void) printf(
"BINATE_SPLIT_SELECT: split against %d\n", best);
283 (void) printf(
"cl=%s\ncr=%s\n",
pc1(cleft),
pc2(cright));
292 register pcube last,
p, *plist, *list;
301 list[1] = (
pcube) plist;
309 register pcube last,
p, *plist, *list;
311 list = plist =
ALLOC(
pcube, A->count + B->count + 3);
321 list[1] = (
pcube) plist;
329 register pcube last,
p, *plist, *list;
331 plist =
ALLOC(
pcube, A->count + B->count + C->count + 3);
345 list[1] = (
pcube) plist;
354 register pcube p, pdest, cof = A1[0];
358 for(i = 2; (p = A1[i]) != NULL; i++) {
369 register pcube *Tdest;
370 register int i, ncubes;
372 (void)
set_copy(cube.temp[0], T[0]);
375 qsort((
char *) (T+2), ncubes,
sizeof(
pset), (
int (*)())
d1_order);
379 for(i = 3; i < ncubes; i++) {
380 if (
d1_order(&T[i-1], &T[i]) != 0) {
386 Tdest[1] = (
pcube) Tdest;
pcover cubeunlist(pcube *A1)
pcube * cube3list(pcover A, pcover B, pcover C)
#define foreach_set(R, last, p)
#define INLINEset_or(r, a, b)
void simplify_cubelist(pcube *T)
ABC_NAMESPACE_IMPL_START pcube * cofactor(IN pcube *T, IN register pcube c)
pcube * cube2list(pcover A, pcover B)
#define ABC_NAMESPACE_IMPL_END
#define is_in_set(set, e)
int binate_split_select(IN pcube *T, IN register pcube cleft, IN register pcube cright, IN int debug_flag)
#define ABC_NAMESPACE_IMPL_START
pcube * scofactor(IN pcube *T, IN pcube c, IN int var)
#define set_insert(set, e)
#define GETSET(family, index)
void massive_count(IN pcube *T)
pcube * cube1list(pcover A)