annotate netdiff/match/main.c @ 154:2328205328a9 default tip

m4-fp: WR-FPC 1mm pitch FFC/FPC connectors
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 25 Oct 2022 07:36:09 +0000
parents d3eb3790386d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
140
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include <stdio.h>
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include <stdlib.h>
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #include "struct.h"
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 char *infnames[2];
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 struct pin_info *database;
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 write_diffs_report(outfile)
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 char *outfile;
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 {
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 FILE *outf;
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 struct pin_info *p;
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 outf = fopen(outfile, "w");
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 if (!outf) {
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 perror(outfile);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 exit(1);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 }
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 for (p = database; p; p = p->next) {
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 if (p->netnames[0] && !p->netnames[1])
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 fprintf(outf, "Pin %s only in %s: net %s\n",
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 p->pin_name, infnames[0], p->netnames[0]);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 if (!p->netnames[0] && p->netnames[1])
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 fprintf(outf, "Pin %s only in %s: net %s\n",
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 p->pin_name, infnames[1], p->netnames[1]);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 }
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 fclose(outf);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 }
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 write_matching_nets(outfile)
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 char *outfile;
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 {
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 FILE *outf;
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 struct pin_info *p;
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 outf = fopen(outfile, "w");
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 if (!outf) {
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 perror(outfile);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 exit(1);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 }
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 for (p = database; p; p = p->next) {
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 if (!p->netnames[0] || !p->netnames[1])
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 continue;
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 fprintf(outf, "%s\t%s\n", p->netnames[0], p->netnames[1]);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 }
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 fclose(outf);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 }
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 main(argc, argv)
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 char **argv;
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 {
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 int i;
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 if (argc != 5) {
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 fprintf(stderr,
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 "usage: %s net1 net2 diffs-report matching-nets\n",
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 argv[0]);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 exit(1);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 }
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 infnames[0] = argv[1];
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 infnames[1] = argv[2];
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 for (i = 0; i < 2; i++)
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 read_pass(i);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 write_diffs_report(argv[3]);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 write_matching_nets(argv[4]);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 exit(0);
d3eb3790386d netdiff: donl-netmatch put together
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 }