62static int opo_no_make_sparse;
63static int opo_repeated;
65static void minimize();
71 opo_no_make_sparse = opo_strategy % 2;
73 opo_repeated = (opo_strategy / 2) % 2;
74 opo_exact = (opo_strategy / 4) % 2;
77 if (PLA->phase != NULL) {
105 for(i = 0; i <
cube.part_size[
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),
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);
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");
243int offset, first, last;
245 static int level = 0;
252 if (opo_no_make_sparse) {
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);
348 register pset p, last,
new;
360 new =
GETSET(F1, F1->count++);
368 table =
sf_new(10, Rp_size);
372 table =
sf_append(table, fcube_is_covered(Flist,
p));
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))
541void opoall(PLA, first_output, last_output, opo_strategy)
543int first_output, last_output;
546 pcover F, D, R, best_F, best_D, best_R;
550 opo_exact = opo_strategy;
552 if (PLA->phase != NULL) {
561 for(i = 0; i <
POW2(last_output - first_output + 1); i++) {
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;
619static void minimize(PLA)
625 EXEC_S(PLA->F =
espresso(PLA->F, PLA->D, PLA->R),
"ESPRESSO ",PLA->F);
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
ABC_NAMESPACE_IMPL_START void cube_setup()
ABC_NAMESPACE_IMPL_START pcover espresso(pcover F, pcover D1, pcover R)
pset_family find_covers()
#define PUTSIZE(set, size)
#define is_in_set(set, e)
#define foreachi_set(R, i, p)
#define set_insert(set, e)
#define GETSET(family, index)
#define set_remove(set, e)
struct set_family * pset_family
#define foreach_set(R, last, p)
pset_family unate_compl()
#define INLINEset_and(r, a, b)
pset_family form_cover_table()
pset_family unate_intersect()
void output_phase_setup()
void repeated_phase_assignment()
#define EXEC_S(fct, name, S)