annotate ueda/sverp-bind/readunet.c @ 19:1d4c693b8f35

unet-bind: sverp netlist reading implemented
author Space Falcon <falcon@ivan.Harhan.ORG>
date Sun, 02 Aug 2015 03:09:15 +0000
parents
children dcdf606dfaaa
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);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
119 if (oc->conn_array[pinidx]) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
120 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
121 "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
122 oc->name, pinnumstr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
123 oc->conn_array[pinidx]->input_lineno, rdstate.lineno);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
124 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
125 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
126 oc->conn_array[pinidx] = create_pinconn();
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
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
129 static void
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
130 process_pinmap(inst)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
131 struct instance *inst;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
132 {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
133 register struct outcomp *oc = inst->outcomp;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
134 register char *pinnum;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
135
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
136 if (!oc->mclcomp) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
137 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
138 "%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
139 input_filename, rdstate.lineno);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
140 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
141 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
142 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
143 if (!pinnum) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
144 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
145 input_filename, rdstate.lineno);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
146 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
147 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
148 connect_pin(oc, pinnum);
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
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
151 static void
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
152 process_component()
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
153 {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
154 struct instance *inst;
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 inst = find_instance(rdout.objname);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
157 if (!inst) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
158 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
159 input_filename, rdstate.lineno, rdout.objname);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
160 unbound_instances++;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
161 } else {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
162 if (inst->claimed) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
163 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
164 "%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
165 input_filename, rdstate.lineno, inst->name);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
166 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
167 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
168 inst->claimed = 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 for (;;) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
171 if (!read_unet_line(&rdstate, &rdout)) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
172 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
173 input_filename);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
174 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
175 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
176 if (rdout.typecode == UNETOBJ_CLOSINGBRACE)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
177 break;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
178 switch(rdout.typecode) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
179 case UNETOBJ_PRIMITIVE:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
180 case UNETOBJ_ALTNAME:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
181 continue;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
182 case UNETOBJ_PIN:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
183 if (inst)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
184 connect_pin(inst->outcomp, rdout.objname);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
185 continue;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
186 case UNETOBJ_PINMAP:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
187 if (inst)
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
188 process_pinmap(inst);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
189 continue;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
190 default:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
191 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
192 "%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
193 input_filename, rdstate.lineno, rdout.keyword);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
194 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
195 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
196 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
197 }
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 process_input_unet()
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 open_unet_input_file(input_filename, &rdstate);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
202 while (read_unet_line(&rdstate, &rdout)) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
203 switch(rdout.typecode) {
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
204 case UNETOBJ_CLOSINGBRACE:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
205 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
206 "%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
207 input_filename, rdstate.lineno);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
208 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
209 case UNETOBJ_NET:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
210 enter_net_object(rdout.objname, 0);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
211 continue;
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
212 case UNETOBJ_COMPONENT:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
213 process_component();
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_STARPOINT:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
216 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
217 "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
218 input_filename, rdstate.lineno);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
219 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
220 default:
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
221 fprintf(stderr,
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
222 "%s line %d: unexpected object type %s\n",
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
223 input_filename, rdstate.lineno, rdout.keyword);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
224 exit(1);
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
225 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
226 }
1d4c693b8f35 unet-bind: sverp netlist reading implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
227 }