19 pcover Tplus, Tminus, Tplusbar, Tminusbar;
20 pcover newf, term1, term2, dcset, dcsetbar;
21 pcube cplus, cminus, last,
p;
23 if (PLA->label ==
NIL(
char *) || PLA->label[0] ==
NIL(
char))
28 for(i = 0; i < cube.num_binary_vars * 2; i++) {
29 if (
strncmp(PLA->label[i],
"DONT_CARE", 9) == 0 ||
30 strncmp(PLA->label[i],
"DONTCARE", 8) == 0 ||
31 strncmp(PLA->label[i],
"dont_care", 9) == 0 ||
32 strncmp(PLA->label[i],
"dontcare", 8) == 0) {
76 for(i = 2*var+2; i < cube.size; i++) {
77 PLA->label[i-2] = PLA->label[i];
79 for(i = var+1; i < cube.num_vars; i++) {
80 cube.part_size[i-1] = cube.part_size[i];
82 cube.num_binary_vars--;
85 PLA->F =
sf_delc(PLA->F, 2*var, 2*var+1);
86 PLA->D =
sf_delc(PLA->D, 2*var, 2*var+1);
96 int i, bit, tot_size, base, old_size;
99 if (PLA->D->count > 0) {
108 if (p2->
pos<0 || p2->
pos>=cube.part_size[cube.output]) {
109 fatal(
"symbolic-output index out of range");
125 old_size = cube.size;
126 cube.part_size[cube.output] += tot_size;
131 base = cube.first_part[cube.output];
132 PLA->F =
sf_addcol(PLA->F, base, tot_size);
133 PLA->D =
sf_addcol(PLA->D, base, tot_size);
134 PLA->R =
sf_addcol(PLA->R, base, tot_size);
163 bit = cube.first_part[cube.output] + p2->
pos;
172 if (cube.size != PLA->F->sf_size)
fatal(
"error");
177 for(i = 0; i < cube.num_vars; i++) {
188 compress, cube.size, old_size, tot_size);
201 register pset last,
p;
257 register pset p, last;
263 S =
cof_output(PLA->D, cube.first_part[cube.output] + p2->
pos);
279 for(i = base; i < base + maxval; i++) {
293 int var, base, num_vars, num_binary_vars, *new_part_size;
294 int new_size, size_added, num_deleted_vars, num_added_vars, newvar;
301 fatal(
".symbolic requires binary variables");
318 compress =
set_full(PLA->F->sf_size + size_added);
325 num_deleted_vars = ((PLA->F->sf_size + size_added) -
set_ord(compress))/2;
328 num_vars = cube.num_vars - num_deleted_vars + num_added_vars;
329 num_binary_vars = cube.num_binary_vars - num_deleted_vars;
330 new_size = cube.size - num_deleted_vars*2 + size_added;
331 new_part_size =
ALLOC(
int, num_vars);
332 new_part_size[num_vars-1] = cube.part_size[cube.num_vars-1];
333 for(var = cube.num_binary_vars; var < cube.num_vars-1; var++) {
334 new_part_size[var-num_deleted_vars] = cube.part_size[
var];
338 base = cube.first_part[cube.output];
339 PLA->F =
sf_addcol(PLA->F, base, size_added);
340 PLA->D =
sf_addcol(PLA->D, base, size_added);
341 PLA->R =
sf_addcol(PLA->R, base, size_added);
344 newvar = (cube.num_vars - 1) - num_deleted_vars;
359 new_size, cube.size, size_added);
361 FREE(cube.part_size);
362 cube.num_vars = num_vars;
363 cube.num_binary_vars = num_binary_vars;
364 cube.part_size = new_part_size;
404 fatal(
"bad cube in form_bitvector");
414 int new_size, old_size, size_added;
422 if ((oldlabel = PLA->label) ==
NIL(
char *))
425 for(i = 0; i < new_size; i++) {
426 PLA->label[i] =
NIL(
char);
431 for(i = 0; i < cube.first_part[cube.output]; i++) {
433 PLA->label[base++] = oldlabel[i];
435 if (oldlabel[i] !=
NIL(
char)) {
447 (void)
sprintf(PLA->label[base+i],
"X%d", i);
449 PLA->label[base+i] = p3->
label;
457 for(i = cube.first_part[cube.output]; i < old_size; i++) {
458 if (
is_in_set(compress, i + size_added)) {
459 PLA->label[base++] = oldlabel[i];
461 if (oldlabel[i] !=
NIL(
char)) {
486 int nin, nstates, nout;
487 int before, after, present_state, next_state, i, j;
488 pcube next_state_mask, present_state_mask, state_mask,
p, p1, last;
497 if (cube.num_vars - cube.num_binary_vars != 2) {
498 (void) fprintf(stderr,
499 "use .symbolic and .symbolic-output to specify\n");
500 (void) fprintf(stderr,
501 "the present state and next state field information\n");
502 fatal(
"disassemble_pla: need two multiple-valued variables\n");
505 nin = cube.num_binary_vars;
506 nstates = cube.part_size[cube.num_binary_vars];
507 nout = cube.part_size[cube.num_vars - 1];
508 if (nout < nstates) {
509 (void) fprintf(stderr,
510 "use .symbolic and .symbolic-output to specify\n");
511 (void) fprintf(stderr,
512 "the present state and next state field information\n");
513 fatal(
"disassemble_pla: # outputs < # states\n");
517 present_state = cube.first_part[cube.num_binary_vars];
519 for(i = 0; i < nstates; i++) {
520 set_insert(present_state_mask, i + present_state);
523 next_state = cube.first_part[cube.num_binary_vars+1];
525 for(i = 0; i < nstates; i++) {
529 state_mask =
set_or(
new_cube(), next_state_mask, present_state_mask);
537 for(i = 0; i < nstates; i++) {
556 printf(
"# state EVERY to %d, before=%d after=%d\n",
573 before = go_nowhere->count;
575 cube.num_binary_vars, cube.num_binary_vars);
576 after = go_nowhere->count;
579 printf(
"# state ANY to NOWHERE, before=%d after=%d\n", before, after);
586 for(i = 0; i < nstates; i++) {
587 for(j = 0; j < nstates; j++) {
614 printf(
"# state %d to %d, before=%d after=%d\n",
615 i, j, before, after);
632 FREE(cube.part_size);
633 cube.num_binary_vars = nin;
634 cube.num_vars = nin + 3;
635 cube.part_size =
ALLOC(
int, cube.num_vars);
636 cube.part_size[cube.num_binary_vars] = nstates;
637 cube.part_size[cube.num_binary_vars+1] = nstates;
638 cube.part_size[cube.num_binary_vars+2] = nout - nstates;
static pcover fsm_simplify(pcover F)
struct symbolic_label_struct * next
ABC_NAMESPACE_IMPL_START void map_dcset(pPLA PLA)
void form_bitvector(pset p, int base, int value, symbolic_list_t *list)
ABC_NAMESPACE_IMPL_START pcover espresso(pcover F, pcover D1, pcover R)
void map_symbolic(pPLA PLA)
symbolic_label_t * symbolic_label
pcover map_symbolic_cover(pcover T, symbolic_list_t *list, int base)
void disassemble_fsm(pPLA PLA, int verbose_mode)
symbolic_list_t * symbolic_list
pset_family d1merge(INOUT pset_family A, IN int var)
ABC_NAMESPACE_IMPL_START void cube_setup()
void map_output_symbolic(pPLA PLA)
void find_inputs(pcover A, pPLA PLA, symbolic_list_t *list, int base, int value, pcover *newF, pcover *newD)
pcover complement(pcube *T)
#define foreach_set(R, last, p)
pset_family sf_compress()
pcover unravel_range(IN pcover B, IN int start, IN int end)
ABC_NAMESPACE_IMPL_START pset_family sf_contain(INOUT pset_family A)
ABC_NAMESPACE_IMPL_START pcube * cofactor(IN pcube *T, IN register pcube c)
void kiss_print_cube(FILE *fp, pPLA PLA, pcube p, char *out_string)
void symbolic_hack_labels(pPLA PLA, symbolic_t *list, pset compress, int new_size, int old_size, int size_added)
struct symbolic_list_struct * next
pcover cof_output(pcover T, int i)
pcube * cube2list(pcover A, pcover B)
#define ABC_NAMESPACE_IMPL_END
#define is_in_set(set, e)
void simp_comp(pcube *T, pcover *Tnew, pcover *Tbar)
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
#define ABC_NAMESPACE_IMPL_START
#define set_remove(set, e)
#define set_insert(set, e)
#define EXEC(fct, name, S)
pset_family sf_union(INOUT pset_family A, INOUT pset_family B)
pset_family sf_inactive()
pcube * cube1list(pcover A)
struct symbolic_struct * next