77 if (PLA->phase != NULL) {
105 for(i = 0; i < cube.part_size[cube.output]; i++) {
111 if (!
is_in_set(phase, cube.first_part[cube.output] + i)) {
112 set_remove(PLA->phase, cube.first_part[cube.output] + i);
116 printf(
"\nOPO loop for output #%d\n", i);
117 printf(
"PLA->phase is %s\n",
pc1(PLA->phase));
118 printf(
"phase is %s\n",
pc1(phase));
144 if (phase1 != NULL) {
154 EXEC_S(PLA1->
F =
opo(phase, PLA1->
F, PLA1->
D, PLA1->
R, first_output),
160 cube.part_size[cube.output] -=
161 (cube.part_size[cube.output] - first_output) / 2;
178 int offset, output, i, last_output, ind;
179 pset pdest, select,
p, p1, last, last1, not_covered, tmp;
184 for(output = 0; output < first_output; output++) {
185 ind = cube.first_part[cube.output] + output;
194 offset = (cube.part_size[cube.output] - first_output) / 2;
195 last_output = first_output + offset - 1;
196 temp =
opo_recur(T, D, select, offset, first_output, last_output);
217 (void)
set_or(not_covered, not_covered,
set_and(tmp, p, p1));
226 for(output = first_output; output <= last_output; output++) {
227 ind = cube.first_part[cube.output] + output;
229 if (
is_in_set(not_covered, ind + offset)) {
230 fatal(
"error in output phase assignment");
243 int offset, first, last;
245 static int level = 0;
255 temp =
opo_leaf(T, select, first, first + offset);
258 temp =
opo_leaf(T, select, first, first + offset);
261 middle = (first + last) / 2;
262 sl =
opo_recur(T, D, select, offset, first, middle);
263 sr =
opo_recur(T, D, select, offset, middle+1, last);
266 printf(
"# OPO[%d]: %4d = %4d x %4d, time = %s\n", level - 1,
268 (void) fflush(stdout);
284 register pset p, pdest;
287 out1 += cube.first_part[cube.output];
288 out2 += cube.first_part[cube.output];
291 temp =
sf_new(2, T->count);
336 f_table =
sf_append(f_table, fbar_table);
345 register
pset select;
348 register pset p, last,
new;
354 n += cube.first_part[cube.output];
360 new =
GETSET(F1, F1->count++);
361 set_or(
new, p, cube.var_mask[cube.output]);
368 table =
sf_new(10, Rp_size);
381 for(i = 0; i < Rp_size; i++) {
422 pcube mask, mask1, last;
423 int first_part, offset;
426 register int i, last_part;
428 if (cube.output == -1)
429 fatal(
"output_phase_setup: must have an output");
434 first_part = cube.first_part[cube.output] + first_output;
435 last_part = cube.last_part[cube.output];
436 offset = cube.part_size[cube.output] - first_output;
440 cube.part_size[cube.output] += offset;
445 for(i = first_part; i < cube.size; i++)
448 for(i = cube.first_part[cube.output]; i < first_part; i++) {
457 pf =
GETSET(PLA->F, (PLA->F)->count++);
458 pr =
GETSET(PLA->R, (PLA->R)->count++);
461 for(i = first_part; i <= last_part; i++)
465 for(i = first_part; i <= last_part; i++)
468 if (! save) PLA->R->count--;
472 pf =
GETSET(PLA->F, (PLA->F)->count++);
473 pr =
GETSET(PLA->R, (PLA->R)->count++);
477 for(i = first_part; i <= last_part; i++)
480 if (! save) PLA->F->count--;
481 for(i = first_part; i <= last_part; i++)
487 pf =
GETSET(PLA->D, (PLA->D)->count++);
489 for(i = first_part; i <= last_part; i++)
511 register pcube last,
p, outmask;
512 register pcube temp=cube.temp[0],
phase=PLA->phase, phase1=cube.temp[1];
514 outmask = cube.var_mask[cube.num_vars - 1];
517 F1 =
new_cover((PLA->F)->count + (PLA->R)->count);
518 R1 =
new_cover((PLA->F)->count + (PLA->R)->count);
539 #define POW2(x) (1 << (x))
541 void opoall(PLA, first_output, last_output, opo_strategy)
543 int first_output, last_output;
552 if (PLA->phase != NULL) {
561 for(i = 0; i <
POW2(last_output - first_output + 1); i++) {
569 PLA->phase =
set_save(cube.fullset);
571 for(j = last_output; j >= first_output; j--) {
573 ind = cube.first_part[cube.output] + j;
581 printf(
"# phase is %s\n",
pc1(PLA->phase));
586 if (PLA->F->count < best_F->count) {
610 PLA->phase = bestphase;
625 EXEC_S(PLA->F =
espresso(PLA->F, PLA->D, PLA->R),
"ESPRESSO ",PLA->F);
static ABC_NAMESPACE_IMPL_START void fcube_is_covered()
pset_family opo_recur(pcover T, pcover D, pcube select, int offset, int first, int last)
ABC_NAMESPACE_IMPL_START pcover espresso(pcover F, pcover D1, pcover R)
pcover opo(pcube phase, pcover T, pcover D, pcover R, int first_output)
pset_family form_cover_table()
static ABC_NAMESPACE_IMPL_START int opo_no_make_sparse
#define INLINEset_and(r, a, b)
pset_family find_covers()
#define PUTSIZE(set, size)
ABC_NAMESPACE_IMPL_START void cube_setup()
void repeated_phase_assignment(pPLA PLA)
void output_phase_setup(INOUT pPLA PLA, int first_output)
pcover complement(pcube *T)
#define foreach_set(R, last, p)
pPLA set_phase(INOUT pPLA PLA)
pcube * cube2list(pcover A, pcover B)
#define EXEC_S(fct, name, S)
#define ABC_NAMESPACE_IMPL_END
pset_family unate_compl()
#define is_in_set(set, e)
pset_family unate_intersect()
void phase_assignment(pPLA PLA, int opo_strategy)
pset_family opo_leaf(pcover T, pset select, int out1, int out2)
pcube find_phase(pPLA PLA, int first_output, pcube phase1)
#define ABC_NAMESPACE_IMPL_START
#define set_remove(set, e)
#define set_insert(set, e)
#define GETSET(family, index)
void opoall(pPLA PLA, int first_output, int last_output, int opo_strategy)
#define foreachi_set(R, i, p)
pcube * cube1list(pcover A)