Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | /* |
11 | mjames | 2 | * $Id: ext_nets.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $ |
2 | mjames | 3 | * |
4 | * $Log: ext_nets.c,v $ |
||
5 | * Revision 1.1.1.1 2003/11/04 23:34:57 mjames |
||
6 | * Imported into local repositrory |
||
7 | * |
||
8 | * Revision 1.13 2002/09/09 10:26:56 mjames |
||
9 | * Removed set generic range and replaced it with a set generic value command |
||
10 | * that takes both integers and ranges. |
||
11 | * |
||
12 | * Revision 1.12 2002/01/16 10:07:42 mjames |
||
13 | * converted to use #ident |
||
14 | * |
||
15 | * Revision 1.11 2001/10/31 22:20:04 mjames |
||
16 | * Tidying up problematical comments caused by CVS |
||
17 | * 'intelligent' comment guessing |
||
18 | * |
||
19 | * Revision 1.10 2001/10/31 16:22:15 mjames |
||
20 | * Added a datastructure to hide regular expression information from programs. |
||
21 | * Changed call to regexec to indicate 0 subexpressions to be matched |
||
22 | * rather than a number dependent on strlen(string) which was wrong. |
||
23 | * |
||
24 | * Revision 1.9 2001/10/10 20:18:23 mjames |
||
25 | * Added a vert_regcomp function to compile regular expressions |
||
26 | * with '^' (match start string) and '$' (match end string) bracketing |
||
27 | * this => wildcard must match entire string not just a part of it. |
||
28 | * |
||
29 | * Revision 1.8 2001/10/07 20:50:53 mjames |
||
30 | * Added wildcard checking (warn user about |
||
31 | * using wildcard '*' on the end of a string in stead of wildcard '.*') |
||
32 | * |
||
33 | * Revision 1.7 2001/09/25 23:15:23 mjames |
||
34 | * Converted wildcards to use proper regexp pattern match library |
||
35 | * |
||
36 | * Revision 1.6 2001/07/09 15:36:17 mjames |
||
37 | * Removed verbose diagnostics from the setting and clearing of flags. |
||
38 | * |
||
39 | * Revision 1.5 2001/06/07 14:46:48 mjames |
||
40 | * Corrected conflict |
||
41 | * |
||
42 | * Revision 1.4 2001/06/07 13:38:15 MJAMES |
||
43 | * Removed internal/external detection from jumpering and |
||
44 | * placed it in ext_nets.c so that the properties of nets affected by set/del ext are |
||
45 | * correctly updated |
||
46 | * |
||
47 | * Revision 1.3 2001/06/06 12:10:23 mjames |
||
48 | * Move from HPUX |
||
49 | * |
||
50 | * Revision 1.2 2001/03/29 22:08:56 mjames |
||
51 | * Modified to define the scope of set generic commands : now can be global |
||
52 | * or defined for a socket or a simple wildcarded list of sockets. |
||
53 | * |
||
54 | * In addition the is_FPGA property has been activated so that FPGA components |
||
55 | * are not listed out when used in a Verilog (.vb) file. |
||
56 | * |
||
57 | * Version raised to 11.02 |
||
58 | * |
||
59 | * Revision 1.1.1.1 2000/10/19 21:58:37 mjames |
||
60 | * Mike put it here |
||
61 | * |
||
62 | * |
||
63 | * Revision 1.27 2000/10/04 10:37:04 10:37:04 mjames (Mike James) |
||
64 | * Modified for Vertical2 : support COMPONENTS and SIGNALS |
||
11 | mjames | 65 | * |
2 | mjames | 66 | * Revision 1.27 2000/10/04 10:37:04 10:37:04 mjames (Mike James) |
67 | * Part of Release PSAVAT01 |
||
11 | mjames | 68 | * |
2 | mjames | 69 | * Revision 1.26 2000/10/02 11:04:12 11:04:12 mjames (Mike James) |
70 | * new_vhdl |
||
11 | mjames | 71 | * |
2 | mjames | 72 | * Revision 1.25 2000/09/27 14:42:13 14:42:13 mjames (Mike James) |
73 | * Part of Release Sep_27_ST_2000 |
||
11 | mjames | 74 | * |
2 | mjames | 75 | * Revision 1.24 2000/09/21 10:15:42 10:15:42 mjames (Mike James) |
76 | * Part of Release Sep21Alpha |
||
11 | mjames | 77 | * |
2 | mjames | 78 | * Revision 1.23 2000/08/25 09:57:11 09:57:11 mjames (Mike James) |
79 | * Part of Release Aug25_alpha |
||
11 | mjames | 80 | * |
2 | mjames | 81 | * Revision 1.22 2000/08/16 08:57:27 08:57:27 mjames (Mike James) |
82 | * Part of Release CD01_Aug2000 |
||
11 | mjames | 83 | * |
2 | mjames | 84 | * Revision 1.21 2000/08/14 14:45:08 14:45:08 mjames (Mike James) |
85 | * Part of Release Aug_14_2000 |
||
11 | mjames | 86 | * |
2 | mjames | 87 | * Revision 1.20 2000/08/11 08:30:29 08:30:29 mjames (Mike James) |
88 | * Part of Release Aug_11_2000 |
||
11 | mjames | 89 | * |
2 | mjames | 90 | * Revision 1.19 2000/08/09 10:31:43 10:31:43 mjames (Mike James) |
91 | * Part of Release Aug__9_2000 |
||
11 | mjames | 92 | * |
2 | mjames | 93 | * Revision 1.18 2000/05/31 11:42:51 11:42:51 mjames (Mike James) |
94 | * Part of Release May_31_2000 |
||
11 | mjames | 95 | * |
2 | mjames | 96 | * Revision 1.17 2000/05/08 17:01:34 17:01:34 mjames (Mike James) |
97 | * Part of Release May__8_2000 |
||
11 | mjames | 98 | * |
2 | mjames | 99 | * Revision 1.16 2000/05/08 16:59:27 16:59:27 mjames (Mike James) |
100 | * Part of Release May__8_2000 |
||
11 | mjames | 101 | * |
2 | mjames | 102 | * Revision 1.15 2000/05/08 16:57:04 16:57:04 mjames (Mike James) |
103 | * Part of Release May__8_2000 |
||
11 | mjames | 104 | * |
2 | mjames | 105 | * Revision 1.14 2000/03/08 16:18:58 16:18:58 mjames (Mike James) |
106 | * New version including PC |
||
11 | mjames | 107 | * |
2 | mjames | 108 | * Revision 1.11 2000/01/20 15:58:43 15:58:43 mjames (Mike James) |
109 | * Part of Release R22 |
||
11 | mjames | 110 | * |
2 | mjames | 111 | * Revision 1.10 99/12/22 11:15:23 11:15:23 mjames (Mike James) |
112 | * Part of Release Dec_22_1999 |
||
11 | mjames | 113 | * |
2 | mjames | 114 | * Revision 1.9 99/06/25 14:35:27 14:35:27 mjames (Mike James) |
11 | mjames | 115 | * Added in reference to expression.h, but no changes made |
2 | mjames | 116 | * to the function of acfread yet. |
11 | mjames | 117 | * |
2 | mjames | 118 | * Revision 1.8 99/06/18 09:23:50 09:23:50 mjames (Mike James) |
11 | mjames | 119 | * |
2 | mjames | 120 | * Revision 1.7 98/04/24 14:11:18 14:11:18 mjames (Mike James) |
121 | * added generic.h header |
||
11 | mjames | 122 | * |
2 | mjames | 123 | * Revision 1.6 97/04/23 08:42:50 08:42:50 mjames (Mike James) |
124 | * CHecked in for release rel23041997 |
||
11 | mjames | 125 | * |
2 | mjames | 126 | * Revision 1.5 97/01/03 13:37:41 13:37:41 mjames (Mike James) |
11 | mjames | 127 | * Altered the set/del ext functions to make themn stop after |
2 | mjames | 128 | * they have found a match if a wildcarded net identifier was |
129 | * not given. |
||
11 | mjames | 130 | * |
2 | mjames | 131 | * Revision 1.4 96/07/19 14:38:53 14:38:53 mjames (Mike James) |
132 | * Update to give to PRL |
||
11 | mjames | 133 | * |
2 | mjames | 134 | * Revision 1.3 1996/07/12 15:52:12 mjames |
135 | * Sorted out things like Alias and Jumpers |
||
136 | * Work Correctly |
||
137 | * Print COrrectly |
||
138 | * |
||
139 | * Revision 1.3 1996/07/12 15:52:12 mjames |
||
140 | * Sorted out things like Alias and Jumpers |
||
141 | * Work Correctly |
||
142 | * Print COrrectly |
||
143 | * |
||
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 |
||
146 | * , |
||
11 | mjames | 147 | * |
2 | mjames | 148 | * Revision 1.1 96/06/04 11:54:57 11:54:57 mjames (Mike James) |
149 | * Initial revision |
||
150 | * */ |
||
151 | |||
11 | mjames | 152 | #include <stdio.h> |
153 | #include <string.h> |
||
154 | #include <stdlib.h> |
||
155 | #include <ctype.h> |
||
156 | #include <sys/types.h> |
||
157 | #include <regex.h> |
||
2 | mjames | 158 | |
11 | mjames | 159 | #include "vertcl_main.h" |
2 | mjames | 160 | #include "expression.h" |
161 | #include "generic.h" |
||
11 | mjames | 162 | #include "database.h" |
2 | mjames | 163 | #include "routing.h" |
11 | mjames | 164 | #include "ext_nets.h" |
165 | #include "cmdparse.h" |
||
166 | #include "cmdlog.h" |
||
167 | #include "chck_names.h" |
||
2 | mjames | 168 | #include "sorting.h" |
169 | |||
170 | /* streq() and strneq() declaration */ |
||
171 | #include "lx_support.h" |
||
172 | |||
11 | mjames | 173 | #ident "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/ext_nets.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $" |
2 | mjames | 174 | |
11 | mjames | 175 | |
2 | mjames | 176 | /* this function sets the is_external flags on sockets */ |
177 | |||
11 | mjames | 178 | typedef enum { SET_EXT,DEL_EXT,SET_FPGA,DEL_FPGA } flag_change_t; |
2 | mjames | 179 | |
180 | |||
11 | mjames | 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; |
||
2 | mjames | 187 | |
11 | mjames | 188 | int found = 0,pass; |
189 | net_t *routed_net = routed_list; |
||
190 | /* compile regular expression */ |
||
191 | vert_regex_t * preg; |
||
2 | mjames | 192 | |
193 | |||
11 | mjames | 194 | rc = vert_regcomp(&preg,template); |
2 | mjames | 195 | |
11 | mjames | 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 | |||
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; |
||
2 | mjames | 238 | } |
11 | mjames | 239 | } |
240 | skt = skt->next; |
||
241 | } |
||
2 | mjames | 242 | |
11 | mjames | 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*/ |
||
2 | mjames | 247 | |
11 | mjames | 248 | pass = 2; |
249 | while (pass) |
||
250 | { |
||
251 | if (pass == 2) |
||
252 | { |
||
253 | routed_net = routed_list; |
||
254 | pass = 1; |
||
255 | } |
||
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) |
||
2 | mjames | 266 | { |
11 | mjames | 267 | if (noderefs->node->socket->is_external && !routed_net->has_external) { |
268 | routed_net->has_external = 1; |
||
269 | /* Log(LOG_GENERAL,"-- external socket on net %s\n",routed_net->identifier); */ |
||
270 | } |
||
271 | noderefs = noderefs->next; |
||
2 | mjames | 272 | } |
11 | mjames | 273 | /* if(!routed_net->has_external) |
274 | Log(LOG_GENERAL,"-- no external socket on net %s\n",routed_net->identifier); */ |
||
275 | routed_net = routed_net->next; |
||
276 | } |
||
2 | mjames | 277 | |
11 | mjames | 278 | } |
2 | mjames | 279 | |
280 | |||
11 | mjames | 281 | vert_regfree(&preg); |
282 | Log(LOG_GENERAL,"-- Set/cleared flag on %d objects\n",count); |
||
283 | } |
||
2 | mjames | 284 | |
285 | |||
11 | mjames | 286 | void set_external_flags(char * template ) |
287 | { |
||
288 | Log(LOG_GENERAL,"-- Beginning setting external flags : prefix '%s' --\n",template ); |
||
289 | set_clear_flags(template,SET_EXT); |
||
290 | Log(LOG_GENERAL,"-- Finished setting external flags --\n"); |
||
291 | } |
||
292 | |||
293 | void clear_external_flags(char * template ) |
||
294 | { |
||
295 | Log(LOG_GENERAL,"-- Beginning clearing external flags : prefix '%s' --\n",template ); |
||
296 | set_clear_flags(template,DEL_EXT); |
||
297 | Log(LOG_GENERAL,"-- Finished clearing external flags --\n"); |
||
298 | } |
||
299 | |||
300 | void set_FPGA_flags(char * template ) |
||
301 | { |
||
302 | Log(LOG_GENERAL,"-- Beginning setting FPGA flags : prefix '%s' --\n",template ); |
||
303 | set_clear_flags(template,SET_FPGA); |
||
304 | Log(LOG_GENERAL,"-- Finished setting FPGA flags --\n"); |
||
305 | } |
||
306 | |||
307 | |||
308 | void clear_FPGA_flags(char * template ) |
||
309 | { |
||
310 | Log(LOG_GENERAL,"-- Beginning setting FPGA flags : prefix '%s' --\n",template ); |
||
311 | set_clear_flags(template,DEL_FPGA); |
||
312 | Log(LOG_GENERAL,"-- Finished setting FPGA flags --\n"); |
||
313 | } |