Subversion Repositories Vertical

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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