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 | * $Header: c:\\cygwin\\cvsroot/Vert03/vertlib/routing.c,v 1.1.1.1 2003/11/04 23:34:57 mjames |
2 | * $Header: c:\\cygwin\\cvsroot/Vert03/vertlib/routing.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $ |
| 3 | * Exp $ |
- | |
| 4 | * |
3 | * |
| 5 | * $Log: routing.c,v $ |
4 | * $Log: routing.c,v $ |
| 6 | * 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 |
| 7 | * Imported into local repositrory |
6 | * Imported into local repositrory |
| 8 | * |
7 | * |
| Line 88... | Line 87... | ||
| 88 | * Revision 1.1.1.1 2000/10/19 21:58:39 mjames |
87 | * Revision 1.1.1.1 2000/10/19 21:58:39 mjames |
| 89 | * Mike put it here |
88 | * Mike put it here |
| 90 | * |
89 | * |
| 91 | * Revision 1.57 2000/10/04 10:37:09 10:37:09 mjames (Mike James) |
90 | * Revision 1.57 2000/10/04 10:37:09 10:37:09 mjames (Mike James) |
| 92 | * Modified for Vertical2 : support COMPONENTS and SIGNALS |
91 | * Modified for Vertical2 : support COMPONENTS and SIGNALS |
| 93 | * |
92 | * |
| 94 | * Revision 1.57 2000/10/04 10:37:09 10:37:09 mjames (Mike James) |
93 | * Revision 1.57 2000/10/04 10:37:09 10:37:09 mjames (Mike James) |
| 95 | * Part of Release PSAVAT01 |
94 | * Part of Release PSAVAT01 |
| 96 | * |
95 | * |
| 97 | * Revision 1.56 2000/10/02 11:04:20 11:04:20 mjames (Mike James) |
96 | * Revision 1.56 2000/10/02 11:04:20 11:04:20 mjames (Mike James) |
| 98 | * new_vhdl |
97 | * new_vhdl |
| 99 | * |
98 | * |
| 100 | * Revision 1.55 2000/09/27 14:42:20 14:42:20 mjames (Mike James) |
99 | * Revision 1.55 2000/09/27 14:42:20 14:42:20 mjames (Mike James) |
| 101 | * Part of Release Sep_27_ST_2000 |
100 | * Part of Release Sep_27_ST_2000 |
| 102 | * |
101 | * |
| 103 | * Revision 1.54 2000/09/21 10:15:50 10:15:50 mjames (Mike James) |
102 | * Revision 1.54 2000/09/21 10:15:50 10:15:50 mjames (Mike James) |
| 104 | * Part of Release Sep21Alpha |
103 | * Part of Release Sep21Alpha |
| 105 | * |
104 | * |
| 106 | * Revision 1.53 2000/08/25 09:57:16 09:57:16 mjames (Mike James) |
105 | * Revision 1.53 2000/08/25 09:57:16 09:57:16 mjames (Mike James) |
| 107 | * Part of Release Aug25_alpha |
106 | * Part of Release Aug25_alpha |
| 108 | * |
107 | * |
| 109 | * Revision 1.52 2000/08/16 08:57:32 08:57:32 mjames (Mike James) |
108 | * Revision 1.52 2000/08/16 08:57:32 08:57:32 mjames (Mike James) |
| 110 | * Part of Release CD01_Aug2000 |
109 | * Part of Release CD01_Aug2000 |
| 111 | * |
110 | * |
| 112 | * Revision 1.51 2000/08/16 08:55:43 08:55:43 mjames (Mike James) |
111 | * Revision 1.51 2000/08/16 08:55:43 08:55:43 mjames (Mike James) |
| 113 | * corrected routing/unroutable nets errors |
112 | * corrected routing/unroutable nets errors |
| 114 | * |
113 | * |
| 115 | * Revision 1.50 2000/08/14 14:45:13 14:45:13 mjames (Mike James) |
114 | * Revision 1.50 2000/08/14 14:45:13 14:45:13 mjames (Mike James) |
| 116 | * Part of Release Aug_14_2000 |
115 | * Part of Release Aug_14_2000 |
| 117 | * |
116 | * |
| 118 | * Revision 1.49 2000/08/14 14:43:31 14:43:31 mjames (Mike James) |
117 | * Revision 1.49 2000/08/14 14:43:31 14:43:31 mjames (Mike James) |
| 119 | * Added power pins |
118 | * Added power pins |
| 120 | * |
119 | * |
| 121 | * Revision 1.48 2000/08/11 08:30:33 08:30:33 mjames (Mike James) |
120 | * Revision 1.48 2000/08/11 08:30:33 08:30:33 mjames (Mike James) |
| 122 | * Part of Release Aug_11_2000 |
121 | * Part of Release Aug_11_2000 |
| 123 | * |
122 | * |
| 124 | * Revision 1.47 2000/08/09 10:31:49 10:31:49 mjames (Mike James) |
123 | * Revision 1.47 2000/08/09 10:31:49 10:31:49 mjames (Mike James) |
| 125 | * Part of Release Aug_9_2000 |
124 | * Part of Release Aug_9_2000 |
| 126 | * |
125 | * |
| 127 | * Revision 1.46 2000/05/31 11:43:00 11:43:00 mjames (Mike James) |
126 | * Revision 1.46 2000/05/31 11:43:00 11:43:00 mjames (Mike James) |
| 128 | * Part of Release May_31_2000 |
127 | * Part of Release May_31_2000 |
| 129 | * |
128 | * |
| 130 | * Revision 1.45 2000/05/08 17:01:39 17:01:39 mjames (Mike James) |
129 | * Revision 1.45 2000/05/08 17:01:39 17:01:39 mjames (Mike James) |
| 131 | * Part of Release May_8_2000 |
130 | * Part of Release May_8_2000 |
| 132 | * |
131 | * |
| 133 | * Revision 1.44 2000/05/08 16:59:32 16:59:32 mjames (Mike James) |
132 | * Revision 1.44 2000/05/08 16:59:32 16:59:32 mjames (Mike James) |
| 134 | * Part of Release May_8_2000 |
133 | * Part of Release May_8_2000 |
| 135 | * |
134 | * |
| 136 | * Revision 1.43 2000/05/08 16:57:09 16:57:09 mjames (Mike James) |
135 | * Revision 1.43 2000/05/08 16:57:09 16:57:09 mjames (Mike James) |
| 137 | * Part of Release May_8_2000 |
136 | * Part of Release May_8_2000 |
| 138 | * |
137 | * |
| 139 | * Revision 1.42 2000/03/08 16:19:29 16:19:29 mjames (Mike James) |
138 | * Revision 1.42 2000/03/08 16:19:29 16:19:29 mjames (Mike James) |
| 140 | * New version including PC |
139 | * New version including PC |
| 141 | * |
140 | * |
| 142 | * Revision 1.39 2000/01/20 15:58:50 15:58:50 mjames (Mike James) |
141 | * Revision 1.39 2000/01/20 15:58:50 15:58:50 mjames (Mike James) |
| 143 | * Part of Release R22 |
142 | * Part of Release R22 |
| 144 | * |
143 | * |
| 145 | * Revision 1.38 99/12/22 11:15:30 11:15:30 mjames (Mike James) |
144 | * Revision 1.38 99/12/22 11:15:30 11:15:30 mjames (Mike James) |
| 146 | * Part of Release Dec_22_1999 |
145 | * Part of Release Dec_22_1999 |
| 147 | * |
146 | * |
| 148 | * Revision 1.37 99/06/25 14:35:50 14:35:50 mjames (Mike James) |
147 | * Revision 1.37 99/06/25 14:35:50 14:35:50 mjames (Mike James) |
| 149 | * Added in reference to expression.h, but no changes made |
148 | * Added in reference to expression.h, but no changes made |
| 150 | * to the function of acfread yet. |
149 | * to the function of acfread yet. |
| 151 | * |
150 | * |
| 152 | * Revision 1.36 99/06/18 09:26:23 09:26:23 mjames (Mike James) |
151 | * Revision 1.36 99/06/18 09:26:23 09:26:23 mjames (Mike James) |
| 153 | * |
152 | * |
| 154 | * Revision 1.35 99/05/04 09:52:46 09:52:46 mjames (Mike James) |
153 | * Revision 1.35 99/05/04 09:52:46 09:52:46 mjames (Mike James) |
| 155 | * General checkin |
154 | * General checkin |
| 156 | * |
155 | * |
| 157 | * Revision 1.33 98/11/27 15:16:05 15:16:05 mjames (Mike James) |
156 | * Revision 1.33 98/11/27 15:16:05 15:16:05 mjames (Mike James) |
| 158 | * FIxed small errors |
157 | * FIxed small errors |
| 159 | * |
158 | * |
| 160 | * Revision 1.32 98/06/15 14:19:24 14:19:24 mjames (Mike James) |
159 | * Revision 1.32 98/06/15 14:19:24 14:19:24 mjames (Mike James) |
| 161 | * Removed and added Route Create from general routing algorithm. |
160 | * Removed and added Route Create from general routing algorithm. |
| 162 | * Added routing routing groups |
161 | * Added routing routing groups |
| 163 | * |
162 | * |
| 164 | * Revision 1.31 98/04/24 14:09:05 14:09:05 mjames (Mike James) |
163 | * Revision 1.31 98/04/24 14:09:05 14:09:05 mjames (Mike James) |
| 165 | * Removed 'create routes' from default routing algorithm set |
164 | * Removed 'create routes' from default routing algorithm set |
| 166 | * used when route command is used. |
165 | * used when route command is used. |
| 167 | * |
166 | * |
| 168 | * Revision 1.30 98/03/16 11:39:50 11:39:50 mjames (Mike James) |
167 | * Revision 1.30 98/03/16 11:39:50 11:39:50 mjames (Mike James) |
| 169 | * Removed an old bug - suffixing of PCB names has been broken for about |
168 | * Removed an old bug - suffixing of PCB names has been broken for about |
| 170 | * a year. If a pcb were read in non-suffixed and then another with a suffix, |
169 | * a year. If a pcb were read in non-suffixed and then another with a suffix, |
| 171 | * the suffix would be applied over all of the sockets and nets, not just the new ones. |
170 | * the suffix would be applied over all of the sockets and nets, not just the new ones. |
| 172 | * |
171 | * |
| 173 | * Revision 1.29 98/02/11 11:27:14 11:27:14 mjames (Mike James) |
172 | * Revision 1.29 98/02/11 11:27:14 11:27:14 mjames (Mike James) |
| 174 | * Checked in for version 6.2a |
173 | * Checked in for version 6.2a |
| 175 | * |
174 | * |
| 176 | * Revision 1.28 97/04/23 08:43:23 08:43414:23 mjames (Mike James) |
175 | * Revision 1.28 97/04/23 08:43:23 08:43414:23 mjames (Mike James) |
| 177 | * CHecked in for release rel23041997 |
176 | * CHecked in for release rel23041997 |
| 178 | * |
177 | * |
| 179 | * Revision 1.27 97/01/03 13:35:24 13:35:24 mjames (Mike James) |
178 | * Revision 1.27 97/01/03 13:35:24 13:35:24 mjames (Mike James) |
| 180 | * Tidied up the ensure_reserved() function. Added in a flag to |
179 | * Tidied up the ensure_reserved() function. Added in a flag to |
| 181 | * indicate that a net has been processed by ensure_reserved() |
180 | * indicate that a net has been processed by ensure_reserved() |
| 182 | * And so is not in error for only having 0 or 1 nodes names (which is the |
181 | * And so is not in error for only having 0 or 1 nodes names (which is the |
| 183 | * case for a 1 or 2 node net that has been processed. One of the nodes will |
182 | * case for a 1 or 2 node net that has been processed. One of the nodes will |
| 184 | * remain unnnamed and this will result in 0 or 1 nodes apparently in use |
183 | * remain unnnamed and this will result in 0 or 1 nodes apparently in use |
| 185 | * |
184 | * |
| 186 | * Revision 1.26 96/12/23 15:14:38 15:14:38 mjames (Mike James) |
185 | * Revision 1.26 96/12/23 15:14:38 15:14:38 mjames (Mike James) |
| 187 | * This code for fixing pins has been split from the 'exact path' |
186 | * This code for fixing pins has been split from the 'exact path' |
| 188 | * routing as the algorithm has become more reliable |
187 | * routing as the algorithm has become more reliable |
| 189 | * if there are two independednt routines. |
188 | * if there are two independednt routines. |
| 190 | * |
189 | * |
| 191 | * Revision 1.25 96/12/13 08:43:11 08:43:11 mjames (Mike James) |
190 | * Revision 1.25 96/12/13 08:43:11 08:43:11 mjames (Mike James) |
| 192 | * Update to v5.1, added Write ID , exact routing |
191 | * Update to v5.1, added Write ID , exact routing |
| 193 | * |
192 | * |
| 194 | * Revision 1.24 96/08/06 13:38:54 13:38:54 mjames (Mike James) |
193 | * Revision 1.24 96/08/06 13:38:54 13:38:54 mjames (Mike James) |
| 195 | * Added FIX_LOCATION pin attribute to netlist |
194 | * Added FIX_LOCATION pin attribute to netlist |
| 196 | * |
195 | * |
| 197 | * Revision 1.23 96/07/19 14:38:44 14:38:44 mjames (Mike James) |
196 | * Revision 1.23 96/07/19 14:38:44 14:38:44 mjames (Mike James) |
| 198 | * Update to give to PRL |
197 | * Update to give to PRL |
| Line 259... | Line 258... | ||
| 259 | * |
258 | * |
| 260 | * Revision 1.1 96/01/10 13:14:36 13:14:36 mjames (Mike James) |
259 | * Revision 1.1 96/01/10 13:14:36 13:14:36 mjames (Mike James) |
| 261 | * Initial revision |
260 | * Initial revision |
| 262 | * */ |
261 | * */ |
| 263 | 262 | ||
| - | 263 | #include <stdio.h> |
|
| 264 | #include "routing.h" |
264 | #include <string.h> |
| - | 265 | #include <stdlib.h> |
|
| - | 266 | #include <ctype.h> |
|
| - | 267 | #include <sys/types.h> |
|
| - | 268 | #include <regex.h> |
|
| 265 | 269 | ||
| 266 | #include "chck_names.h" |
270 | #include "vertcl_main.h" |
| 267 | #include "cmdlog.h" |
- | |
| 268 | #include "cmdparse.h" |
- | |
| 269 | #include "database.h" |
- | |
| 270 | #include "expression.h" |
271 | #include "expression.h" |
| 271 | #include "generic.h" |
272 | #include "generic.h" |
| - | 273 | #include "database.h" |
|
| 272 | #include "lx_support.h" |
274 | #include "lx_support.h" |
| 273 | #include "sorting.h" |
275 | #include "routing.h" |
| 274 | #include "statistics.h" |
- | |
| 275 | #include "unrouted.h" |
276 | #include "unrouted.h" |
| - | 277 | #include "chck_names.h" |
|
| - | 278 | #include "statistics.h" |
|
| - | 279 | #include "cmdparse.h" |
|
| - | 280 | #include "cmdlog.h" |
|
| 276 | #include "vertcl_main.h" |
281 | #include "sorting.h" |
| - | 282 | ||
| - | 283 | #ident "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/routing.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $" |
|
| 277 | 284 | ||
| 278 | #include <ctype.h> |
- | |
| 279 | #include <regex.h> |
- | |
| 280 | #include <stdio.h> |
- | |
| 281 | #include <stdlib.h> |
- | |
| 282 | #include <string.h> |
- | |
| 283 | #include <sys/types.h> |
- | |
| 284 | 285 | ||
| 285 | #ident \ |
- | |
| 286 | "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/routing.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $" |
- | |
| 287 | 286 | ||
| 288 | /* used in search for pre-existing path */ |
287 | /* used in search for pre-existing path */ |
| 289 | int MaxNodesForSearch = MAX_NODES_FOR_PATH_SEARCH; |
288 | int MaxNodesForSearch = MAX_NODES_FOR_PATH_SEARCH; |
| 290 | 289 | ||
| 291 | int global_group_flag = 0; |
- | |
| 292 | 290 | ||
| - | 291 | int global_group_flag = 0 ; |
|
| - | 292 | ||
| - | 293 | static void |
|
| 293 | static void get_num_nets (net_t *list, char *message) |
294 | get_num_nets (net_t * list, char *message) |
| 294 | { |
295 | { |
| 295 | int i = 0; |
296 | int i = 0; |
| 296 | while (list) |
297 | while (list) |
| 297 | { |
298 | { |
| 298 | list = list->next; |
299 | list = list->next; |
| 299 | i++; |
300 | i++; |
| 300 | } |
301 | } |
| 301 | Log (LOG_GENERAL, "-- %-4d %s\n", i, message); |
302 | Log (LOG_GENERAL, "-- %-4d %s\n", i, message); |
| 302 | } |
303 | } |
| 303 | 304 | ||
| - | 305 | void |
|
| 304 | void count_nets (char *message) |
306 | count_nets (char *message) |
| 305 | { |
307 | { |
| 306 | Log (LOG_GENERAL, "-- Routing Statistics : %s\n", message); |
- | |
| 307 | 308 | ||
| - | 309 | Log (LOG_GENERAL, "-- Routing Statistics : %s\n", message); |
|
| - | 310 | ||
| 308 | get_num_nets (unrouted_list, "Connections not routed"); |
311 | get_num_nets (unrouted_list, "Connections not routed"); |
| 309 | get_num_nets (routed_list, "Nets connected but not in use"); |
312 | get_num_nets (routed_list, "Nets connected but not in use"); |
| 310 | get_num_nets (named_list, "Nets connected and used by named signals"); |
313 | get_num_nets (named_list, "Nets connected and used by named signals"); |
| 311 | Log (LOG_GENERAL, "-- \n"); |
314 | Log (LOG_GENERAL, "-- \n"); |
| - | 315 | ||
| 312 | } |
316 | } |
| 313 | 317 | ||
| - | 318 | ||
| 314 | /* clear the routing flags on the node references on a particular net */ |
319 | /* clear the routing flags on the node references on a particular net */ |
| 315 | /* this tries to avoid the situation where two unrouted nets both find the |
320 | /* this tries to avoid the situation where two unrouted nets both find the |
| 316 | same pin connection on the routed net when it is searched to see if |
321 | same pin connection on the routed net when it is searched to see if |
| 317 | it is connected to a socket. The old algorithm found the first |
322 | it is connected to a socket. The old algorithm found the first |
| 318 | connected pin on a socket and then used this */ |
323 | connected pin on a socket and then used this */ |
| 319 | void clear_routing_flags (noderef_t *net_nodes) |
324 | void clear_routing_flags(noderef_t * net_nodes) |
| 320 | { |
325 | { |
| 321 | while (net_nodes) |
326 | while (net_nodes) |
| 322 | { |
327 | { |
| 323 | /* Indicate not already visited all nodes on this net */ |
328 | /* Indicate not already visited all nodes on this net */ |
| 324 | net_nodes->r_flag = 0; |
329 | net_nodes->r_flag = 0; |
| 325 | net_nodes = net_nodes->next; |
330 | net_nodes = net_nodes->next; |
| 326 | } |
331 | } |
| - | 332 | ||
| 327 | } |
333 | } |
| 328 | 334 | ||
| - | 335 | ||
| - | 336 | ||
| 329 | /* does a net reach the wanted socket with the pin direction correct |
337 | /* does a net reach the wanted socket with the pin direction correct |
| 330 | and if we are using pin_groups is this pin in the correct group */ |
338 | and if we are using pin_groups is this pin in the correct group */ |
| - | 339 | noderef_t * search_net_for_socket (noderef_t * wanted_ref, |
|
| 331 | noderef_t * |
340 | noderef_t * net_nodes, |
| 332 | search_net_for_socket (noderef_t *wanted_ref, noderef_t *net_nodes, int use_group_mask) |
341 | int use_group_mask) |
| 333 | { |
342 | { |
| 334 | int route_flags = 0; |
343 | int route_flags=0; |
| 335 | node_t *wanted = wanted_ref->node; |
344 | node_t *wanted = wanted_ref->node; |
| 336 | if (use_group_mask) |
345 | if (use_group_mask) |
| 337 | route_flags = wanted->socket->route_flags; |
346 | route_flags = wanted->socket->route_flags; |
| 338 | while (net_nodes) |
347 | while (net_nodes) |
| 339 | { |
348 | { |
| 340 | node_t *nnode = net_nodes->node; |
349 | node_t *nnode = net_nodes->node; |
| 341 | 350 | ||
| 342 | /* if we have not already visited this node */ |
351 | /* if we have not already visited this node */ |
| - | 352 | if ((net_nodes->r_flag == 0) && |
|
| 343 | if ((net_nodes->r_flag == 0) && (nnode->socket == wanted->socket) && |
353 | (nnode->socket == wanted->socket) && |
| 344 | /* either |
354 | /* either |
| 345 | NOT a fixed pin (pin direction NOT pin location ) or |
355 | NOT a fixed pin (pin direction NOT pin location ) or |
| 346 | IS a fixed pin and in the right direction : probably can use compat_pins |
356 | IS a fixed pin and in the right direction : probably can use compat_pins info |
| 347 | info from template.c here MDJ Aug 2000 */ |
357 | from template.c here MDJ Aug 2000 */ |
| 348 | (nnode->fixed_pin == 0 || nnode->pindir == wanted_ref->pindir) && |
358 | (nnode->fixed_pin == 0 || nnode->pindir == wanted_ref->pindir) && |
| 349 | /* either |
359 | /* either |
| 350 | Not using pin groups |
360 | Not using pin groups |
| 351 | or the pin group is the same */ |
361 | or the pin group is the same */ |
| 352 | (!route_flags || |
- | |
| 353 | ((nnode->pin_group & route_flags) == (wanted->pin_group & route_flags)))) |
362 | (!route_flags || ((nnode->pin_group & route_flags) == (wanted->pin_group & route_flags ))) |
| 354 | { |
363 | ) |
| - | 364 | { |
|
| 355 | net_nodes->r_flag = 1; |
365 | net_nodes->r_flag = 1; |
| 356 | return (net_nodes); |
366 | return (net_nodes); |
| 357 | } |
367 | } |
| 358 | net_nodes = net_nodes->next; |
368 | net_nodes = net_nodes->next; |
| 359 | } |
369 | } |
| 360 | return NULL; |
370 | return NULL; |
| 361 | } |
371 | } |
| 362 | 372 | ||
| - | 373 | ||
| 363 | /* removes a net from the list of nets */ |
374 | /* removes a net from the list of nets */ |
| 364 | 375 | ||
| 365 | net_t *remove_net (net_t **list, net_t *net) |
376 | net_t *remove_net (net_t ** list, net_t * net) |
| 366 | { |
377 | { |
| 367 | noderef_t *refs, *temp; |
378 | noderef_t *refs, *temp; |
| 368 | net_t *next_net, *prev_net; |
379 | net_t *next_net, * prev_net; |
| 369 | /* |
380 | /* |
| 370 | printf("-- removing %s (%s) (%p) list %p\n", |
381 | printf("-- removing %s (%s) (%p) list %p\n", |
| 371 | net->identifier,net->name,*list,net); |
382 | net->identifier,net->name,*list,net); |
| 372 | */ |
383 | */ |
| 373 | next_net = net->next; |
384 | next_net = net->next; |
| 374 | prev_net = net->prev; |
385 | prev_net = net->prev; |
| 375 | /* fill in the gap */ |
386 | /* fill in the gap */ |
| 376 | /* removal from head of list is different */ |
387 | /* removal from head of list is different */ |
| 377 | if (net == *list) |
388 | if (net == *list) { |
| 378 | { |
- | |
| 379 | *list = next_net; |
389 | *list = next_net; |
| 380 | if (next_net) |
390 | if (next_net) |
| 381 | next_net->prev = NULL; |
391 | next_net->prev = NULL; |
| 382 | } |
392 | } |
| 383 | else |
393 | else { |
| 384 | { |
394 | |
| 385 | if (prev_net) |
395 | if (prev_net) |
| 386 | prev_net->next = net->next; |
396 | prev_net->next = net->next; |
| 387 | if (next_net) |
397 | if (next_net) |
| 388 | next_net->prev = net->prev; |
398 | next_net->prev = net->prev; |
| 389 | }; |
399 | }; |
| - | 400 | ||
| 390 | 401 | ||
| 391 | /* get pointer to the nodes on this net */ |
402 | /* get pointer to the nodes on this net */ |
| 392 | refs = net->nodes; |
403 | refs = net->nodes; |
| 393 | 404 | ||
| 394 | /* do not destroy the net linking structure |
405 | /* do not destroy the net linking structure |
| 395 | as it could still be pointed at by unused unrouted |
406 | as it could still be pointed at by unused unrouted |
| 396 | nodes that are still attached to sockets which you will |
407 | nodes that are still attached to sockets which you will |
| 397 | find if you examine all of the nodes attached to a socket. */ |
408 | find if you examine all of the nodes attached to a socket. */ |
| 398 | net->list_ref = NULL; /* this net is not held on any list now */ |
409 | net->list_ref = NULL; /* this net is not held on any list now */ |
| 399 | net->nodecount = 0; |
410 | net->nodecount = 0; |
| 400 | net->nodes = NULL; |
411 | net->nodes = NULL; |
| 401 | /*net->subnets = NULL; do not destroy subnets , used for alias listing */ |
412 | /*net->subnets = NULL; do not destroy subnets , used for alias listing */ |
| 402 | /*change name to something worrying */ |
413 | /*change name to something worrying */ |
| 403 | net->name = "[DELETED so this is INVISIBLE]"; |
414 | net->name = "[DELETED so this is INVISIBLE]"; |
| - | 415 | ||
| - | 416 | /* remove the nodes on this net */ |
|
| - | 417 | while (refs) |
|
| - | 418 | { |
|
| - | 419 | refs->node->refcount--; /* one less reference */ |
|
| - | 420 | temp = refs->next; |
|
| - | 421 | free (refs); |
|
| - | 422 | refs = temp; |
|
| - | 423 | }; |
|
| 404 | 424 | ||
| 405 | /* remove the nodes on this net */ |
- | |
| 406 | while (refs) |
- | |
| 407 | { |
- | |
| 408 | refs->node->refcount--; /* one less reference */ |
- | |
| 409 | temp = refs->next; |
- | |
| 410 | free (refs); |
- | |
| 411 | refs = temp; |
- | |
| 412 | }; |
- | |
| 413 | 425 | ||
| - | 426 | ||
| 414 | return next_net; |
427 | return next_net; |
| 415 | } |
428 | } |
| 416 | 429 | ||
| - | 430 | ||
| 417 | /* moves a net from one list to another */ |
431 | /* moves a net from one list to another */ |
| - | 432 | void |
|
| 418 | void transfer_net_to_named (net_t **from_list, net_t *net) |
433 | transfer_net_to_named (net_t ** from_list, |
| - | 434 | net_t * net) |
|
| 419 | { |
435 | { |
| 420 | /* remove the node from the 'from' list */ |
- | |
| 421 | /* |
- | |
| 422 | printf("-- transferring %s (%s) (%p) list |
- | |
| 423 | %p\n",net->identifier,net->name,*from_list,net); |
- | |
| 424 | */ |
- | |
| 425 | if (net->next) |
- | |
| 426 | net->next->prev = net->prev; |
- | |
| 427 | if (net->prev) |
- | |
| 428 | net->prev->next = net->next; |
- | |
| 429 | - | ||
| 430 | if (net == *from_list) |
- | |
| 431 | *from_list = net->next; |
- | |
| 432 | - | ||
| 433 | net->list_ref = &named_list; /* net now is on the named list */ |
- | |
| 434 | - | ||
| 435 | /* stick net on tail of 'to' list */ |
- | |
| 436 | if (named_tail) |
- | |
| 437 | named_tail->next = net; |
- | |
| 438 | net->prev = named_tail; |
- | |
| 439 | - | ||
| 440 | if (!named_list) |
- | |
| 441 | named_list = net; |
- | |
| 442 | net->next = NULL; |
- | |
| 443 | 436 | ||
| - | 437 | /* remove the node from the 'from' list */ |
|
| - | 438 | /* |
|
| - | 439 | printf("-- transferring %s (%s) (%p) list %p\n",net->identifier,net->name,*from_list,net); |
|
| - | 440 | */ |
|
| - | 441 | if (net->next) |
|
| - | 442 | net->next->prev = net->prev; |
|
| - | 443 | if (net->prev) |
|
| - | 444 | net->prev->next = net->next; |
|
| - | 445 | ||
| - | 446 | ||
| - | 447 | if (net == *from_list) |
|
| - | 448 | *from_list = net->next; |
|
| - | 449 | ||
| - | 450 | net->list_ref = &named_list; /* net now is on the named list */ |
|
| - | 451 | ||
| - | 452 | ||
| - | 453 | /* stick net on tail of 'to' list */ |
|
| - | 454 | if (named_tail) |
|
| - | 455 | named_tail->next = net; |
|
| - | 456 | net->prev = named_tail; |
|
| - | 457 | ||
| - | 458 | if (!named_list) |
|
| - | 459 | named_list = net; |
|
| - | 460 | net->next = NULL; |
|
| - | 461 | ||
| 444 | named_tail = net; |
462 | named_tail = net; |
| - | 463 | ||
| - | 464 | ||
| 445 | } |
465 | } |
| 446 | 466 | ||
| - | 467 | ||
| 447 | /* ******************************************** */ |
468 | /* ******************************************** */ |
| 448 | /* |
469 | /* |
| 449 | This function tidies up, setting net names for all of the pins on the |
470 | This function tidies up, setting net names for all of the pins on the |
| 450 | net that have not been used by the unrouted net, to a net whose name |
471 | net that have not been used by the unrouted net, to a net whose name |
| 451 | is RSV00001Z where the 00001 is a sequence number . |
472 | is RSV00001Z where the 00001 is a sequence number . |
| Line 454... | Line 475... | ||
| 454 | Recently modified such that external connections do not get this treatment |
475 | Recently modified such that external connections do not get this treatment |
| 455 | These pins take on the names of the nets connected regardless, as they are |
476 | These pins take on the names of the nets connected regardless, as they are |
| 456 | not EPLDs, so there won't be a complaint by Maxplus2. |
477 | not EPLDs, so there won't be a complaint by Maxplus2. |
| 457 | */ |
478 | */ |
| 458 | 479 | ||
| 459 | /* the dummy node count is external to the naming routine, as it |
480 | /* the dummy node count is external to the naming routine, as it |
| 460 | is used in the ensure_reservation code */ |
481 | is used in the ensure_reservation code */ |
| 461 | static int nodecount = 0; |
482 | static int nodecount = 0; |
| 462 | 483 | ||
| - | 484 | void |
|
| 463 | void name_unused_nodes (net_t *routed_net, char *identifier) |
485 | name_unused_nodes (net_t * routed_net, |
| - | 486 | char *identifier) |
|
| 464 | { |
487 | { |
| 465 | noderef_t *routed_nodes; |
488 | noderef_t *routed_nodes; |
| 466 | char *unused_ident; |
489 | char *unused_ident; |
| - | 490 | ||
| 467 | 491 | ||
| 468 | routed_nodes = routed_net->nodes; |
492 | routed_nodes = routed_net->nodes; |
| 469 | while (routed_nodes) |
493 | while (routed_nodes) |
| 470 | { |
494 | { |
| 471 | node_t *cnode = routed_nodes->node; |
495 | node_t *cnode = routed_nodes->node; |
| 472 | if (routed_nodes->node->net_assigned == 0) |
496 | if (routed_nodes->node->net_assigned == 0) |
| 473 | { /* this node hasnt yet been used by a net */ |
497 | { /* this node hasnt yet been used by a net */ |
| 474 | if (cnode->socket->is_external == 0) |
498 | if (cnode->socket->is_external == 0) |
| 475 | { /* EPLD or internal node */ |
499 | { /* EPLD or internal node */ |
| 476 | /* every reserved pin is unique, so make it a new name c */ |
500 | /* every reserved pin is unique, so make it a new name c */ |
| 477 | unused_ident = calloc (RES_NAMLEN + 1, sizeof (char)); |
501 | unused_ident = calloc (RES_NAMLEN + 1, sizeof (char)); |
| 478 | sprintf (unused_ident, RES_FMT, nodecount++); |
502 | sprintf (unused_ident, RES_FMT, nodecount++); |
| 479 | cnode->name = unused_ident; /* use the created name */ |
503 | cnode->name = unused_ident; /* use the created name */ |
| 480 | 504 | ||
| 481 | cnode->net = |
- | |
| 482 | routed_net; /* tell the node its got a net assigned */ |
505 | cnode->net = routed_net; /* tell the node its got a net assigned */ |
| 483 | cnode->pindir = INPUT; |
506 | cnode->pindir = INPUT; |
| 484 | /* cnode->datatype = "Named through naming unused |
507 | /* cnode->datatype = "Named through naming unused nodes";*/ |
| 485 | * nodes";*/ |
- | |
| 486 | /* cnode->datatype = routed_net->datatype; */ |
508 | /* cnode->datatype = routed_net->datatype; */ |
| 487 | cnode->vhdltype = |
- | |
| 488 | default_vhdl_datatype; /* put something there */ |
509 | cnode->vhdltype = default_vhdl_datatype; /* put something there */ |
| 489 | cnode->lhs_expr = NULL; |
510 | cnode->lhs_expr = NULL; |
| 490 | 511 | ||
| 491 | cnode->orig_vhdltype = NULL; /* put something there */ |
512 | cnode->orig_vhdltype = NULL; /* put something there */ |
| - | 513 | ||
| 492 | } |
514 | } |
| 493 | else |
515 | else |
| 494 | { /* An external flag See SET EXTERNAL <prefix> */ |
516 | { /* An external flag See SET EXTERNAL <prefix> */ |
| 495 | cnode->name = identifier; /* same name as the net */ |
517 | cnode->name = identifier; /* same name as the net */ |
| 496 | 518 | ||
| 497 | cnode->net = |
- | |
| 498 | routed_net; /* tell the node its got a net assigned */ |
519 | cnode->net = routed_net; /* tell the node its got a net assigned */ |
| 499 | cnode->pindir = INPUT; |
520 | cnode->pindir = INPUT; |
| 500 | /* cnode->datatype = routed_net->datatype; */ /* routed_net->datatype; |
521 | /* cnode->datatype = routed_net->datatype; *//* routed_net->datatype; */ |
| 501 | */ |
- | |
| 502 | cnode->vhdltype = |
- | |
| 503 | routed_net->vhdltype; /* put something there */ |
522 | cnode->vhdltype = routed_net->vhdltype; /* put something there */ |
| 504 | cnode->lhs_expr = NULL; |
523 | cnode->lhs_expr = NULL; |
| 505 | cnode->orig_vhdltype = NULL; /* put something there */ |
524 | cnode->orig_vhdltype = NULL; /* put something there */ |
| 506 | } |
525 | } |
| 507 | 526 | ||
| 508 | cnode->net_assigned = 1; /* tell the node its got a net assigned */ |
527 | cnode->net_assigned = 1; /* tell the node its got a net assigned */ |
| 509 | cnode->in_use = 0; /* if the node is in use then set its flag */ |
528 | cnode->in_use = 0; /* if the node is in use then set its flag */ |
| - | 529 | ||
| 510 | } |
530 | } |
| 511 | routed_nodes = routed_nodes->next; |
531 | routed_nodes = routed_nodes->next; |
| 512 | } |
532 | } |
| 513 | } |
533 | } |
| 514 | 534 | ||
| 515 | /* ******************************************** */ |
535 | /* ******************************************** */ |
| 516 | /* connect up the routed and unrouted nets */ |
536 | /* connect up the routed and unrouted nets */ |
| 517 | 537 | ||
| - | 538 | void |
|
| 518 | void combine_sub (net_t *routed_net, net_t *unrouted_net) |
539 | combine_sub (net_t * routed_net, |
| - | 540 | net_t * unrouted_net) |
|
| 519 | { |
541 | { |
| 520 | noderef_t *routed_nodes, *unrouted_nodes; |
542 | noderef_t *routed_nodes, *unrouted_nodes; |
| 521 | 543 | ||
| 522 | /* |
544 | /* |
| 523 | printf("-- Moving net %s onto routing of %s\n", |
545 | printf("-- Moving net %s onto routing of %s\n", |
| 524 | unrouted_net->identifier,routed_net->identifier); |
546 | unrouted_net->identifier,routed_net->identifier); |
| 525 | */ |
547 | */ |
| 526 | 548 | ||
| 527 | unrouted_nodes = unrouted_net->nodes; |
549 | unrouted_nodes = unrouted_net->nodes; |
| 528 | routed_nodes = routed_net->nodes; |
550 | routed_nodes = routed_net->nodes; |
| - | 551 | if (level & 2) { |
|
| - | 552 | Log(LOG_GENERAL,"#COMBINE_SUB routed=%s, unrouted=%s\n", |
|
| - | 553 | unrouted_net->name,routed_net->name); |
|
| - | 554 | Log(LOG_GENERAL," type def routed = %d unrouted=%d\n", |
|
| - | 555 | unrouted_net->type_defined,routed_net->type_defined); |
|
| - | 556 | } |
|
| - | 557 | /* for each node on the routed net, is this net needed on |
|
| - | 558 | the unrouted net */ |
|
| - | 559 | while (unrouted_nodes) |
|
| - | 560 | { |
|
| - | 561 | noderef_t *route_ref; |
|
| - | 562 | node_t *routed_node, *unrouted_node; |
|
| - | 563 | unrouted_node = unrouted_nodes->node; |
|
| - | 564 | ||
| - | 565 | /* we have a route, this search _will succeed .. if it doesnt .. oops. */ |
|
| - | 566 | /* do not need to worry about the groups here as the nets have already |
|
| - | 567 | been found */ |
|
| - | 568 | ||
| - | 569 | /* Changed MDJ July 2001 : made it a prerequisite to check if the pin_group matches */ |
|
| - | 570 | ||
| - | 571 | route_ref = search_net_for_socket (unrouted_nodes, routed_nodes,unrouted_node->pin_group); |
|
| - | 572 | ||
| - | 573 | ||
| - | 574 | ||
| - | 575 | ||
| - | 576 | /* if we have found a node on the right socket on the |
|
| - | 577 | routed net that has not yet been used */ |
|
| - | 578 | ||
| - | 579 | if (route_ref) |
|
| - | 580 | { |
|
| - | 581 | ||
| - | 582 | ||
| - | 583 | routed_node = route_ref->node; |
|
| - | 584 | if (level &2) |
|
| - | 585 | Log(LOG_GENERAL,"info %s(%s) '%s'\n",routed_node->socket->name,routed_node->identifier, |
|
| - | 586 | route_ref->orig_name?route_ref->orig_name:unrouted_net->name); |
|
| - | 587 | ||
| - | 588 | /* |
|
| - | 589 | route_ref->r_flag = 1; |
|
| - | 590 | *//* we are using this node */ |
|
| - | 591 | routed_node->pindir = unrouted_nodes->pindir; /* the node reference holds the |
|
| - | 592 | pin direction */ |
|
| - | 593 | ||
| - | 594 | /* routed_node->name = unrouted_net->identifier; Previous !!!*/ |
|
| - | 595 | if(route_ref->orig_name) { |
|
| - | 596 | routed_node->name = route_ref->orig_name; |
|
| - | 597 | routed_node->vhdltype = route_ref->vhdltype; |
|
| - | 598 | routed_node->orig_vhdltype = route_ref->orig_vhdltype; |
|
| - | 599 | routed_node->lhs_expr = route_ref->lhs_expr; |
|
| 529 | if (level & 2) |
600 | if (level & 2) |
| - | 601 | Log(LOG_GENERAL,"# Info : found rename to %s on %s\n", route_ref->orig_name, unrouted_net->identifier); |
|
| - | 602 | ||
| 530 | { |
603 | } |
| 531 | Log ( |
604 | else { |
| 532 | LOG_GENERAL, |
- | |
| 533 | "#COMBINE_SUB routed=%s, unrouted=%s\n", |
- | |
| 534 | unrouted_net->name, |
605 | routed_node->name = unrouted_net->identifier; |
| 535 | routed_net->name); |
- | |
| 536 | Log ( |
- | |
| 537 | LOG_GENERAL, |
- | |
| 538 | " type def routed = %d unrouted=%d\n", |
606 | routed_node->vhdltype = unrouted_nodes->vhdltype; |
| 539 | unrouted_net->type_defined, |
607 | routed_node->lhs_expr = unrouted_nodes->lhs_expr; |
| 540 | routed_net->type_defined); |
608 | routed_node->orig_vhdltype = unrouted_nodes->orig_vhdltype; |
| 541 | } |
609 | } |
| 542 | /* for each node on the routed net, is this net needed on |
610 | /* routed_node->datatype = unrouted_nodes->datatype; */ |
| 543 | the unrouted net */ |
- | |
| 544 | while (unrouted_nodes) |
- | |
| 545 | { |
- | |
| 546 | noderef_t *route_ref; |
611 | routed_node->net = routed_net; /* tell the node its got a net assigned */ |
| 547 | node_t *routed_node, *unrouted_node; |
612 | routed_node->in_use = 1; /* if the node is in use then set its flag */ |
| 548 | unrouted_node = unrouted_nodes->node; |
613 | routed_node->net_assigned = 1; |
| 549 | - | ||
| 550 | /* we have a route, this search _will succeed .. if it doesnt .. oops. */ |
614 | routed_node->routed_net = NULL; /* all nodes on the routed net are |
| 551 | /* do not need to worry about the groups here as the nets have already |
615 | about to belong to the named list */ |
| 552 | been found */ |
- | |
| 553 | 616 | ||
| 554 | /* Changed MDJ July 2001 : made it a prerequisite to check if the pin_group |
- | |
| 555 | * matches */ |
- | |
| 556 | 617 | ||
| 557 | route_ref = search_net_for_socket ( |
- | |
| 558 | unrouted_nodes, routed_nodes, unrouted_node->pin_group); |
- | |
| 559 | 618 | ||
| 560 | /* if we have found a node on the right socket on the |
- | |
| 561 | routed net that has not yet been used */ |
- | |
| 562 | 619 | } |
|
| 563 | if (route_ref) |
620 | if (level & 2) |
| 564 | { |
621 | Log(LOG_GENERAL,"#\n"); |
| 565 | routed_node = route_ref->node; |
622 | unrouted_nodes = unrouted_nodes->next; |
| 566 | if (level & 2) |
- | |
| 567 | Log ( |
623 | }; |
| 568 | LOG_GENERAL, |
- | |
| 569 | "info %s(%s) '%s'\n", |
- | |
| 570 | routed_node->socket->name, |
- | |
| 571 | routed_node->identifier, |
- | |
| 572 | route_ref->orig_name ? route_ref->orig_name |
- | |
| 573 | : unrouted_net->name); |
- | |
| 574 | 624 | ||
| 575 | /* |
- | |
| 576 | route_ref->r_flag = 1; |
- | |
| 577 | *//* we are using this node */ |
- | |
| 578 | routed_node->pindir = |
- | |
| 579 | unrouted_nodes->pindir; /* the node reference holds the |
- | |
| 580 | pin direction */ |
- | |
| - | 625 | } |
|
| 581 | 626 | ||
| 582 | /* routed_node->name = unrouted_net->identifier; Previous !!!*/ |
- | |
| 583 | if (route_ref->orig_name) |
- | |
| 584 | { |
- | |
| 585 | routed_node->name = route_ref->orig_name; |
- | |
| 586 | routed_node->vhdltype = route_ref->vhdltype; |
- | |
| 587 | routed_node->orig_vhdltype = route_ref->orig_vhdltype; |
- | |
| 588 | routed_node->lhs_expr = route_ref->lhs_expr; |
- | |
| 589 | if (level & 2) |
- | |
| 590 | Log ( |
- | |
| 591 | LOG_GENERAL, |
- | |
| 592 | "# Info : found rename to %s on %s\n", |
- | |
| 593 | route_ref->orig_name, |
- | |
| 594 | unrouted_net->identifier); |
- | |
| 595 | } |
- | |
| 596 | else |
- | |
| 597 | { |
- | |
| 598 | routed_node->name = unrouted_net->identifier; |
- | |
| 599 | routed_node->vhdltype = unrouted_nodes->vhdltype; |
- | |
| 600 | routed_node->lhs_expr = unrouted_nodes->lhs_expr; |
- | |
| 601 | routed_node->orig_vhdltype = unrouted_nodes->orig_vhdltype; |
- | |
| 602 | } |
- | |
| 603 | /* routed_node->datatype = unrouted_nodes->datatype; */ |
- | |
| 604 | routed_node->net = |
- | |
| 605 | routed_net; /* tell the node its got a net assigned */ |
- | |
| 606 | routed_node->in_use = 1; /* if the node is in use then set its flag */ |
- | |
| 607 | routed_node->net_assigned = 1; |
- | |
| 608 | routed_node->routed_net = NULL; /* all nodes on the routed net are |
- | |
| 609 | about to belong to the named list */ |
- | |
| 610 | } |
- | |
| 611 | if (level & 2) |
- | |
| 612 | Log (LOG_GENERAL, "#\n"); |
- | |
| 613 | unrouted_nodes = unrouted_nodes->next; |
- | |
| 614 | }; |
- | |
| 615 | } |
627 | |
| 616 | 628 | ||
| - | 629 | static void |
|
| 617 | static void combine_alias (net_t *routed_net, net_t *unrouted_net) |
630 | combine_alias (net_t * routed_net, |
| - | 631 | net_t * unrouted_net) |
|
| 618 | { |
632 | { |
| 619 | /* printf("combining alias %s with routed %s\n",unrouted_net->identifier, |
633 | /* printf("combining alias %s with routed %s\n",unrouted_net->identifier, |
| 620 | routed_net->identifier); */ |
634 | routed_net->identifier); */ |
| 621 | while (unrouted_net) |
635 | while (unrouted_net) |
| 622 | { |
636 | { |
| 623 | if (unrouted_net->how_joined == Aliased) |
637 | if (unrouted_net->how_joined == Aliased) |
| 624 | { /* recursion for alias */ |
638 | { /* recursion for alias */ |
| 625 | if (unrouted_net->subnets) |
639 | if (unrouted_net->subnets) |
| 626 | combine_alias (routed_net, unrouted_net->subnets); |
640 | combine_alias (routed_net, unrouted_net->subnets); |
| 627 | } |
641 | } |
| 628 | else |
642 | else |
| 629 | { |
643 | { |
| 630 | /* and for each aliased subnet ... */ |
644 | /* and for each aliased subnet ... */ |
| 631 | clear_routing_flags (unrouted_net->nodes); |
645 | clear_routing_flags (unrouted_net->nodes); |
| 632 | /* printf("moving aliased net .%s.\n",unrouted_net->identifier); */ |
646 | /* printf("moving aliased net .%s.\n",unrouted_net->identifier); */ |
| 633 | combine_sub (routed_net, unrouted_net); |
647 | combine_sub (routed_net, |
| - | 648 | unrouted_net); |
|
| 634 | /* name_unused_nodes (routed_net, unrouted_net->identifier); */ |
649 | /* name_unused_nodes (routed_net, unrouted_net->identifier); */ |
| 635 | } |
650 | } |
| 636 | unrouted_net = unrouted_net->joined_nets; |
651 | unrouted_net = unrouted_net->joined_nets; |
| 637 | } |
652 | } |
| - | 653 | ||
| 638 | } |
654 | } |
| 639 | /* ******************************************** */ |
655 | /* ******************************************** */ |
| 640 | /* if a net was created by aliasing names, now we have to copy out each of |
656 | /* if a net was created by aliasing names, now we have to copy out each of |
| 641 | the unrouted sub nets to the routed net - getting node names right |
657 | the unrouted sub nets to the routed net - getting node names right |
| 642 | in particular . Otherwise just do the one */ |
658 | in particular . Otherwise just do the one */ |
| 643 | 659 | ||
| - | 660 | void |
|
| 644 | void combine_routed_and_unrouted (net_t *routed_net, net_t *unrouted_net) |
661 | combine_routed_and_unrouted (net_t * routed_net, |
| - | 662 | net_t * unrouted_net) |
|
| 645 | { |
663 | { |
| 646 | clear_routing_flags (routed_net->nodes); |
664 | clear_routing_flags (routed_net->nodes); |
| 647 | /* refer across to unrouted net for printout */ |
665 | /* refer across to unrouted net for printout */ |
| 648 | /* |
666 | /* |
| 649 | printf("Combining '%s' and '%s' \n",routed_net->identifier, |
667 | printf("Combining '%s' and '%s' \n",routed_net->identifier, |
| 650 | unrouted_net->identifier); |
668 | unrouted_net->identifier); |
| 651 | */ |
669 | */ |
| 652 | routed_net->unrouted_reference = unrouted_net; |
670 | routed_net->unrouted_reference = unrouted_net; |
| 653 | routed_net->name = unrouted_net->identifier; |
671 | routed_net->name = unrouted_net->identifier; |
| 654 | /* assumption here is that the datatype and vhdltype are the same */ |
672 | /* assumption here is that the datatype and vhdltype are the same */ |
| 655 | /* routed_net->datatype = unrouted_net->datatype; */ |
673 | /* routed_net->datatype = unrouted_net->datatype; */ |
| - | 674 | ||
| - | 675 | routed_net->vhdltype = unrouted_net->vhdltype; |
|
| 656 | 676 | ||
| 657 | routed_net->vhdltype = unrouted_net->vhdltype; |
- | |
| 658 | 677 | ||
| 659 | if (unrouted_net->how_joined == Aliased) |
- | |
| 660 | { |
- | |
| 661 | /* preserve aliasing information */ |
- | |
| 662 | combine_alias (routed_net, unrouted_net); |
- | |
| 663 | } |
- | |
| 664 | else |
- | |
| 665 | { |
- | |
| 666 | clear_routing_flags (unrouted_net->nodes); |
- | |
| 667 | combine_sub (routed_net, unrouted_net); |
- | |
| 668 | 678 | ||
| - | 679 | if (unrouted_net->how_joined == Aliased) |
|
| - | 680 | { |
|
| - | 681 | /* preserve aliasing information */ |
|
| - | 682 | combine_alias (routed_net, unrouted_net); |
|
| - | 683 | } |
|
| - | 684 | else |
|
| - | 685 | { |
|
| - | 686 | clear_routing_flags (unrouted_net->nodes); |
|
| - | 687 | combine_sub (routed_net, |
|
| - | 688 | unrouted_net); |
|
| - | 689 | ||
| 669 | /* name_unused_nodes (routed_net, unrouted_net->identifier); */ |
690 | /* name_unused_nodes (routed_net, unrouted_net->identifier); */ |
| 670 | } |
691 | } |
| 671 | } |
692 | } |
| 672 | 693 | ||
| - | 694 | ||
| 673 | /* **************************************************************** */ |
695 | /* **************************************************************** */ |
| 674 | /* This function ensures net reservation is made for all internal |
696 | /* This function ensures net reservation is made for all internal |
| 675 | nodes that are on internal sockets . |
697 | nodes that are on internal sockets . |
| 676 | If any external socket is on the net then all internal pins are reserved. |
698 | If any external socket is on the net then all internal pins are reserved. |
| 677 | Otherwise a single internal pin is left as a non-reserved driver */ |
699 | Otherwise a single internal pin is left as a non-reserved driver */ |
| - | 700 | ||
| - | 701 | void |
|
| - | 702 | ensure_reservation (void) |
|
| - | 703 | { |
|
| - | 704 | char *unused_ident; |
|
| - | 705 | net_t * net_head = routed_list; |
|
| - | 706 | int skip; /* the number of nodes on the net to leave unreserved */ |
|
| 678 | 707 | ||
| 679 | void ensure_reservation (void) |
- | |
| 680 | { |
708 | /* |
| 681 | char *unused_ident; |
- | |
| 682 | net_t *net_head = routed_list; |
- | |
| 683 | int skip; /* the number of nodes on the net to leave unreserved */ |
- | |
| 684 | - | ||
| 685 | /* |
- | |
| 686 | puts("ensure_reservation entered"); |
709 | puts("ensure_reservation entered"); |
| 687 | */ |
- | |
| 688 | while (net_head) |
710 | */ while(net_head) { |
| 689 | { |
- | |
| 690 | net_t *altered_net = NULL; |
711 | net_t * altered_net= NULL; |
| 691 | if (net_head->nodecount > 1 && IS_ROUTABLE (net_head->how_routed)) |
712 | if(net_head->nodecount>1 && |
| 692 | { /* ignore single node nets as they need to be external */ |
713 | IS_ROUTABLE(net_head->how_routed)) { /* ignore single node nets as they need to be external */ |
| 693 | noderef_t *routed_nodes = net_head->nodes; |
714 | noderef_t * routed_nodes = net_head->nodes; |
| 694 | net_head->nodes_reserved = 0; /* Begin by clearing the flag */ |
715 | net_head->nodes_reserved = 0; /* Begin by clearing the flag */ |
| 695 | /* nets with external sockets cannot be allowed */ |
716 | /* nets with external sockets cannot be allowed */ |
| 696 | if (net_head->has_external) |
717 | if(net_head->has_external) |
| 697 | skip = 0; |
718 | skip=0; |
| 698 | else |
719 | else |
| 699 | skip = 1; |
720 | skip=1; |
| 700 | /* |
721 | /* |
| 701 | printf("Net '%s'\n",net_head->identifier); |
722 | printf("Net '%s'\n",net_head->identifier); |
| 702 | */ |
723 | */ |
| 703 | while (routed_nodes) |
724 | while (routed_nodes) { |
| 704 | { |
- | |
| 705 | node_t *cnode = routed_nodes->node; |
725 | node_t *cnode = routed_nodes->node; |
| 706 | if (cnode->net_assigned == 0 && /* this node hasnt yet been |
726 | if (cnode->net_assigned == 0 && /* this node hasnt yet been used by a net */ |
| 707 | used by a net */ |
- | |
| 708 | /* set the flag to stop count_nets_with_few_nodes() in |
- | |
| 709 | statistics.c from complaining */ |
- | |
| 710 | cnode->socket->is_external == 0) |
727 | /* set the flag to stop count_nets_with_few_nodes() in statistics.c from complaining */ cnode->socket->is_external == 0) { /* EPLD or internal node */ |
| 711 | { /* EPLD or internal node */ |
- | |
| 712 | net_head->nodes_reserved = 1; |
728 | net_head->nodes_reserved = 1; |
| 713 | /* every reserved pin is unique, so make it a new name |
729 | /* every reserved pin is unique, so make it a new name */ |
| 714 | */ |
- | |
| 715 | if (skip == 0) |
- | |
| 716 | { /* skipped enough ? */ |
730 | if(skip==0) { /* skipped enough ? */ |
| 717 | unused_ident = |
- | |
| 718 | calloc (RES_NAMLEN + 1, sizeof (char)); |
731 | unused_ident = calloc (RES_NAMLEN + 1, sizeof (char)); |
| 719 | sprintf ( |
- | |
| 720 | unused_ident, |
- | |
| 721 | RES_FMT, |
- | |
| 722 | nodecount++); /* shared node counter */ |
732 | sprintf (unused_ident, RES_FMT, nodecount++); /* shared node counter */ |
| 723 | cnode->name = |
- | |
| 724 | unused_ident; /* use the created name */ |
733 | cnode->name = unused_ident; /* use the created name */ |
| 725 | 734 | ||
| 726 | cnode->net = net_head; /* tell the node its got |
735 | cnode->net = net_head; /* tell the node its got a net assigned */ |
| 727 | a net assigned */ |
- | |
| 728 | cnode->pindir = INPUT; |
736 | cnode->pindir = INPUT; |
| 729 | /* cnode->datatype = "Named |
- | |
| 730 | * through naming unused nodes";*/ /* routed_net->datatype; */ |
737 | /* cnode->datatype = "Named through naming unused nodes";*/ /* routed_net->datatype; */ |
| 731 | cnode->vhdltype = |
- | |
| 732 | default_vhdl_datatype; /* put something |
738 | cnode->vhdltype = default_vhdl_datatype; /* put something there */ |
| 733 | there */ |
- | |
| 734 | cnode->net_assigned = 1; |
739 | cnode->net_assigned = 1; |
| 735 | cnode->lhs_expr = NULL; |
740 | cnode->lhs_expr = NULL; |
| 736 | altered_net = net_head; |
741 | altered_net = net_head; |
| 737 | } |
742 | } |
| 738 | else |
743 | else |
| 739 | skip--; |
744 | skip--; |
| 740 | } |
745 | } |
| 741 | 746 | ||
| 742 | routed_nodes = routed_nodes->next; |
747 | routed_nodes = routed_nodes->next; |
| 743 | } |
748 | } |
| 744 | } /* nodecount */ |
749 | } /* nodecount */ |
| 745 | net_head = net_head->next; |
750 | net_head = net_head->next; |
| 746 | if (altered_net) |
751 | if(altered_net) |
| 747 | { |
752 | { |
| 748 | /* |
753 | /* |
| 749 | transfer_net_to_named (&routed_list, altered_net); |
754 | transfer_net_to_named (&routed_list, altered_net); |
| 750 | */ } |
755 | */ } |
| 751 | } |
756 | } |
| 752 | } |
757 | } |
| 753 | 758 | ||
| 754 | /* this function checks to see if the net identifier of an unrouted net matches that |
759 | /* this function checks to see if the net identifier of an unrouted net matches that |
| 755 | of a routed net, which is itself not routable */ |
760 | of a routed net, which is itself not routable */ |
| 756 | void validate_unrouted (void) |
761 | void validate_unrouted (void) |
| 757 | { |
762 | { |
| 758 | net_t *routed_net, *unrouted_net; |
763 | net_t *routed_net, *unrouted_net; |
| - | 764 | ||
| - | 765 | unrouted_net = unrouted_list; |
|
| - | 766 | while (unrouted_net) { |
|
| - | 767 | if (unrouted_net->identifier[0]) { |
|
| - | 768 | /* search first for matching Identifier */ |
|
| - | 769 | routed_net = find_net (&routed_list, Ident, unrouted_net->identifier, Search); |
|
| - | 770 | ||
| - | 771 | /* located a net that could be a candidate . Validate routing status and |
|
| - | 772 | report an error if there is a problem */ |
|
| - | 773 | ||
| - | 774 | if (routed_net && IS_NOT_ROUTABLE(routed_net->how_routed)) { |
|
| - | 775 | noderef_t * nodes = unrouted_net -> nodes; |
|
| - | 776 | unrouted_net -> how_routed = routed_net->how_routed; |
|
| - | 777 | Log(LOG_ERROR,"-- WARNING : Routing : Net '%s' with following unrouted\n" |
|
| - | 778 | "-- nodes cannot be connected to an UNROUTABLE routed net\n", |
|
| - | 779 | unrouted_net->identifier); |
|
| - | 780 | while(nodes) { |
|
| - | 781 | Log(LOG_ERROR,"-- %s(%s)\n",nodes->node->socket->identifier, |
|
| - | 782 | nodes->node->identifier); |
|
| - | 783 | nodes = nodes->next; |
|
| - | 784 | } |
|
| - | 785 | ||
| - | 786 | } |
|
| - | 787 | else |
|
| - | 788 | unrouted_net -> how_routed = Free; /* can keep on routing this net */ |
|
| - | 789 | } |
|
| - | 790 | unrouted_net = unrouted_net->next; |
|
| - | 791 | } |
|
| - | 792 | } |
|
| - | 793 | ||
| - | 794 | ||
| - | 795 | ||
| - | 796 | ||
| - | 797 | ||
| - | 798 | ||
| - | 799 | ||
| 759 | 800 | ||
| 760 | unrouted_net = unrouted_list; |
- | |
| 761 | while (unrouted_net) |
- | |
| 762 | { |
- | |
| 763 | if (unrouted_net->identifier[0]) |
- | |
| 764 | { |
- | |
| 765 | /* search first for matching Identifier */ |
- | |
| 766 | routed_net = |
- | |
| 767 | find_net (&routed_list, Ident, unrouted_net->identifier, Search); |
- | |
| 768 | - | ||
| 769 | /* located a net that could be a candidate . Validate routing status |
- | |
| 770 | and report an error if there is a problem */ |
- | |
| 771 | - | ||
| 772 | if (routed_net && IS_NOT_ROUTABLE (routed_net->how_routed)) |
- | |
| 773 | { |
- | |
| 774 | noderef_t *nodes = unrouted_net->nodes; |
- | |
| 775 | unrouted_net->how_routed = routed_net->how_routed; |
- | |
| 776 | Log ( |
- | |
| 777 | LOG_ERROR, |
- | |
| 778 | "-- WARNING : Routing : Net '%s' with following unrouted\n" |
- | |
| 779 | "-- nodes cannot be connected to an UNROUTABLE routed " |
- | |
| 780 | "net\n", |
- | |
| 781 | unrouted_net->identifier); |
- | |
| 782 | while (nodes) |
- | |
| 783 | { |
- | |
| 784 | Log ( |
- | |
| 785 | LOG_ERROR, |
- | |
| 786 | "-- %s(%s)\n", |
- | |
| 787 | nodes->node->socket->identifier, |
- | |
| 788 | nodes->node->identifier); |
- | |
| 789 | nodes = nodes->next; |
- | |
| 790 | } |
- | |
| 791 | } |
- | |
| 792 | else |
- | |
| 793 | unrouted_net->how_routed = |
- | |
| 794 | Free; /* can keep on routing this net */ |
- | |
| 795 | } |
- | |
| 796 | unrouted_net = unrouted_net->next; |
- | |
| 797 | } |
- | |
| 798 | } |
- | |
| 799 | 801 | ||
| 800 | /* ******************************************** */ |
802 | /* ******************************************** */ |
| 801 | /* this procedure searches the unrouted nets one by one. |
803 | /* this procedure searches the unrouted nets one by one. |
| 802 | if an unrouted net has the same name as a |
804 | if an unrouted net has the same name as a |
| 803 | routed net, then all nodes on the unrouted net take on the |
805 | routed net, then all nodes on the unrouted net take on the |
| 804 | routed net name , and the routed net's status is changed to reflect this |
806 | routed net name , and the routed net's status is changed to reflect this |
| 805 | name. All 'spare' nodes on the routed net are set to point at a 'reserved' net |
807 | name. All 'spare' nodes on the routed net are set to point at a 'reserved' net |
| 806 | for future safety */ |
808 | for future safety */ |
| - | 809 | void |
|
| 807 | void perform_routing_by_name (void) |
810 | perform_routing_by_name (void) |
| 808 | { |
811 | { |
| 809 | net_t *routed_net; |
812 | net_t *routed_net; |
| 810 | noderef_t *routed_nodes, *unrouted_nodes; |
813 | noderef_t *routed_nodes, *unrouted_nodes; |
| 811 | net_t *unrouted_net, *prev_net; |
814 | net_t *unrouted_net, *prev_net; |
| 812 | int routed_ok; |
815 | int routed_ok; |
| 813 | 816 | ||
| 814 | prev_net = NULL; |
817 | prev_net = NULL; |
| 815 | unrouted_net = unrouted_list; |
818 | unrouted_net = unrouted_list; |
| 816 | while (unrouted_net) |
819 | while (unrouted_net) |
| 817 | { |
820 | { |
| 818 | routed_ok = 0; |
821 | routed_ok = 0; |
| 819 | if (unrouted_net->identifier[0] && IS_ROUTABLE (unrouted_net->how_routed)) |
822 | if (unrouted_net->identifier[0] && IS_ROUTABLE(unrouted_net->how_routed)) |
| 820 | { |
823 | { |
| 821 | /* search first for matching Name then for matching Identifier */ |
824 | /* search first for matching Name then for matching Identifier */ |
| 822 | 825 | ||
| 823 | routed_net = |
- | |
| 824 | find_net (&routed_list, Name, unrouted_net->identifier, Search); |
826 | routed_net = find_net (&routed_list, Name, unrouted_net->identifier, Search); |
| 825 | if (!routed_net) |
827 | if (!routed_net) |
| 826 | routed_net = find_net ( |
- | |
| 827 | &routed_list, Ident, unrouted_net->identifier, Search); |
828 | routed_net = find_net (&routed_list, Ident, unrouted_net->identifier, Search); |
| - | 829 | ||
| 828 | 830 | ||
| 829 | if (routed_net && IS_ROUTABLE (routed_net->how_routed)) |
831 | if (routed_net && IS_ROUTABLE(routed_net->how_routed)) |
| 830 | { |
832 | { |
| 831 | /* found a routed net, with this name or |
833 | /* found a routed net, with this name or ident */ |
| 832 | * ident */ |
- | |
| 833 | /* check status of this net, see if it connects the right |
834 | /* check status of this net, see if it connects the right places */ |
| 834 | * places */ |
- | |
| 835 | int f = 1; |
835 | int f = 1; |
| 836 | /* |
- | |
| - | 836 | /* |
|
| 837 | printf("Found matching routed net \n"); |
837 | printf("Found matching routed net \n"); |
| 838 | */ |
838 | */ |
| 839 | unrouted_nodes = unrouted_net->nodes; |
839 | unrouted_nodes = unrouted_net->nodes; |
| 840 | routed_nodes = routed_net->nodes; |
840 | routed_nodes = routed_net->nodes; |
| 841 | clear_routing_flags (routed_nodes); |
841 | clear_routing_flags (routed_nodes); |
| 842 | 842 | ||
| 843 | while (unrouted_nodes && f) |
843 | while (unrouted_nodes && f) |
| 844 | { |
- | |
| - | 844 | { |
|
| 845 | f = search_net_for_socket ( |
845 | f = search_net_for_socket (unrouted_nodes, |
| 846 | unrouted_nodes, routed_nodes, 1) != NULL; |
846 | routed_nodes,1) != NULL; |
| 847 | unrouted_nodes = unrouted_nodes->next; |
847 | unrouted_nodes = unrouted_nodes->next; |
| 848 | } |
- | |
| - | 848 | } |
|
| 849 | 849 | ||
| 850 | /* if f is 1 then the routed net connects all of the nodes on |
850 | /* if f is 1 then the routed net connects all of the nodes on the |
| 851 | the unrouted net */ |
851 | unrouted net */ |
| 852 | if (f) |
852 | if (f) |
| 853 | { |
- | |
| 854 | /* |
- | |
| - | 853 | { |
|
| - | 854 | /* |
|
| 855 | printf("and can join together sockets \n"); |
855 | printf("and can join together sockets \n"); |
| 856 | */ |
- | |
| - | 856 | */ |
|
| 857 | /* Can fit nets together */ |
857 | /* Can fit nets together */ |
| 858 | combine_routed_and_unrouted (routed_net, unrouted_net); |
858 | combine_routed_and_unrouted (routed_net, unrouted_net); |
| 859 | /* prevent this net from being recycled, move to |
859 | /* prevent this net from being recycled, move to |
| 860 | the fully named and routed list */ |
860 | the fully named and routed list */ |
| 861 | transfer_net_to_named (&routed_list, routed_net); |
861 | transfer_net_to_named (&routed_list, routed_net); |
| 862 | routed_net->how_routed = |
- | |
| 863 | By_Name; /* This net was routed by name !! */ |
862 | routed_net->how_routed = By_Name; /* This net was routed by name !! */ |
| 864 | routed_ok = 1; |
- | |
| 865 | } |
- | |
| 866 | } |
863 | routed_ok = 1; |
| - | 864 | } |
|
| 867 | } |
865 | } |
| - | 866 | } |
|
| 868 | if (routed_ok) |
867 | if (routed_ok) |
| 869 | /* remove the unrouted net from the list */ |
868 | /* remove the unrouted net from the list */ |
| 870 | unrouted_net = remove_net (&unrouted_list, unrouted_net); |
869 | unrouted_net = remove_net (&unrouted_list, unrouted_net); |
| 871 | else |
870 | else |
| 872 | /* Not removing net as algorithm hasnt found a match */ |
871 | /* Not removing net as algorithm hasnt found a match */ |
| 873 | unrouted_net = unrouted_net->next; |
872 | unrouted_net = unrouted_net->next; |
| 874 | }; |
873 | }; |
| 875 | count_nets ("After routing by matching existing net names"); |
874 | count_nets ("After routing by matching existing net names"); |
| 876 | } |
875 | } |
| 877 | 876 | ||
| - | 877 | ||
| - | 878 | ||
| 878 | /************************************************************************/ |
879 | /************************************************************************/ |
| 879 | /* this algorithm works by considering each of the routed nets in turn |
880 | /* this algorithm works by considering each of the routed nets in turn |
| 880 | to see if there is an unrouted net 'fixed' to it. */ |
881 | to see if there is an unrouted net 'fixed' to it. */ |
| 881 | /************************************************************************/ |
882 | /************************************************************************/ |
| - | 883 | ||
| - | 884 | void |
|
| - | 885 | perform_routing_by_fixed_net(void) |
|
| - | 886 | { |
|
| - | 887 | net_t *unrouted_net,*routed_next; |
|
| - | 888 | net_t *routed_net = routed_list; |
|
| - | 889 | int routed_ok,f; |
|
| - | 890 | while (routed_net) { |
|
| - | 891 | routed_next = routed_net->next; /* 'next' will be changed when a routed |
|
| - | 892 | net is moved onto the named list */ |
|
| - | 893 | routed_ok = 0; |
|
| - | 894 | f = 1; |
|
| - | 895 | /* |
|
| - | 896 | printf("Considering ROUTED '%s'\n",routed_net->identifier); |
|
| - | 897 | */ |
|
| - | 898 | if(IS_ROUTABLE(routed_net->how_routed) && |
|
| - | 899 | routed_net->has_fix_location && |
|
| - | 900 | routed_net->unrouted_fix_net) { |
|
| - | 901 | unrouted_net = routed_net->unrouted_fix_net; |
|
| - | 902 | /* |
|
| - | 903 | printf(" with UNROUTED '%s'\n",unrouted_net->identifier); |
|
| - | 904 | */ |
|
| 882 | 905 | ||
| 883 | void perform_routing_by_fixed_net (void) |
- | |
| 884 | { |
- | |
| 885 | net_t *unrouted_net, *routed_next; |
906 | if ( unrouted_net->nodecount > 0 && IS_NOT_ROUTABLE(unrouted_net->how_routed)) |
| 886 | net_t *routed_net = routed_list; |
907 | /* skip all 1-node nets, these will be dealt with by |
| 887 | int routed_ok, f; |
908 | a later routing algorithm */ |
| 888 | while (routed_net) |
- | |
| 889 | { |
909 | { |
| 890 | routed_next = routed_net->next; /* 'next' will be changed when a routed |
- | |
| 891 | net is moved onto the named list */ |
- | |
| 892 | routed_ok = 0; |
- | |
| 893 | f = 1; |
- | |
| 894 | /* |
- | |
| 895 | printf("Considering ROUTED '%s'\n",routed_net->identifier); |
- | |
| 896 | */ |
- | |
| 897 | if (IS_ROUTABLE (routed_net->how_routed) && routed_net->has_fix_location && |
- | |
| 898 | routed_net->unrouted_fix_net) |
- | |
| 899 | { |
- | |
| 900 | unrouted_net = routed_net->unrouted_fix_net; |
- | |
| 901 | /* |
- | |
| 902 | printf(" with UNROUTED '%s'\n",unrouted_net->identifier); |
- | |
| 903 | */ |
- | |
| 904 | 910 | ||
| 905 | if (unrouted_net->nodecount > 0 && |
- | |
| 906 | IS_NOT_ROUTABLE (unrouted_net->how_routed)) |
- | |
| 907 | /* skip all 1-node nets, these will be dealt with by |
- | |
| 908 | a later routing algorithm */ |
- | |
| 909 | { |
- | |
| 910 | if (routed_net->nodecount >= unrouted_net->nodecount) |
911 | if (routed_net->nodecount >= unrouted_net->nodecount) { |
| 911 | { |
- | |
| 912 | /* enough nodes, but does it go the right places ?? */ |
912 | /* enough nodes, but does it go the right places ?? */ |
| 913 | noderef_t *unrouted_nodes = unrouted_net->nodes; |
913 | noderef_t *unrouted_nodes = unrouted_net->nodes; |
| 914 | noderef_t *routed_nodes = routed_net->nodes; |
914 | noderef_t *routed_nodes = routed_net->nodes; |
| 915 | clear_routing_flags (routed_nodes); |
915 | clear_routing_flags (routed_nodes); |
| 916 | while (unrouted_nodes && f) |
916 | while (unrouted_nodes && f) { |
| 917 | { |
917 | f = search_net_for_socket (unrouted_nodes, |
| 918 | f = search_net_for_socket ( |
- | |
| 919 | unrouted_nodes, routed_nodes, 1) != |
- | |
| 920 | NULL; |
918 | routed_nodes,1) != NULL; |
| 921 | unrouted_nodes = unrouted_nodes->next; |
919 | unrouted_nodes = unrouted_nodes->next; |
| 922 | } |
920 | } |
| 923 | /* if f is 1 then the routed net connects all of the |
921 | /* if f is 1 then the routed net connects all of the nodes on the |
| 924 | nodes on the unrouted net */ |
922 | unrouted net */ |
| 925 | if (f) |
- | |
| 926 | { |
923 | if (f) { |
| 927 | /* Can join Routed & Unrouted nets together */ |
924 | /* Can join Routed & Unrouted nets together */ |
| 928 | /* |
- | |
| 929 | printf("Managed '%s' for fixed net |
- | |
| - | 925 | /* |
|
| 930 | routing '%s' \n",routed_net -> identifier, |
926 | printf("Managed '%s' for fixed net routing '%s' \n",routed_net -> identifier, |
| 931 | unrouted_net->identifier); |
- | |
| 932 | */ |
927 | unrouted_net->identifier); |
| 933 | combine_routed_and_unrouted ( |
- | |
| - | 928 | */ |
|
| 934 | routed_net, unrouted_net); |
929 | combine_routed_and_unrouted (routed_net, unrouted_net); |
| 935 | 930 | ||
| 936 | /* prevent this net from being recycled, move |
931 | /* prevent this net from being recycled, move to |
| 937 | to the fully named and routed list */ |
932 | the fully named and routed list */ |
| 938 | transfer_net_to_named ( |
- | |
| 939 | &routed_list, routed_net); |
933 | transfer_net_to_named (&routed_list, routed_net); |
| 940 | routed_net->how_routed = |
- | |
| 941 | By_Fixed_Net; /* This net was routed by |
- | |
| 942 | finding a wire! */ |
934 | routed_net->how_routed = By_Fixed_Net; /* This net was routed by finding a wire! */ |
| 943 | routed_ok = 1; |
935 | routed_ok = 1; |
| 944 | /* |
- | |
| 945 | Log (LOG_GENERAL, "# |
- | |
| 946 | Sucessfully routed net '%s' by fixing |
- | |
| - | 936 | /* |
|
| 947 | pins\n", routed_net->name); |
937 | Log (LOG_GENERAL, "# Sucessfully routed net '%s' by fixing pins\n", routed_net->name); |
| 948 | */ |
- | |
| - | 938 | */ |
|
| - | 939 | ||
| 949 | } |
940 | } |
| - | 941 | ||
| - | 942 | ||
| 950 | } |
943 | } |
| 951 | }; |
944 | }; |
| 952 | 945 | ||
| 953 | if (routed_ok) |
946 | if (routed_ok) { |
| 954 | { |
- | |
| 955 | /* printf("Removing '%s' from |
- | |
| 956 | * list\n",unrouted_net->identifier); |
947 | /* printf("Removing '%s' from list\n",unrouted_net->identifier); |
| 957 | */ |
- | |
| - | 948 | */ |
|
| 958 | /* remove the unrouted net from the list */ |
949 | /* remove the unrouted net from the list */ |
| 959 | remove_net (&unrouted_list, unrouted_net); |
950 | remove_net (&unrouted_list, unrouted_net); |
| 960 | } |
951 | } |
| 961 | else |
952 | else |
| 962 | Log ( |
- | |
| 963 | LOG_ERROR, |
- | |
| 964 | "-- Error (probably) : net '%s': Fix pin attempt has " |
953 | Log(LOG_ERROR,"-- Error (probably) : net '%s': Fix pin attempt has failed on this net !!\n",unrouted_net->identifier); |
| 965 | "failed on this net !!\n", |
- | |
| 966 | unrouted_net->identifier); |
- | |
| 967 | } |
954 | |
| - | 955 | } |
|
| 968 | routed_net = routed_next; |
956 | routed_net = routed_next; |
| 969 | } |
957 | } |
| 970 | count_nets ("After routing fixed nets"); |
958 | count_nets ("After routing fixed nets"); |
| 971 | } |
959 | } |
| 972 | 960 | ||
| - | 961 | ||
| - | 962 | ||
| - | 963 | ||
| - | 964 | ||
| - | 965 | ||
| 973 | /* ******************************************** */ |
966 | /* ******************************************** */ |
| 974 | /* this code deals with trying to find if a Routed net with |
967 | /* this code deals with trying to find if a Routed net with |
| 975 | exactly the same connections as the Unrouted net exists. |
968 | exactly the same connections as the Unrouted net exists. |
| 976 | Preference is to be given to any routed nets that have fixed pins */ |
969 | Preference is to be given to any routed nets that have fixed pins */ |
| 977 | /* ******************************************** */ |
970 | /* ******************************************** */ |
| 978 | 971 | ||
| - | 972 | ||
| - | 973 | ||
| - | 974 | void |
|
| 979 | void perform_routing_by_exact_path (void) |
975 | perform_routing_by_exact_path (void) |
| 980 | { |
976 | { |
| 981 | net_t *unrouted_net; |
977 | net_t *unrouted_net; |
| 982 | net_t *routed_net; |
978 | net_t *routed_net; |
| 983 | int routed_ok, f; |
979 | int routed_ok,f; |
| - | 980 | enum { CheckFixed,DoAny } pass; |
|
| - | 981 | ||
| - | 982 | for(pass=CheckFixed;pass<=DoAny;pass++) |
|
| - | 983 | { |
|
| - | 984 | ||
| - | 985 | unrouted_net = unrouted_list; |
|
| - | 986 | while (unrouted_net) { |
|
| - | 987 | routed_ok = 0; |
|
| 984 | enum |
988 | f = 1; |
| - | 989 | ||
| - | 990 | /* if we are looking for EXACT path matching, then ANY node on the unrouted list |
|
| - | 991 | will be connected to the SAME routed net, so just pick the first node */ |
|
| - | 992 | ||
| - | 993 | ||
| - | 994 | if (unrouted_net->nodes) |
|
| - | 995 | routed_net = unrouted_net->nodes->node->routed_net; |
|
| - | 996 | else |
|
| - | 997 | routed_net = NULL; |
|
| - | 998 | ||
| - | 999 | if (IS_ROUTABLE(unrouted_net->how_routed) && |
|
| - | 1000 | routed_net && /* any nodes ? */ |
|
| - | 1001 | /* on pass= DoAny, consider all. */ |
|
| - | 1002 | /* on pass= CheckFixed, only those with a fixed pin on the net */ |
|
| - | 1003 | (pass==DoAny || (pass==CheckFixed && routed_net->has_fix_location)) && |
|
| 985 | { |
1004 | |
| - | 1005 | routed_net->list_ref == &routed_list && /* is routed net still available on the routed list ? */ |
|
| - | 1006 | unrouted_net->nodecount > 0) /* skip all 1-node nets, these will be dealt with by |
|
| - | 1007 | a later routing algorithm */ |
|
| - | 1008 | { |
|
| - | 1009 | ||
| - | 1010 | if (routed_net->nodecount >= unrouted_net->nodecount && |
|
| - | 1011 | IS_ROUTABLE(routed_net->how_routed)) |
|
| - | 1012 | { |
|
| - | 1013 | /* enough nodes, but does it go the right places ?? */ |
|
| - | 1014 | noderef_t *unrouted_nodes = unrouted_net->nodes; |
|
| - | 1015 | noderef_t *routed_nodes = routed_net->nodes; |
|
| - | 1016 | clear_routing_flags (routed_nodes); |
|
| - | 1017 | while (unrouted_nodes && f) |
|
| - | 1018 | { |
|
| - | 1019 | f = search_net_for_socket (unrouted_nodes, |
|
| - | 1020 | routed_nodes,1) != NULL; |
|
| - | 1021 | unrouted_nodes = unrouted_nodes->next; |
|
| - | 1022 | } |
|
| - | 1023 | /* if f is 1 then the routed net connects all of the nodes on the |
|
| 986 | CheckFixed, |
1024 | unrouted net */ |
| - | 1025 | if (f) |
|
| - | 1026 | { |
|
| - | 1027 | /* Can join Routed & Unrouted nets together */ |
|
| - | 1028 | /* printf("Managed '%s' for exact path routing '%s' \n",routed_net -> identifier, |
|
| - | 1029 | unrouted_net->identifier); |
|
| - | 1030 | */ |
|
| - | 1031 | combine_routed_and_unrouted (routed_net, unrouted_net); |
|
| - | 1032 | ||
| - | 1033 | /* prevent this net from being recycled, move to |
|
| - | 1034 | the fully named and routed list */ |
|
| - | 1035 | transfer_net_to_named (&routed_list, routed_net); |
|
| - | 1036 | routed_net->how_routed = By_Exact_Net; /* This net was routed by finding a wire! */ |
|
| 987 | DoAny |
1037 | routed_ok = 1; |
| - | 1038 | /* |
|
| - | 1039 | Log (LOG_GENERAL, "# Sucessfully routed net '%s' by exact path\n", routed_net->name); |
|
| - | 1040 | */ |
|
| - | 1041 | ||
| - | 1042 | } |
|
| - | 1043 | ||
| - | 1044 | ||
| - | 1045 | } |
|
| - | 1046 | }; |
|
| - | 1047 | if (routed_ok) { |
|
| - | 1048 | /* printf("Removing '%s' from list\n",unrouted_net->identifier); |
|
| - | 1049 | */ |
|
| - | 1050 | /* remove the unrouted net from the list */ |
|
| - | 1051 | unrouted_net = remove_net (&unrouted_list, unrouted_net);} |
|
| - | 1052 | else { |
|
| - | 1053 | ||
| - | 1054 | /* Not removing net as algorithm hasnt found a match */ |
|
| - | 1055 | unrouted_net = unrouted_net->next; |
|
| - | 1056 | } |
|
| 988 | } pass; |
1057 | } |
| - | 1058 | } /* pass counter loop */ |
|
| - | 1059 | count_nets ("After routing by finding exactly identical paths"); |
|
| - | 1060 | ||
| 989 | 1061 | ||
| 990 | for (pass = CheckFixed; pass <= DoAny; pass++) |
- | |
| 991 | { |
- | |
| 992 | unrouted_net = unrouted_list; |
- | |
| 993 | while (unrouted_net) |
- | |
| 994 | { |
- | |
| 995 | routed_ok = 0; |
- | |
| 996 | f = 1; |
- | |
| 997 | - | ||
| 998 | /* if we are looking for EXACT path matching, then ANY node on the |
- | |
| 999 | unrouted list |
- | |
| 1000 | will be connected to the SAME routed net, so just pick the first |
- | |
| 1001 | node */ |
- | |
| 1002 | - | ||
| 1003 | if (unrouted_net->nodes) |
- | |
| 1004 | routed_net = unrouted_net->nodes->node->routed_net; |
- | |
| 1005 | else |
- | |
| 1006 | routed_net = NULL; |
- | |
| 1007 | - | ||
| 1008 | if (IS_ROUTABLE (unrouted_net->how_routed) && |
- | |
| 1009 | routed_net && /* any nodes ? */ |
- | |
| 1010 | /* on pass= DoAny, consider all. */ |
- | |
| 1011 | /* on pass= CheckFixed, only those with a fixed pin on the net */ |
- | |
| 1012 | (pass == DoAny || |
- | |
| 1013 | (pass == CheckFixed && routed_net->has_fix_location)) && |
- | |
| 1014 | - | ||
| 1015 | routed_net->list_ref == &routed_list && /* is routed net still |
- | |
| 1016 | available on the routed |
- | |
| 1017 | list ? */ |
- | |
| 1018 | unrouted_net->nodecount > 0) /* skip all 1-node nets, these will be |
- | |
| 1019 | dealt with by a later routing |
- | |
| 1020 | algorithm */ |
- | |
| 1021 | { |
- | |
| 1022 | if (routed_net->nodecount >= unrouted_net->nodecount && |
- | |
| 1023 | IS_ROUTABLE (routed_net->how_routed)) |
- | |
| 1024 | { |
- | |
| 1025 | /* enough nodes, but does it go the right places ?? */ |
- | |
| 1026 | noderef_t *unrouted_nodes = unrouted_net->nodes; |
- | |
| 1027 | noderef_t *routed_nodes = routed_net->nodes; |
- | |
| 1028 | clear_routing_flags (routed_nodes); |
- | |
| 1029 | while (unrouted_nodes && f) |
- | |
| 1030 | { |
- | |
| 1031 | f = search_net_for_socket ( |
- | |
| 1032 | unrouted_nodes, routed_nodes, 1) != |
- | |
| 1033 | NULL; |
- | |
| 1034 | unrouted_nodes = unrouted_nodes->next; |
- | |
| 1035 | } |
- | |
| 1036 | /* if f is 1 then the routed net connects all of the |
- | |
| 1037 | nodes on the unrouted net */ |
- | |
| 1038 | if (f) |
- | |
| 1039 | { |
- | |
| 1040 | /* Can join Routed & Unrouted nets together */ |
- | |
| 1041 | /* printf("Managed '%s' for exact path |
- | |
| 1042 | routing '%s' \n",routed_net -> identifier, |
- | |
| 1043 | unrouted_net->identifier); |
- | |
| 1044 | */ |
- | |
| 1045 | combine_routed_and_unrouted ( |
- | |
| 1046 | routed_net, unrouted_net); |
- | |
| 1047 | - | ||
| 1048 | /* prevent this net from being recycled, move |
- | |
| 1049 | to the fully named and routed list */ |
- | |
| 1050 | transfer_net_to_named ( |
- | |
| 1051 | &routed_list, routed_net); |
- | |
| 1052 | routed_net->how_routed = |
- | |
| 1053 | By_Exact_Net; /* This net was routed by |
- | |
| 1054 | finding a wire! */ |
- | |
| 1055 | routed_ok = 1; |
- | |
| 1056 | /* |
- | |
| 1057 | Log (LOG_GENERAL, "# |
- | |
| 1058 | Sucessfully routed net '%s' by exact |
- | |
| 1059 | path\n", routed_net->name); |
- | |
| 1060 | */ |
- | |
| 1061 | } |
- | |
| 1062 | } |
- | |
| 1063 | }; |
- | |
| 1064 | if (routed_ok) |
- | |
| 1065 | { |
- | |
| 1066 | /* printf("Removing '%s' from |
- | |
| 1067 | * list\n",unrouted_net->identifier); |
- | |
| 1068 | */ |
- | |
| 1069 | /* remove the unrouted net from the list */ |
- | |
| 1070 | unrouted_net = remove_net (&unrouted_list, unrouted_net); |
- | |
| 1071 | } |
- | |
| 1072 | else |
- | |
| 1073 | { |
- | |
| 1074 | /* Not removing net as algorithm hasnt found a match */ |
- | |
| 1075 | unrouted_net = unrouted_net->next; |
- | |
| 1076 | } |
- | |
| 1077 | } |
- | |
| 1078 | } /* pass counter loop */ |
- | |
| 1079 | count_nets ("After routing by finding exactly identical paths"); |
- | |
| 1080 | } |
1062 | } |
| 1081 | 1063 | ||
| 1082 | /* ******************************************** */ |
1064 | /* ******************************************** */ |
| - | 1065 | void |
|
| 1083 | void perform_routing_by_path (void) |
1066 | perform_routing_by_path (void) |
| 1084 | { |
1067 | { |
| 1085 | net_t *unrouted_net = unrouted_list; |
1068 | net_t *unrouted_net = unrouted_list; |
| 1086 | net_t *routed_net; |
1069 | net_t *routed_net; |
| 1087 | int accept_nodes; |
1070 | int accept_nodes; |
| - | 1071 | ||
| 1088 | 1072 | ||
| 1089 | while (unrouted_net) |
- | |
| 1090 | { |
- | |
| 1091 | int routed_ok = 0; |
- | |
| 1092 | 1073 | ||
| 1093 | /* |
- | |
| 1094 | printf("-- by path : identifier %s\n",unrouted_net->identifier); |
- | |
| 1095 | */ |
- | |
| 1096 | /* repeatedly search the routed nodes list for one with more or the same |
- | |
| 1097 | number of connections wanted */ |
- | |
| 1098 | /* skip all 1-node nets, these will be dealt with by a later routing algorithm |
- | |
| 1099 | */ |
- | |
| 1100 | if (unrouted_net->nodecount > 0 && IS_ROUTABLE (unrouted_net->how_routed)) |
- | |
| 1101 | { |
- | |
| 1102 | for (accept_nodes = unrouted_net->nodecount; |
- | |
| 1103 | accept_nodes < MaxNodesForSearch && !routed_ok; |
- | |
| 1104 | accept_nodes++) |
- | |
| 1105 | { |
- | |
| 1106 | /* locate any fix_location nodes here eventually */ |
- | |
| 1107 | routed_net = routed_list; |
- | |
| 1108 | - | ||
| 1109 | while (routed_net && !routed_ok) |
- | |
| 1110 | { |
- | |
| 1111 | if (routed_net->nodecount == accept_nodes && |
- | |
| 1112 | IS_ROUTABLE (routed_net->how_routed)) |
- | |
| 1113 | { |
- | |
| 1114 | /* enough nodes, but does it go the right |
- | |
| 1115 | * places ?? */ |
- | |
| 1116 | int f = 1; |
- | |
| 1117 | noderef_t *unrouted_nodes = |
- | |
| 1118 | unrouted_net->nodes; |
- | |
| 1119 | noderef_t *routed_nodes = routed_net->nodes; |
- | |
| 1120 | clear_routing_flags (routed_nodes); |
- | |
| 1121 | while (unrouted_nodes && f) |
- | |
| 1122 | { |
- | |
| 1123 | f = search_net_for_socket ( |
- | |
| 1124 | unrouted_nodes, |
- | |
| 1125 | routed_nodes, |
- | |
| 1126 | 1) != NULL; |
- | |
| 1127 | unrouted_nodes = unrouted_nodes->next; |
- | |
| 1128 | } |
- | |
| 1129 | /* if f is 1 then the routed net connects all |
- | |
| 1130 | of the nodes on the unrouted net */ |
- | |
| 1131 | if (f) |
- | |
| 1132 | { |
- | |
| 1133 | /* Can join Routed & Unrouted nets |
- | |
| 1134 | * together */ |
- | |
| 1135 | combine_routed_and_unrouted ( |
- | |
| 1136 | routed_net, unrouted_net); |
- | |
| 1137 | - | ||
| 1138 | /* prevent this net from being |
- | |
| 1139 | recycled, move to the fully named |
- | |
| 1140 | and routed list */ |
- | |
| 1141 | transfer_net_to_named ( |
- | |
| 1142 | &routed_list, routed_net); |
- | |
| 1143 | routed_net->how_routed = |
- | |
| 1144 | By_Net; /* This net was routed by |
- | |
| 1145 | finding a wire! */ |
- | |
| 1146 | routed_ok = 1; |
- | |
| 1147 | } |
- | |
| 1148 | } |
- | |
| 1149 | routed_net = routed_net->next; |
- | |
| 1150 | }; |
- | |
| 1151 | } |
- | |
| 1152 | } |
- | |
| 1153 | if (routed_ok) |
- | |
| 1154 | { |
- | |
| 1155 | /* remove the unrouted net from the list */ |
- | |
| 1156 | unrouted_net = remove_net (&unrouted_list, unrouted_net); |
- | |
| 1157 | } |
- | |
| 1158 | else |
- | |
| 1159 | /* Not removing net as algorithm hasnt found a match */ |
- | |
| 1160 | unrouted_net = unrouted_net->next; |
- | |
| 1161 | } |
- | |
| 1162 | 1074 | ||
| - | 1075 | while (unrouted_net) |
|
| - | 1076 | { |
|
| - | 1077 | int routed_ok = 0; |
|
| - | 1078 | ||
| - | 1079 | /* |
|
| - | 1080 | printf("-- by path : identifier %s\n",unrouted_net->identifier); |
|
| - | 1081 | */ |
|
| - | 1082 | /* repeatedly search the routed nodes list for one with more or the same |
|
| - | 1083 | number of connections wanted */ |
|
| - | 1084 | /* skip all 1-node nets, these will be dealt with by a later routing algorithm */ |
|
| - | 1085 | if (unrouted_net->nodecount > 0 && IS_ROUTABLE(unrouted_net->how_routed)) |
|
| - | 1086 | { |
|
| - | 1087 | for (accept_nodes = unrouted_net->nodecount; |
|
| - | 1088 | accept_nodes < MaxNodesForSearch && !routed_ok; |
|
| - | 1089 | accept_nodes++) |
|
| - | 1090 | { |
|
| - | 1091 | /* locate any fix_location nodes here eventually */ |
|
| - | 1092 | routed_net = routed_list; |
|
| - | 1093 | ||
| - | 1094 | ||
| - | 1095 | while (routed_net && !routed_ok) |
|
| - | 1096 | { |
|
| - | 1097 | ||
| - | 1098 | if (routed_net->nodecount == accept_nodes && |
|
| - | 1099 | IS_ROUTABLE(routed_net->how_routed)) |
|
| - | 1100 | { |
|
| - | 1101 | /* enough nodes, but does it go the right places ?? */ |
|
| - | 1102 | int f = 1; |
|
| - | 1103 | noderef_t *unrouted_nodes = unrouted_net->nodes; |
|
| - | 1104 | noderef_t *routed_nodes = routed_net->nodes; |
|
| - | 1105 | clear_routing_flags (routed_nodes); |
|
| - | 1106 | while (unrouted_nodes && f) |
|
| - | 1107 | { |
|
| - | 1108 | f = search_net_for_socket (unrouted_nodes, |
|
| - | 1109 | routed_nodes,1) != NULL; |
|
| - | 1110 | unrouted_nodes = unrouted_nodes->next; |
|
| - | 1111 | } |
|
| - | 1112 | /* if f is 1 then the routed net connects all of the nodes on the |
|
| - | 1113 | unrouted net */ |
|
| - | 1114 | if (f) |
|
| - | 1115 | { |
|
| - | 1116 | /* Can join Routed & Unrouted nets together */ |
|
| - | 1117 | combine_routed_and_unrouted (routed_net, unrouted_net); |
|
| - | 1118 | ||
| - | 1119 | /* prevent this net from being recycled, move to |
|
| - | 1120 | the fully named and routed list */ |
|
| - | 1121 | transfer_net_to_named (&routed_list, routed_net); |
|
| - | 1122 | routed_net->how_routed = By_Net; /* This net was routed by finding a wire! */ |
|
| - | 1123 | routed_ok = 1; |
|
| - | 1124 | } |
|
| - | 1125 | } |
|
| - | 1126 | routed_net = routed_net->next; |
|
| - | 1127 | }; |
|
| - | 1128 | } |
|
| - | 1129 | } |
|
| - | 1130 | if (routed_ok) { |
|
| - | 1131 | /* remove the unrouted net from the list */ |
|
| - | 1132 | unrouted_net = remove_net (&unrouted_list, unrouted_net); |
|
| - | 1133 | } |
|
| - | 1134 | else |
|
| - | 1135 | /* Not removing net as algorithm hasnt found a match */ |
|
| - | 1136 | unrouted_net = unrouted_net->next; |
|
| - | 1137 | } |
|
| - | 1138 | ||
| 1163 | count_nets ("After routing by finding existing net paths"); |
1139 | count_nets ("After routing by finding existing net paths"); |
| - | 1140 | ||
| - | 1141 | ||
| 1164 | } |
1142 | } |
| 1165 | 1143 | ||
| - | 1144 | ||
| 1166 | /* ******************************************** */ |
1145 | /* ******************************************** */ |
| 1167 | /* this function checks all the unrouted nets to see if any of them |
1146 | /* this function checks all the unrouted nets to see if any of them |
| 1168 | are connected to nodes that are known to exist on a connector, but |
1147 | are connected to nodes that are known to exist on a connector, but |
| 1169 | are not on any net. This works to join up unrouted nets mentioned in |
1148 | are not on any net. This works to join up unrouted nets mentioned in |
| 1170 | CHIP descriptions */ |
1149 | CHIP descriptions */ |
| 1171 | 1150 | ||
| - | 1151 | void |
|
| 1172 | void perform_routing_by_making_nets (void) |
1152 | perform_routing_by_making_nets (void) |
| 1173 | { |
1153 | { |
| 1174 | net_t *unrouted_net = unrouted_list; |
1154 | net_t *unrouted_net = unrouted_list; |
| 1175 | net_t *next_net; |
1155 | net_t *next_net; |
| 1176 | int failcount = 0; |
1156 | int failcount = 0; |
| 1177 | while (unrouted_net) |
1157 | while (unrouted_net) |
| 1178 | { |
1158 | { |
| 1179 | int routed_ok = 0; |
1159 | int routed_ok = 0; |
| 1180 | int f = 1; |
1160 | int f = 1; |
| 1181 | noderef_t *unrouted_nodes; |
1161 | noderef_t *unrouted_nodes; |
| 1182 | next_net = unrouted_net->next; |
1162 | next_net = unrouted_net->next; |
| 1183 | if (IS_ROUTABLE (unrouted_net->how_routed)) |
1163 | if(IS_ROUTABLE(unrouted_net->how_routed)) { |
| 1184 | { |
- | |
| 1185 | unrouted_nodes = unrouted_net->nodes; |
1164 | unrouted_nodes = unrouted_net->nodes; |
| 1186 | 1165 | ||
| 1187 | /* |
1166 | /* |
| 1188 | printf("-- by making nets : identifier |
- | |
| 1189 | %s\n",unrouted_net->identifier); |
1167 | printf("-- by making nets : identifier %s\n",unrouted_net->identifier); |
| 1190 | */ |
1168 | */ |
| 1191 | /* repeatedly search the unrouted net list */ |
1169 | /* repeatedly search the unrouted net list */ |
| 1192 | /* only route unconnected nodes referred to by one net, |
1170 | /* only route unconnected nodes referred to by one net, |
| 1193 | whether routed or unrouted otherwise shorts will happen */ |
1171 | whether routed or unrouted otherwise shorts will happen */ |
| 1194 | while (IS_ROUTABLE (unrouted_net->how_routed) && unrouted_nodes && |
1172 | while (IS_ROUTABLE(unrouted_net->how_routed) && |
| - | 1173 | unrouted_nodes && |
|
| 1195 | ((f = unrouted_nodes->node->net_assigned == 0) && |
1174 | ((f = unrouted_nodes->node->net_assigned == 0) && |
| 1196 | unrouted_nodes->node->refcount == 1)) |
1175 | unrouted_nodes->node->refcount == 1)) |
| 1197 | unrouted_nodes = unrouted_nodes->next; |
1176 | unrouted_nodes = unrouted_nodes->next; |
| 1198 | if (!f && unrouted_nodes) |
1177 | if (!f && unrouted_nodes) |
| 1199 | { |
1178 | { |
| 1200 | failcount++; |
1179 | failcount++; |
| 1201 | Log ( |
- | |
| 1202 | LOG_ERROR, |
- | |
| 1203 | "-- FAIL on : net %s\n", |
- | |
| 1204 | unrouted_net->identifier); |
1180 | Log (LOG_ERROR, "-- FAIL on : net %s\n", unrouted_net->identifier); |
| 1205 | Log ( |
- | |
| 1206 | LOG_ERROR, |
- | |
| 1207 | "-- node %s(%s)\n", |
1181 | Log (LOG_ERROR, "-- node %s(%s)\n", |
| 1208 | unrouted_nodes->node->socket->identifier, |
1182 | unrouted_nodes->node->socket->identifier, |
| 1209 | unrouted_nodes->node->identifier); |
1183 | unrouted_nodes->node->identifier); |
| 1210 | if (unrouted_nodes->node->net_assigned) |
1184 | if (unrouted_nodes->node->net_assigned) |
| 1211 | Log ( |
- | |
| 1212 | LOG_ERROR, |
- | |
| 1213 | "-- Node is on an already assigned net\n"); |
1185 | Log (LOG_ERROR, "-- Node is on an already assigned net\n"); |
| 1214 | if (unrouted_nodes->node->refcount > 1) |
1186 | if (unrouted_nodes->node->refcount > 1) |
| 1215 | Log ( |
- | |
| 1216 | LOG_ERROR, |
- | |
| 1217 | "-- Node is referred to by %d nets\n", |
1187 | Log (LOG_ERROR, "-- Node is referred to by %d nets\n", |
| 1218 | unrouted_nodes->node->refcount); |
1188 | unrouted_nodes->node->refcount); |
| 1219 | } |
1189 | } |
| - | 1190 | ||
| 1220 | 1191 | ||
| 1221 | /* if f is 1 then the unrouted net contains only unassigned nodes */ |
1192 | /* if f is 1 then the unrouted net contains only unassigned nodes */ |
| 1222 | if (f) |
1193 | if (f) |
| 1223 | { |
1194 | { |
| 1224 | net_t *poss_routed_net; |
1195 | net_t *poss_routed_net; |
| 1225 | /* now we need to confirm that the name is unique: |
1196 | /* now we need to confirm that the name is unique: |
| 1226 | search for it to see if there already*/ |
1197 | search for it to see if there already*/ |
| 1227 | poss_routed_net = find_net ( |
- | |
| 1228 | &routed_list, Ident, unrouted_net->identifier, Search); |
1198 | poss_routed_net = find_net (&routed_list, Ident, unrouted_net->identifier, Search); |
| 1229 | if (!poss_routed_net) |
- | |
| 1230 | { /* its unique */ |
1199 | if (!poss_routed_net ) { /* its unique */ |
| 1231 | /* prevent this net from being recycled, move to |
1200 | /* prevent this net from being recycled, move to |
| 1232 | the fully named and routed list */ |
1201 | the fully named and routed list */ |
| 1233 | combine_routed_and_unrouted ( |
- | |
| 1234 | unrouted_net, unrouted_net); |
1202 | combine_routed_and_unrouted (unrouted_net, unrouted_net); |
| 1235 | transfer_net_to_named (&unrouted_list, unrouted_net); |
1203 | transfer_net_to_named (&unrouted_list, unrouted_net); |
| 1236 | unrouted_net->how_routed = |
- | |
| 1237 | By_Creating; /* This net was routed by creating a |
1204 | unrouted_net->how_routed = By_Creating; /* This net was routed by creating a new one !! */ |
| 1238 | new one !! */ |
- | |
| 1239 | Log ( |
- | |
| 1240 | LOG_GENERAL, |
- | |
| 1241 | "-- Info: Created Wiring for net '%s'\n", |
- | |
| 1242 | unrouted_net->identifier); |
1205 | Log (LOG_GENERAL, "-- Info: Created Wiring for net '%s'\n",unrouted_net->identifier); |
| 1243 | routed_ok = 1; |
1206 | routed_ok = 1; |
| 1244 | } |
1207 | } |
| 1245 | else |
- | |
| 1246 | { |
1208 | else { |
| 1247 | Log ( |
- | |
| 1248 | LOG_ERROR, |
- | |
| 1249 | "-- ERROR: Net identifier '%s' already in use in " |
- | |
| 1250 | "routed list: cannot create\n", |
1209 | Log (LOG_ERROR, "-- ERROR: Net identifier '%s' already in use in routed list: cannot create\n",unrouted_net->identifier); |
| 1251 | unrouted_net->identifier); |
- | |
| 1252 | routed_ok = 0; |
1210 | routed_ok = 0; |
| 1253 | } |
1211 | } |
| 1254 | } |
1212 | |
| - | 1213 | } |
|
| 1255 | } |
1214 | } |
| 1256 | /* move on , either its been moved from one list to the other or its still |
1215 | /* move on , either its been moved from one list to the other or its still there */ |
| 1257 | * there */ |
- | |
| 1258 | unrouted_net = next_net; |
1216 | unrouted_net = next_net; |
| 1259 | } |
1217 | } |
| - | 1218 | ||
| - | 1219 | count_nets ("After routing by making nets"); |
|
| - | 1220 | ||
| 1260 | 1221 | ||
| 1261 | count_nets ("After routing by making nets"); |
- | |
| 1262 | } |
1222 | } |
| 1263 | 1223 | ||
| - | 1224 | ||
| - | 1225 | ||
| - | 1226 | ||
| - | 1227 | ||
| - | 1228 | ||
| - | 1229 | ||
| 1264 | /* ******************************************** */ |
1230 | /* ******************************************** */ |
| 1265 | /* Pruning nets that have names like rsv00000z */ |
1231 | /* Pruning nets that have names like rsv00000z */ |
| 1266 | /* from a list */ |
1232 | /* from a list */ |
| 1267 | /* ******************************************** */ |
1233 | /* ******************************************** */ |
| 1268 | 1234 | ||
| 1269 | void prune_nets_from_list (net_t **list, char *res_tpl) |
1235 | void prune_nets_from_list (net_t ** list, char *res_tpl) |
| 1270 | { |
1236 | { |
| 1271 | net_t *curr_net = *list; |
1237 | net_t *curr_net = *list; |
| 1272 | while (curr_net) |
1238 | while (curr_net) |
| 1273 | { |
1239 | { |
| 1274 | int i = 0; |
1240 | int i = 0; |
| 1275 | while ((i < RES_NAMLEN) && |
1241 | while ((i < RES_NAMLEN) && |
| 1276 | /* string match */ |
1242 | /* string match */ |
| 1277 | (res_tpl[i] == tolower (curr_net->identifier[i]) || |
1243 | (res_tpl[i] == tolower(curr_net->identifier[i]) || |
| 1278 | /* 0 in template matches a digit */ |
1244 | /* 0 in template matches a digit */ |
| 1279 | ((res_tpl[i] == '0') && isdigit (curr_net->identifier[i])))) |
1245 | ((res_tpl[i] == '0') && isdigit (curr_net->identifier[i])))) |
| 1280 | i++; |
1246 | i++; |
| 1281 | if (i == RES_NAMLEN) |
1247 | if (i == RES_NAMLEN) |
| 1282 | curr_net = remove_net (list, curr_net); |
1248 | curr_net = remove_net (list, curr_net); |
| 1283 | else |
1249 | else |
| 1284 | curr_net = curr_net->next; |
1250 | curr_net = curr_net->next; |
| 1285 | } |
1251 | } |
| 1286 | } |
1252 | } |
| 1287 | 1253 | ||
| 1288 | /* ******************************************** */ |
1254 | /* ******************************************** */ |
| 1289 | 1255 | ||
| - | 1256 | ||
| - | 1257 | void |
|
| 1290 | void prune_nets () |
1258 | prune_nets () |
| 1291 | { |
1259 | { |
| 1292 | char res_tpl[RES_NAMLEN + 1]; |
1260 | char res_tpl[RES_NAMLEN + 1]; |
| 1293 | sprintf (res_tpl, RES_FMT, 0); /* create a template, with 00000 in it */ |
1261 | sprintf (res_tpl, RES_FMT, 0); /* create a template, with 00000 in it */ |
| 1294 | prune_nets_from_list (&routed_list, res_tpl); |
1262 | prune_nets_from_list (&routed_list, res_tpl); |
| 1295 | prune_nets_from_list (&unrouted_list, res_tpl); |
1263 | prune_nets_from_list (&unrouted_list, res_tpl); |
| 1296 | 1264 | ||
| 1297 | count_nets ("After deleting dummy nets e.g. 'rsv00001z'"); |
1265 | count_nets ("After deleting dummy nets e.g. 'rsv00001z'"); |
| 1298 | } |
1266 | } |
| 1299 | 1267 | ||
| - | 1268 | ||
| - | 1269 | ||
| 1300 | /* ******************************************** */ |
1270 | /* ******************************************** */ |
| 1301 | /* this function is intended to check to see how many nets have got |
1271 | /* this function is intended to check to see how many nets have got |
| 1302 | how_routed = By_FixPins . */ |
1272 | how_routed = By_FixPins . */ |
| 1303 | 1273 | ||
| - | 1274 | void |
|
| 1304 | void check_for_unused_fixed_nets (char *why) |
1275 | check_for_unused_fixed_nets (char * why) |
| 1305 | { |
1276 | { |
| 1306 | net_t *curr_net = routed_list; |
1277 | net_t *curr_net = routed_list; |
| 1307 | int print_flag = 1; |
1278 | int print_flag=1; |
| 1308 | while (curr_net) |
1279 | while (curr_net) |
| 1309 | { |
1280 | { |
| 1310 | if (curr_net->how_routed == By_FixPins) |
1281 | if (curr_net->how_routed == By_FixPins) { |
| 1311 | { |
- | |
| 1312 | if (print_flag) |
1282 | if(print_flag) { |
| 1313 | { |
1283 | print_flag=0; |
| 1314 | print_flag = 0; |
- | |
| 1315 | Log ( |
- | |
| 1316 | LOG_ERROR, |
- | |
| 1317 | "-- ERROR : fix_pin fails due to %s:\n-- Failures :\n", |
1284 | Log (LOG_ERROR, "-- ERROR : fix_pin fails due to %s:\n-- Failures :\n",why); |
| 1318 | why); |
- | |
| 1319 | } |
1285 | } |
| 1320 | Log ( |
- | |
| 1321 | LOG_ERROR, |
- | |
| 1322 | "-- '%s' to routed net='%s'\n", |
- | |
| 1323 | curr_net->name, |
- | |
| 1324 | curr_net->identifier); |
1286 | Log (LOG_ERROR, "-- '%s' to routed net='%s'\n", curr_net->name, curr_net->identifier); |
| 1325 | } |
1287 | } |
| 1326 | curr_net = curr_net->next; |
1288 | curr_net = curr_net->next; |
| 1327 | } |
1289 | } |
| 1328 | puts ("--"); |
1290 | puts ("--"); |
| 1329 | } |
1291 | } |
| 1330 | 1292 | ||
| 1331 | /* ******************************************** */ |
- | |
| 1332 | 1293 | ||
| 1333 | void perform_routing (HowRouted_t how) |
- | |
| 1334 | { |
- | |
| 1335 | count_nets ("Before fixing up pin aliases"); |
- | |
| 1336 | - | ||
| 1337 | create_unrouted_list (); |
- | |
| 1338 | 1294 | ||
| 1339 | if (need_validate_names) |
- | |
| 1340 | { |
- | |
| 1341 | Log (LOG_GENERAL, "# Validating net names and identifiers\n"); |
- | |
| 1342 | validate_names (); |
- | |
| 1343 | need_validate_names = 0; |
1295 | /* ******************************************** */ |
| 1344 | } |
- | |
| 1345 | count_nets ("Before routing"); |
- | |
| 1346 | validate_unrouted (); |
- | |
| 1347 | 1296 | ||
| - | 1297 | void |
|
| 1348 | prune_nets (); |
1298 | perform_routing (HowRouted_t how) |
| - | 1299 | { |
|
| 1349 | 1300 | ||
| - | 1301 | count_nets("Before fixing up pin aliases"); |
|
| - | 1302 | ||
| - | 1303 | create_unrouted_list(); |
|
| - | 1304 | ||
| - | 1305 | if (need_validate_names) { |
|
| - | 1306 | Log(LOG_GENERAL,"# Validating net names and identifiers\n"); |
|
| - | 1307 | validate_names(); |
|
| - | 1308 | need_validate_names = 0; |
|
| - | 1309 | } |
|
| - | 1310 | count_nets ("Before routing"); |
|
| - | 1311 | validate_unrouted(); |
|
| - | 1312 | ||
| - | 1313 | prune_nets (); |
|
| - | 1314 | ||
| - | 1315 | ||
| 1350 | if (how == Free || how == By_Name) |
1316 | if (how == Free || how == By_Name) |
| 1351 | { |
1317 | { |
| 1352 | /* get rid of all unrouted nets that have been invented in the first place */ |
1318 | /* get rid of all unrouted nets that have been invented in the first place */ |
| 1353 | perform_routing_by_name (); |
1319 | perform_routing_by_name (); |
| 1354 | check_for_unused_fixed_nets ("Nets already routed by name"); |
1320 | check_for_unused_fixed_nets ("Nets already routed by name"); |
| 1355 | }; |
1321 | }; |
| 1356 | if (how == Free || how == By_Fixed_Net) |
1322 | if (how == Free || how == By_Fixed_Net) |
| 1357 | { |
1323 | { |
| 1358 | perform_routing_by_fixed_net (); |
1324 | perform_routing_by_fixed_net (); |
| 1359 | check_for_unused_fixed_nets ("Routed nets with fixed pins do not match " |
1325 | check_for_unused_fixed_nets ("Routed nets with fixed pins do not match unrouted"); |
| 1360 | "unrouted"); |
- | |
| 1361 | }; |
1326 | }; |
| 1362 | if (how == Free || how == By_Exact_Net) |
1327 | if (how == Free || how == By_Exact_Net) |
| 1363 | perform_routing_by_exact_path (); |
1328 | perform_routing_by_exact_path (); |
| 1364 | if (how == Free || how == By_Net) |
1329 | if (how == Free || how == By_Net) |
| 1365 | perform_routing_by_path (); |
1330 | perform_routing_by_path (); |
| 1366 | if (how == By_Creating) /* Will not create missing nets !! : use creation */ |
1331 | if (how == By_Creating) /* Will not create missing nets !! : use creation */ |
| 1367 | perform_routing_by_making_nets (); |
1332 | perform_routing_by_making_nets (); |
| 1368 | if (how == Free) |
1333 | if(how==Free ) |
| 1369 | ensure_reservation (); |
1334 | ensure_reservation(); |
| 1370 | count_nets_with_few_nodes (1); /* summarise single connection nets */ |
1335 | count_nets_with_few_nodes(1); /* summarise single connection nets */ |
| 1371 | } |
1336 | } |
| 1372 | 1337 | ||
| - | 1338 | ||
| 1373 | /* ******************************************** */ |
1339 | /* ******************************************** */ |
| 1374 | /* Experimental bit of code : For all nets that connect to |
1340 | /* Experimental bit of code : For all nets that connect to |
| 1375 | a pin of an external socket in the unrouted list , |
1341 | a pin of an external socket in the unrouted list , |
| 1376 | check to see if the routed net connected to the same pin has a name assigned. |
1342 | check to see if the routed net connected to the same pin has a name assigned. |
| 1377 | If it does not then try setting the name of the net to the identifier |
1343 | If it does not then try setting the name of the net to the identifier |
| 1378 | of the unrouted net . Use this before routing */ |
1344 | of the unrouted net . Use this before routing */ |
| 1379 | 1345 | ||
| - | 1346 | ||
| - | 1347 | void |
|
| 1380 | void perform_trial_naming (void) |
1348 | perform_trial_naming (void) |
| 1381 | { |
1349 | { |
| 1382 | net_t *cur_net; |
1350 | net_t *cur_net ; |
| - | 1351 | int fixed_counter = 0 ; |
|
| - | 1352 | ||
| - | 1353 | create_unrouted_list(); |
|
| - | 1354 | ||
| - | 1355 | cur_net = unrouted_list; /* after pin renames etc have been executed */ |
|
| - | 1356 | ||
| - | 1357 | prune_nets(); /* will not fix rsv00000z pins !! */ |
|
| - | 1358 | ||
| - | 1359 | while (cur_net) |
|
| - | 1360 | { |
|
| - | 1361 | noderef_t *nodes = cur_net->nodes; |
|
| - | 1362 | if (level & 8) |
|
| - | 1363 | Log (LOG_GENERAL, "# Trying to fix net '%s'\n", |
|
| - | 1364 | cur_net->identifier); |
|
| - | 1365 | while (nodes) |
|
| - | 1366 | { |
|
| - | 1367 | /* is this node pointing at an external socket */ |
|
| - | 1368 | node_t *n = nodes->node; |
|
| - | 1369 | /* only fix one routed net to this un_routed net */ |
|
| - | 1370 | if (n->socket->is_external) |
|
| - | 1371 | { /* on an external socket */ |
|
| - | 1372 | ||
| - | 1373 | n->fix_location = 1; /* set the location fixed flag a*/ |
|
| - | 1374 | if(n->routed_net) { /* and set the flag on the routed net */ |
|
| - | 1375 | n->routed_net->unrouted_fix_net = cur_net; |
|
| - | 1376 | n->routed_net->has_fix_location = 1; |
|
| 1383 | int fixed_counter = 0; |
1377 | fixed_counter++; |
| - | 1378 | if (level & 8) |
|
| - | 1379 | Log (LOG_GENERAL, "# to net '%s'\n", |
|
| - | 1380 | n->routed_net->identifier); |
|
| - | 1381 | } |
|
| - | 1382 | } |
|
| - | 1383 | nodes = nodes->next; |
|
| - | 1384 | } |
|
| - | 1385 | /* |
|
| - | 1386 | Log (LOG_GENERAL, "#\n"); |
|
| - | 1387 | */ |
|
| - | 1388 | cur_net = cur_net->next; |
|
| - | 1389 | } |
|
| - | 1390 | Log (LOG_GENERAL, "# Fixed %d pins\n", |
|
| - | 1391 | fixed_counter); |
|
| - | 1392 | } |
|
| 1384 | 1393 | ||
| 1385 | create_unrouted_list (); |
- | |
| 1386 | 1394 | ||
| 1387 | cur_net = unrouted_list; /* after pin renames etc have been executed */ |
- | |
| 1388 | 1395 | ||
| 1389 | prune_nets (); /* will not fix rsv00000z pins !! */ |
- | |
| 1390 | 1396 | ||
| 1391 | while (cur_net) |
- | |
| 1392 | { |
- | |
| 1393 | noderef_t *nodes = cur_net->nodes; |
- | |
| 1394 | if (level & 8) |
- | |
| 1395 | Log (LOG_GENERAL, "# Trying to fix net '%s'\n", cur_net->identifier); |
- | |
| 1396 | while (nodes) |
- | |
| 1397 | { |
- | |
| 1398 | /* is this node pointing at an external socket */ |
- | |
| 1399 | node_t *n = nodes->node; |
- | |
| 1400 | /* only fix one routed net to this un_routed net */ |
- | |
| 1401 | if (n->socket->is_external) |
- | |
| 1402 | { /* on an external socket */ |
- | |
| 1403 | - | ||
| 1404 | n->fix_location = 1; /* set the location fixed flag a*/ |
- | |
| 1405 | if (n->routed_net) |
- | |
| 1406 | { /* and set the flag on the routed net */ |
- | |
| 1407 | n->routed_net->unrouted_fix_net = cur_net; |
- | |
| 1408 | n->routed_net->has_fix_location = 1; |
- | |
| 1409 | fixed_counter++; |
- | |
| 1410 | if (level & 8) |
- | |
| 1411 | Log ( |
- | |
| 1412 | LOG_GENERAL, |
- | |
| 1413 | "# to net '%s'\n", |
- | |
| 1414 | n->routed_net->identifier); |
- | |
| 1415 | } |
- | |
| 1416 | } |
- | |
| 1417 | nodes = nodes->next; |
- | |
| 1418 | } |
- | |
| 1419 | /* |
- | |
| 1420 | Log (LOG_GENERAL, "#\n"); |
- | |
| 1421 | */ |
- | |
| 1422 | cur_net = cur_net->next; |
- | |
| 1423 | } |
- | |
| 1424 | Log (LOG_GENERAL, "# Fixed %d pins\n", fixed_counter); |
- | |
| 1425 | } |
- | |
| 1426 | 1397 | ||
| 1427 | /* ********************************************************************* */ |
1398 | /* ********************************************************************* */ |
| 1428 | 1399 | ||
| 1429 | /* force routing flag of routed net */ |
1400 | /* force routing flag of routed net */ |
| 1430 | void force_route (char *template, HowRouted_t flag) |
1401 | void force_route(char * template,HowRouted_t flag) |
| 1431 | { |
1402 | { |
| 1432 | net_t *net = routed_list; |
1403 | net_t * net = routed_list; |
| 1433 | int rc, any_found = 0; |
1404 | int rc,any_found =0; |
| 1434 | int found; |
1405 | int found; |
| 1435 | 1406 | ||
| 1436 | /* compile regular expression */ |
1407 | /* compile regular expression */ |
| 1437 | vert_regex_t *preg; |
1408 | vert_regex_t * preg; |
| 1438 | 1409 | ||
| 1439 | rc = vert_regcomp (&preg, template); |
1410 | rc = vert_regcomp(&preg,template); |
| 1440 | 1411 | ||
| 1441 | if (rc != 0) |
1412 | if (rc != 0 ) |
| 1442 | { |
1413 | { |
| 1443 | char errbuff[100]; |
1414 | char errbuff[100]; |
| 1444 | regerror (rc, preg->preg, errbuff, 100); |
1415 | regerror(rc,preg->preg,errbuff,100); |
| 1445 | Log ( |
- | |
| 1446 | LOG_ERROR, |
- | |
| 1447 | "-- Problem (rc=%d) %s with '%s' as regular expression\n", |
1416 | Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,template); |
| 1448 | rc, |
1417 | |
| 1449 | errbuff, |
1418 | /* return TCL_ERROR; |
| 1450 | template); |
- | |
| 1451 | 1419 | */ |
|
| 1452 | /* return TCL_ERROR; |
- | |
| 1453 | */ |
- | |
| 1454 | return; |
1420 | return; |
| 1455 | } |
1421 | } |
| 1456 | else |
1422 | else |
| 1457 | { |
1423 | { |
| 1458 | Log (LOG_GENERAL, "-- Using '%s' as match pattern\n", template); |
1424 | Log(LOG_GENERAL,"-- Using '%s' as match pattern\n",template); |
| 1459 | } |
1425 | } |
| 1460 | 1426 | ||
| 1461 | while (net) |
1427 | while(net) { |
| 1462 | { |
- | |
| 1463 | found = regexec (preg->preg, net->identifier, 0, preg->regpatt, 0); |
1428 | found = regexec(preg->preg,net->identifier,0,preg->regpatt,0); |
| 1464 | 1429 | ||
| 1465 | if (!found) |
1430 | if(!found) { |
| 1466 | { |
1431 | char * s; |
| 1467 | char *s; |
- | |
| 1468 | any_found = 1; |
1432 | any_found = 1; |
| 1469 | net->how_routed = flag; |
1433 | net->how_routed = flag; |
| 1470 | switch (flag) |
1434 | switch(flag) |
| 1471 | { |
1435 | { |
| 1472 | case Not_Routable: |
- | |
| 1473 | s = "not routable"; |
1436 | case Not_Routable : s="not routable"; break; |
| 1474 | break; |
- | |
| 1475 | case Not_Routable_H: |
- | |
| 1476 | s = "not routable H"; |
1437 | case Not_Routable_H: s="not routable H"; break; |
| 1477 | break; |
- | |
| 1478 | case Not_Routable_L: |
- | |
| 1479 | s = "not routable L"; |
1438 | case Not_Routable_L: s="not routable L"; break; |
| 1480 | break; |
- | |
| 1481 | default: |
- | |
| 1482 | s = "routable"; |
- | |
| 1483 | break; |
1439 | default : s="routable"; break; |
| 1484 | } |
1440 | } |
| 1485 | Log (LOG_GENERAL, "-- Set net '%s' as %s\n", net->identifier, s); |
1441 | Log(LOG_GENERAL,"-- Set net '%s' as %s\n",net->identifier,s); |
| 1486 | } |
1442 | } |
| 1487 | net = net->next; |
1443 | net = net->next; |
| 1488 | } |
1444 | } |
| 1489 | if (!any_found) |
1445 | if(!any_found) |
| 1490 | Log (LOG_GENERAL, "-- No nets match '%s'\n", template); |
1446 | Log(LOG_GENERAL,"-- No nets match '%s'\n",template); |
| 1491 | vert_regfree (&preg); |
1447 | vert_regfree(&preg); |
| 1492 | } |
1448 | } |
| - | 1449 | ||
| 1493 | 1450 | ||
| 1494 | /* ********************************************************************* */ |
1451 | /* ********************************************************************* */ |
| 1495 | void set_group_route_flags (char *template, int flag) |
1452 | void set_group_route_flags(char * template,int flag) |
| 1496 | { |
1453 | { |
| 1497 | int found; |
1454 | int found; |
| 1498 | socket_t *socket = socket_head; |
1455 | socket_t * socket = socket_head; |
| 1499 | int rc, any_found = 0; |
1456 | int rc,any_found =0; |
| - | 1457 | ||
| - | 1458 | /* compile regular expression */ |
|
| - | 1459 | vert_regex_t * preg; |
|
| - | 1460 | rc = vert_regcomp(&preg,template); |
|
| - | 1461 | ||
| - | 1462 | if (rc != 0 ) |
|
| - | 1463 | { |
|
| - | 1464 | char errbuff[100]; |
|
| - | 1465 | regerror(rc,preg->preg,errbuff,100); |
|
| - | 1466 | Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,template); |
|
| - | 1467 | ||
| - | 1468 | /* return TCL_ERROR; |
|
| - | 1469 | */ |
|
| - | 1470 | return; |
|
| - | 1471 | } |
|
| - | 1472 | else |
|
| - | 1473 | { |
|
| - | 1474 | Log(LOG_GENERAL,"-- Using '%s' as match pattern\n",template); |
|
| - | 1475 | } |
|
| - | 1476 | ||
| - | 1477 | Log(LOG_GENERAL,"----- Setting pin group routing flags to %d for\n",flag); |
|
| - | 1478 | ||
| - | 1479 | while(socket ) { |
|
| - | 1480 | found = regexec(preg->preg,socket->identifier,0,preg->regpatt,0); |
|
| - | 1481 | if(!found) { |
|
| - | 1482 | any_found = 1; |
|
| - | 1483 | socket->route_flags = flag; |
|
| - | 1484 | Log(LOG_GENERAL,"-- socket '%s'\n",socket->identifier); |
|
| - | 1485 | } |
|
| - | 1486 | socket = socket->next; |
|
| - | 1487 | } |
|
| - | 1488 | if(!any_found) |
|
| - | 1489 | Log(LOG_GENERAL,"-- No sockets match '%s'\n",template); |
|
| - | 1490 | vert_regfree(&preg); |
|
| - | 1491 | } |
|
| 1500 | 1492 | ||
| 1501 | /* compile regular expression */ |
- | |
| 1502 | vert_regex_t *preg; |
- | |
| 1503 | rc = vert_regcomp (&preg, template); |
- | |
| 1504 | - | ||
| 1505 | if (rc != 0) |
- | |
| 1506 | { |
- | |
| 1507 | char errbuff[100]; |
- | |
| 1508 | regerror (rc, preg->preg, errbuff, 100); |
- | |
| 1509 | Log ( |
- | |
| 1510 | LOG_ERROR, |
- | |
| 1511 | "-- Problem (rc=%d) %s with '%s' as regular expression\n", |
- | |
| 1512 | rc, |
- | |
| 1513 | errbuff, |
- | |
| 1514 | template); |
- | |
| 1515 | - | ||
| 1516 | /* return TCL_ERROR; |
- | |
| 1517 | */ |
- | |
| 1518 | return; |
- | |
| 1519 | } |
- | |
| 1520 | else |
- | |
| 1521 | { |
- | |
| 1522 | Log (LOG_GENERAL, "-- Using '%s' as match pattern\n", template); |
- | |
| 1523 | } |
- | |
| 1524 | - | ||
| 1525 | Log (LOG_GENERAL, "----- Setting pin group routing flags to %d for\n", flag); |
- | |
| 1526 | - | ||
| 1527 | while (socket) |
- | |
| 1528 | { |
- | |
| 1529 | found = regexec (preg->preg, socket->identifier, 0, preg->regpatt, 0); |
- | |
| 1530 | if (!found) |
- | |
| 1531 | { |
- | |
| 1532 | any_found = 1; |
- | |
| 1533 | socket->route_flags = flag; |
- | |
| 1534 | Log (LOG_GENERAL, "-- socket '%s'\n", socket->identifier); |
- | |
| 1535 | } |
- | |
| 1536 | socket = socket->next; |
- | |
| 1537 | } |
- | |
| 1538 | if (!any_found) |
- | |
| 1539 | Log (LOG_GENERAL, "-- No sockets match '%s'\n", template); |
- | |
| 1540 | vert_regfree (&preg); |
- | |
| 1541 | } |
- | |
| 1542 | 1493 | ||
| 1543 | /**************************************************************/ |
1494 | /**************************************************************/ |
| 1544 | /* Function sets the pin group flags on a device */ |
1495 | /* Function sets the pin group flags on a device */ |
| 1545 | /* pattern is ic.pin */ |
1496 | /* pattern is ic.pin */ |
| 1546 | /* changed to ic(pin) */ |
1497 | /* changed to ic(pin) */ |
| 1547 | void set_pin_group_flags (char *device_string, int flag) |
1498 | void set_pin_group_flags (char * device_string,int flag) { |
| 1548 | { |
- | |
| 1549 | socket_t *socket; |
1499 | socket_t * socket; |
| 1550 | node_t *node; |
1500 | node_t * node; |
| 1551 | int socket_cnt = 0, pin_cnt = 0; /* counters */ |
1501 | int socket_cnt=0,pin_cnt=0; /* counters */ |
| 1552 | int found_socket, found_pin; |
1502 | int found_socket,found_pin; |
| 1553 | char *s = strdup (device_string); |
1503 | char * s = strdup(device_string); |
| 1554 | char *p, *q; |
1504 | char * p, *q; |
| 1555 | int rc; |
1505 | int rc; |
| 1556 | /* compile regular expression */ |
1506 | /* compile regular expression */ |
| 1557 | vert_regex_t *skt_reg, *pin_reg; |
1507 | vert_regex_t * skt_reg, * pin_reg; |
| - | 1508 | ||
| - | 1509 | ||
| 1558 | 1510 | ||
| - | 1511 | ||
| 1559 | /* find the '(' in the socket name name */ |
1512 | /* find the '(' in the socket name name */ |
| 1560 | 1513 | ||
| 1561 | p = strchr (s, '('); |
1514 | p = strchr(s,'('); |
| 1562 | q = strrchr (s, ')'); |
1515 | q = strrchr(s,')'); |
| 1563 | if (p == s) |
1516 | if(p==s) |
| 1564 | { |
1517 | { |
| 1565 | s = ".*"; /* wildcard for chip id */ |
1518 | s= ".*"; /* wildcard for chip id */ |
| 1566 | } |
1519 | } |
| 1567 | if (!p || !q || q < p) |
1520 | if (!p || !q || q<p) |
| 1568 | { |
1521 | { |
| 1569 | p = ".*"; /* wilcard for pin id */ |
1522 | p = ".*"; /* wilcard for pin id */ |
| 1570 | } |
1523 | } |
| 1571 | else |
1524 | else |
| 1572 | { |
1525 | { |
| 1573 | *p++ = 0; |
1526 | *p++ = 0; |
| 1574 | *q = 0; |
1527 | *q = 0; |
| 1575 | } |
1528 | } |
| 1576 | 1529 | ||
| 1577 | rc = vert_regcomp (&skt_reg, s); |
1530 | rc = vert_regcomp(&skt_reg,s); |
| 1578 | 1531 | ||
| 1579 | if (rc != 0) |
1532 | if (rc != 0 ) |
| 1580 | { |
1533 | { |
| 1581 | char errbuff[100]; |
1534 | char errbuff[100]; |
| 1582 | regerror (rc, skt_reg->preg, errbuff, 100); |
1535 | regerror(rc,skt_reg->preg,errbuff,100); |
| 1583 | Log ( |
- | |
| 1584 | LOG_ERROR, |
- | |
| 1585 | "-- Problem (rc=%d) %s with '%s' as regular expression\n", |
1536 | Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,s); |
| - | 1537 | ||
| 1586 | rc, |
1538 | /* return TCL_ERROR; |
| - | 1539 | */ |
|
| 1587 | errbuff, |
1540 | return; |
| - | 1541 | } |
|
| - | 1542 | else |
|
| - | 1543 | { |
|
| - | 1544 | Log(LOG_GENERAL,"-- Using '%s' as socket match pattern\n",s); |
|
| - | 1545 | } |
|
| - | 1546 | ||
| 1588 | s); |
1547 | rc = vert_regcomp(&pin_reg,p); |
| 1589 | 1548 | ||
| - | 1549 | if (rc != 0 ) |
|
| - | 1550 | { |
|
| - | 1551 | char errbuff[100]; |
|
| 1590 | /* return TCL_ERROR; |
1552 | regerror(rc,pin_reg->preg,errbuff,100); |
| - | 1553 | Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,p); |
|
| - | 1554 | ||
| 1591 | */ |
1555 | /* return TCL_ERROR; |
| - | 1556 | */ |
|
| 1592 | return; |
1557 | return; |
| 1593 | } |
1558 | } |
| 1594 | else |
1559 | else |
| 1595 | { |
1560 | { |
| 1596 | Log (LOG_GENERAL, "-- Using '%s' as socket match pattern\n", s); |
1561 | Log(LOG_GENERAL,"-- Using '%s' as socket match pattern\n",p); |
| 1597 | } |
1562 | } |
| - | 1563 | ||
| 1598 | 1564 | ||
| - | 1565 | socket = socket_head; |
|
| - | 1566 | while(socket) |
|
| - | 1567 | { |
|
| - | 1568 | found_socket = regexec(skt_reg->preg,socket->identifier,0,skt_reg->regpatt,0); |
|
| - | 1569 | if(!found_socket) { |
|
| - | 1570 | socket_cnt ++; |
|
| 1599 | rc = vert_regcomp (&pin_reg, p); |
1571 | node = socket->nodes; |
| - | 1572 | /* |
|
| - | 1573 | Log(LOG_GENERAL,"-- Chip ID %s\n",socket->identifier); |
|
| - | 1574 | */ |
|
| - | 1575 | found_pin = 0; |
|
| - | 1576 | while(node) { |
|
| - | 1577 | found_pin = regexec(pin_reg->preg,node->identifier,0,pin_reg->regpatt,0); |
|
| 1600 | 1578 | ||
| 1601 | if (rc != 0) |
1579 | if(!found_pin) { |
| 1602 | { |
1580 | /* |
| 1603 | char errbuff[100]; |
- | |
| 1604 | regerror (rc, pin_reg->preg, errbuff, 100); |
1581 | Log(LOG_GENERAL,"-- Pin %s.%s\n",socket->identifier,node->identifier); |
| - | 1582 | */ |
|
| 1605 | Log ( |
1583 | pin_cnt ++; |
| 1606 | LOG_ERROR, |
1584 | node->pin_group = flag; |
| 1607 | "-- Problem (rc=%d) %s with '%s' as regular expression\n", |
- | |
| 1608 | rc, |
1585 | } |
| 1609 | errbuff, |
1586 | node = node->sktnext; |
| 1610 | p); |
1587 | } |
| 1611 | - | ||
| 1612 | /* return TCL_ERROR; |
- | |
| 1613 | */ |
1588 | } |
| 1614 | return; |
1589 | socket = socket->next; |
| 1615 | } |
1590 | } |
| 1616 | else |
1591 | if(socket_cnt) |
| - | 1592 | Log(LOG_GENERAL,"-- Checked %d sockets\n",socket_cnt); |
|
| 1617 | { |
1593 | if(pin_cnt) |
| 1618 | Log (LOG_GENERAL, "-- Using '%s' as socket match pattern\n", p); |
1594 | Log(LOG_GENERAL,"-- Set pin group to %d on a total of %d pins\n", |
| - | 1595 | flag,pin_cnt); |
|
| 1619 | } |
1596 | else |
| - | 1597 | Log(LOG_GENERAL,"-- Did not locate any pins matching pattern\n"); |
|
| 1620 | 1598 | ||
| 1621 | socket = socket_head; |
- | |
| 1622 | while (socket) |
1599 | vert_regfree(&pin_reg); |
| 1623 | { |
- | |
| 1624 | found_socket = |
- | |
| 1625 | regexec (skt_reg->preg, socket->identifier, 0, skt_reg->regpatt, 0); |
- | |
| 1626 | if (!found_socket) |
- | |
| 1627 | { |
- | |
| 1628 | socket_cnt++; |
- | |
| 1629 | node = socket->nodes; |
- | |
| 1630 | /* |
- | |
| 1631 | Log(LOG_GENERAL,"-- Chip ID %s\n",socket->identifier); |
- | |
| 1632 | */ |
- | |
| 1633 | found_pin = 0; |
- | |
| 1634 | while (node) |
- | |
| 1635 | { |
- | |
| 1636 | found_pin = regexec ( |
- | |
| 1637 | pin_reg->preg, node->identifier, 0, pin_reg->regpatt, 0); |
- | |
| 1638 | - | ||
| 1639 | if (!found_pin) |
- | |
| 1640 | { |
- | |
| 1641 | /* |
- | |
| 1642 | Log(LOG_GENERAL,"-- Pin |
- | |
| 1643 | %s.%s\n",socket->identifier,node->identifier); |
- | |
| 1644 | */ |
- | |
| 1645 | pin_cnt++; |
- | |
| 1646 | node->pin_group = flag; |
- | |
| 1647 | } |
- | |
| 1648 | node = node->sktnext; |
- | |
| 1649 | } |
- | |
| 1650 | } |
- | |
| 1651 | socket = socket->next; |
- | |
| 1652 | } |
- | |
| 1653 | if (socket_cnt) |
1600 | vert_regfree(&skt_reg); |
| 1654 | Log (LOG_GENERAL, "-- Checked %d sockets\n", socket_cnt); |
- | |
| 1655 | if (pin_cnt) |
- | |
| 1656 | Log ( |
- | |
| 1657 | LOG_GENERAL, |
- | |
| 1658 | "-- Set pin group to %d on a total of %d pins\n", |
- | |
| 1659 | flag, |
- | |
| 1660 | pin_cnt); |
- | |
| 1661 | else |
- | |
| 1662 | Log (LOG_GENERAL, "-- Did not locate any pins matching pattern\n"); |
- | |
| 1663 | 1601 | ||
| 1664 | vert_regfree (&pin_reg); |
- | |
| 1665 | vert_regfree (&skt_reg); |
- | |
| 1666 | } |
1602 | } |