comparison 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
comparison
equal deleted inserted replaced
139:bf188727e606 140:d3eb3790386d
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "struct.h"
4
5 char *infnames[2];
6 struct pin_info *database;
7
8 write_diffs_report(outfile)
9 char *outfile;
10 {
11 FILE *outf;
12 struct pin_info *p;
13
14 outf = fopen(outfile, "w");
15 if (!outf) {
16 perror(outfile);
17 exit(1);
18 }
19 for (p = database; p; p = p->next) {
20 if (p->netnames[0] && !p->netnames[1])
21 fprintf(outf, "Pin %s only in %s: net %s\n",
22 p->pin_name, infnames[0], p->netnames[0]);
23 if (!p->netnames[0] && p->netnames[1])
24 fprintf(outf, "Pin %s only in %s: net %s\n",
25 p->pin_name, infnames[1], p->netnames[1]);
26 }
27 fclose(outf);
28 }
29
30 write_matching_nets(outfile)
31 char *outfile;
32 {
33 FILE *outf;
34 struct pin_info *p;
35
36 outf = fopen(outfile, "w");
37 if (!outf) {
38 perror(outfile);
39 exit(1);
40 }
41 for (p = database; p; p = p->next) {
42 if (!p->netnames[0] || !p->netnames[1])
43 continue;
44 fprintf(outf, "%s\t%s\n", p->netnames[0], p->netnames[1]);
45 }
46 fclose(outf);
47 }
48
49 main(argc, argv)
50 char **argv;
51 {
52 int i;
53
54 if (argc != 5) {
55 fprintf(stderr,
56 "usage: %s net1 net2 diffs-report matching-nets\n",
57 argv[0]);
58 exit(1);
59 }
60 infnames[0] = argv[1];
61 infnames[1] = argv[2];
62 for (i = 0; i < 2; i++)
63 read_pass(i);
64 write_diffs_report(argv[3]);
65 write_matching_nets(argv[4]);
66 exit(0);
67 }