32#define USE_COMPL_LIFT 0
33#define USE_COMPL_LIFT_ONSET 1
34#define USE_COMPL_LIFT_ONSET_COMPLEX 2
37static bool compl_special_cases();
38static pcover compl_merge();
39static void compl_d1merge();
41static void compl_lift();
42static void compl_lift_onset();
43static void compl_lift_onset_complex();
44static bool simp_comp_special_cases();
45static bool simplify_special_cases();
52 register pcube cl, cr;
56 static int compl_level = 0;
61 if (compl_special_cases(T, &Tbar) ==
MAYBE) {
72 if (Tr->count*Tl->count > (Tr->count+Tl->count)*
CUBELISTSIZE(T)) {
77 Tbar = compl_merge(T, Tl, Tr, cl, cr, best, lifting);
89static bool compl_special_cases(T, Tbar)
93 register pcube *T1,
p, ceil, cof=T[0];
105 *Tbar = compl_cube(
set_or(cof, cof, T[2]));
111 for(T1 = T+2; (
p = *T1++) != NULL; ) {
121 for(T1 = T+2; (
p = *T1++) != NULL; ) {
125 ceil_compl = compl_cube(ceil);
137 if (cdata.vars_active == 1) {
143 }
else if (cdata.vars_unate == cdata.vars_active) {
172static pcover compl_merge(T1, L, R, cl, cr, var, lifting)
175register pcube cl, cr;
179 register pcube p, last, pt;
184 (void) printf(
"compl_merge: left %d, right %d\n", L->count, R->count);
185 (void) printf(
"%s (cl)\n%s (cr)\nLeft is\n",
pc1(cl),
pc2(cr));
187 (void) printf(
"Right is\n");
207 compl_d1merge(L1, R1);
213 compl_lift_onset(L1, T, cr, var);
214 compl_lift_onset(R1, T, cl, var);
219 compl_lift_onset_complex(L1, T, var);
220 compl_lift_onset_complex(R1, T, var);
224 compl_lift(L1, R1, cr, var);
225 compl_lift(R1, L1, cl, var);
250 (void) printf(
"Result %d\n", Tbar->count);
266static void compl_lift(A1, B1, bcube, var)
267pcube *A1, *B1, bcube;
270 register pcube a, b, *B2, lift=
cube.temp[4], liftor=
cube.temp[5];
273 (void)
set_and(liftor, bcube, mask);
276 for(; (a = *A1++) != NULL; ) {
283 for(B2 = B1; (b = *B2++) != NULL; ) {
303static void compl_lift_onset(A1, T, bcube, var)
312 for(; (a = *A1++) != NULL; ) {
338static void compl_lift_onset_complex(A1, T, var)
344 register pcube last,
p, a, xlower;
348 for(; (a = *A1++) != NULL; ) {
357 fatal(
"compl: ON-set and OFF-set are not orthogonal");
365 (void)
set_or(a, a, xlower);
376static void compl_d1merge(L1, R1)
377register pcube *L1, *R1;
379 register pcube pl, pr;
382 for(pl = *L1, pr = *R1; (pl != NULL) && (pr != NULL); )
403 register pcube diff=
cube.temp[7], pdest, mask, full=
cube.fullset;
417 pdest =
GETSET(R, R->count++);
430 register pcube cl, cr;
432 pcover Tl, Tr, Tlbar, Trbar;
434 static int simplify_level = 0;
439 if (simp_comp_special_cases(T, Tnew, Tbar) ==
MAYBE) {
451 *Tnew = compl_merge(T, Tl, Tr, cl, cr, best, lifting);
454 *Tbar = compl_merge(T, Tlbar, Trbar, cl, cr, best, lifting);
468 debug1_print(*Tnew,
"exit SIMPCOMP (new)", simplify_level);
469 debug1_print(*Tbar,
"exit SIMPCOMP (compl)", simplify_level);
474static bool simp_comp_special_cases(T, Tnew, Tbar)
479 register pcube *T1,
p, ceil, cof=T[0];
493 (void)
set_or(cof, cof, T[2]);
495 *Tbar = compl_cube(cof);
501 for(T1 = T+2; (
p = *T1++) != NULL; ) {
512 for(T1 = T+2; (
p = *T1++) != NULL; ) {
529 *Tbar =
sf_append(*Tbar, compl_cube(ceil));
539 if (cdata.vars_active == 1) {
546 }
else if (cdata.vars_unate == cdata.vars_active) {
569 register pcube cl, cr;
573 static int simplify_level = 0;
579 if (simplify_special_cases(T, &Tbar) ==
MAYBE) {
592 Tbar = compl_merge(T, Tl, Tr, cl, cr, best, lifting);
611static bool simplify_special_cases(T, Tnew)
615 register pcube *T1,
p, ceil, cof=T[0];
634 for(T1 = T+2; (
p = *T1++) != NULL; ) {
644 for(T1 = T+2; (
p = *T1++) != NULL; ) {
667 if (cdata.vars_active == 1) {
673 }
else if (cdata.vars_unate == cdata.vars_active) {
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define USE_COMPL_LIFT_ONSET
#define USE_COMPL_LIFT_ONSET_COMPLEX
#define INLINEset_diff(r, a, b)
#define INLINEset_or(r, a, b)
#define INLINEsetp_implies(a, b, when_false)
pcover map_unate_to_cover()
#define INLINEset_clear(r, size)
#define foreach_active_set(R, last, p)
ABC_NAMESPACE_HEADER_END int binate_split_select()
#define GETSET(family, index)
pcover map_cover_to_unate()
#define INLINEset_copy(r, a)
#define foreach_set(R, last, p)
pset_family unate_compl()
#define INLINEset_merge(r, a, b, mask)
#define INLINEset_and(r, a, b)