FreeCalypso > hg > ueda-linux
diff netdiff/match/main.c @ 140:d3eb3790386d
netdiff: donl-netmatch put together
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 07 Sep 2020 04:57:37 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netdiff/match/main.c Mon Sep 07 04:57:37 2020 +0000 @@ -0,0 +1,67 @@ +#include <stdio.h> +#include <stdlib.h> +#include "struct.h" + +char *infnames[2]; +struct pin_info *database; + +write_diffs_report(outfile) + char *outfile; +{ + FILE *outf; + struct pin_info *p; + + outf = fopen(outfile, "w"); + if (!outf) { + perror(outfile); + exit(1); + } + for (p = database; p; p = p->next) { + if (p->netnames[0] && !p->netnames[1]) + fprintf(outf, "Pin %s only in %s: net %s\n", + p->pin_name, infnames[0], p->netnames[0]); + if (!p->netnames[0] && p->netnames[1]) + fprintf(outf, "Pin %s only in %s: net %s\n", + p->pin_name, infnames[1], p->netnames[1]); + } + fclose(outf); +} + +write_matching_nets(outfile) + char *outfile; +{ + FILE *outf; + struct pin_info *p; + + outf = fopen(outfile, "w"); + if (!outf) { + perror(outfile); + exit(1); + } + for (p = database; p; p = p->next) { + if (!p->netnames[0] || !p->netnames[1]) + continue; + fprintf(outf, "%s\t%s\n", p->netnames[0], p->netnames[1]); + } + fclose(outf); +} + +main(argc, argv) + char **argv; +{ + int i; + + if (argc != 5) { + fprintf(stderr, + "usage: %s net1 net2 diffs-report matching-nets\n", + argv[0]); + exit(1); + } + infnames[0] = argv[1]; + infnames[1] = argv[2]; + for (i = 0; i < 2; i++) + read_pass(i); + write_diffs_report(argv[3]); + write_matching_nets(argv[4]); + exit(0); +}