Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | /* |
2 | * $id: c:\\cygwin\\cvsroot/vertical/bundle.c,v 1.9 2001/10/31 16:23:44 mjames Exp $ |
||
3 | * |
||
4 | * $Log: bundle.c,v $ |
||
5 | * Revision 1.2 2004/06/22 21:44:14 mjames |
||
6 | * Firrst build most files |
||
7 | * |
||
8 | * Revision 1.13 2002/09/09 10:18:04 mjames |
||
9 | * Moved pin remapping function to pin ident editing function from |
||
10 | * sorting pin name routine. |
||
11 | * |
||
12 | * Revision 1.12 2002/08/23 14:21:21 mjames |
||
13 | * Cleared the bundle_index of a pin that does not have bundle membership |
||
14 | * |
||
15 | * Revision 1.11 2001/12/20 13:52:15 mjames |
||
16 | * Removed lost variables |
||
17 | * |
||
18 | * Revision 1.10 2001/10/31 22:19:57 mjames |
||
19 | * Tidying up problematical comments caused by CVS |
||
20 | * 'intelligent' comment guessing |
||
21 | * |
||
22 | * Revision 1.9 2001/10/31 16:23:44 mjames |
||
23 | * Added a datastructure to hide regular expression information from programs. |
||
24 | * Changed call to regexec to indicate 0 subexpressions to be matched |
||
25 | * rather than a number dependent on strlen(string) which was wrong. |
||
26 | * |
||
27 | * Revision 1.8 2001/10/23 21:16:46 mjames |
||
28 | * Removed highest_bundle attribute if someone is removing the bundle |
||
29 | * |
||
30 | * Revision 1.7 2001/10/10 20:18:45 mjames |
||
31 | * Added a vert_regcomp function to compile regular expressions |
||
32 | * with '^' (match start string) and '$' (match end string) bracketing |
||
33 | * this => wildcard must match entire string not just a part of it. |
||
34 | * |
||
35 | * Revision 1.6 2001/10/07 20:50:55 mjames |
||
36 | * Added wildcard checking (warn user about |
||
37 | * using wildcard '*' on the end of a string in stead of wildcard '.*') |
||
38 | * |
||
39 | * Revision 1.5 2001/09/25 23:15:24 mjames |
||
40 | * Converted wildcards to use proper regexp pattern match library |
||
41 | * |
||
42 | * Revision 1.4 2001/09/16 20:36:04 mjames |
||
43 | * Second attempt to modify wire bundles to be connector rather than net |
||
44 | * centric. Allows more than one connector to carry the same net, |
||
45 | * |
||
46 | * Revision 1.3 2001/09/16 19:50:07 mjames |
||
47 | * Second attempt at bundling the pins on sockets |
||
48 | * |
||
49 | * Revision 1.2 2001/09/13 21:09:51 mjames |
||
50 | * Using correct pointer references |
||
51 | * |
||
52 | * Revision 1.1 2001/09/12 21:27:21 mjames |
||
53 | * Bundling for Certify .vb files. Bundle up all wires on a connector into a bus |
||
54 | * with the same name as the connector and a width the same as the pins |
||
55 | * on the connector |
||
56 | * |
||
57 | */ |
||
58 | #include "cmdlog.h" |
||
59 | #include "cmdparse.h" |
||
60 | #include "database.h" |
||
61 | #include "expression.h" |
||
62 | #include "generic.h" |
||
63 | #include "printout.h" |
||
64 | #include "sorting.h" |
||
65 | #include "vertcl_main.h" |
||
66 | |||
67 | #include <ctype.h> |
||
68 | #include <regex.h> |
||
69 | #include <stdio.h> |
||
70 | #include <stdlib.h> |
||
71 | #include <string.h> |
||
72 | #include <sys/types.h> |
||
73 | |||
74 | #ident "@(#)$Header: C:/cvsroot/Vert03/vertlib/bundle.c,v 1.2 2004/06/22 21:44:14 mjames Exp $" |
||
75 | |||
76 | /* this function sets or clears all of the bundle group related to a socket */ |
||
77 | /* it allocates a unique integer to each net on the port list of the socket */ |
||
78 | |||
79 | /* faults : Does not check pin directions yet */ |
||
80 | /* assumes a net is only on one socket. not true for rings ! */ |
||
81 | |||
82 | static void set_bundle (socket_t *socket, int set_or_clear) |
||
83 | { |
||
84 | node_t *node; |
||
85 | int rows, columns; |
||
86 | int bundle; |
||
87 | int bundle_base; |
||
88 | /* Use generics to set up the bundle base */ |
||
89 | |||
90 | generic_info_t gen[1]; |
||
91 | |||
92 | if (!socket) |
||
93 | return; |
||
94 | |||
95 | /* is the array going from 130:1 or 129:0 ... */ |
||
96 | bundle_base = 1; |
||
97 | if (get_generic_value (&socket->generics, "bundle_base", gen) == IS_INTEGER) |
||
98 | { |
||
99 | bundle_base = eval_expression (gen->expr, &global_generics); |
||
100 | } |
||
101 | |||
102 | /* Removed Nov 2008 MDJ |
||
103 | if (get_generic_value(&global_generics, "bundle_base",gen) == IS_INTEGER) |
||
104 | { |
||
105 | bundle_base = eval_expression(gen->expr, &global_generics); |
||
106 | } |
||
107 | */ |
||
108 | /* |
||
109 | printf("bundle base \n",bundle_base); |
||
110 | */ |
||
111 | |||
112 | sort_nodes (socket, EXTRACT_XY); |
||
113 | |||
114 | /* the sort routine tells me pin row and column limits */ |
||
115 | /* rows are defined as numbers, columns defined as letters */ |
||
116 | rows = socket->max_pin_row - socket->min_pin_row + 1; |
||
117 | columns = socket->max_pin_col - socket->min_pin_col + 1; |
||
118 | node = socket->nodes; |
||
119 | bundle = 0; |
||
120 | while (node) |
||
121 | { |
||
122 | net_t *net = node->net; |
||
123 | /* |
||
124 | printf("node %s\n",node->identifier); |
||
125 | */ |
||
126 | if (net) |
||
127 | { |
||
128 | if (set_or_clear && net->how_routed != Not_Routable) |
||
129 | { |
||
130 | node->bundle_index = |
||
131 | node->pin_row - socket->min_pin_row + |
||
132 | (node->pin_col - socket->min_pin_col) * rows + bundle_base; |
||
133 | net->bundle_member = 1; |
||
134 | bundle++; |
||
135 | /* |
||
136 | printf("net %s -> |
||
137 | %s[%d]\n",net->identifier,net->bundle_parent->identifier,net->bundle_index); |
||
138 | */ |
||
139 | } |
||
140 | else /* clear */ |
||
141 | { |
||
142 | node->bundle_index = -1; |
||
143 | net->bundle_member = 0; |
||
144 | } |
||
145 | } |
||
146 | else |
||
147 | { |
||
148 | node->bundle_index = -1; |
||
149 | } |
||
150 | node = node->sktnext; |
||
151 | } |
||
152 | if (set_or_clear) |
||
153 | { |
||
154 | socket->highest_bundle = |
||
155 | rows * columns + bundle_base - 1; /* one more than bundle pins */ |
||
156 | socket->lowest_bundle = bundle_base; |
||
157 | socket->bundle_width = bundle; |
||
158 | } |
||
159 | else |
||
160 | { |
||
161 | socket->highest_bundle = 0; |
||
162 | socket->lowest_bundle = 0; |
||
163 | socket->bundle_width = 0; |
||
164 | } |
||
165 | /* for further declarations */ |
||
166 | } |
||
167 | |||
168 | void wildcard_bundle (char *chip_id_template, int create_or_delete) |
||
169 | { |
||
170 | int rc; |
||
171 | socket_t *skt = socket_head; |
||
172 | int count = 0; |
||
173 | int found = 0; |
||
174 | |||
175 | /* create_unrouted_list(); */ |
||
176 | /* compile regular expression */ |
||
177 | vert_regex_t *preg; |
||
178 | |||
179 | if (!chip_id_template) |
||
180 | { |
||
181 | chip_id_template = ".*"; |
||
182 | } |
||
183 | |||
184 | rc = vert_regcomp (&preg, chip_id_template); |
||
185 | if (rc != 0) |
||
186 | { |
||
187 | char errbuff[100]; |
||
188 | regerror (rc, preg->preg, errbuff, 100); |
||
189 | Log ( |
||
190 | LOG_ERROR, |
||
191 | "-- Problem (rc=%d) %s with '%s' as regular expression\n", |
||
192 | rc, |
||
193 | errbuff, |
||
194 | chip_id_template); |
||
195 | |||
196 | /* return TCL_ERROR; |
||
197 | */ |
||
198 | return; |
||
199 | } |
||
200 | else |
||
201 | { |
||
202 | Log (LOG_GENERAL, "-- Using '%s' as match pattern\n", chip_id_template); |
||
203 | } |
||
204 | while (skt) |
||
205 | { |
||
206 | found = regexec (preg->preg, skt->identifier, 0, preg->regpatt, 0); |
||
207 | |||
208 | if (!found) |
||
209 | { |
||
210 | /* |
||
211 | Log(LOG_GENERAL,"found %s\n",skt->identifier); |
||
212 | */ |
||
213 | count++; |
||
214 | set_bundle (skt, create_or_delete); |
||
215 | } |
||
216 | skt = skt->next; |
||
217 | } |
||
218 | Log (LOG_GENERAL, "-- matched %d sockets\n", count); |
||
219 | vert_regfree (&preg); |
||
220 | } |