Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
11 | mjames | 1 | /* |
2 | mjames | 2 | * $Id: printout.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $ |
3 | * |
||
4 | * $Log: printout.c,v $ |
||
5 | * Revision 1.1.1.1 2003/11/04 23:34:57 mjames |
||
6 | * Imported into local repositrory |
||
7 | * |
||
8 | * Revision 1.18 2002/09/27 22:32:07 MJAMES |
||
9 | * Added comments to make pin renames easier to find again |
||
10 | * |
||
11 | * Revision 1.17 2002/09/09 10:11:01 mjames |
||
12 | * Moved pin remapping function to pin ident editing function from |
||
13 | * sorting pin name routine. |
||
14 | * |
||
15 | * Revision 1.16 2002/08/06 12:52:33 mjames |
||
16 | * Merge in from latest version |
||
17 | * |
||
18 | * Revision 1.18 2002/08/06 08:51:49 mjames |
||
19 | * Removed mention of Altera from banner printed at top of files. |
||
20 | * |
||
21 | * Revision 1.17 2002/04/10 14:29:10 mjames |
||
22 | * Moved setting debug level to cmdutil.c |
||
23 | * |
||
24 | * Amended print external command to list all net names on socket pins |
||
25 | * whether routed or not. |
||
26 | * |
||
27 | * Revision 1.16 2002/03/08 11:49:00 mjames |
||
28 | * Corrected an error involving accessing strings via a null pointer when printing |
||
29 | * a list of sockets. |
||
30 | * |
||
31 | * Revision 1.15 2002/01/03 16:36:10 mjames |
||
32 | * Method of accessing Vertical version changed to avoid |
||
33 | * global variable |
||
34 | * |
||
35 | * Revision 1.14 2001/12/13 22:15:38 mjames |
||
36 | * Using #ident with header to identify file |
||
37 | * |
||
38 | * Revision 1.13 2001/11/30 22:16:14 mjames |
||
39 | * Printout of aliased templates has been corrected as the target alias |
||
40 | * type was not being printed. |
||
41 | * |
||
42 | * Revision 1.12 2001/11/01 11:02:55 mjames |
||
43 | * Removed unused variables. |
||
44 | * Allowed acf files to print device pinouts : this had failed because |
||
45 | * a && b was written where a & b was meant ! |
||
46 | * |
||
47 | * Revision 1.11 2001/10/31 22:20:14 mjames |
||
48 | * Tidying up problematical comments caused by CVS |
||
49 | * 'intelligent' comment guessing |
||
50 | * |
||
51 | * Revision 1.10 2001/10/22 10:55:18 mjames |
||
52 | * Gives pin index min/max row/col as comments in component declarations |
||
53 | * |
||
54 | * Revision 1.9 2001/10/11 16:10:17 mjames |
||
55 | * Corrections to the SWAP command, and printout so that |
||
56 | * WRITE net now outputs all chips in the design so that their generics |
||
57 | * can be passed forward to the next phase. |
||
58 | * |
||
59 | * Revision 1.8 2001/10/10 20:18:22 mjames |
||
60 | * Added a vert_regcomp function to compile regular expressions |
||
61 | * with '^' (match start string) and '$' (match end string) bracketing |
||
62 | * this => wildcard must match entire string not just a part of it. |
||
63 | * |
||
64 | * Revision 1.7 2001/08/31 09:38:43 mjames |
||
65 | * Added a comment about the printing of equivalent pins being enabled by a flag |
||
66 | * |
||
67 | * Revision 1.6 2001/07/09 15:38:29 mjames |
||
68 | * Placed the version string in an independent file to save time on building |
||
69 | * all of the variants of Vertical |
||
70 | * |
||
71 | * Revision 1.5 2001/07/09 10:05:27 mjames |
||
72 | * Placed the version string in an independent file to save time on building |
||
73 | * all of the variants of Vertical |
||
74 | * |
||
75 | * Revision 1.4 2001/06/06 12:10:18 mjames |
||
76 | * Move from HPUX |
||
77 | * |
||
78 | * Revision 1.3 2000/11/29 21:51:19 mjames |
||
79 | * Fine tuning of software |
||
80 | * |
||
81 | * Revision 1.2 2000/10/21 20:41:29 mjames |
||
11 | mjames | 82 | * Added the 'write flatten' command that only lists the wires |
2 | mjames | 83 | * created by making jumpered connections rather than listing |
84 | * the jumpers themselves |
||
85 | * |
||
86 | * Revision 1.1.1.1 2000/10/19 21:58:39 mjames |
||
87 | * Mike put it here |
||
88 | * |
||
89 | * |
||
90 | * Revision 1.68 2000/10/04 10:37:08 10:37:08 mjames (Mike James) |
||
91 | * Modified for Vertical2 : support COMPONENTS and SIGNALS |
||
11 | mjames | 92 | * |
2 | mjames | 93 | * Revision 1.68 2000/10/04 10:37:08 10:37:08 mjames (Mike James) |
94 | * Part of Release PSAVAT01 |
||
11 | mjames | 95 | * |
2 | mjames | 96 | * Revision 1.67 2000/10/02 11:04:18 11:04:18 mjames (Mike James) |
97 | * new_vhdl |
||
11 | mjames | 98 | * |
2 | mjames | 99 | * Revision 1.66 2000/09/27 14:42:19 14:42:19 mjames (Mike James) |
100 | * Part of Release Sep_27_ST_2000 |
||
11 | mjames | 101 | * |
2 | mjames | 102 | * Revision 1.65 2000/09/27 14:27:57 14:27:57 mjames (Mike James) |
103 | * Made list renamed pins refer to device identifier. |
||
11 | mjames | 104 | * |
2 | mjames | 105 | * Revision 1.64 2000/09/27 10:58:07 10:58:07 mjames (Mike James) |
106 | * Started using g_class member of generic structure to control |
||
107 | * printing. |
||
108 | * ,. |
||
11 | mjames | 109 | * |
2 | mjames | 110 | * Revision 1.63 2000/09/21 10:15:49 10:15:49 mjames (Mike James) |
111 | * Part of Release Sep21Alpha |
||
11 | mjames | 112 | * |
2 | mjames | 113 | * Revision 1.62 2000/09/21 09:47:19 09:47:19 mjames (Mike James) |
114 | * Added code to deal with pin equivalents |
||
11 | mjames | 115 | * |
2 | mjames | 116 | * Revision 1.61 2000/08/25 09:57:15 09:57:15 mjames (Mike James) |
117 | * Part of Release Aug25_alpha |
||
11 | mjames | 118 | * |
2 | mjames | 119 | * Revision 1.60 2000/08/16 08:57:31 08:57:31 mjames (Mike James) |
120 | * Part of Release CD01_Aug2000 |
||
11 | mjames | 121 | * |
2 | mjames | 122 | * Revision 1.59 2000/08/14 14:45:12 14:45:12 mjames (Mike James) |
123 | * Part of Release Aug_14_2000 |
||
11 | mjames | 124 | * |
2 | mjames | 125 | * Revision 1.58 2000/08/14 14:43:29 14:43:29 mjames (Mike James) |
126 | * Added power pins |
||
11 | mjames | 127 | * |
2 | mjames | 128 | * Revision 1.57 2000/08/11 08:30:32 08:30:32 mjames (Mike James) |
129 | * Part of Release Aug_11_2000 |
||
11 | mjames | 130 | * |
2 | mjames | 131 | * Revision 1.56 2000/08/09 10:31:47 10:31:47 mjames (Mike James) |
132 | * Part of Release Aug__9_2000 |
||
11 | mjames | 133 | * |
2 | mjames | 134 | * Revision 1.55 2000/05/31 11:42:57 11:42:57 mjames (Mike James) |
135 | * Part of Release May_31_2000 |
||
11 | mjames | 136 | * |
2 | mjames | 137 | * Revision 1.54 2000/05/08 17:01:38 17:01:38 mjames (Mike James) |
138 | * Part of Release May__8_2000 |
||
11 | mjames | 139 | * |
2 | mjames | 140 | * Revision 1.53 2000/05/08 16:59:31 16:59:31 mjames (Mike James) |
141 | * Part of Release May__8_2000 |
||
11 | mjames | 142 | * |
2 | mjames | 143 | * Revision 1.52 2000/05/08 16:57:08 16:57:08 mjames (Mike James) |
144 | * Part of Release May__8_2000 |
||
11 | mjames | 145 | * |
2 | mjames | 146 | * Revision 1.51 2000/03/08 16:19:24 16:19:24 mjames (Mike James) |
147 | * New version including PC |
||
11 | mjames | 148 | * |
2 | mjames | 149 | * Revision 1.48 2000/02/18 15:45:44 15:45:44 mjames (Mike James) |
11 | mjames | 150 | * Amended to support PC |
151 | * |
||
2 | mjames | 152 | * Revision 1.47 2000/01/20 15:58:48 15:58:48 mjames (Mike James) |
153 | * Part of Release R22 |
||
11 | mjames | 154 | * |
2 | mjames | 155 | * Revision 1.46 99/12/22 11:15:28 11:15:28 mjames (Mike James) |
156 | * Part of Release Dec_22_1999 |
||
11 | mjames | 157 | * |
2 | mjames | 158 | * Revision 1.45 99/11/23 13:53:12 13:53:12 mjames (Mike James) |
11 | mjames | 159 | * Addedd Verilog support and removed VHDL functions to a separate |
2 | mjames | 160 | * file |
11 | mjames | 161 | * |
2 | mjames | 162 | * Revision 1.40 98/11/27 15:15:48 15:15:48 mjames (Mike James) |
163 | * Altered listing of jumpers |
||
11 | mjames | 164 | * |
2 | mjames | 165 | * Revision 1.39 98/11/16 13:18:36 13:18:36 mjames (Mike James) |
11 | mjames | 166 | * |
2 | mjames | 167 | * Revision 1.38 98/08/12 14:21:57 14:21:57 mjames (Mike James) |
168 | * COrrected VHDL printout |
||
11 | mjames | 169 | * |
2 | mjames | 170 | * Revision 1.37 98/07/14 13:25:38 13:25:38 mjames (Mike James) |
171 | * Altered device printout to meet new requirements |
||
11 | mjames | 172 | * |
2 | mjames | 173 | * Revision 1.36 98/06/15 14:19:01 14:19:01 mjames (Mike James) |
174 | * Added template printout functionality |
||
11 | mjames | 175 | * |
2 | mjames | 176 | * Revision 1.35 98/04/24 13:49:16 13:49:16 mjames (Mike James) |
11 | mjames | 177 | * Avoid priting 'generics' for chips without them |
178 | * |
||
2 | mjames | 179 | * Revision 1.34 98/03/16 11:37:55 11:37:55 mjames (Mike James) |
180 | * Added generics to printout listings |
||
11 | mjames | 181 | * |
2 | mjames | 182 | * Revision 1.33 98/02/11 11:27:01 11:27:01 mjames (Mike James) |
183 | * Checked in for version 6.2a |
||
11 | mjames | 184 | * |
2 | mjames | 185 | * Revision 1.32 98/01/13 11:33:41 11:33:41 mjames (Mike James) |
186 | * Added the bility to use a VHDL template file |
||
187 | * containing $ENT$ and $ARCH$ in the position where one |
||
188 | * wants the entity and architecture to be given. |
||
11 | mjames | 189 | * |
2 | mjames | 190 | * Revision 1.31 97/04/23 08:43:21 08:43:21 mjames (Mike James) |
191 | * CHecked in for release rel23041997 |
||
11 | mjames | 192 | * |
2 | mjames | 193 | * Revision 1.30 96/12/23 15:19:14 15:19:14 mjames (Mike James) |
194 | * Altered headline for UMA email address |
||
11 | mjames | 195 | * |
2 | mjames | 196 | * Revision 1.29 96/12/23 15:12:52 15:12:52 mjames (Mike James) |
197 | * Fixing printout routines to work with templates |
||
198 | * (somewhat unecessary as they are on a different linked list |
||
199 | * to the sockets which was causing problems until I saw |
||
200 | * the mistake. |
||
11 | mjames | 201 | * |
2 | mjames | 202 | * Revision 1.28 96/12/23 10:23:33 10:23:33 mjames (Mike James) |
203 | * Altered to make it sort the results |
||
204 | * of listing COMPONENTS and CHIP pins. |
||
205 | * / |
||
11 | mjames | 206 | * |
2 | mjames | 207 | * Revision 1.27 96/12/13 08:43:06 08:43:06 mjames (Mike James) |
208 | * Update to v5.1, added Write ID , exact routing |
||
11 | mjames | 209 | * |
2 | mjames | 210 | * Revision 1.26 96/08/06 13:37:05 13:37:05 mjames (Mike James) |
211 | * Added FIX_LOCATION pin attribute to netlist |
||
212 | * |
||
213 | * Revision 1.25 96/07/19 14:38:39 14:38:39 mjames (Mike James) |
||
214 | * Update to give to PRL |
||
215 | * |
||
216 | * Revision 1.24 1996/07/12 15:52:12 mjames |
||
217 | * Sorted out things like Alias and Jumpers |
||
218 | * Work Correctly |
||
219 | * Print COrrectly |
||
220 | * |
||
221 | * Revision 1.23 96/07/09 15:53:39 15:53:39 mjames (Mike James) |
||
222 | * Altered aliasing to make it hierarchical, also for jumpering |
||
223 | * |
||
224 | * Revision 1.22 96/06/17 11:02:24 11:02:24 mjames (Mike James) |
||
225 | * Altered the printing of JUMPERED and ALIASED nets |
||
226 | * , |
||
227 | * |
||
228 | * Revision 1.21 96/06/11 14:16:48 14:16:48 mjames (Mike James) |
||
229 | * Removed a spurios printf. |
||
230 | * |
||
231 | * Revision 1.20 96/06/11 14:11:22 14:11:22 mjames (Mike James) |
||
232 | * Added hierarchical jumpering |
||
233 | * |
||
234 | * Revision 1.19 96/06/10 13:26:00 13:26:00 mjames (Mike James) |
||
235 | * Checkin before altering joined/subnet behaviour |
||
236 | * |
||
237 | * Revision 1.18 96/06/04 11:53:11 11:53:11 mjames (Mike James) |
||
238 | * Added the ability to jumper nets by reference to a node on the nets |
||
239 | * |
||
240 | * Revision 1.17 96/05/21 14:13:53 14:13:53 mjames (Mike James) |
||
241 | * Altered printout decode_pin[] array as I have fixed buffer_pins |
||
242 | * so that they are beginning to work. |
||
243 | * |
||
244 | * Revision 1.16 96/04/26 16:02:23 16:02:23 mjames (Mike James) |
||
245 | * Altered inside/outside determination of signal directions |
||
246 | * |
||
247 | * Revision 1.15 96/04/15 14:19:33 14:19:33 mjames (Mike James) |
||
248 | * Checkin before datatype printing |
||
249 | * modifications |
||
250 | * |
||
251 | * Revision 1.14 96/03/29 14:46:30 14:46:30 mjames (Mike James) |
||
252 | * Added VHDL netlist writing to the capabilities of ACFREAD |
||
253 | * |
||
254 | * Revision 1.12 96/03/19 08:51:43 08:51:43 mjames (Mike James) |
||
255 | * Corrected bug with zero length nets crashing WRITE PCB |
||
256 | * |
||
257 | * Revision 1.8 96/03/13 15:36:10 15:36:10 mjames (Mike James) |
||
258 | * Altered the how_routed field to be used to indicate the routing algorithm used |
||
259 | * to route this net. |
||
260 | * |
||
261 | * Revision 1.7 96/02/13 09:13:27 09:13:27 mjames (Mike James) |
||
262 | * Updated to be version 2.0 with net joining |
||
263 | * |
||
264 | * Revision 1.6 96/02/09 10:50:21 10:50:21 mjames (Mike James) |
||
265 | * Added different behaviour for 'write id' and 'write name' |
||
266 | * 'write id' now writes all pins including unused ones |
||
267 | * 'write name' only writes used pins in the ACF file |
||
268 | * |
||
269 | * Revision 1.5 96/02/08 15:28:28 15:28:28 mjames (Mike James) |
||
270 | * First release |
||
271 | * |
||
272 | * Revision 1.4 96/02/07 16:01:32 16:01:32 mjames (Mike James) |
||
273 | * Added correct RCS header |
||
274 | * |
||
275 | * Revision 1.3 96/02/07 15:50:42 15:50:42 mjames (Mike James) |
||
276 | * Added RCS ident message |
||
277 | * |
||
278 | * Revision 1.2 96/02/07 11:04:19 11:04:19 mjames (Mike James) |
||
279 | * Checkin before adding new command parsing to program |
||
280 | * |
||
281 | * Revision 1.1 96/01/10 13:13:51 13:13:51 mjames (Mike James) |
||
282 | * Initial revision |
||
283 | * |
||
11 | mjames | 284 | */ |
285 | #include <stdio.h> |
||
286 | #include <string.h> |
||
287 | #include <stdlib.h> |
||
288 | #include <ctype.h> |
||
289 | #include <time.h> |
||
290 | #include <regex.h> |
||
2 | mjames | 291 | |
11 | mjames | 292 | #include "vertcl_main.h" |
2 | mjames | 293 | #include "expression.h" |
294 | #include "generic.h" |
||
11 | mjames | 295 | #include "database.h" |
296 | #include "printout.h" |
||
2 | mjames | 297 | #include "print_vhdl.h" |
298 | #include "print_vlog.h" |
||
299 | #include "sorting.h" |
||
11 | mjames | 300 | #include "cmdparse.h" |
301 | #include "cmdlog.h" |
||
302 | #include "equivalent.h" |
||
2 | mjames | 303 | #include "version.h" |
304 | |||
11 | mjames | 305 | #ident "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/printout.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $" |
2 | mjames | 306 | |
307 | /* decoding pin direction in ACF form */ |
||
308 | /* see pindir_t in database.h */ |
||
11 | mjames | 309 | static char * decode_pin[]= |
310 | { |
||
311 | "NONE", |
||
312 | "INPUT_PIN", |
||
313 | "OUTPUT_PIN", |
||
314 | "output_pin", /* buffer is a sort of Output pin (lower case is for info only )*/ |
||
315 | "BIDIR_PIN ", |
||
316 | "CONFIG_PIN", |
||
317 | "POWER_PIN"}; |
||
2 | mjames | 318 | |
11 | mjames | 319 | |
2 | mjames | 320 | /* returns a valid pointer to a null string */ |
11 | mjames | 321 | char * check_null_str(char * s ) |
322 | { /* using shortcircuit evaluation rules here */ |
||
323 | if(!s || s[0]==0 || strcmp(s,nullstr)==0) |
||
324 | return (nullstr); |
||
325 | else |
||
326 | return(s); |
||
2 | mjames | 327 | } |
328 | |||
11 | mjames | 329 | |
330 | |||
331 | |||
2 | mjames | 332 | /* ********************************************************************** */ |
333 | |||
334 | /* this prints out the contents of the working database */ |
||
335 | /* prints a single net as a connection */ |
||
336 | /* subnets are printed as having the how_routed field of their |
||
337 | parent, because this is the how_routed value that is indicated |
||
338 | by the routing */ |
||
339 | |||
11 | mjames | 340 | void list_net_nodes(FILE * f,net_t * cnet,net_t * root_net) |
2 | mjames | 341 | { |
11 | mjames | 342 | noderef_t * bnode; |
343 | node_t * cnode; |
||
344 | int wrapc ; |
||
345 | if(!cnet) |
||
346 | return; |
||
347 | fprintf(f," CONNECTION \"%s\" \"%s\" %s; -- %d nodes\n ", |
||
348 | cnet->identifier, |
||
349 | check_null_str(root_net->name), |
||
350 | decode_how_routed[root_net->how_routed], |
||
351 | cnet->nodecount); |
||
352 | fprintf(f,"-- partition port=%d in=%d need_buff=%d\n", |
||
2 | mjames | 353 | cnet->leaves_partition, |
354 | cnet->inside_partition, |
||
355 | cnet->needs_buff_sig); |
||
11 | mjames | 356 | if (cnet->vhdltype) { |
357 | fprintf(f,"-- vhdl '"); |
||
358 | print_range_expression(f,cnet->vhdltype->expr,NO_RECURSE); |
||
359 | fprintf(f,"'\n"); |
||
360 | } |
||
361 | if (cnet->type_defined) |
||
362 | fprintf(f,"-- net type defined\n"); |
||
363 | bnode = cnet->nodes; |
||
364 | wrapc = 0; |
||
365 | while(bnode) { |
||
366 | cnode=bnode->node; |
||
367 | fprintf(f," %s(%s)",cnode->socket->identifier,cnode->identifier); |
||
368 | /* printout if any lines have fix_location flags set */ |
||
369 | if(cnode->fix_location) { |
||
370 | wrapc+=2; /* cant get as much on this line */ |
||
371 | fprintf(f," FIX_LOCATION"); |
||
372 | } |
||
373 | if(cnode->fixed_pin) { |
||
374 | wrapc+=2; /* cant get as much on this line */ |
||
375 | fprintf(f," %s",decode_pin[cnode->pindir]); |
||
376 | } |
||
377 | if(cnode->pin_group) { |
||
378 | wrapc+=2; /* cant get as much on this line */ |
||
379 | fprintf(f," (%d)",cnode->pin_group); |
||
380 | } |
||
381 | fprintf(f,";"); |
||
2 | mjames | 382 | |
11 | mjames | 383 | wrapc++; |
384 | if (wrapc>=8) |
||
385 | { |
||
386 | wrapc=0; |
||
387 | fprintf(f,"\n "); |
||
388 | } |
||
389 | bnode = bnode->next; |
||
390 | }; |
||
391 | if(wrapc) |
||
392 | fprintf(f,"\n "); |
||
393 | fprintf(f,"END_CONN;\n"); |
||
2 | mjames | 394 | } |
395 | |||
396 | /* ********************************************************************** */ |
||
11 | mjames | 397 | void list_net_structure(FILE * f, net_t * cnet,net_t * root_net,int alias_depth,int flatten_jumpers) |
2 | mjames | 398 | { |
11 | mjames | 399 | net_t * subnet; |
400 | subnet = cnet->subnets; |
||
401 | if(cnet==root_net) |
||
402 | fprintf(f,"--Top Level\n"); |
||
403 | if ( cnet->how_joined == Jumpered && subnet) { |
||
404 | fprintf(f,"-- Jumpered Connections to '%s' name '%s' found here --\n", |
||
405 | cnet->identifier,cnet->name); |
||
406 | if (flatten_jumpers == FLATTEN_JUMPERS) |
||
407 | list_net_nodes(f,cnet,root_net); |
||
2 | mjames | 408 | |
11 | mjames | 409 | else while(subnet) { |
410 | list_net_structure(f, subnet, root_net,0,flatten_jumpers); /* depth = 0, not aliased */ |
||
411 | subnet = subnet->joined_nets; |
||
412 | } |
||
413 | fprintf(f,"--\n"); |
||
414 | } |
||
415 | else if ( cnet->how_joined == Aliased && subnet) { |
||
416 | fprintf(f,"-- Net nodes of aliased list here \n"); |
||
417 | list_net_nodes(f,cnet,root_net); |
||
418 | fprintf(f,"-- %*s '%s' (name %s) created by Alias of --\n", |
||
419 | alias_depth,"",cnet->identifier,cnet->name); |
||
420 | while(subnet){ |
||
421 | fprintf(f,"-- %*s '%s' -- \n",alias_depth,"",subnet->identifier); |
||
422 | list_net_structure(f,subnet,root_net,alias_depth+1,flatten_jumpers); |
||
423 | subnet = subnet->joined_nets; |
||
424 | } |
||
425 | fprintf(f,"--\n"); |
||
426 | } |
||
427 | else if(alias_depth == 0) |
||
428 | list_net_nodes(f,cnet,root_net); |
||
429 | |||
2 | mjames | 430 | } |
431 | |||
11 | mjames | 432 | |
2 | mjames | 433 | /* ********************************************************************** */ |
434 | /* lists all the connections on the board */ |
||
11 | mjames | 435 | void list_nets(FILE * f,net_t * cnet,int flatten_jumpers) |
2 | mjames | 436 | { |
11 | mjames | 437 | while(cnet) { |
438 | list_net_structure(f,cnet,cnet,0,flatten_jumpers); |
||
439 | cnet = cnet->next; |
||
440 | } |
||
2 | mjames | 441 | } |
442 | |||
11 | mjames | 443 | |
2 | mjames | 444 | /* ********************************************************************** */ |
445 | |||
11 | mjames | 446 | static void list_join(FILE * f, char * typ, net_t * cnet) |
2 | mjames | 447 | { |
11 | mjames | 448 | int wrapc = 1; |
449 | /* printf("List join %s , cnet = %p, join_parent = %p , join_parent->id =%p\n", |
||
450 | typ,cnet,cnet->join_parent,cnet->join_parent->identifier); */ |
||
451 | fprintf(f," %s %s = (",typ,cnet->join_parent->identifier); |
||
452 | while(cnet) { |
||
453 | if(cnet->external_node) |
||
454 | fprintf(f,"%s(%s); ", |
||
455 | cnet->external_node->socket->identifier, |
||
456 | cnet->external_node->identifier); |
||
457 | else |
||
458 | fprintf(f,"%s; ",cnet->identifier); |
||
459 | wrapc++; |
||
460 | if (wrapc==8) { |
||
461 | wrapc=0; |
||
462 | fprintf(f,"\n "); |
||
463 | } |
||
464 | cnet = cnet->joined_nets; |
||
465 | } |
||
466 | fprintf(f,");"); |
||
2 | mjames | 467 | } |
468 | |||
11 | mjames | 469 | |
2 | mjames | 470 | /* ********************************************************************** */ |
471 | /* we are now one level down so it must be a join of some sort |
||
472 | therefore join_parent is now valid */ |
||
11 | mjames | 473 | static void list_subnets(FILE * f,net_t * cnet,JoinMode_t join) |
2 | mjames | 474 | { |
11 | mjames | 475 | net_t * tnet = cnet; |
476 | char * nettype; |
||
477 | net_t * topname ; |
||
2 | mjames | 478 | |
11 | mjames | 479 | while(tnet) { |
480 | if(tnet->subnets) |
||
481 | list_subnets(f,tnet->subnets,join); |
||
482 | tnet = tnet->joined_nets; |
||
483 | } |
||
2 | mjames | 484 | |
11 | mjames | 485 | /* if we are interested in aliases, print these */ |
486 | /* Or if we are interested in joins print these */ |
||
2 | mjames | 487 | |
11 | mjames | 488 | /* printf("id %s join_parent %p howjoin %d\n", |
489 | cnet->identifier,cnet->join_parent,cnet->how_joined); */ |
||
2 | mjames | 490 | |
11 | mjames | 491 | if (cnet->join_parent->how_joined == join) { |
492 | switch(join) |
||
493 | { |
||
494 | case Aliased : nettype = "ALIAS"; break; |
||
495 | case Jumpered : nettype = "JUMPER";break; |
||
496 | default : nettype = "??";break; |
||
497 | }; |
||
498 | list_join( f, nettype, cnet); |
||
499 | |||
500 | topname = cnet; |
||
501 | /* ascend jumper hierarchy to get the real name */ |
||
502 | while ( topname->join_parent && ISNULLSTR(topname->name)) |
||
503 | topname = topname->join_parent; |
||
504 | |||
505 | |||
506 | if (join != Aliased && !ISNULLSTR(topname->name) ) |
||
507 | fprintf(f," -- signal '%s' \n",topname->name); |
||
508 | else |
||
509 | fprintf(f,"\n"); |
||
510 | }; |
||
2 | mjames | 511 | } |
512 | /* ********************************************************************** */ |
||
513 | |||
514 | /* this lists all joined nets. it is recursive. Any subnets will be explored |
||
515 | before printing out the joins for this net if any are presaent */ |
||
516 | |||
11 | mjames | 517 | static void list_joined_nets(FILE * f,net_t * cnet) |
2 | mjames | 518 | { |
519 | |||
11 | mjames | 520 | if(!cnet) |
521 | return; |
||
522 | |||
523 | |||
524 | while(cnet) { |
||
525 | /* if there are any subnets here, do the recursion on them */ |
||
526 | /* printf("cnet = %p, subnets= %p \n",cnet,cnet->subnets); */ |
||
527 | if(cnet->subnets) |
||
528 | { |
||
529 | list_subnets(f,cnet->subnets,Jumpered); |
||
530 | } |
||
531 | if(cnet->vhdl_connect_net) |
||
532 | { |
||
533 | fprintf(f," VHDL_CONN %s <= %s;\n",cnet->name,cnet->vhdl_connect_net->name); |
||
534 | } |
||
535 | cnet = cnet->next; |
||
536 | } |
||
537 | |||
2 | mjames | 538 | } |
539 | |||
540 | /************************************************************************/ |
||
541 | |||
11 | mjames | 542 | static void list_routed_aliased_nets(FILE * f,net_t * cnet) |
2 | mjames | 543 | { |
544 | |||
11 | mjames | 545 | if(!cnet) |
546 | return; |
||
547 | |||
548 | |||
549 | while(cnet) { |
||
550 | net_t * unrouted = cnet->unrouted_reference; |
||
551 | /* if there are any subnets here, do the recursion on them */ |
||
552 | /* this will find out aliases if they exist */ |
||
553 | if(unrouted && unrouted->subnets ) |
||
554 | list_subnets(f,unrouted->subnets,Aliased); |
||
555 | cnet = cnet->next; |
||
556 | } |
||
557 | |||
2 | mjames | 558 | } |
559 | |||
560 | /************************************************************************/ |
||
561 | |||
11 | mjames | 562 | static void list_aliased_nets(FILE * f,net_t * cnet) |
2 | mjames | 563 | { |
564 | |||
11 | mjames | 565 | if(!cnet) |
566 | return; |
||
2 | mjames | 567 | |
11 | mjames | 568 | |
569 | while(cnet) { |
||
570 | /* if there are any subnets here, do the recursion on them */ |
||
571 | /* printf("cnet = %p, subnets= %p \n",cnet,cnet->subnets); */ |
||
572 | if(cnet->subnets) |
||
573 | list_subnets(f,cnet->subnets,Aliased); |
||
574 | |||
575 | cnet = cnet->next; |
||
576 | } |
||
577 | |||
2 | mjames | 578 | } |
579 | |||
580 | /************************************************************************/ |
||
11 | mjames | 581 | void list_components(FILE * f) |
2 | mjames | 582 | { |
11 | mjames | 583 | socket_t * cskt = sort_sockets(&socket_head); |
584 | fprintf(f,"COMPONENTS\nBEGIN\n"); |
||
585 | while(cskt) { |
||
586 | if(cskt->is_template) |
||
587 | fprintf(f,"-- %s : Socket Template\n", |
||
588 | cskt->type); |
||
589 | else |
||
590 | fprintf(f," %s : \"%s\" \"%s\" \"%s\"; -- %s\n", |
||
591 | cskt->identifier, |
||
592 | check_null_str(cskt->name), |
||
593 | check_null_str(cskt->type), |
||
594 | check_null_str(cskt->value), |
||
595 | cskt->is_external ? "External" : "Internal"); |
||
596 | cskt = cskt->next; |
||
597 | }; |
||
598 | fprintf(f,"END;\n\n"); |
||
2 | mjames | 599 | } |
600 | |||
601 | /***********************************************************************************/ |
||
602 | /* only list device info for those sockets which have "external" flags set */ |
||
11 | mjames | 603 | /* |
604 | This is intended to provide Vertical write extern |
||
2 | mjames | 605 | with an explicit tie-up between the socket ID |
11 | mjames | 606 | e.g. U1 and a device name in the socket e.g. BusChip or whatever. In fact in this |
2 | mjames | 607 | context the contents of socket U1 will be known as device name U1. |
608 | |||
609 | Without this info, the tool cannot locate sockets by name using the chip identifier |
||
610 | as ACF files do not contain the chip identifier, only the chip name. |
||
11 | mjames | 611 | */ |
2 | mjames | 612 | |
11 | mjames | 613 | void list_extern_sockets(FILE * f) |
2 | mjames | 614 | { |
11 | mjames | 615 | socket_t * cskt = sort_sockets(&socket_head); |
616 | char * name; |
||
617 | fprintf(f,"COMPONENTS\nBEGIN\n"); |
||
618 | while(cskt) { |
||
619 | if(cskt->is_external) |
||
620 | { |
||
621 | /* force the device to have an identifier if it does not have one */ |
||
622 | name = cskt->name; |
||
623 | if (ISNULLSTR(name)) |
||
624 | name = cskt->identifier; |
||
625 | |||
626 | fprintf(f," %s : \"%s\" \"%s\" \"%s\";\n", |
||
627 | cskt->identifier, |
||
628 | name, |
||
629 | check_null_str(cskt->type), |
||
630 | check_null_str(cskt->value)); |
||
631 | } |
||
632 | cskt = cskt->next; |
||
633 | }; |
||
634 | fprintf(f,"END;\n\n"); |
||
2 | mjames | 635 | } |
636 | |||
11 | mjames | 637 | |
638 | |||
2 | mjames | 639 | /************************************************************************/ |
11 | mjames | 640 | void list_database(FILE * f,int flatten_jumpers) |
2 | mjames | 641 | { |
11 | mjames | 642 | list_components(f); |
2 | mjames | 643 | |
11 | mjames | 644 | fprintf(f,"WIRED_NETS\nBEGIN\n"); |
645 | fprintf(f,"-- Routed & Named nets follow --\n\nNAMED\n\n"); |
||
646 | list_nets(f,named_list,flatten_jumpers); |
||
647 | fprintf(f,"-- Routed & unused nets follow --\n\nROUTED\n\n"); |
||
648 | list_nets(f,routed_list,flatten_jumpers); |
||
649 | fprintf(f,"-- Unrouted nets follow --\n\nUNROUTED\n\n"); |
||
650 | list_nets(f,unrouted_list,flatten_jumpers); |
||
651 | fprintf(f,"END;\n\n"); |
||
652 | |||
2 | mjames | 653 | } |
654 | /************************************************************************/ |
||
11 | mjames | 655 | void list_jumper(FILE * f) |
2 | mjames | 656 | { |
11 | mjames | 657 | fprintf(f,"-- Jumper list here --\n"); |
658 | fprintf(f,"JOINED_NETS\nBEGIN\n"); |
||
2 | mjames | 659 | |
11 | mjames | 660 | fprintf(f,"-- named list\n"); |
661 | list_joined_nets(f,named_list); |
||
662 | fprintf(f,"-- routed list\n"); |
||
663 | list_joined_nets(f,routed_list); |
||
664 | fprintf(f,"END;\n\n"); |
||
2 | mjames | 665 | } |
666 | |||
667 | /************************************************************************/ |
||
11 | mjames | 668 | void list_alias(FILE * f) |
2 | mjames | 669 | { |
11 | mjames | 670 | fprintf(f,"-- Alias list here --\n"); |
671 | fprintf(f,"JOINED_NETS\nBEGIN\n"); |
||
672 | fprintf(f,"-- named list\n"); |
||
673 | list_routed_aliased_nets(f,named_list); |
||
674 | fprintf(f,"-- routed list\n"); |
||
675 | list_routed_aliased_nets(f,routed_list); |
||
676 | fprintf(f,"-- unrouted list\n"); |
||
677 | list_aliased_nets(f,unrouted_list); |
||
678 | fprintf(f,"END;\n\n"); |
||
2 | mjames | 679 | } |
680 | |||
11 | mjames | 681 | |
2 | mjames | 682 | /************************************************************************/ |
11 | mjames | 683 | void list_joined(FILE * f) |
2 | mjames | 684 | { |
11 | mjames | 685 | /* and now the joined nets */ |
2 | mjames | 686 | |
11 | mjames | 687 | fprintf(f,"JOINED_NETS\nBEGIN\n"); |
2 | mjames | 688 | |
11 | mjames | 689 | fprintf(f,"-- Jumper list here --\n"); |
690 | list_joined_nets(f,named_list); |
||
691 | list_joined_nets(f,routed_list); |
||
692 | fprintf(f,"-- Alias list here --\n"); |
||
693 | list_routed_aliased_nets(f,named_list); |
||
694 | list_routed_aliased_nets(f,routed_list); |
||
695 | list_aliased_nets(f,unrouted_list); |
||
696 | fprintf(f,"END;\n\n"); |
||
697 | |||
2 | mjames | 698 | } |
699 | |||
700 | /* ********************************************************************** */ |
||
701 | /* if options & PRINT_ALL then print all known pins on the device */ |
||
702 | /* if options & PRINT_TYPE then print the VHDL data type of this pin */ |
||
703 | /* if options & PRINT_GENERIC then print out the device's generic map here also */ |
||
704 | /* if options & PRINT_EXPAND_BUS then expand out the VHDL bus to individual wires */ |
||
705 | /* if options & PRINT_GROUP then print out the pin groups */ |
||
706 | /* if options & PRINT_ROUTE_FLAGS then print out the routing flags */ |
||
707 | /* if options & PRINT_AS_UNROUTED then printout "UNROUTED" instead of any pindir info */ |
||
708 | /* if options & PRINT_EQUIVALENT_PINS then print the list of pin equivalents */ |
||
11 | mjames | 709 | void print_device(FILE * f,socket_t * dev, int options) |
2 | mjames | 710 | { |
11 | mjames | 711 | node_t * n; |
712 | char * vhdl_bus_format; |
||
2 | mjames | 713 | |
714 | |||
11 | mjames | 715 | generic_info_t gen[1]; |
716 | |||
717 | /* sort all the nodes into alphabetical order */ |
||
718 | sort_nodes(dev,NO_EXTRACT_XY); |
||
2 | mjames | 719 | |
11 | mjames | 720 | /* if we are using VHDL then look at the VHDL bus formatting tail*/ |
721 | if ((options & PRINT_EXPAND_BUS) && |
||
722 | get_generic_value(&global_generics, "vhdl_bus_format",gen) == IS_ENV_VAL && gen->expr) |
||
723 | vhdl_bus_format = gen->expr->left.s; |
||
724 | else |
||
725 | vhdl_bus_format = "_%d_"; /* persuade GCC the string pointer is modifiable */ |
||
726 | |||
2 | mjames | 727 | |
728 | |||
11 | mjames | 729 | /* if it hasnt got a name, use its identifier */ |
730 | |||
731 | if(!dev->is_template) { |
||
732 | if(dev->name != NULL && dev->name[0]) |
||
733 | fprintf(f,"CHIP %s\n",check_null_str(dev->name)); |
||
734 | else |
||
735 | fprintf(f,"CHIP %s\n",dev->identifier); |
||
2 | mjames | 736 | |
11 | mjames | 737 | fprintf(f,"BEGIN\n DEVICE = \"%s\";\n",check_null_str(dev->type)); |
738 | if(options & PRINT_ROUTE_FLAGS && dev->route_flags) |
||
739 | fprintf(f," ROUTE_FLAGS = %d;\n",dev->route_flags); |
||
2 | mjames | 740 | |
11 | mjames | 741 | if(dev->is_external) |
742 | fprintf(f,"-- External Connection\n\n"); |
||
743 | else |
||
744 | fprintf(f,"-- Internal Socket\n\n"); |
||
2 | mjames | 745 | |
746 | |||
11 | mjames | 747 | fprintf(f,"-- DEV_IDENT \"%s\"\n",dev->identifier); |
748 | if(dev->highest_bundle) |
||
749 | { |
||
750 | fprintf(f,"-- Bundle of %d pins\n",dev->highest_bundle); |
||
751 | fprintf(f,"-- min_pin_row %d\n",dev->min_pin_row ); |
||
752 | fprintf(f,"-- max_pin_row %d\n",dev->max_pin_row ); |
||
753 | fprintf(f,"-- min_pin_col %d\n",dev->min_pin_col ); |
||
754 | fprintf(f,"-- max_pin_col %d\n",dev->max_pin_col ); |
||
755 | } |
||
2 | mjames | 756 | |
757 | |||
758 | |||
11 | mjames | 759 | } |
760 | else { |
||
761 | fprintf(f,"TEMPLATE \"%s\"\n",check_null_str(dev->type)); |
||
762 | fprintf(f,"BEGIN\n"); |
||
763 | }; |
||
764 | |||
765 | if(options & PRINT_GENERIC && dev->generics) |
||
766 | list_generic_values(f,&dev->generics,2); |
||
767 | |||
768 | if ( dev->is_template && dev->parent_template_ref) { |
||
769 | fprintf(f," ALIAS \"%s\"\n",check_null_str(dev->parent_template_ref->type)); |
||
770 | n=NULL; /* alias templates have no nodes of their own */ |
||
771 | } |
||
772 | else |
||
773 | n=dev->nodes; |
||
2 | mjames | 774 | |
11 | mjames | 775 | if(options & NO_PRINT_PINS) |
776 | n = NULL; |
||
2 | mjames | 777 | |
11 | mjames | 778 | while(n) { |
779 | char tmp_name[MAXIDLEN],vhdltail[MAXIDLEN],group_tail[MAXIDLEN]; |
||
780 | int iter,iter_hi,iter_low; |
||
781 | vhdl_t * vhdl; |
||
782 | if( n->net_assigned || |
||
783 | (options &PRINT_ALL ) || |
||
784 | dev->is_template || |
||
785 | ((options & PRINT_NET_NAMES) && n->routed_net && !ISNULLSTR(n->routed_net->name))) { |
||
786 | /* there is a possibility here of printing |
||
787 | out a bus as separate signals */ |
||
788 | if(n->orig_vhdltype) /* if a pin rename has taken place, use the original name !! */ |
||
789 | vhdl= n->orig_vhdltype; |
||
790 | else |
||
791 | vhdl = n->vhdltype; |
||
2 | mjames | 792 | |
11 | mjames | 793 | if((options&PRINT_EXPAND_BUS) && vhdl && vhdl->is_vector) { |
794 | fprintf(f,"-- Bus expansion follows '"); |
||
795 | decode_vhdl_bus(f,vhdl,NO_RECURSE); |
||
796 | fprintf(f,"'\n"); |
||
797 | eval_vhdl_expression(vhdl->expr,&iter_hi,&iter_low); |
||
798 | if(iter_hi<iter_low) { |
||
799 | int t; |
||
800 | fprintf(f,"-- VHDL Range is backwards !! \n"); |
||
801 | t = iter_hi; |
||
802 | iter_hi=iter_low; |
||
803 | iter_low=t; |
||
804 | }; |
||
2 | mjames | 805 | |
11 | mjames | 806 | } |
807 | else { |
||
808 | iter_hi=0; |
||
809 | iter_low=0; |
||
810 | } |
||
2 | mjames | 811 | |
11 | mjames | 812 | |
813 | for(iter = iter_low; iter<= iter_hi;iter++) { |
||
814 | /* create a tail on the signal name */ |
||
815 | vhdltail[0] = '\0'; |
||
816 | if(vhdl && vhdl->is_vector) |
||
817 | sprintf(vhdltail,vhdl_bus_format,iter); /* this should be a template : setup in symbol table */ |
||
818 | |||
819 | |||
820 | if(options & PRINT_USABLE) { |
||
821 | if (n->routed_net) |
||
822 | sprintf(tmp_name,"\"%s%s\"",check_null_str(n->net->identifier),vhdltail); |
||
823 | else |
||
824 | sprintf(tmp_name,"\"unknown_net\""); |
||
825 | } |
||
826 | else if (options & PRINT_NET_NAMES ) /* signal assigned to net regardless of whether routed to this pin */ |
||
827 | { |
||
828 | if (n->net) |
||
829 | sprintf(tmp_name,"\"%s%s\"",check_null_str(n->net->name),vhdltail); |
||
830 | else if (n->routed_net) |
||
831 | sprintf(tmp_name,"\"%s%s\"",check_null_str(n->routed_net->name),vhdltail); |
||
832 | } |
||
833 | else |
||
834 | { |
||
835 | sprintf(tmp_name,"\"%s%s\"",check_null_str(n->name),vhdltail); |
||
836 | } |
||
837 | group_tail[0]='\0'; |
||
838 | if((options & PRINT_GROUP) && n->pin_group) |
||
839 | sprintf(group_tail,"(%d)", n->pin_group) ; |
||
2 | mjames | 840 | |
11 | mjames | 841 | fprintf(f," %-32s : ", |
842 | tmp_name); |
||
843 | |||
844 | |||
845 | if(options & PRINT_AS_UNROUTED) |
||
846 | fprintf(f,"UNROUTED "); |
||
847 | else |
||
848 | fprintf(f,"%s%s = %4s%s ", |
||
849 | decode_pin[(int)n->pindir], |
||
850 | group_tail, |
||
851 | n->identifier, |
||
852 | vhdltail); |
||
853 | if(options & PRINT_TYPE) { |
||
854 | if(!vhdl) /* VHDL base types only are printed here as |
||
855 | vectors are expanded */ |
||
856 | fprintf(f," : %s",default_vhdl_datatype->basetype); |
||
857 | else |
||
858 | fprintf(f," : %s",vhdl->basetype); |
||
859 | } |
||
860 | |||
861 | |||
862 | fprintf(f,"; -- refs=%d %s %s %s\n", |
||
863 | n->refcount, |
||
864 | n->fixed_pin?"fixed":"", |
||
865 | n->in_use?"in use":"unused", |
||
866 | n->net_assigned?"net assigned":""); |
||
867 | }; |
||
868 | } |
||
869 | n=n->sktnext; /* traverse to next pin on socket */ |
||
870 | }; |
||
871 | |||
872 | /* use routine in equivalent.c */ |
||
873 | if (options & PRINT_EQUIVALENT_PINS) |
||
874 | list_equivalent_pins(f,dev); |
||
875 | fprintf(f,"END;\n\n"); |
||
2 | mjames | 876 | } |
877 | |||
878 | /************************************************************************/ |
||
879 | /* this function prints the 'entity' of a top level of a partition as an |
||
880 | ACFP file */ |
||
881 | |||
11 | mjames | 882 | void print_ACF_entity(FILE * f,char * entityname) |
2 | mjames | 883 | { |
11 | mjames | 884 | net_t * net = named_list; |
885 | int pin_num = 1; |
||
2 | mjames | 886 | |
11 | mjames | 887 | fprintf(f,"CHIP %s\n",entityname); |
2 | mjames | 888 | |
11 | mjames | 889 | fprintf(f,"BEGIN\n DEVICE = \"VHDL-TOP\";\n"); |
890 | while(net){ |
||
891 | if(net->leaves_partition){ |
||
892 | char nam[MAXIDLEN]; |
||
893 | sprintf(nam,"\"%s\"",check_null_str(net->name)); |
||
894 | fprintf(f," %-32s : %5s = \"%d\" ", |
||
895 | nam, |
||
896 | decode_pin[(int)net->ext_dir], |
||
897 | pin_num++); |
||
898 | fprintf(f," : \""); |
||
899 | decode_vhdl_type(f,net->vhdltype,0); |
||
900 | fprintf(f,"\";\n"); |
||
901 | } |
||
902 | net=net->next; |
||
903 | } |
||
904 | fprintf(f,"END; -- %s\n\n",entityname); |
||
905 | |||
2 | mjames | 906 | } |
907 | /************************************************************************/ |
||
908 | |||
909 | /* devices are always listed in acfp files with VHDL data types */ |
||
11 | mjames | 910 | void list_devices(FILE * f,int listflags) |
2 | mjames | 911 | { |
11 | mjames | 912 | socket_t * dev; |
913 | dev = socket_head; |
||
914 | while(dev) |
||
915 | { |
||
916 | /* only print named devices !!! */ |
||
917 | if(!ISNULLSTR(dev->name)) |
||
918 | print_device(f,dev,listflags); |
||
919 | dev = dev->next; |
||
920 | }; |
||
2 | mjames | 921 | } |
922 | |||
923 | /************************************************************************/ |
||
924 | /* devices are always listed in acfp files with VHDL data types */ |
||
925 | /* only those with their is_external flags set */ |
||
926 | |||
11 | mjames | 927 | void list_extern_devices(FILE * f) |
2 | mjames | 928 | { |
11 | mjames | 929 | socket_t * dev; |
930 | dev = socket_head; |
||
931 | while(dev) |
||
932 | { |
||
933 | /* only print external devices !!! */ |
||
934 | if(dev->is_external) |
||
935 | print_device(f,dev,PRINT_TYPE | PRINT_NET_NAMES ); |
||
936 | dev = dev->next; |
||
937 | }; |
||
2 | mjames | 938 | } |
939 | |||
11 | mjames | 940 | |
2 | mjames | 941 | /************************************************************************/ |
11 | mjames | 942 | static int list_pin_renames(net_t * list,FILE * f,int any_renames_seen) { |
943 | noderef_t * nodes ,* ref; |
||
2 | mjames | 944 | |
11 | mjames | 945 | if (!list) return any_renames_seen; |
946 | while(list) { |
||
947 | nodes = list->nodes; |
||
2 | mjames | 948 | |
11 | mjames | 949 | while(nodes) { |
950 | ref = nodes->base_noderef; |
||
951 | if(ref->orig_name) { |
||
952 | if(!any_renames_seen) { /* overall, start the list if there is a rename */ |
||
953 | fprintf(f,"RENAME_PINS\n BEGIN\n"); |
||
954 | any_renames_seen = 1; |
||
955 | } |
||
956 | if(ref->orig_vhdltype){ |
||
957 | fprintf(f," %s",list->identifier); |
||
958 | decode_vhdl_bus(f,ref->vhdltype,0); |
||
959 | fprintf(f," = ( "); |
||
960 | } |
||
961 | else |
||
962 | fprintf(f," %s = ( ",list->identifier); |
||
963 | fprintf(f,"%s.%s;);\n",ref->node->socket->identifier,ref->orig_name); |
||
2 | mjames | 964 | } |
11 | mjames | 965 | nodes = nodes->next; |
966 | } |
||
967 | list=list->next; |
||
968 | } |
||
969 | return(any_renames_seen); |
||
970 | } |
||
971 | |||
972 | |||
2 | mjames | 973 | /************************************************************************/ |
11 | mjames | 974 | |
975 | void print_pin_renames(FILE * f){ |
||
976 | int any_renames_seen = 0; |
||
977 | fprintf(f,"-- pin renames on unrouted list follow --\n"); |
||
978 | list_pin_renames(unrouted_list,f,any_renames_seen); |
||
979 | fprintf(f,"-- pin renames on routed list follow --\n"); |
||
980 | any_renames_seen = list_pin_renames(routed_list,f,any_renames_seen); |
||
981 | fprintf(f,"-- pin renames on named list follow --\n"); |
||
982 | any_renames_seen = list_pin_renames(named_list,f,any_renames_seen); |
||
983 | if(any_renames_seen) |
||
984 | fprintf(f,"END;\n"); |
||
985 | } |
||
986 | |||
987 | /************************************************************************/ |
||
2 | mjames | 988 | |
989 | |||
990 | |||
11 | mjames | 991 | |
992 | |||
993 | |||
2 | mjames | 994 | /************************************************************************/ |
995 | /* and now for the FRB formatted stuff */ |
||
996 | /* prints a frb formatted net */ |
||
11 | mjames | 997 | void frb_list_net(FILE * f,net_t * cnet) |
2 | mjames | 998 | { |
11 | mjames | 999 | noderef_t * bnode; |
1000 | node_t * cnode; |
||
1001 | bnode = cnet->nodes; |
||
1002 | if(bnode){ /* only print out a net that has at leat one node on it */ |
||
1003 | cnode=bnode->node; |
||
1004 | fprintf(f,".ADD_TER %s %s %s\n", |
||
1005 | cnode->socket->identifier, |
||
1006 | cnode->identifier, |
||
1007 | cnet->identifier); |
||
1008 | bnode = bnode->next; |
||
2 | mjames | 1009 | |
11 | mjames | 1010 | if(bnode) |
1011 | fprintf(f,".TER\n"); |
||
1012 | while(bnode) { |
||
1013 | cnode=bnode->node; |
||
1014 | fprintf(f,"%s %s\n",cnode->socket->identifier,cnode->identifier); |
||
1015 | bnode = bnode->next; |
||
1016 | }; |
||
1017 | fprintf(f,"\n"); |
||
1018 | }; |
||
2 | mjames | 1019 | } |
1020 | |||
1021 | /* ********************************************************************** */ |
||
1022 | |||
1023 | /* only jumpered nets are permitted to be listed as separate physical nets*/ |
||
1024 | /* aliased nets cannot, as they are asingle physical net */ |
||
11 | mjames | 1025 | void frb_list_net_connections(FILE * f,net_t * cnet) |
2 | mjames | 1026 | { |
11 | mjames | 1027 | while(cnet) { |
1028 | net_t * subnet = cnet->subnets; |
||
1029 | if(subnet && cnet->how_joined == Jumpered ) { |
||
1030 | while(subnet) { |
||
1031 | frb_list_net (f,subnet); |
||
1032 | subnet = subnet->subnets; |
||
1033 | } |
||
1034 | } |
||
1035 | else |
||
1036 | frb_list_net (f,cnet); |
||
2 | mjames | 1037 | |
11 | mjames | 1038 | cnet=cnet->next; |
1039 | }; |
||
2 | mjames | 1040 | } |
1041 | |||
1042 | /* ********************************************************************** */ |
||
1043 | |||
11 | mjames | 1044 | void produce_frb(FILE * f) |
2 | mjames | 1045 | |
1046 | { |
||
11 | mjames | 1047 | time_t now; |
1048 | struct tm * tim; |
||
2 | mjames | 1049 | |
11 | mjames | 1050 | socket_t * dev; |
2 | mjames | 1051 | |
11 | mjames | 1052 | time( &now); |
1053 | tim =localtime(&now); |
||
2 | mjames | 1054 | |
11 | mjames | 1055 | fprintf(f,".HEA\n.TIM %4d %02d %02d %02d %02d %02d\n", |
1056 | tim->tm_year+1900, |
||
1057 | tim->tm_mon+1, /* tm_mon has range 0..11 (jan=0) */ |
||
1058 | tim->tm_mday, /* but tm_mday has range 1..31 !! */ |
||
1059 | tim->tm_hour, |
||
1060 | tim->tm_min, |
||
1061 | tim->tm_sec); |
||
2 | mjames | 1062 | |
1063 | |||
11 | mjames | 1064 | fprintf(f,".JOB J_%d\n",(int)now); |
2 | mjames | 1065 | |
11 | mjames | 1066 | fprintf(f,".TYP FULL\n"); |
1067 | fprintf(f,".APP \"Neutral Architecture File\"\n\n"); |
||
2 | mjames | 1068 | |
1069 | |||
11 | mjames | 1070 | dev = socket_head; |
1071 | while(dev) { |
||
1072 | /* only print named devices !!! */ |
||
1073 | fprintf(f,".ADD_COM %s %s %s\n", |
||
1074 | dev->identifier, |
||
1075 | dev->type, |
||
1076 | dev->value); |
||
1077 | dev = dev->next; |
||
1078 | } |
||
1079 | fprintf(f,"\n\n"); |
||
1080 | |||
1081 | frb_list_net_connections(f,named_list); |
||
1082 | frb_list_net_connections(f,routed_list); |
||
1083 | |||
1084 | fprintf(f,".END\n"); |
||
1085 | |||
2 | mjames | 1086 | } |
1087 | |||
1088 | /* ********************************************************************** */ |
||
11 | mjames | 1089 | #if defined PC |
2 | mjames | 1090 | #define FMT1STR " Produced by %s (PC-CygWin)\n" |
1091 | #define FMT2STR " at %02d:%02d:%02d on %02d/%02d/%4d \n\n" |
||
1092 | #else |
||
1093 | #define FMT1STR " Produced by %s (HPUX)\n" |
||
1094 | #define FMT2STR " at %02d:%02d:%02d on %02d/%02d/%4d \n\n" |
||
1095 | #endif |
||
1096 | |||
11 | mjames | 1097 | #define VHDL_FMTSTR "--" FMT1STR "--" FMT2STR |
2 | mjames | 1098 | #define VLOG_FMTSTR "/*" FMT1STR " *" FMT2STR "*/" |
1099 | |||
1100 | /* puts a comment on the head of the file */ |
||
11 | mjames | 1101 | void print_header(FILE * f,char * tool) |
2 | mjames | 1102 | |
1103 | { |
||
11 | mjames | 1104 | time_t now; |
1105 | struct tm * tim; |
||
2 | mjames | 1106 | |
11 | mjames | 1107 | |
1108 | time( &now); |
||
1109 | tim =localtime(&now); |
||
1110 | fprintf(f,"-- FPGA / EPLD / PCB / VHDL tools --\n"); |
||
1111 | fprintf(f,"-- NFL Technologies 1995-2003 --\n\n"); |
||
1112 | fprintf(f,"-- by: Mike James \n\n"); |
||
1113 | fprintf(f,"-- package version: %s compiled: %s--\n\n",Vertical_Version ,Vertical_Time); |
||
1114 | fprintf(f,VHDL_FMTSTR, |
||
1115 | tool, |
||
1116 | tim->tm_hour, |
||
1117 | tim->tm_min, |
||
1118 | tim->tm_sec, |
||
1119 | tim->tm_mday, |
||
1120 | tim->tm_mon+1, |
||
1121 | tim->tm_year+1900); |
||
1122 | |||
1123 | |||
2 | mjames | 1124 | } |
1125 | |||
11 | mjames | 1126 | |
2 | mjames | 1127 | /* puts a comment on the head of the file */ |
11 | mjames | 1128 | void print_VLOG_header(FILE * f,char * tool) |
2 | mjames | 1129 | |
1130 | { |
||
11 | mjames | 1131 | time_t now; |
1132 | struct tm * tim; |
||
2 | mjames | 1133 | |
11 | mjames | 1134 | |
1135 | time( &now); |
||
1136 | tim =localtime(&now); |
||
1137 | fprintf(f,"/* FPGA / EPLD / PCB / VHDL tools */\n"); |
||
1138 | fprintf(f,"/* NFL Technologies 1995-2003 --\n\n */"); |
||
1139 | fprintf(f,"/* by: Mike James \n\n */"); |
||
1140 | fprintf(f,"/* package version: %s compiled: %s*/\n\n",Vertical_Version ,Vertical_Time); |
||
1141 | fprintf(f,VLOG_FMTSTR, |
||
1142 | tool, |
||
1143 | tim->tm_hour, |
||
1144 | tim->tm_min, |
||
1145 | tim->tm_sec, |
||
1146 | tim->tm_mday, |
||
1147 | tim->tm_mon+1, |
||
1148 | tim->tm_year+1900); |
||
1149 | |||
1150 | |||
2 | mjames | 1151 | } |
11 | mjames | 1152 | |
1153 |