485{
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;
490
491
492
493
494
495
496
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");
503 }
504
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");
514 }
515
516
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);
521 }
522
523 next_state =
cube.first_part[
cube.num_binary_vars+1];
525 for(i = 0; i < nstates; i++) {
527 }
528
529 state_mask =
set_or(
new_cube(), next_state_mask, present_state_mask);
530
532
533
534
535
536
537 for(i = 0; i < nstates; i++) {
543 }
544 }
545 }
546 before = tF->count;
547 if (before > 0) {
548 tF = fsm_simplify(tF);
549
552 }
553 after = tF->count;
555 if (verbose_mode) {
556 printf("# state EVERY to %d, before=%d after=%d\n",
557 i, before, after);
558 }
559 }
560 }
561
562
563
564
565
566
571 }
572 }
573 before = go_nowhere->count;
575 cube.num_binary_vars,
cube.num_binary_vars);
576 after = go_nowhere->count;
578 if (verbose_mode) {
579 printf("# state ANY to NOWHERE, before=%d after=%d\n", before, after);
580 }
581
582
583
584
585
586 for(i = 0; i < nstates; i++) {
587 for(j = 0; j < nstates; j++) {
590
600 }
601 }
602 }
603 }
604 before = tF->count;
605 if (before > 0) {
606 tF = fsm_simplify(tF);
607
610 }
611 after = tF->count;
613 if (verbose_mode) {
614 printf("# state %d to %d, before=%d after=%d\n",
615 i, j, before, after);
616 }
617 }
618 }
619 }
620
621
625
630
633 cube.num_binary_vars = nin;
634 cube.num_vars = nin + 3;
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;
640
643 }
644}
ABC_NAMESPACE_IMPL_START void cube_setup()
#define is_in_set(set, e)
#define set_insert(set, e)
#define foreach_set(R, last, p)