Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 11 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* |
1 | /* |
2 | * $Id: ext_nets.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $ |
2 | * $Id: ext_nets.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $ |
3 | * |
3 | * |
4 | * $Log: ext_nets.c,v $ |
4 | * $Log: ext_nets.c,v $ |
5 | * Revision 1.1.1.1 2003/11/04 23:34:57 mjames |
5 | * Revision 1.1.1.1 2003/11/04 23:34:57 mjames |
6 | * Imported into local repositrory |
6 | * Imported into local repositrory |
7 | * |
7 | * |
Line 60... | Line 60... | ||
60 | * Mike put it here |
60 | * Mike put it here |
61 | * |
61 | * |
62 | * |
62 | * |
63 | * Revision 1.27 2000/10/04 10:37:04 10:37:04 mjames (Mike James) |
63 | * Revision 1.27 2000/10/04 10:37:04 10:37:04 mjames (Mike James) |
64 | * Modified for Vertical2 : support COMPONENTS and SIGNALS |
64 | * Modified for Vertical2 : support COMPONENTS and SIGNALS |
65 | * |
65 | * |
66 | * Revision 1.27 2000/10/04 10:37:04 10:37:04 mjames (Mike James) |
66 | * Revision 1.27 2000/10/04 10:37:04 10:37:04 mjames (Mike James) |
67 | * Part of Release PSAVAT01 |
67 | * Part of Release PSAVAT01 |
68 | * |
68 | * |
69 | * Revision 1.26 2000/10/02 11:04:12 11:04:12 mjames (Mike James) |
69 | * Revision 1.26 2000/10/02 11:04:12 11:04:12 mjames (Mike James) |
70 | * new_vhdl |
70 | * new_vhdl |
71 | * |
71 | * |
72 | * Revision 1.25 2000/09/27 14:42:13 14:42:13 mjames (Mike James) |
72 | * Revision 1.25 2000/09/27 14:42:13 14:42:13 mjames (Mike James) |
73 | * Part of Release Sep_27_ST_2000 |
73 | * Part of Release Sep_27_ST_2000 |
74 | * |
74 | * |
75 | * Revision 1.24 2000/09/21 10:15:42 10:15:42 mjames (Mike James) |
75 | * Revision 1.24 2000/09/21 10:15:42 10:15:42 mjames (Mike James) |
76 | * Part of Release Sep21Alpha |
76 | * Part of Release Sep21Alpha |
77 | * |
77 | * |
78 | * Revision 1.23 2000/08/25 09:57:11 09:57:11 mjames (Mike James) |
78 | * Revision 1.23 2000/08/25 09:57:11 09:57:11 mjames (Mike James) |
79 | * Part of Release Aug25_alpha |
79 | * Part of Release Aug25_alpha |
80 | * |
80 | * |
81 | * Revision 1.22 2000/08/16 08:57:27 08:57:27 mjames (Mike James) |
81 | * Revision 1.22 2000/08/16 08:57:27 08:57:27 mjames (Mike James) |
82 | * Part of Release CD01_Aug2000 |
82 | * Part of Release CD01_Aug2000 |
83 | * |
83 | * |
84 | * Revision 1.21 2000/08/14 14:45:08 14:45:08 mjames (Mike James) |
84 | * Revision 1.21 2000/08/14 14:45:08 14:45:08 mjames (Mike James) |
85 | * Part of Release Aug_14_2000 |
85 | * Part of Release Aug_14_2000 |
86 | * |
86 | * |
87 | * Revision 1.20 2000/08/11 08:30:29 08:30:29 mjames (Mike James) |
87 | * Revision 1.20 2000/08/11 08:30:29 08:30:29 mjames (Mike James) |
88 | * Part of Release Aug_11_2000 |
88 | * Part of Release Aug_11_2000 |
89 | * |
89 | * |
90 | * Revision 1.19 2000/08/09 10:31:43 10:31:43 mjames (Mike James) |
90 | * Revision 1.19 2000/08/09 10:31:43 10:31:43 mjames (Mike James) |
91 | * Part of Release Aug__9_2000 |
91 | * Part of Release Aug__9_2000 |
92 | * |
92 | * |
93 | * Revision 1.18 2000/05/31 11:42:51 11:42:51 mjames (Mike James) |
93 | * Revision 1.18 2000/05/31 11:42:51 11:42:51 mjames (Mike James) |
94 | * Part of Release May_31_2000 |
94 | * Part of Release May_31_2000 |
95 | * |
95 | * |
96 | * Revision 1.17 2000/05/08 17:01:34 17:01:34 mjames (Mike James) |
96 | * Revision 1.17 2000/05/08 17:01:34 17:01:34 mjames (Mike James) |
97 | * Part of Release May__8_2000 |
97 | * Part of Release May__8_2000 |
98 | * |
98 | * |
99 | * Revision 1.16 2000/05/08 16:59:27 16:59:27 mjames (Mike James) |
99 | * Revision 1.16 2000/05/08 16:59:27 16:59:27 mjames (Mike James) |
100 | * Part of Release May__8_2000 |
100 | * Part of Release May__8_2000 |
101 | * |
101 | * |
102 | * Revision 1.15 2000/05/08 16:57:04 16:57:04 mjames (Mike James) |
102 | * Revision 1.15 2000/05/08 16:57:04 16:57:04 mjames (Mike James) |
103 | * Part of Release May__8_2000 |
103 | * Part of Release May__8_2000 |
104 | * |
104 | * |
105 | * Revision 1.14 2000/03/08 16:18:58 16:18:58 mjames (Mike James) |
105 | * Revision 1.14 2000/03/08 16:18:58 16:18:58 mjames (Mike James) |
106 | * New version including PC |
106 | * New version including PC |
107 | * |
107 | * |
108 | * Revision 1.11 2000/01/20 15:58:43 15:58:43 mjames (Mike James) |
108 | * Revision 1.11 2000/01/20 15:58:43 15:58:43 mjames (Mike James) |
109 | * Part of Release R22 |
109 | * Part of Release R22 |
110 | * |
110 | * |
111 | * Revision 1.10 99/12/22 11:15:23 11:15:23 mjames (Mike James) |
111 | * Revision 1.10 99/12/22 11:15:23 11:15:23 mjames (Mike James) |
112 | * Part of Release Dec_22_1999 |
112 | * Part of Release Dec_22_1999 |
113 | * |
113 | * |
114 | * Revision 1.9 99/06/25 14:35:27 14:35:27 mjames (Mike James) |
114 | * Revision 1.9 99/06/25 14:35:27 14:35:27 mjames (Mike James) |
115 | * Added in reference to expression.h, but no changes made |
115 | * Added in reference to expression.h, but no changes made |
116 | * to the function of acfread yet. |
116 | * to the function of acfread yet. |
117 | * |
117 | * |
118 | * Revision 1.8 99/06/18 09:23:50 09:23:50 mjames (Mike James) |
118 | * Revision 1.8 99/06/18 09:23:50 09:23:50 mjames (Mike James) |
119 | * |
119 | * |
120 | * Revision 1.7 98/04/24 14:11:18 14:11:18 mjames (Mike James) |
120 | * Revision 1.7 98/04/24 14:11:18 14:11:18 mjames (Mike James) |
121 | * added generic.h header |
121 | * added generic.h header |
122 | * |
122 | * |
123 | * Revision 1.6 97/04/23 08:42:50 08:42:50 mjames (Mike James) |
123 | * Revision 1.6 97/04/23 08:42:50 08:42:50 mjames (Mike James) |
124 | * CHecked in for release rel23041997 |
124 | * CHecked in for release rel23041997 |
125 | * |
125 | * |
126 | * Revision 1.5 97/01/03 13:37:41 13:37:41 mjames (Mike James) |
126 | * Revision 1.5 97/01/03 13:37:41 13:37:41 mjames (Mike James) |
127 | * Altered the set/del ext functions to make themn stop after |
127 | * Altered the set/del ext functions to make themn stop after |
128 | * they have found a match if a wildcarded net identifier was |
128 | * they have found a match if a wildcarded net identifier was |
129 | * not given. |
129 | * not given. |
130 | * |
130 | * |
131 | * Revision 1.4 96/07/19 14:38:53 14:38:53 mjames (Mike James) |
131 | * Revision 1.4 96/07/19 14:38:53 14:38:53 mjames (Mike James) |
132 | * Update to give to PRL |
132 | * Update to give to PRL |
133 | * |
133 | * |
134 | * Revision 1.3 1996/07/12 15:52:12 mjames |
134 | * Revision 1.3 1996/07/12 15:52:12 mjames |
135 | * Sorted out things like Alias and Jumpers |
135 | * Sorted out things like Alias and Jumpers |
136 | * Work Correctly |
136 | * Work Correctly |
137 | * Print COrrectly |
137 | * Print COrrectly |
138 | * |
138 | * |
Line 142... | Line 142... | ||
142 | * Print COrrectly |
142 | * Print COrrectly |
143 | * |
143 | * |
144 | * Revision 1.2 96/06/17 13:01:53 13:01:53 mjames (Mike James) |
144 | * Revision 1.2 96/06/17 13:01:53 13:01:53 mjames (Mike James) |
145 | * Altered the printing of JUMPERED and ALIASED nets |
145 | * Altered the printing of JUMPERED and ALIASED nets |
146 | * , |
146 | * , |
147 | * |
147 | * |
148 | * Revision 1.1 96/06/04 11:54:57 11:54:57 mjames (Mike James) |
148 | * Revision 1.1 96/06/04 11:54:57 11:54:57 mjames (Mike James) |
149 | * Initial revision |
149 | * Initial revision |
150 | * */ |
150 | * */ |
151 | 151 | ||
- | 152 | #include <stdio.h> |
|
- | 153 | #include <string.h> |
|
- | 154 | #include <stdlib.h> |
|
152 | #include "ext_nets.h" |
155 | #include <ctype.h> |
- | 156 | #include <sys/types.h> |
|
- | 157 | #include <regex.h> |
|
153 | 158 | ||
154 | #include "chck_names.h" |
159 | #include "vertcl_main.h" |
155 | #include "cmdlog.h" |
- | |
156 | #include "cmdparse.h" |
- | |
157 | #include "database.h" |
- | |
158 | #include "expression.h" |
160 | #include "expression.h" |
159 | #include "generic.h" |
161 | #include "generic.h" |
- | 162 | #include "database.h" |
|
160 | #include "routing.h" |
163 | #include "routing.h" |
- | 164 | #include "ext_nets.h" |
|
- | 165 | #include "cmdparse.h" |
|
- | 166 | #include "cmdlog.h" |
|
- | 167 | #include "chck_names.h" |
|
161 | #include "sorting.h" |
168 | #include "sorting.h" |
162 | #include "vertcl_main.h" |
- | |
163 | - | ||
164 | #include <ctype.h> |
- | |
165 | #include <regex.h> |
- | |
166 | #include <stdio.h> |
- | |
167 | #include <stdlib.h> |
- | |
168 | #include <string.h> |
- | |
169 | #include <sys/types.h> |
- | |
170 | 169 | ||
171 | /* streq() and strneq() declaration */ |
170 | /* streq() and strneq() declaration */ |
172 | #include "lx_support.h" |
171 | #include "lx_support.h" |
173 | 172 | ||
174 | #ident \ |
- | |
175 | "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/ext_nets.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $" |
173 | #ident "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/ext_nets.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $" |
176 | 174 | ||
177 | /* this function sets the is_external flags on sockets */ |
- | |
178 | 175 | ||
179 | typedef enum |
- | |
180 | { |
- | |
181 | SET_EXT, |
- | |
182 | DEL_EXT, |
- | |
183 | SET_FPGA, |
- | |
184 | DEL_FPGA |
- | |
185 | } flag_change_t; |
- | |
186 | - | ||
187 | static void set_clear_flags (char *template, flag_change_t oper) |
176 | /* this function sets the is_external flags on sockets */ |
188 | { |
- | |
189 | int rc; |
- | |
190 | long count = 0; |
- | |
191 | socket_t *skt = socket_head; |
- | |
192 | - | ||
193 | int found = 0, pass; |
- | |
194 | net_t *routed_net = routed_list; |
- | |
195 | /* compile regular expression */ |
- | |
196 | vert_regex_t *preg; |
- | |
197 | 177 | ||
198 | rc = vert_regcomp (&preg, template); |
178 | typedef enum { SET_EXT,DEL_EXT,SET_FPGA,DEL_FPGA } flag_change_t; |
199 | 179 | ||
200 | if (rc != 0) |
- | |
201 | { |
- | |
202 | char errbuff[100]; |
- | |
203 | regerror (rc, preg->preg, errbuff, 100); |
- | |
204 | Log ( |
- | |
205 | LOG_ERROR, |
- | |
206 | "-- Problem (rc=%d) %s with '%s' as regular expression\n", |
- | |
207 | rc, |
- | |
208 | errbuff, |
- | |
209 | template); |
- | |
210 | 180 | ||
- | 181 | static void set_clear_flags(char * template, |
|
- | 182 | flag_change_t oper) |
|
- | 183 | { |
|
- | 184 | int rc; |
|
- | 185 | long count = 0; |
|
- | 186 | socket_t * skt = socket_head; |
|
- | 187 | ||
- | 188 | int found = 0,pass; |
|
- | 189 | net_t *routed_net = routed_list; |
|
- | 190 | /* compile regular expression */ |
|
- | 191 | vert_regex_t * preg; |
|
- | 192 | ||
- | 193 | ||
- | 194 | rc = vert_regcomp(&preg,template); |
|
- | 195 | ||
- | 196 | if (rc != 0 ) |
|
- | 197 | { |
|
- | 198 | char errbuff[100]; |
|
- | 199 | regerror(rc,preg->preg,errbuff,100); |
|
- | 200 | Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,template); |
|
- | 201 | ||
211 | return /*TCL_ERROR*/; |
202 | return /*TCL_ERROR*/; |
- | 203 | } |
|
- | 204 | else |
|
- | 205 | { |
|
- | 206 | Log(LOG_GENERAL,"-- Using '%s' as match pattern\n",template); |
|
- | 207 | } |
|
- | 208 | ||
- | 209 | while(skt) { |
|
- | 210 | ||
- | 211 | found = regexec(preg->preg,skt->identifier,0,preg->regpatt,0); |
|
- | 212 | if(!found) { |
|
- | 213 | switch (oper) { |
|
- | 214 | case SET_EXT: |
|
- | 215 | if(level & 4) |
|
- | 216 | Log(LOG_GENERAL,"-- Set '%s' as external\n",skt->identifier); |
|
- | 217 | skt->is_external = 1; |
|
- | 218 | count++; |
|
- | 219 | break; |
|
- | 220 | case DEL_EXT: |
|
- | 221 | if(level & 4) |
|
- | 222 | Log(LOG_GENERAL,"-- Set '%s' as internal\n",skt->identifier); |
|
- | 223 | skt->is_external = 0; |
|
- | 224 | count++; |
|
- | 225 | break; |
|
- | 226 | case SET_FPGA: |
|
- | 227 | if(level & 4) |
|
- | 228 | Log(LOG_GENERAL,"-- Set '%s' as FPGA\n",skt->identifier); |
|
- | 229 | skt->is_FPGA = 1; |
|
- | 230 | count++; |
|
- | 231 | break; |
|
- | 232 | case DEL_FPGA: |
|
- | 233 | if(level & 4) |
|
- | 234 | Log(LOG_GENERAL,"-- Set '%s' as not FPGA\n",skt->identifier); |
|
- | 235 | skt->is_FPGA = 0; |
|
- | 236 | count++; |
|
- | 237 | break; |
|
212 | } |
238 | } |
- | 239 | } |
|
- | 240 | skt = skt->next; |
|
- | 241 | } |
|
- | 242 | ||
- | 243 | /* code moved here from jumpering.c as it is needed in several contexts, not just in jumpering */ |
|
- | 244 | /* firstly, set up the has_external flags on all of the nets, by checking to see if any |
|
- | 245 | nodes on any nets are connected to external sockets. |
|
- | 246 | If connected to an external socket, the net gets the property has_external*/ |
|
- | 247 | ||
- | 248 | pass = 2; |
|
- | 249 | while (pass) |
|
- | 250 | { |
|
- | 251 | if (pass == 2) |
|
- | 252 | { |
|
- | 253 | routed_net = routed_list; |
|
- | 254 | pass = 1; |
|
- | 255 | } |
|
213 | else |
256 | else |
- | 257 | { |
|
- | 258 | routed_net = named_list; |
|
- | 259 | pass = 0; |
|
- | 260 | }; |
|
- | 261 | while (routed_net) |
|
- | 262 | { |
|
- | 263 | noderef_t *noderefs = routed_net->nodes; |
|
- | 264 | routed_net->has_external = 0; |
|
- | 265 | while (noderefs) |
|
214 | { |
266 | { |
- | 267 | if (noderefs->node->socket->is_external && !routed_net->has_external) { |
|
- | 268 | routed_net->has_external = 1; |
|
215 | Log (LOG_GENERAL, "-- Using '%s' as match pattern\n", template); |
269 | /* Log(LOG_GENERAL,"-- external socket on net %s\n",routed_net->identifier); */ |
- | 270 | } |
|
- | 271 | noderefs = noderefs->next; |
|
216 | } |
272 | } |
217 | - | ||
218 | while (skt) |
- | |
219 | { |
- | |
220 | found = regexec (preg->preg, skt->identifier, 0, preg->regpatt, 0); |
- | |
221 | if (!found) |
- | |
222 | { |
- | |
223 | switch (oper) |
- | |
224 | { |
- | |
225 | case SET_EXT: |
273 | /* if(!routed_net->has_external) |
226 | if (level & 4) |
- | |
227 | Log ( |
- | |
228 | LOG_GENERAL, |
- | |
229 | "-- Set '%s' as external\n", |
- | |
230 | skt->identifier); |
- | |
231 | skt->is_external = 1; |
- | |
232 | count++; |
- | |
233 | break; |
- | |
234 | case DEL_EXT: |
- | |
235 | if (level & 4) |
- | |
236 | Log ( |
- | |
237 | LOG_GENERAL, |
- | |
238 | "-- Set '%s' as internal\n", |
- | |
239 | skt->identifier); |
- | |
240 | skt->is_external = 0; |
- | |
241 | count++; |
- | |
242 | break; |
- | |
243 | case SET_FPGA: |
- | |
244 | if (level & 4) |
- | |
245 | Log ( |
- | |
246 | LOG_GENERAL, |
- | |
247 | "-- Set '%s' as FPGA\n", |
- | |
248 | skt->identifier); |
- | |
249 | skt->is_FPGA = 1; |
- | |
250 | count++; |
- | |
251 | break; |
- | |
252 | case DEL_FPGA: |
- | |
253 | if (level & 4) |
- | |
254 | Log ( |
- | |
255 | LOG_GENERAL, |
- | |
256 | "-- Set '%s' as not FPGA\n", |
- | |
257 | skt->identifier); |
274 | Log(LOG_GENERAL,"-- no external socket on net %s\n",routed_net->identifier); */ |
258 | skt->is_FPGA = 0; |
- | |
259 | count++; |
- | |
260 | break; |
- | |
261 | } |
- | |
262 | } |
- | |
263 | skt = skt->next; |
275 | routed_net = routed_net->next; |
264 | } |
276 | } |
265 | 277 | ||
266 | /* code moved here from jumpering.c as it is needed in several contexts, not just in |
- | |
267 | * jumpering */ |
278 | } |
268 | /* firstly, set up the has_external flags on all of the nets, by checking to see if any |
- | |
269 | nodes on any nets are connected to external sockets. |
- | |
270 | If connected to an external socket, the net gets the property has_external*/ |
- | |
271 | 279 | ||
272 | pass = 2; |
- | |
273 | while (pass) |
- | |
274 | { |
- | |
275 | if (pass == 2) |
- | |
276 | { |
- | |
277 | routed_net = routed_list; |
- | |
278 | pass = 1; |
- | |
279 | } |
- | |
280 | else |
- | |
281 | { |
- | |
282 | routed_net = named_list; |
- | |
283 | pass = 0; |
- | |
284 | }; |
- | |
285 | while (routed_net) |
- | |
286 | { |
- | |
287 | noderef_t *noderefs = routed_net->nodes; |
- | |
288 | routed_net->has_external = 0; |
- | |
289 | while (noderefs) |
- | |
290 | { |
- | |
291 | if (noderefs->node->socket->is_external && |
- | |
292 | !routed_net->has_external) |
- | |
293 | { |
- | |
294 | routed_net->has_external = 1; |
- | |
295 | /* Log(LOG_GENERAL,"-- external socket on |
- | |
296 | * net %s\n",routed_net->identifier); */ |
- | |
297 | } |
- | |
298 | noderefs = noderefs->next; |
- | |
299 | } |
- | |
300 | /* if(!routed_net->has_external) |
- | |
301 | Log(LOG_GENERAL,"-- no external socket on net |
- | |
302 | %s\n",routed_net->identifier); */ |
- | |
303 | routed_net = routed_net->next; |
- | |
304 | } |
- | |
305 | } |
- | |
306 | 280 | ||
307 | vert_regfree (&preg); |
281 | vert_regfree(&preg); |
308 | Log (LOG_GENERAL, "-- Set/cleared flag on %d objects\n", count); |
282 | Log(LOG_GENERAL,"-- Set/cleared flag on %d objects\n",count); |
- | 283 | } |
|
309 | } |
284 | |
310 | 285 | ||
311 | void set_external_flags (char *template) |
286 | void set_external_flags(char * template ) |
312 | { |
287 | { |
313 | Log (LOG_GENERAL, "-- Beginning setting external flags : prefix '%s' --\n", template); |
288 | Log(LOG_GENERAL,"-- Beginning setting external flags : prefix '%s' --\n",template ); |
314 | set_clear_flags (template, SET_EXT); |
289 | set_clear_flags(template,SET_EXT); |
315 | Log (LOG_GENERAL, "-- Finished setting external flags --\n"); |
290 | Log(LOG_GENERAL,"-- Finished setting external flags --\n"); |
316 | } |
291 | } |
317 | 292 | ||
318 | void clear_external_flags (char *template) |
293 | void clear_external_flags(char * template ) |
319 | { |
294 | { |
320 | Log (LOG_GENERAL, "-- Beginning clearing external flags : prefix '%s' --\n", template); |
295 | Log(LOG_GENERAL,"-- Beginning clearing external flags : prefix '%s' --\n",template ); |
321 | set_clear_flags (template, DEL_EXT); |
296 | set_clear_flags(template,DEL_EXT); |
322 | Log (LOG_GENERAL, "-- Finished clearing external flags --\n"); |
297 | Log(LOG_GENERAL,"-- Finished clearing external flags --\n"); |
323 | } |
298 | } |
324 | 299 | ||
325 | void set_FPGA_flags (char *template) |
300 | void set_FPGA_flags(char * template ) |
326 | { |
301 | { |
327 | Log (LOG_GENERAL, "-- Beginning setting FPGA flags : prefix '%s' --\n", template); |
302 | Log(LOG_GENERAL,"-- Beginning setting FPGA flags : prefix '%s' --\n",template ); |
328 | set_clear_flags (template, SET_FPGA); |
303 | set_clear_flags(template,SET_FPGA); |
329 | Log (LOG_GENERAL, "-- Finished setting FPGA flags --\n"); |
304 | Log(LOG_GENERAL,"-- Finished setting FPGA flags --\n"); |
- | 305 | } |
|
330 | } |
306 | |
331 | 307 | ||
332 | void clear_FPGA_flags (char *template) |
308 | void clear_FPGA_flags(char * template ) |
333 | { |
309 | { |
334 | Log (LOG_GENERAL, "-- Beginning setting FPGA flags : prefix '%s' --\n", template); |
310 | Log(LOG_GENERAL,"-- Beginning setting FPGA flags : prefix '%s' --\n",template ); |
335 | set_clear_flags (template, DEL_FPGA); |
311 | set_clear_flags(template,DEL_FPGA); |
336 | Log (LOG_GENERAL, "-- Finished setting FPGA flags --\n"); |
312 | Log(LOG_GENERAL,"-- Finished setting FPGA flags --\n"); |
337 | } |
313 | } |