annotate ueda/sverp-bind/readunet.c @ 55:e93375570f91

pads2gpcb/decals.c: saving of silk lines and arcs implemented
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 31 Jan 2016 02:14:57 +0000
parents ce887659d12e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 #include <stdio.h>
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 #include <stdlib.h>
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 #include <string.h>
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4 #include <strings.h>
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 #include "../libueda/xga.h"
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 #include "../libunet/unetrd.h"
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 #include "struct.h"
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 extern char *pinname_to_pinnumber();
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 extern struct net *find_net_by_name();
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11 extern struct instance *find_instance();
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 extern char *input_filename;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14 extern int unbound_instances;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16 static struct unetrd_state rdstate;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17 static struct unetrd_out rdout;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 static int
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 resolve_pinnum_numeric(oc, pinnumstr)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 struct outcomp *oc;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22 register char *pinnumstr;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23 {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24 register int num;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 if (!string_is_valid_decnum(pinnumstr)) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27 invnum: fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
28 "%s line %d: component %s has numeric pins and \"%s\" is not a valid pin number\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29 input_filename, rdstate.lineno, oc->name, pinnumstr);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
30 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32 num = atoi(pinnumstr);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 if (num < 1)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 goto invnum;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 if (num > oc->npins) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 "%s line %d: attempting connection to pin %d on component %s that only has %d pins\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
38 input_filename, rdstate.lineno, num, oc->name,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
39 oc->npins);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
40 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
41 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
42 return(num - 1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
43 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
44
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
45 static int
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
46 resolve_pinnum_grid(oc, pinnumstr)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
47 struct outcomp *oc;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
48 char *pinnumstr;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
49 {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
50 register struct grid_pkg_desc *xga = oc->grid_pkg;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
51 struct xga_parsed_pinnum rowcol;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
52 register int idx;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
53
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
54 if (parse_xga_pinnumber(xga, pinnumstr, &rowcol) < 0) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
55 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
56 "%s line %d: \"%s\" is not a valid pin number for grid package %s\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
57 input_filename, rdstate.lineno, pinnumstr, oc->name);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
58 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
59 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
60 idx = rowcol.row_0based * xga->ncolumns + rowcol.col_0based;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
61 if (xga->holes_array[idx]) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
62 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
63 "%s line %d: pin position %s is a hole in the grid package for %s\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
64 input_filename, rdstate.lineno, pinnumstr, oc->name);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
65 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
66 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
67 return(idx);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
68 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
69
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
70 static int
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
71 resolve_pinnum(oc, pinnumstr)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
72 register struct outcomp *oc;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
73 char *pinnumstr;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
74 {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
75 if (oc->grid_pkg)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
76 return resolve_pinnum_grid(oc, pinnumstr);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
77 else
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
78 return resolve_pinnum_numeric(oc, pinnumstr);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
79 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
80
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
81 static struct pinconn *
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
82 create_pinconn()
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
83 {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
84 register struct pinconn *conn;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
85 register struct net *net;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
86
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
87 if (rdout.connect_to_net) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
88 net = find_net_by_name(rdout.connect_to_net);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
89 conn = (struct pinconn *) malloc(sizeof(struct pinconn));
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
90 if (!conn) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
91 perror("malloc");
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
92 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
93 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
94 conn->net = net;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
95 conn->nc_comment = 0;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
96 } else {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
97 conn = (struct pinconn *) malloc(sizeof(struct pinconn) +
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
98 strlen(rdout.nc_comment) + 1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
99 if (!conn) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
100 perror("malloc");
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
101 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
102 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
103 conn->net = 0;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
104 conn->nc_comment = (char *)(conn + 1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
105 strcpy(conn->nc_comment, rdout.nc_comment);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
106 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
107 conn->input_lineno = rdstate.lineno;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
108 return conn;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
109 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
110
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
111 static void
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
112 connect_pin(oc, pinnumstr)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
113 register struct outcomp *oc;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
114 char *pinnumstr;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
115 {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
116 register int pinidx;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
117
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
118 pinidx = resolve_pinnum(oc, pinnumstr);
37
ce887659d12e unet-bind: implemented hier=flip:... hack for 2-pin components
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 29
diff changeset
119 if (oc->reverse_2pin)
ce887659d12e unet-bind: implemented hier=flip:... hack for 2-pin components
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 29
diff changeset
120 pinidx = !pinidx;
19
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
121 if (oc->conn_array[pinidx]) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
122 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
123 "error: multiple connections to %s pin %s (input lines %d and %d)\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
124 oc->name, pinnumstr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
125 oc->conn_array[pinidx]->input_lineno, rdstate.lineno);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
126 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
127 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
128 oc->conn_array[pinidx] = create_pinconn();
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
129 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
130
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
131 static void
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
132 process_pinmap(inst)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
133 struct instance *inst;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
134 {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
135 register struct outcomp *oc = inst->outcomp;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
136 register char *pinnum;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
137
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
138 if (!oc->mclcomp) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
139 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
140 "%s line %d: PINMAP is meaningless for starpoints\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
141 input_filename, rdstate.lineno);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
142 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
143 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
144 pinnum = pinname_to_pinnumber(oc->mclcomp, rdout.objname, inst->slot);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
145 if (!pinnum) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
146 fprintf(stderr, "PINMAP error on %s line %d\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
147 input_filename, rdstate.lineno);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
148 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
149 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
150 connect_pin(oc, pinnum);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
151 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
152
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
153 static void
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
154 process_component()
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
155 {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
156 struct instance *inst;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
157
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
158 inst = find_instance(rdout.objname);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
159 if (!inst) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
160 fprintf(stderr, "%s line %d: instance %s not bound in MCL\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
161 input_filename, rdstate.lineno, rdout.objname);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
162 unbound_instances++;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
163 } else {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
164 if (inst->claimed) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
165 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
166 "%s line %d: instance %s appears more than once\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
167 input_filename, rdstate.lineno, inst->name);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
168 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
169 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
170 inst->claimed = 1;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
171 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
172 for (;;) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
173 if (!read_unet_line(&rdstate, &rdout)) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
174 fprintf(stderr, "%s error: EOF in component block\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
175 input_filename);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
176 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
177 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
178 if (rdout.typecode == UNETOBJ_CLOSINGBRACE)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
179 break;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
180 switch(rdout.typecode) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
181 case UNETOBJ_PRIMITIVE:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
182 case UNETOBJ_ALTNAME:
29
dcdf606dfaaa unet-bind: ignore ATTR lines in unet input
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 19
diff changeset
183 case UNETOBJ_ATTR:
19
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
184 continue;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
185 case UNETOBJ_PIN:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
186 if (inst)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
187 connect_pin(inst->outcomp, rdout.objname);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
188 continue;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
189 case UNETOBJ_PINMAP:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
190 if (inst)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
191 process_pinmap(inst);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
192 continue;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
193 default:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
194 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
195 "%s line %d: object type %s unexpected in component block\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
196 input_filename, rdstate.lineno, rdout.keyword);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
197 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
198 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
199 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
200 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
201
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
202 process_input_unet()
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
203 {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
204 open_unet_input_file(input_filename, &rdstate);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
205 while (read_unet_line(&rdstate, &rdout)) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
206 switch(rdout.typecode) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
207 case UNETOBJ_CLOSINGBRACE:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
208 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
209 "%s line %d: unexpected '}' outside of component block\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
210 input_filename, rdstate.lineno);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
211 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
212 case UNETOBJ_NET:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
213 enter_net_object(rdout.objname, 0);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
214 continue;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
215 case UNETOBJ_COMPONENT:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
216 process_component();
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
217 continue;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
218 case UNETOBJ_STARPOINT:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
219 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
220 "error: STARPOINT objects not expected in unet-bind input (%s line %d)\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
221 input_filename, rdstate.lineno);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
222 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
223 default:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
224 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
225 "%s line %d: unexpected object type %s\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
226 input_filename, rdstate.lineno, rdout.keyword);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
227 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
228 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
229 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
230 }