Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2 | mjames | 1 | /* |
| 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 |
||
| 82 | * Added the 'write flatten' command that only lists the wires |
||
| 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 |
||
| 92 | * |
||
| 93 | * Revision 1.68 2000/10/04 10:37:08 10:37:08 mjames (Mike James) |
||
| 94 | * Part of Release PSAVAT01 |
||
| 95 | * |
||
| 96 | * Revision 1.67 2000/10/02 11:04:18 11:04:18 mjames (Mike James) |
||
| 97 | * new_vhdl |
||
| 98 | * |
||
| 99 | * Revision 1.66 2000/09/27 14:42:19 14:42:19 mjames (Mike James) |
||
| 100 | * Part of Release Sep_27_ST_2000 |
||
| 101 | * |
||
| 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. |
||
| 104 | * |
||
| 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 | * ,. |
||
| 109 | * |
||
| 110 | * Revision 1.63 2000/09/21 10:15:49 10:15:49 mjames (Mike James) |
||
| 111 | * Part of Release Sep21Alpha |
||
| 112 | * |
||
| 113 | * Revision 1.62 2000/09/21 09:47:19 09:47:19 mjames (Mike James) |
||
| 114 | * Added code to deal with pin equivalents |
||
| 115 | * |
||
| 116 | * Revision 1.61 2000/08/25 09:57:15 09:57:15 mjames (Mike James) |
||
| 117 | * Part of Release Aug25_alpha |
||
| 118 | * |
||
| 119 | * Revision 1.60 2000/08/16 08:57:31 08:57:31 mjames (Mike James) |
||
| 120 | * Part of Release CD01_Aug2000 |
||
| 121 | * |
||
| 122 | * Revision 1.59 2000/08/14 14:45:12 14:45:12 mjames (Mike James) |
||
| 123 | * Part of Release Aug_14_2000 |
||
| 124 | * |
||
| 125 | * Revision 1.58 2000/08/14 14:43:29 14:43:29 mjames (Mike James) |
||
| 126 | * Added power pins |
||
| 127 | * |
||
| 128 | * Revision 1.57 2000/08/11 08:30:32 08:30:32 mjames (Mike James) |
||
| 129 | * Part of Release Aug_11_2000 |
||
| 130 | * |
||
| 131 | * Revision 1.56 2000/08/09 10:31:47 10:31:47 mjames (Mike James) |
||
| 132 | * Part of Release Aug__9_2000 |
||
| 133 | * |
||
| 134 | * Revision 1.55 2000/05/31 11:42:57 11:42:57 mjames (Mike James) |
||
| 135 | * Part of Release May_31_2000 |
||
| 136 | * |
||
| 137 | * Revision 1.54 2000/05/08 17:01:38 17:01:38 mjames (Mike James) |
||
| 138 | * Part of Release May__8_2000 |
||
| 139 | * |
||
| 140 | * Revision 1.53 2000/05/08 16:59:31 16:59:31 mjames (Mike James) |
||
| 141 | * Part of Release May__8_2000 |
||
| 142 | * |
||
| 143 | * Revision 1.52 2000/05/08 16:57:08 16:57:08 mjames (Mike James) |
||
| 144 | * Part of Release May__8_2000 |
||
| 145 | * |
||
| 146 | * Revision 1.51 2000/03/08 16:19:24 16:19:24 mjames (Mike James) |
||
| 147 | * New version including PC |
||
| 148 | * |
||
| 149 | * Revision 1.48 2000/02/18 15:45:44 15:45:44 mjames (Mike James) |
||
| 150 | * Amended to support PC |
||
| 151 | * |
||
| 152 | * Revision 1.47 2000/01/20 15:58:48 15:58:48 mjames (Mike James) |
||
| 153 | * Part of Release R22 |
||
| 154 | * |
||
| 155 | * Revision 1.46 99/12/22 11:15:28 11:15:28 mjames (Mike James) |
||
| 156 | * Part of Release Dec_22_1999 |
||
| 157 | * |
||
| 158 | * Revision 1.45 99/11/23 13:53:12 13:53:12 mjames (Mike James) |
||
| 159 | * Addedd Verilog support and removed VHDL functions to a separate |
||
| 160 | * file |
||
| 161 | * |
||
| 162 | * Revision 1.40 98/11/27 15:15:48 15:15:48 mjames (Mike James) |
||
| 163 | * Altered listing of jumpers |
||
| 164 | * |
||
| 165 | * Revision 1.39 98/11/16 13:18:36 13:18:36 mjames (Mike James) |
||
| 166 | * |
||
| 167 | * Revision 1.38 98/08/12 14:21:57 14:21:57 mjames (Mike James) |
||
| 168 | * COrrected VHDL printout |
||
| 169 | * |
||
| 170 | * Revision 1.37 98/07/14 13:25:38 13:25:38 mjames (Mike James) |
||
| 171 | * Altered device printout to meet new requirements |
||
| 172 | * |
||
| 173 | * Revision 1.36 98/06/15 14:19:01 14:19:01 mjames (Mike James) |
||
| 174 | * Added template printout functionality |
||
| 175 | * |
||
| 176 | * Revision 1.35 98/04/24 13:49:16 13:49:16 mjames (Mike James) |
||
| 177 | * Avoid priting 'generics' for chips without them |
||
| 178 | * |
||
| 179 | * Revision 1.34 98/03/16 11:37:55 11:37:55 mjames (Mike James) |
||
| 180 | * Added generics to printout listings |
||
| 181 | * |
||
| 182 | * Revision 1.33 98/02/11 11:27:01 11:27:01 mjames (Mike James) |
||
| 183 | * Checked in for version 6.2a |
||
| 184 | * |
||
| 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. |
||
| 189 | * |
||
| 190 | * Revision 1.31 97/04/23 08:43:21 08:43:21 mjames (Mike James) |
||
| 191 | * CHecked in for release rel23041997 |
||
| 192 | * |
||
| 193 | * Revision 1.30 96/12/23 15:19:14 15:19:14 mjames (Mike James) |
||
| 194 | * Altered headline for UMA email address |
||
| 195 | * |
||
| 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. |
||
| 201 | * |
||
| 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 | * / |
||
| 206 | * |
||
| 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 |
||
| 209 | * |
||
| 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 | * |
||
| 284 | */ |
||
| 285 | #include "printout.h" |
||
| 286 | |||
| 287 | #include "cmdlog.h" |
||
| 288 | #include "cmdparse.h" |
||
| 289 | #include "database.h" |
||
| 290 | #include "equivalent.h" |
||
| 291 | #include "expression.h" |
||
| 292 | #include "generic.h" |
||
| 293 | #include "print_vhdl.h" |
||
| 294 | #include "print_vlog.h" |
||
| 295 | #include "sorting.h" |
||
| 296 | #include "version.h" |
||
| 297 | #include "vertcl_main.h" |
||
| 298 | |||
| 299 | #include <ctype.h> |
||
| 300 | #include <regex.h> |
||
| 301 | #include <stdio.h> |
||
| 302 | #include <stdlib.h> |
||
| 303 | #include <string.h> |
||
| 304 | #include <time.h> |
||
| 305 | |||
| 306 | #ident \ |
||
| 307 | "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/printout.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $" |
||
| 308 | |||
| 309 | /* decoding pin direction in ACF form */ |
||
| 310 | /* see pindir_t in database.h */ |
||
| 311 | static char *decode_pin[] = {"NONE", |
||
| 312 | "INPUT_PIN", |
||
| 313 | "OUTPUT_PIN", |
||
| 314 | "output_pin", /* buffer is a sort of Output pin (lower case is for |
||
| 315 | info only )*/ |
||
| 316 | "BIDIR_PIN ", |
||
| 317 | "CONFIG_PIN", |
||
| 318 | "POWER_PIN"}; |
||
| 319 | |||
| 320 | /* returns a valid pointer to a null string */ |
||
| 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); |
||
| 327 | } |
||
| 328 | |||
| 329 | /* ********************************************************************** */ |
||
| 330 | |||
| 331 | /* this prints out the contents of the working database */ |
||
| 332 | /* prints a single net as a connection */ |
||
| 333 | /* subnets are printed as having the how_routed field of their |
||
| 334 | parent, because this is the how_routed value that is indicated |
||
| 335 | by the routing */ |
||
| 336 | |||
| 337 | void list_net_nodes (FILE *f, net_t *cnet, net_t *root_net) |
||
| 338 | { |
||
| 339 | noderef_t *bnode; |
||
| 340 | node_t *cnode; |
||
| 341 | int wrapc; |
||
| 342 | if (!cnet) |
||
| 343 | return; |
||
| 344 | fprintf ( |
||
| 345 | f, |
||
| 346 | " CONNECTION \"%s\" \"%s\" %s; -- %d nodes\n ", |
||
| 347 | cnet->identifier, |
||
| 348 | check_null_str (root_net->name), |
||
| 349 | decode_how_routed[root_net->how_routed], |
||
| 350 | cnet->nodecount); |
||
| 351 | fprintf ( |
||
| 352 | f, |
||
| 353 | "-- partition port=%d in=%d need_buff=%d\n", |
||
| 354 | cnet->leaves_partition, |
||
| 355 | cnet->inside_partition, |
||
| 356 | cnet->needs_buff_sig); |
||
| 357 | if (cnet->vhdltype) |
||
| 358 | { |
||
| 359 | fprintf (f, "-- vhdl '"); |
||
| 360 | print_range_expression (f, cnet->vhdltype->expr, NO_RECURSE); |
||
| 361 | fprintf (f, "'\n"); |
||
| 362 | } |
||
| 363 | if (cnet->type_defined) |
||
| 364 | fprintf (f, "-- net type defined\n"); |
||
| 365 | bnode = cnet->nodes; |
||
| 366 | wrapc = 0; |
||
| 367 | while (bnode) |
||
| 368 | { |
||
| 369 | cnode = bnode->node; |
||
| 370 | fprintf (f, " %s(%s)", cnode->socket->identifier, cnode->identifier); |
||
| 371 | /* printout if any lines have fix_location flags set */ |
||
| 372 | if (cnode->fix_location) |
||
| 373 | { |
||
| 374 | wrapc += 2; /* cant get as much on this line */ |
||
| 375 | fprintf (f, " FIX_LOCATION"); |
||
| 376 | } |
||
| 377 | if (cnode->fixed_pin) |
||
| 378 | { |
||
| 379 | wrapc += 2; /* cant get as much on this line */ |
||
| 380 | fprintf (f, " %s", decode_pin[cnode->pindir]); |
||
| 381 | } |
||
| 382 | if (cnode->pin_group) |
||
| 383 | { |
||
| 384 | wrapc += 2; /* cant get as much on this line */ |
||
| 385 | fprintf (f, " (%d)", cnode->pin_group); |
||
| 386 | } |
||
| 387 | fprintf (f, ";"); |
||
| 388 | |||
| 389 | wrapc++; |
||
| 390 | if (wrapc >= 8) |
||
| 391 | { |
||
| 392 | wrapc = 0; |
||
| 393 | fprintf (f, "\n "); |
||
| 394 | } |
||
| 395 | bnode = bnode->next; |
||
| 396 | }; |
||
| 397 | if (wrapc) |
||
| 398 | fprintf (f, "\n "); |
||
| 399 | fprintf (f, "END_CONN;\n"); |
||
| 400 | } |
||
| 401 | |||
| 402 | /* ********************************************************************** */ |
||
| 403 | void list_net_structure ( |
||
| 404 | FILE *f, net_t *cnet, net_t *root_net, int alias_depth, int flatten_jumpers) |
||
| 405 | { |
||
| 406 | net_t *subnet; |
||
| 407 | subnet = cnet->subnets; |
||
| 408 | if (cnet == root_net) |
||
| 409 | fprintf (f, "--Top Level\n"); |
||
| 410 | if (cnet->how_joined == Jumpered && subnet) |
||
| 411 | { |
||
| 412 | fprintf ( |
||
| 413 | f, |
||
| 414 | "-- Jumpered Connections to '%s' name '%s' found here --\n", |
||
| 415 | cnet->identifier, |
||
| 416 | cnet->name); |
||
| 417 | if (flatten_jumpers == FLATTEN_JUMPERS) |
||
| 418 | list_net_nodes (f, cnet, root_net); |
||
| 419 | |||
| 420 | else |
||
| 421 | while (subnet) |
||
| 422 | { |
||
| 423 | list_net_structure ( |
||
| 424 | f, subnet, root_net, 0, flatten_jumpers); /* depth = 0, not |
||
| 425 | aliased */ |
||
| 426 | subnet = subnet->joined_nets; |
||
| 427 | } |
||
| 428 | fprintf (f, "--\n"); |
||
| 429 | } |
||
| 430 | else if (cnet->how_joined == Aliased && subnet) |
||
| 431 | { |
||
| 432 | fprintf (f, "-- Net nodes of aliased list here \n"); |
||
| 433 | list_net_nodes (f, cnet, root_net); |
||
| 434 | fprintf ( |
||
| 435 | f, |
||
| 436 | "-- %*s '%s' (name %s) created by Alias of --\n", |
||
| 437 | alias_depth, |
||
| 438 | "", |
||
| 439 | cnet->identifier, |
||
| 440 | cnet->name); |
||
| 441 | while (subnet) |
||
| 442 | { |
||
| 443 | fprintf (f, "-- %*s '%s' -- \n", alias_depth, "", subnet->identifier); |
||
| 444 | list_net_structure ( |
||
| 445 | f, subnet, root_net, alias_depth + 1, flatten_jumpers); |
||
| 446 | subnet = subnet->joined_nets; |
||
| 447 | } |
||
| 448 | fprintf (f, "--\n"); |
||
| 449 | } |
||
| 450 | else if (alias_depth == 0) |
||
| 451 | list_net_nodes (f, cnet, root_net); |
||
| 452 | } |
||
| 453 | |||
| 454 | /* ********************************************************************** */ |
||
| 455 | /* lists all the connections on the board */ |
||
| 456 | void list_nets (FILE *f, net_t *cnet, int flatten_jumpers) |
||
| 457 | { |
||
| 458 | while (cnet) |
||
| 459 | { |
||
| 460 | list_net_structure (f, cnet, cnet, 0, flatten_jumpers); |
||
| 461 | cnet = cnet->next; |
||
| 462 | } |
||
| 463 | } |
||
| 464 | |||
| 465 | /* ********************************************************************** */ |
||
| 466 | |||
| 467 | static void list_join (FILE *f, char *typ, net_t *cnet) |
||
| 468 | { |
||
| 469 | int wrapc = 1; |
||
| 470 | /* printf("List join %s , cnet = %p, join_parent = %p , join_parent->id =%p\n", |
||
| 471 | typ,cnet,cnet->join_parent,cnet->join_parent->identifier); */ |
||
| 472 | fprintf (f, " %s %s = (", typ, cnet->join_parent->identifier); |
||
| 473 | while (cnet) |
||
| 474 | { |
||
| 475 | if (cnet->external_node) |
||
| 476 | fprintf ( |
||
| 477 | f, |
||
| 478 | "%s(%s); ", |
||
| 479 | cnet->external_node->socket->identifier, |
||
| 480 | cnet->external_node->identifier); |
||
| 481 | else |
||
| 482 | fprintf (f, "%s; ", cnet->identifier); |
||
| 483 | wrapc++; |
||
| 484 | if (wrapc == 8) |
||
| 485 | { |
||
| 486 | wrapc = 0; |
||
| 487 | fprintf (f, "\n "); |
||
| 488 | } |
||
| 489 | cnet = cnet->joined_nets; |
||
| 490 | } |
||
| 491 | fprintf (f, ");"); |
||
| 492 | } |
||
| 493 | |||
| 494 | /* ********************************************************************** */ |
||
| 495 | /* we are now one level down so it must be a join of some sort |
||
| 496 | therefore join_parent is now valid */ |
||
| 497 | static void list_subnets (FILE *f, net_t *cnet, JoinMode_t join) |
||
| 498 | { |
||
| 499 | net_t *tnet = cnet; |
||
| 500 | char *nettype; |
||
| 501 | net_t *topname; |
||
| 502 | |||
| 503 | while (tnet) |
||
| 504 | { |
||
| 505 | if (tnet->subnets) |
||
| 506 | list_subnets (f, tnet->subnets, join); |
||
| 507 | tnet = tnet->joined_nets; |
||
| 508 | } |
||
| 509 | |||
| 510 | /* if we are interested in aliases, print these */ |
||
| 511 | /* Or if we are interested in joins print these */ |
||
| 512 | |||
| 513 | /* printf("id %s join_parent %p howjoin %d\n", |
||
| 514 | cnet->identifier,cnet->join_parent,cnet->how_joined); */ |
||
| 515 | |||
| 516 | if (cnet->join_parent->how_joined == join) |
||
| 517 | { |
||
| 518 | switch (join) |
||
| 519 | { |
||
| 520 | case Aliased: |
||
| 521 | nettype = "ALIAS"; |
||
| 522 | break; |
||
| 523 | case Jumpered: |
||
| 524 | nettype = "JUMPER"; |
||
| 525 | break; |
||
| 526 | default: |
||
| 527 | nettype = "??"; |
||
| 528 | break; |
||
| 529 | }; |
||
| 530 | list_join (f, nettype, cnet); |
||
| 531 | |||
| 532 | topname = cnet; |
||
| 533 | /* ascend jumper hierarchy to get the real name */ |
||
| 534 | while (topname->join_parent && ISNULLSTR (topname->name)) |
||
| 535 | topname = topname->join_parent; |
||
| 536 | |||
| 537 | if (join != Aliased && !ISNULLSTR (topname->name)) |
||
| 538 | fprintf (f, " -- signal '%s' \n", topname->name); |
||
| 539 | else |
||
| 540 | fprintf (f, "\n"); |
||
| 541 | }; |
||
| 542 | } |
||
| 543 | /* ********************************************************************** */ |
||
| 544 | |||
| 545 | /* this lists all joined nets. it is recursive. Any subnets will be explored |
||
| 546 | before printing out the joins for this net if any are presaent */ |
||
| 547 | |||
| 548 | static void list_joined_nets (FILE *f, net_t *cnet) |
||
| 549 | { |
||
| 550 | if (!cnet) |
||
| 551 | return; |
||
| 552 | |||
| 553 | while (cnet) |
||
| 554 | { |
||
| 555 | /* if there are any subnets here, do the recursion on them */ |
||
| 556 | /* printf("cnet = %p, subnets= %p \n",cnet,cnet->subnets); */ |
||
| 557 | if (cnet->subnets) |
||
| 558 | { |
||
| 559 | list_subnets (f, cnet->subnets, Jumpered); |
||
| 560 | } |
||
| 561 | if (cnet->vhdl_connect_net) |
||
| 562 | { |
||
| 563 | fprintf ( |
||
| 564 | f, |
||
| 565 | " VHDL_CONN %s <= %s;\n", |
||
| 566 | cnet->name, |
||
| 567 | cnet->vhdl_connect_net->name); |
||
| 568 | } |
||
| 569 | cnet = cnet->next; |
||
| 570 | } |
||
| 571 | } |
||
| 572 | |||
| 573 | /************************************************************************/ |
||
| 574 | |||
| 575 | static void list_routed_aliased_nets (FILE *f, net_t *cnet) |
||
| 576 | { |
||
| 577 | if (!cnet) |
||
| 578 | return; |
||
| 579 | |||
| 580 | while (cnet) |
||
| 581 | { |
||
| 582 | net_t *unrouted = cnet->unrouted_reference; |
||
| 583 | /* if there are any subnets here, do the recursion on them */ |
||
| 584 | /* this will find out aliases if they exist */ |
||
| 585 | if (unrouted && unrouted->subnets) |
||
| 586 | list_subnets (f, unrouted->subnets, Aliased); |
||
| 587 | cnet = cnet->next; |
||
| 588 | } |
||
| 589 | } |
||
| 590 | |||
| 591 | /************************************************************************/ |
||
| 592 | |||
| 593 | static void list_aliased_nets (FILE *f, net_t *cnet) |
||
| 594 | { |
||
| 595 | if (!cnet) |
||
| 596 | return; |
||
| 597 | |||
| 598 | while (cnet) |
||
| 599 | { |
||
| 600 | /* if there are any subnets here, do the recursion on them */ |
||
| 601 | /* printf("cnet = %p, subnets= %p \n",cnet,cnet->subnets); */ |
||
| 602 | if (cnet->subnets) |
||
| 603 | list_subnets (f, cnet->subnets, Aliased); |
||
| 604 | |||
| 605 | cnet = cnet->next; |
||
| 606 | } |
||
| 607 | } |
||
| 608 | |||
| 609 | /************************************************************************/ |
||
| 610 | void list_components (FILE *f) |
||
| 611 | { |
||
| 612 | socket_t *cskt = sort_sockets (&socket_head); |
||
| 613 | fprintf (f, "COMPONENTS\nBEGIN\n"); |
||
| 614 | while (cskt) |
||
| 615 | { |
||
| 616 | if (cskt->is_template) |
||
| 617 | fprintf (f, "-- %s : Socket Template\n", cskt->type); |
||
| 618 | else |
||
| 619 | fprintf ( |
||
| 620 | f, |
||
| 621 | " %s : \"%s\" \"%s\" \"%s\"; -- %s\n", |
||
| 622 | cskt->identifier, |
||
| 623 | check_null_str (cskt->name), |
||
| 624 | check_null_str (cskt->type), |
||
| 625 | check_null_str (cskt->value), |
||
| 626 | cskt->is_external ? "External" : "Internal"); |
||
| 627 | cskt = cskt->next; |
||
| 628 | }; |
||
| 629 | fprintf (f, "END;\n\n"); |
||
| 630 | } |
||
| 631 | |||
| 632 | /***********************************************************************************/ |
||
| 633 | /* only list device info for those sockets which have "external" flags set */ |
||
| 634 | /* |
||
| 635 | This is intended to provide Vertical write extern |
||
| 636 | with an explicit tie-up between the socket ID |
||
| 637 | e.g. U1 and a device name in the socket e.g. BusChip or whatever. In fact in this |
||
| 638 | context the contents of socket U1 will be known as device name U1. |
||
| 639 | |||
| 640 | Without this info, the tool cannot locate sockets by name using the chip identifier |
||
| 641 | as ACF files do not contain the chip identifier, only the chip name. |
||
| 642 | */ |
||
| 643 | |||
| 644 | void list_extern_sockets (FILE *f) |
||
| 645 | { |
||
| 646 | socket_t *cskt = sort_sockets (&socket_head); |
||
| 647 | char *name; |
||
| 648 | fprintf (f, "COMPONENTS\nBEGIN\n"); |
||
| 649 | while (cskt) |
||
| 650 | { |
||
| 651 | if (cskt->is_external) |
||
| 652 | { |
||
| 653 | /* force the device to have an identifier if it does not have one */ |
||
| 654 | name = cskt->name; |
||
| 655 | if (ISNULLSTR (name)) |
||
| 656 | name = cskt->identifier; |
||
| 657 | |||
| 658 | fprintf ( |
||
| 659 | f, |
||
| 660 | " %s : \"%s\" \"%s\" \"%s\";\n", |
||
| 661 | cskt->identifier, |
||
| 662 | name, |
||
| 663 | check_null_str (cskt->type), |
||
| 664 | check_null_str (cskt->value)); |
||
| 665 | } |
||
| 666 | cskt = cskt->next; |
||
| 667 | }; |
||
| 668 | fprintf (f, "END;\n\n"); |
||
| 669 | } |
||
| 670 | |||
| 671 | /************************************************************************/ |
||
| 672 | void list_database (FILE *f, int flatten_jumpers) |
||
| 673 | { |
||
| 674 | list_components (f); |
||
| 675 | |||
| 676 | fprintf (f, "WIRED_NETS\nBEGIN\n"); |
||
| 677 | fprintf (f, "-- Routed & Named nets follow --\n\nNAMED\n\n"); |
||
| 678 | list_nets (f, named_list, flatten_jumpers); |
||
| 679 | fprintf (f, "-- Routed & unused nets follow --\n\nROUTED\n\n"); |
||
| 680 | list_nets (f, routed_list, flatten_jumpers); |
||
| 681 | fprintf (f, "-- Unrouted nets follow --\n\nUNROUTED\n\n"); |
||
| 682 | list_nets (f, unrouted_list, flatten_jumpers); |
||
| 683 | fprintf (f, "END;\n\n"); |
||
| 684 | } |
||
| 685 | /************************************************************************/ |
||
| 686 | void list_jumper (FILE *f) |
||
| 687 | { |
||
| 688 | fprintf (f, "-- Jumper list here --\n"); |
||
| 689 | fprintf (f, "JOINED_NETS\nBEGIN\n"); |
||
| 690 | |||
| 691 | fprintf (f, "-- named list\n"); |
||
| 692 | list_joined_nets (f, named_list); |
||
| 693 | fprintf (f, "-- routed list\n"); |
||
| 694 | list_joined_nets (f, routed_list); |
||
| 695 | fprintf (f, "END;\n\n"); |
||
| 696 | } |
||
| 697 | |||
| 698 | /************************************************************************/ |
||
| 699 | void list_alias (FILE *f) |
||
| 700 | { |
||
| 701 | fprintf (f, "-- Alias list here --\n"); |
||
| 702 | fprintf (f, "JOINED_NETS\nBEGIN\n"); |
||
| 703 | fprintf (f, "-- named list\n"); |
||
| 704 | list_routed_aliased_nets (f, named_list); |
||
| 705 | fprintf (f, "-- routed list\n"); |
||
| 706 | list_routed_aliased_nets (f, routed_list); |
||
| 707 | fprintf (f, "-- unrouted list\n"); |
||
| 708 | list_aliased_nets (f, unrouted_list); |
||
| 709 | fprintf (f, "END;\n\n"); |
||
| 710 | } |
||
| 711 | |||
| 712 | /************************************************************************/ |
||
| 713 | void list_joined (FILE *f) |
||
| 714 | { |
||
| 715 | /* and now the joined nets */ |
||
| 716 | |||
| 717 | fprintf (f, "JOINED_NETS\nBEGIN\n"); |
||
| 718 | |||
| 719 | fprintf (f, "-- Jumper list here --\n"); |
||
| 720 | list_joined_nets (f, named_list); |
||
| 721 | list_joined_nets (f, routed_list); |
||
| 722 | fprintf (f, "-- Alias list here --\n"); |
||
| 723 | list_routed_aliased_nets (f, named_list); |
||
| 724 | list_routed_aliased_nets (f, routed_list); |
||
| 725 | list_aliased_nets (f, unrouted_list); |
||
| 726 | fprintf (f, "END;\n\n"); |
||
| 727 | } |
||
| 728 | |||
| 729 | /* ********************************************************************** */ |
||
| 730 | /* if options & PRINT_ALL then print all known pins on the device */ |
||
| 731 | /* if options & PRINT_TYPE then print the VHDL data type of this pin */ |
||
| 732 | /* if options & PRINT_GENERIC then print out the device's generic map here also */ |
||
| 733 | /* if options & PRINT_EXPAND_BUS then expand out the VHDL bus to individual wires */ |
||
| 734 | /* if options & PRINT_GROUP then print out the pin groups */ |
||
| 735 | /* if options & PRINT_ROUTE_FLAGS then print out the routing flags */ |
||
| 736 | /* if options & PRINT_AS_UNROUTED then printout "UNROUTED" instead of any pindir info */ |
||
| 737 | /* if options & PRINT_EQUIVALENT_PINS then print the list of pin equivalents */ |
||
| 738 | void print_device (FILE *f, socket_t *dev, int options) |
||
| 739 | { |
||
| 740 | node_t *n; |
||
| 741 | char *vhdl_bus_format; |
||
| 742 | |||
| 743 | generic_info_t gen[1]; |
||
| 744 | |||
| 745 | /* sort all the nodes into alphabetical order */ |
||
| 746 | sort_nodes (dev, NO_EXTRACT_XY); |
||
| 747 | |||
| 748 | /* if we are using VHDL then look at the VHDL bus formatting tail*/ |
||
| 749 | if ((options & PRINT_EXPAND_BUS) && |
||
| 750 | get_generic_value (&global_generics, "vhdl_bus_format", gen) == IS_ENV_VAL && |
||
| 751 | gen->expr) |
||
| 752 | vhdl_bus_format = gen->expr->left.s; |
||
| 753 | else |
||
| 754 | vhdl_bus_format = "_%d_"; /* persuade GCC the string pointer is modifiable */ |
||
| 755 | |||
| 756 | /* if it hasnt got a name, use its identifier */ |
||
| 757 | |||
| 758 | if (!dev->is_template) |
||
| 759 | { |
||
| 760 | if (dev->name != NULL && dev->name[0]) |
||
| 761 | fprintf (f, "CHIP %s\n", check_null_str (dev->name)); |
||
| 762 | else |
||
| 763 | fprintf (f, "CHIP %s\n", dev->identifier); |
||
| 764 | |||
| 765 | fprintf (f, "BEGIN\n DEVICE = \"%s\";\n", check_null_str (dev->type)); |
||
| 766 | if (options & PRINT_ROUTE_FLAGS && dev->route_flags) |
||
| 767 | fprintf (f, " ROUTE_FLAGS = %d;\n", dev->route_flags); |
||
| 768 | |||
| 769 | if (dev->is_external) |
||
| 770 | fprintf (f, "-- External Connection\n\n"); |
||
| 771 | else |
||
| 772 | fprintf (f, "-- Internal Socket\n\n"); |
||
| 773 | |||
| 774 | fprintf (f, "-- DEV_IDENT \"%s\"\n", dev->identifier); |
||
| 775 | if (dev->highest_bundle) |
||
| 776 | { |
||
| 777 | fprintf (f, "-- Bundle of %d pins\n", dev->highest_bundle); |
||
| 778 | fprintf (f, "-- min_pin_row %d\n", dev->min_pin_row); |
||
| 779 | fprintf (f, "-- max_pin_row %d\n", dev->max_pin_row); |
||
| 780 | fprintf (f, "-- min_pin_col %d\n", dev->min_pin_col); |
||
| 781 | fprintf (f, "-- max_pin_col %d\n", dev->max_pin_col); |
||
| 782 | } |
||
| 783 | } |
||
| 784 | else |
||
| 785 | { |
||
| 786 | fprintf (f, "TEMPLATE \"%s\"\n", check_null_str (dev->type)); |
||
| 787 | fprintf (f, "BEGIN\n"); |
||
| 788 | }; |
||
| 789 | |||
| 790 | if (options & PRINT_GENERIC && dev->generics) |
||
| 791 | list_generic_values (f, &dev->generics, 2); |
||
| 792 | |||
| 793 | if (dev->is_template && dev->parent_template_ref) |
||
| 794 | { |
||
| 795 | fprintf ( |
||
| 796 | f, " ALIAS \"%s\"\n", check_null_str (dev->parent_template_ref->type)); |
||
| 797 | n = NULL; /* alias templates have no nodes of their own */ |
||
| 798 | } |
||
| 799 | else |
||
| 800 | n = dev->nodes; |
||
| 801 | |||
| 802 | if (options & NO_PRINT_PINS) |
||
| 803 | n = NULL; |
||
| 804 | |||
| 805 | while (n) |
||
| 806 | { |
||
| 807 | char tmp_name[MAXIDLEN], vhdltail[MAXIDLEN], group_tail[MAXIDLEN]; |
||
| 808 | int iter, iter_hi, iter_low; |
||
| 809 | vhdl_t *vhdl; |
||
| 810 | if (n->net_assigned || (options & PRINT_ALL) || dev->is_template || |
||
| 811 | ((options & PRINT_NET_NAMES) && n->routed_net && |
||
| 812 | !ISNULLSTR (n->routed_net->name))) |
||
| 813 | { |
||
| 814 | /* there is a possibility here of printing |
||
| 815 | out a bus as separate signals */ |
||
| 816 | if (n->orig_vhdltype) /* if a pin rename has taken place, use the |
||
| 817 | original name !! */ |
||
| 818 | vhdl = n->orig_vhdltype; |
||
| 819 | else |
||
| 820 | vhdl = n->vhdltype; |
||
| 821 | |||
| 822 | if ((options & PRINT_EXPAND_BUS) && vhdl && vhdl->is_vector) |
||
| 823 | { |
||
| 824 | fprintf (f, "-- Bus expansion follows '"); |
||
| 825 | decode_vhdl_bus (f, vhdl, NO_RECURSE); |
||
| 826 | fprintf (f, "'\n"); |
||
| 827 | eval_vhdl_expression (vhdl->expr, &iter_hi, &iter_low); |
||
| 828 | if (iter_hi < iter_low) |
||
| 829 | { |
||
| 830 | int t; |
||
| 831 | fprintf (f, "-- VHDL Range is backwards !! \n"); |
||
| 832 | t = iter_hi; |
||
| 833 | iter_hi = iter_low; |
||
| 834 | iter_low = t; |
||
| 835 | }; |
||
| 836 | } |
||
| 837 | else |
||
| 838 | { |
||
| 839 | iter_hi = 0; |
||
| 840 | iter_low = 0; |
||
| 841 | } |
||
| 842 | |||
| 843 | for (iter = iter_low; iter <= iter_hi; iter++) |
||
| 844 | { |
||
| 845 | /* create a tail on the signal name */ |
||
| 846 | vhdltail[0] = '\0'; |
||
| 847 | if (vhdl && vhdl->is_vector) |
||
| 848 | sprintf ( |
||
| 849 | vhdltail, |
||
| 850 | vhdl_bus_format, |
||
| 851 | iter); /* this should be a template : setup in |
||
| 852 | symbol table */ |
||
| 853 | |||
| 854 | if (options & PRINT_USABLE) |
||
| 855 | { |
||
| 856 | if (n->routed_net) |
||
| 857 | sprintf ( |
||
| 858 | tmp_name, |
||
| 859 | "\"%s%s\"", |
||
| 860 | check_null_str (n->net->identifier), |
||
| 861 | vhdltail); |
||
| 862 | else |
||
| 863 | sprintf (tmp_name, "\"unknown_net\""); |
||
| 864 | } |
||
| 865 | else if (options & PRINT_NET_NAMES) /* signal assigned to net |
||
| 866 | regardless of whether |
||
| 867 | routed to this pin */ |
||
| 868 | { |
||
| 869 | if (n->net) |
||
| 870 | sprintf ( |
||
| 871 | tmp_name, |
||
| 872 | "\"%s%s\"", |
||
| 873 | check_null_str (n->net->name), |
||
| 874 | vhdltail); |
||
| 875 | else if (n->routed_net) |
||
| 876 | sprintf ( |
||
| 877 | tmp_name, |
||
| 878 | "\"%s%s\"", |
||
| 879 | check_null_str (n->routed_net->name), |
||
| 880 | vhdltail); |
||
| 881 | } |
||
| 882 | else |
||
| 883 | { |
||
| 884 | sprintf ( |
||
| 885 | tmp_name, |
||
| 886 | "\"%s%s\"", |
||
| 887 | check_null_str (n->name), |
||
| 888 | vhdltail); |
||
| 889 | } |
||
| 890 | group_tail[0] = '\0'; |
||
| 891 | if ((options & PRINT_GROUP) && n->pin_group) |
||
| 892 | sprintf (group_tail, "(%d)", n->pin_group); |
||
| 893 | |||
| 894 | fprintf (f, " %-32s : ", tmp_name); |
||
| 895 | |||
| 896 | if (options & PRINT_AS_UNROUTED) |
||
| 897 | fprintf (f, "UNROUTED "); |
||
| 898 | else |
||
| 899 | fprintf ( |
||
| 900 | f, |
||
| 901 | "%s%s = %4s%s ", |
||
| 902 | decode_pin[(int) n->pindir], |
||
| 903 | group_tail, |
||
| 904 | n->identifier, |
||
| 905 | vhdltail); |
||
| 906 | if (options & PRINT_TYPE) |
||
| 907 | { |
||
| 908 | if (!vhdl) /* VHDL base types only are printed here as |
||
| 909 | vectors are expanded */ |
||
| 910 | fprintf ( |
||
| 911 | f, |
||
| 912 | " : %s", |
||
| 913 | default_vhdl_datatype->basetype); |
||
| 914 | else |
||
| 915 | fprintf (f, " : %s", vhdl->basetype); |
||
| 916 | } |
||
| 917 | |||
| 918 | fprintf ( |
||
| 919 | f, |
||
| 920 | "; -- refs=%d %s %s %s\n", |
||
| 921 | n->refcount, |
||
| 922 | n->fixed_pin ? "fixed" : "", |
||
| 923 | n->in_use ? "in use" : "unused", |
||
| 924 | n->net_assigned ? "net assigned" : ""); |
||
| 925 | }; |
||
| 926 | } |
||
| 927 | n = n->sktnext; /* traverse to next pin on socket */ |
||
| 928 | }; |
||
| 929 | |||
| 930 | /* use routine in equivalent.c */ |
||
| 931 | if (options & PRINT_EQUIVALENT_PINS) |
||
| 932 | list_equivalent_pins (f, dev); |
||
| 933 | fprintf (f, "END;\n\n"); |
||
| 934 | } |
||
| 935 | |||
| 936 | /************************************************************************/ |
||
| 937 | /* this function prints the 'entity' of a top level of a partition as an |
||
| 938 | ACFP file */ |
||
| 939 | |||
| 940 | void print_ACF_entity (FILE *f, char *entityname) |
||
| 941 | { |
||
| 942 | net_t *net = named_list; |
||
| 943 | int pin_num = 1; |
||
| 944 | |||
| 945 | fprintf (f, "CHIP %s\n", entityname); |
||
| 946 | |||
| 947 | fprintf (f, "BEGIN\n DEVICE = \"VHDL-TOP\";\n"); |
||
| 948 | while (net) |
||
| 949 | { |
||
| 950 | if (net->leaves_partition) |
||
| 951 | { |
||
| 952 | char nam[MAXIDLEN]; |
||
| 953 | sprintf (nam, "\"%s\"", check_null_str (net->name)); |
||
| 954 | fprintf ( |
||
| 955 | f, |
||
| 956 | " %-32s : %5s = \"%d\" ", |
||
| 957 | nam, |
||
| 958 | decode_pin[(int) net->ext_dir], |
||
| 959 | pin_num++); |
||
| 960 | fprintf (f, " : \""); |
||
| 961 | decode_vhdl_type (f, net->vhdltype, 0); |
||
| 962 | fprintf (f, "\";\n"); |
||
| 963 | } |
||
| 964 | net = net->next; |
||
| 965 | } |
||
| 966 | fprintf (f, "END; -- %s\n\n", entityname); |
||
| 967 | } |
||
| 968 | /************************************************************************/ |
||
| 969 | |||
| 970 | /* devices are always listed in acfp files with VHDL data types */ |
||
| 971 | void list_devices (FILE *f, int listflags) |
||
| 972 | { |
||
| 973 | socket_t *dev; |
||
| 974 | dev = socket_head; |
||
| 975 | while (dev) |
||
| 976 | { |
||
| 977 | /* only print named devices !!! */ |
||
| 978 | if (!ISNULLSTR (dev->name)) |
||
| 979 | print_device (f, dev, listflags); |
||
| 980 | dev = dev->next; |
||
| 981 | }; |
||
| 982 | } |
||
| 983 | |||
| 984 | /************************************************************************/ |
||
| 985 | /* devices are always listed in acfp files with VHDL data types */ |
||
| 986 | /* only those with their is_external flags set */ |
||
| 987 | |||
| 988 | void list_extern_devices (FILE *f) |
||
| 989 | { |
||
| 990 | socket_t *dev; |
||
| 991 | dev = socket_head; |
||
| 992 | while (dev) |
||
| 993 | { |
||
| 994 | /* only print external devices !!! */ |
||
| 995 | if (dev->is_external) |
||
| 996 | print_device (f, dev, PRINT_TYPE | PRINT_NET_NAMES); |
||
| 997 | dev = dev->next; |
||
| 998 | }; |
||
| 999 | } |
||
| 1000 | |||
| 1001 | /************************************************************************/ |
||
| 1002 | static int list_pin_renames (net_t *list, FILE *f, int any_renames_seen) |
||
| 1003 | { |
||
| 1004 | noderef_t *nodes, *ref; |
||
| 1005 | |||
| 1006 | if (!list) |
||
| 1007 | return any_renames_seen; |
||
| 1008 | while (list) |
||
| 1009 | { |
||
| 1010 | nodes = list->nodes; |
||
| 1011 | |||
| 1012 | while (nodes) |
||
| 1013 | { |
||
| 1014 | ref = nodes->base_noderef; |
||
| 1015 | if (ref->orig_name) |
||
| 1016 | { |
||
| 1017 | if (!any_renames_seen) |
||
| 1018 | { /* overall, start the list if there is a rename */ |
||
| 1019 | fprintf (f, "RENAME_PINS\n BEGIN\n"); |
||
| 1020 | any_renames_seen = 1; |
||
| 1021 | } |
||
| 1022 | if (ref->orig_vhdltype) |
||
| 1023 | { |
||
| 1024 | fprintf (f, " %s", list->identifier); |
||
| 1025 | decode_vhdl_bus (f, ref->vhdltype, 0); |
||
| 1026 | fprintf (f, " = ( "); |
||
| 1027 | } |
||
| 1028 | else |
||
| 1029 | fprintf (f, " %s = ( ", list->identifier); |
||
| 1030 | fprintf ( |
||
| 1031 | f, |
||
| 1032 | "%s.%s;);\n", |
||
| 1033 | ref->node->socket->identifier, |
||
| 1034 | ref->orig_name); |
||
| 1035 | } |
||
| 1036 | nodes = nodes->next; |
||
| 1037 | } |
||
| 1038 | list = list->next; |
||
| 1039 | } |
||
| 1040 | return (any_renames_seen); |
||
| 1041 | } |
||
| 1042 | |||
| 1043 | /************************************************************************/ |
||
| 1044 | |||
| 1045 | void print_pin_renames (FILE *f) |
||
| 1046 | { |
||
| 1047 | int any_renames_seen = 0; |
||
| 1048 | fprintf (f, "-- pin renames on unrouted list follow --\n"); |
||
| 1049 | list_pin_renames (unrouted_list, f, any_renames_seen); |
||
| 1050 | fprintf (f, "-- pin renames on routed list follow --\n"); |
||
| 1051 | any_renames_seen = list_pin_renames (routed_list, f, any_renames_seen); |
||
| 1052 | fprintf (f, "-- pin renames on named list follow --\n"); |
||
| 1053 | any_renames_seen = list_pin_renames (named_list, f, any_renames_seen); |
||
| 1054 | if (any_renames_seen) |
||
| 1055 | fprintf (f, "END;\n"); |
||
| 1056 | } |
||
| 1057 | |||
| 1058 | /************************************************************************/ |
||
| 1059 | |||
| 1060 | /************************************************************************/ |
||
| 1061 | /* and now for the FRB formatted stuff */ |
||
| 1062 | /* prints a frb formatted net */ |
||
| 1063 | void frb_list_net (FILE *f, net_t *cnet) |
||
| 1064 | { |
||
| 1065 | noderef_t *bnode; |
||
| 1066 | node_t *cnode; |
||
| 1067 | bnode = cnet->nodes; |
||
| 1068 | if (bnode) |
||
| 1069 | { /* only print out a net that has at leat one node on it */ |
||
| 1070 | cnode = bnode->node; |
||
| 1071 | fprintf ( |
||
| 1072 | f, |
||
| 1073 | ".ADD_TER %s %s %s\n", |
||
| 1074 | cnode->socket->identifier, |
||
| 1075 | cnode->identifier, |
||
| 1076 | cnet->identifier); |
||
| 1077 | bnode = bnode->next; |
||
| 1078 | |||
| 1079 | if (bnode) |
||
| 1080 | fprintf (f, ".TER\n"); |
||
| 1081 | while (bnode) |
||
| 1082 | { |
||
| 1083 | cnode = bnode->node; |
||
| 1084 | fprintf (f, "%s %s\n", cnode->socket->identifier, cnode->identifier); |
||
| 1085 | bnode = bnode->next; |
||
| 1086 | }; |
||
| 1087 | fprintf (f, "\n"); |
||
| 1088 | }; |
||
| 1089 | } |
||
| 1090 | |||
| 1091 | /* ********************************************************************** */ |
||
| 1092 | |||
| 1093 | /* only jumpered nets are permitted to be listed as separate physical nets*/ |
||
| 1094 | /* aliased nets cannot, as they are asingle physical net */ |
||
| 1095 | void frb_list_net_connections (FILE *f, net_t *cnet) |
||
| 1096 | { |
||
| 1097 | while (cnet) |
||
| 1098 | { |
||
| 1099 | net_t *subnet = cnet->subnets; |
||
| 1100 | if (subnet && cnet->how_joined == Jumpered) |
||
| 1101 | { |
||
| 1102 | while (subnet) |
||
| 1103 | { |
||
| 1104 | frb_list_net (f, subnet); |
||
| 1105 | subnet = subnet->subnets; |
||
| 1106 | } |
||
| 1107 | } |
||
| 1108 | else |
||
| 1109 | frb_list_net (f, cnet); |
||
| 1110 | |||
| 1111 | cnet = cnet->next; |
||
| 1112 | }; |
||
| 1113 | } |
||
| 1114 | |||
| 1115 | /* ********************************************************************** */ |
||
| 1116 | |||
| 1117 | void produce_frb (FILE *f) |
||
| 1118 | |||
| 1119 | { |
||
| 1120 | time_t now; |
||
| 1121 | struct tm *tim; |
||
| 1122 | |||
| 1123 | socket_t *dev; |
||
| 1124 | |||
| 1125 | time (&now); |
||
| 1126 | tim = localtime (&now); |
||
| 1127 | |||
| 1128 | fprintf ( |
||
| 1129 | f, |
||
| 1130 | ".HEA\n.TIM %4d %02d %02d %02d %02d %02d\n", |
||
| 1131 | tim->tm_year + 1900, |
||
| 1132 | tim->tm_mon + 1, /* tm_mon has range 0..11 (jan=0) */ |
||
| 1133 | tim->tm_mday, /* but tm_mday has range 1..31 !! */ |
||
| 1134 | tim->tm_hour, |
||
| 1135 | tim->tm_min, |
||
| 1136 | tim->tm_sec); |
||
| 1137 | |||
| 1138 | fprintf (f, ".JOB J_%d\n", (int) now); |
||
| 1139 | |||
| 1140 | fprintf (f, ".TYP FULL\n"); |
||
| 1141 | fprintf (f, ".APP \"Neutral Architecture File\"\n\n"); |
||
| 1142 | |||
| 1143 | dev = socket_head; |
||
| 1144 | while (dev) |
||
| 1145 | { |
||
| 1146 | /* only print named devices !!! */ |
||
| 1147 | fprintf (f, ".ADD_COM %s %s %s\n", dev->identifier, dev->type, dev->value); |
||
| 1148 | dev = dev->next; |
||
| 1149 | } |
||
| 1150 | fprintf (f, "\n\n"); |
||
| 1151 | |||
| 1152 | frb_list_net_connections (f, named_list); |
||
| 1153 | frb_list_net_connections (f, routed_list); |
||
| 1154 | |||
| 1155 | fprintf (f, ".END\n"); |
||
| 1156 | } |
||
| 1157 | |||
| 1158 | /* ********************************************************************** */ |
||
| 1159 | #if defined PC |
||
| 1160 | #define FMT1STR " Produced by %s (PC-CygWin)\n" |
||
| 1161 | #define FMT2STR " at %02d:%02d:%02d on %02d/%02d/%4d \n\n" |
||
| 1162 | #else |
||
| 1163 | #define FMT1STR " Produced by %s (HPUX)\n" |
||
| 1164 | #define FMT2STR " at %02d:%02d:%02d on %02d/%02d/%4d \n\n" |
||
| 1165 | #endif |
||
| 1166 | |||
| 1167 | #define VHDL_FMTSTR "--" FMT1STR "--" FMT2STR |
||
| 1168 | #define VLOG_FMTSTR "/*" FMT1STR " *" FMT2STR "*/" |
||
| 1169 | |||
| 1170 | /* puts a comment on the head of the file */ |
||
| 1171 | void print_header (FILE *f, char *tool) |
||
| 1172 | |||
| 1173 | { |
||
| 1174 | time_t now; |
||
| 1175 | struct tm *tim; |
||
| 1176 | |||
| 1177 | time (&now); |
||
| 1178 | tim = localtime (&now); |
||
| 1179 | fprintf (f, "-- FPGA / EPLD / PCB / VHDL tools --\n"); |
||
| 1180 | fprintf (f, "-- NFL Technologies 1995-2003 --\n\n"); |
||
| 1181 | fprintf (f, "-- by: Mike James \n\n"); |
||
| 1182 | fprintf ( |
||
| 1183 | f, "-- package version: %s compiled: %s--\n\n", Vertical_Version, Vertical_Time); |
||
| 1184 | fprintf ( |
||
| 1185 | f, |
||
| 1186 | VHDL_FMTSTR, |
||
| 1187 | tool, |
||
| 1188 | tim->tm_hour, |
||
| 1189 | tim->tm_min, |
||
| 1190 | tim->tm_sec, |
||
| 1191 | tim->tm_mday, |
||
| 1192 | tim->tm_mon + 1, |
||
| 1193 | tim->tm_year + 1900); |
||
| 1194 | } |
||
| 1195 | |||
| 1196 | /* puts a comment on the head of the file */ |
||
| 1197 | void print_VLOG_header (FILE *f, char *tool) |
||
| 1198 | |||
| 1199 | { |
||
| 1200 | time_t now; |
||
| 1201 | struct tm *tim; |
||
| 1202 | |||
| 1203 | time (&now); |
||
| 1204 | tim = localtime (&now); |
||
| 1205 | fprintf (f, "/* FPGA / EPLD / PCB / VHDL tools */\n"); |
||
| 1206 | fprintf (f, "/* NFL Technologies 1995-2003 --\n\n */"); |
||
| 1207 | fprintf (f, "/* by: Mike James \n\n */"); |
||
| 1208 | fprintf ( |
||
| 1209 | f, "/* package version: %s compiled: %s*/\n\n", Vertical_Version, Vertical_Time); |
||
| 1210 | fprintf ( |
||
| 1211 | f, |
||
| 1212 | VLOG_FMTSTR, |
||
| 1213 | tool, |
||
| 1214 | tim->tm_hour, |
||
| 1215 | tim->tm_min, |
||
| 1216 | tim->tm_sec, |
||
| 1217 | tim->tm_mday, |
||
| 1218 | tim->tm_mon + 1, |
||
| 1219 | tim->tm_year + 1900); |
||
| 1220 | } |