30 int i, j, first, last, strategy, out_type, option;
35 bool error, exact_cover;
75 while ((i =
util_getopt(argc, argv,
"D:S:de:o:r:stv:x")) != EOF) {
85 (void) fprintf(stderr,
"%s: bad subcommand \"%s\"\n",
86 argv[0], util_optarg);
99 (void) fprintf(stderr,
"%s: bad output type \"%s\"\n",
100 argv[0], util_optarg);
113 (void) fprintf(stderr,
"%s: bad espresso option \"%s\"\n",
114 argv[0], util_optarg);
134 (void) fprintf(stderr,
"%s: bad debug type \"%s\"\n",
135 argv[0], util_optarg);
153 strategy = atoi(util_optarg);
157 if (sscanf(util_optarg,
"%d-%d", &first, &last) < 2) {
158 (void) fprintf(stderr,
"%s: bad output range \"%s\"\n",
159 argv[0], util_optarg);
174 for(i = 0; i < argc; i++) {
175 printf(
" %s", argv[i]);
185 if (util_optind+2 < argc)
fatal(
"trailing arguments on command line");
186 getPLA(util_optind++, argc, argv, option, &PLA, out_type);
187 getPLA(util_optind++, argc, argv, option, &PLA1, out_type);
190 if (util_optind+1 < argc)
fatal(
"trailing arguments on command line");
191 getPLA(util_optind++, argc, argv, option, &PLA, out_type);
194 if (util_optind < argc)
fatal(
"trailing arguments on command line");
229 (void) fflush(stdout);
234 FREE(cube.part_size);
244 if (strategy < 0 || strategy > 1) {
251 if (strategy < 0 || strategy > 1) {
324 if (first < 0 || first >= cube.part_size[cube.output]) {
327 if (last < 0 || last >= cube.part_size[cube.output]) {
328 last = cube.part_size[cube.output] - 1;
330 opoall(PLA, first, last, strategy);
349 printf(
"ON-set is%sa tautology\n",
388 if (first < 0 || first >= cube.num_vars) {
391 if (last < 0 || last >= cube.num_vars) {
392 last = cube.num_vars - 1;
398 if (first < 0 || first >= cube.num_vars) {
401 if (last < 0 || last >= cube.num_vars) {
402 last = cube.num_vars - 1;
404 for(i = first; i <= last; i++) {
410 for(i = 0; i < cube.num_binary_vars; i++) {
418 printf(
"PLA comparison failed; the PLA's are not equivalent\n");
421 printf(
"PLA's compared equal\n");
427 Fold = PLA->
F; Dold = PLA->
D; F = PLA1->
F;
430 printf(
"PLA comparison failed; the PLA's are not equivalent\n");
433 printf(
"PLA's compared equal\n");
510 fatal(
"cover verification failed");
515 FREE(cube.part_size);
524 getPLA(opt, argc, argv, option, PLA, out_type)
541 if (
strcmp(fname,
"-") == 0) {
543 }
else if ((fp = fopen(argv[opt],
"r")) == NULL) {
544 (void) fprintf(stderr,
"%s: Unable to open %s\n", argv[0], fname);
549 needs_dcset = (out_type &
D_type) != 0;
550 needs_offset = (out_type &
R_type) != 0;
557 (void) fprintf(stderr,
"%s: Unable to find PLA on file %s\n", argv[0], fname);
560 (*PLA)->filename = util_strsav(fname);
571 long total = 1, temp;
579 printf(
"# %s\t%2d call(s) for %s (%2ld.%01ld%%)\n",
581 temp/total, (10 * (temp%total)) / total);
629 printf(
"SYNOPSIS: espresso [options] [file]\n\n");
630 printf(
" -d Enable debugging\n");
631 printf(
" -e[opt] Select espresso option:\n");
632 printf(
" fast, ness, nirr, nunwrap, onset, pos, strong,\n");
633 printf(
" eat, eatdots, kiss, random\n");
634 printf(
" -o[type] Select output format:\n");
635 printf(
" f, fd, fr, fdr, pleasure, eqntott, kiss, cons\n");
636 printf(
" -rn-m Select range for subcommands:\n");
637 printf(
" d1merge: first and last variables (0 ... m-1)\n");
638 printf(
" minterms: first and last variables (0 ... m-1)\n");
639 printf(
" opoall: first and last outputs (0 ... m-1)\n");
640 printf(
" -s Provide short execution summary\n");
641 printf(
" -t Provide longer execution trace\n");
642 printf(
" -x Suppress printing of solution\n");
643 printf(
" -v[type] Verbose debugging detail (-v '' for all)\n");
644 printf(
" -D[cmd] Execute subcommand 'cmd':\n");
646 printf(
" -Sn Select strategy for subcommands:\n");
647 printf(
" opo: bit2=exact bit1=repeated bit0=skip sparse\n");
648 printf(
" opoall: 0=minimize, 1=exact\n");
649 printf(
" pair: 0=algebraic, 1=strongd, 2=espresso, 3=exact\n");
650 printf(
" pairall: 0=minimize, 1=exact, 2=opo\n");
651 printf(
" so_espresso: 0=minimize, 1=exact\n");
652 printf(
" so_both: 0=minimize, 1=exact\n");
669 for(i = 1; i < (*argc)-1; i++) {
670 if (
strcmp(argv[i],
"-do") == 0) {
679 (void) fprintf(stderr,
680 "espresso: bad keyword \"%s\" following -do\n",argv[i+1]);
687 for(i = 1; i < (*argc)-1; i++) {
688 if (
strcmp(argv[i],
"-out") == 0) {
697 (void) fprintf(stderr,
698 "espresso: bad keyword \"%s\" following -out\n",argv[i+1]);
705 for(i = 1; i < (*argc); i++) {
706 if (argv[i][0] ==
'-') {
726 register
char *argv[];
730 for(i = num; i < *argc; i++) {
739 register
char *argv[], *s;
742 for(i = 1; i < *argc; i++) {
743 if (
strcmp(argv[i], s) == 0) {
pcover primes_consensus()
ABC_NAMESPACE_IMPL_START pcover espresso(pcover F, pcover D1, pcover R)
void so_espresso(pPLA PLA, int strategy)
void PLA_summary(pPLA PLA)
pset_family sf_dupl(INOUT pset_family A)
bool check_arg(int *argc, argv,*s)
void so_both_espresso(pPLA PLA, int strategy)
void disassemble_fsm(pPLA PLA, int verbose_mode)
long total_time[TIME_COUNT]
void print_trace(pcover T, char *name, long time)
struct @49 option_table[]
pset_family d1merge(INOUT pset_family A, IN int var)
int read_pla(IN FILE *fp, IN bool needs_dcset, IN bool needs_offset, IN int pla_type, OUT pPLA *PLA_return)
pcover complement(pcube *T)
#define foreach_set(R, last, p)
struct @51 esp_opt_table[]
struct pla_types_struct pla_types[]
pcover unravel_range(IN pcover B, IN int start, IN int end)
char * total_name[TIME_COUNT]
pcover lex_sort(pcover T)
ABC_NAMESPACE_IMPL_START pset_family sf_contain(INOUT pset_family A)
int total_calls[TIME_COUNT]
static ABC_NAMESPACE_IMPL_START FILE * last_fp
getPLA(int opt, int argc, argv, int option, pPLA *PLA, int out_type)
void find_optimal_pairing()
pcube * cube2list(pcover A, pcover B)
#define ABC_NAMESPACE_IMPL_END
ABC_NAMESPACE_IMPL_START void find_equiv_outputs(pPLA PLA)
bool echo_unknown_commands
backward_compatibility_hack(int *argc, char **argv, int *option, int *out_type)
ABC_NAMESPACE_IMPL_START void fprint_pla(INOUT FILE *fp, IN pPLA PLA, IN int output_type)
#define ABC_NAMESPACE_IMPL_START
pcover simplify(pcube *T)
#define EXEC(fct, name, S)
pset_family sf_union(INOUT pset_family A, INOUT pset_family B)
#define EXECUTE(fct, i, S, cost)
delete_arg(int *argc, argv, int num)
pcube * cube1list(pcover A)