Subversion Repositories Vertical

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
/*
2
 * $Header: C:/cvsroot/Vert03/vertlib/database.h,v 1.2 2004/06/22 21:44:14 mjames Exp $
3
 *
4
 * $Log: database.h,v $
5
 * Revision 1.2  2004/06/22 21:44:14  mjames
6
 * Firrst build most files
7
 *
8
 * Revision 1.1.1.1  2003/11/04 23:34:56  mjames
9
 * Imported into local repositrory
10
 *
11
 * Revision 1.14  2003/01/02 21:37:15  mjames
12
 * Experiment on creating NOT_ROUTABLE_H and NOT_ROUTABLE_L
13
 * properties on the nets so that pin jumpers can be made without a problem.
14
 *
15
 * Still need to sort out pin assignments made to these not_routable nets
16
 * which will become legal in some cases so that pullups and pulldown
17
 * pins can be used on the FPGA.
18
 *
19
 * Revision 1.13  2002/09/30 13:26:01  MJAMES
20
 * Upgraded nets to include 'lhs_expression' being the range on the
21
 * left hand side of a signal connection to a port
22
 *
23
 * std_logic_vector (0) <= std_logic , on a port of a chip
24
 *
25
 * Revision 1.12  2002/09/09 10:14:14  mjames
26
 * Moved pin remapping function to pin ident editing function from
27
 * sorting pin name routine.
28
 *
29
 * Revision 1.11  2002/08/06 12:52:49  mjames
30
 * Merge in from latest version
31
 *
32
 * Revision 1.11  2002/03/21 17:12:58  mjames
33
 * Added search path to vertical file opening for read
34
 *
35
 * Revision 1.10  2002/01/16 11:22:42  mjames
36
 * database.h header file is read in first as it undefined DLL stuff irrelevant
37
 * to HPUX
38
 *
39
 * Revision 1.9  2001/12/20 13:53:09  mjames
40
 * Added a bundle width field to the chip declaration
41
 *
42
 * Revision 1.8  2001/10/31 22:20:02  mjames
43
 * Tidying up problematical comments caused by CVS
44
 * 'intelligent' comment guessing
45
 *
46
 * Revision 1.7  2001/10/23 21:12:43  mjames
47
 * Created preliminary 'disconnect_node' function
48
 *
49
 * Revision 1.6  2001/09/16 20:36:03  mjames
50
 * Second attempt to modify wire bundles to be connector rather than net
51
 * centric. Allows more than one connector to carry the same net,
52
 *
53
 * Revision 1.5  2001/09/16 19:49:54  mjames
54
 * Second attempt at bundling the pins on sockets
55
 *
56
 * Revision 1.4  2001/09/13 21:08:21  mjames
57
 * Added simple wire bundling data structures.
58
 *
59
 * Revision 1.3  2001/06/06 12:10:24  mjames
60
 * Move from HPUX
61
 *
62
 * Revision 1.2  2000/10/19 22:06:36  mjames
63
 * Removed spurious RCS log lines from new CVS stuff
64
 *
65
 * Revision 1.1.1.1  2000/10/19 21:58:35  mjames
66
 * Mike put it here
67
 *
68
 *
69
 *
70
 */
71
 #pragma once
72
#include "expression.h"
73
#include "generic.h"
74
 
75
#if !defined _DATABASE
76
#define _DATABASE
77
 
78
 
79
#define MAXIDLEN 1024
80
 
81
#define BUFPREFIX "XX_"
82
 
83
#if defined PC
84
#define VERTICAL_INI_PATH "vertical.ini"
85
#define VERTICAL_PATH ".;c:/cygwin/usr/local/vert_files"
86
#else
87
#define VERTICAL_INI_PATH "vertical.ini"
88
#define VERTICAL_PATH ".;$(HOME)/.caddata/vert_files"
89
/* DLL creation declaration mode. not used on HP */
90
#if !defined __declspec
91
#define __declspec(x)
9 mjames 92
#define DLLIMPORT
93
#define DLLEXPORT
94
 
2 mjames 95
#endif
96
#endif
97
 
98
/* incomplete declarations to placate 'c' */
99
 
100
struct connector;
101
struct net;
102
struct netref;
103
struct equivalent_node_set;
104
 
105
/* the direction list */
106
typedef enum
107
{
108
        NONE,
109
        INPUT,
110
        OUTPUT,
111
        BUFFER,
112
        BIDIR,
113
        CONFIG,
114
        POWER
115
} pindir_t;
116
 
117
#define Create 0
118
#define Search 1
119
 
120
#define ISNULLSTR(x) ((x == NULL) || (x && (x[0] == 0)))
121
 
122
/* operations to manipulate the data structure */
123
/* from the ACF reader */
124
 
125
/* typedef enum { Ident,Type,Name,Value,Datatype,How_Routed } property_t; */
126
typedef enum
127
{
128
        Ident,
129
        Type,
130
        Name,
131
        Value,
132
        How_Routed
133
} property_t;
134
 
135
/* used in seting the routing_status attribute of a net */
136
 
137
typedef enum
138
{
139
        Free,           /* name given may be reassigned */
140
        By_Name,        /* Routed by Name */
141
        By_Net,         /* Routed by already existing net */
142
        By_Fixed_Net,   /* Routed through fixed existing net */
143
        By_Exact_Net,   /* Routed using identical already existing net */
144
        By_Creating,    /* Routed by creating a new net */
145
        By_Jumpering,   /* Routed by connecting an existing net */
146
        By_FixPins,     /* can only go here as pins are fixed */
147
        Not_Routable,   /* not allowed to participate in any routing */
148
        Not_Routable_H, /* pullup/VCC */
149
        Not_Routable_L  /* pulldown/GND */
150
} HowRouted_t;
151
/* these macros are reliant on sorted ordinal values */
152
#define IS_NOT_ROUTABLE(x) ((x) >= Not_Routable)
153
#define IS_ROUTABLE(x) ((x) < Not_Routable)
154
 
155
/* a type to hold a VHDL data type */
156
typedef struct vhdl
157
{
158
        char *basetype;
159
        expression_t *decl_expr; /* the range given in its declaration */
160
 
161
        expression_t *expr;         /* the expression that is used to */
162
                                    /* define the values of high/low etc */
163
        expression_t *default_expr; /* default value assigned in declaration */
164
        /*  char * text; */         /* this is the original declaration */
165
                                    /*  int low;
166
                                      int high; */
167
        unsigned int valid : 1;     /* is the expression valid ? */
168
        unsigned int is_vector : 1; /* is this port a vector */
169
        unsigned int is_downto : 1; /* is the vector X TO Y or X DOWNTO Y  */
170
} vhdl_t;
171
 
172
/* object node : point in a circuit connected a socket and a net */
173
typedef struct node
174
{
175
        struct node *sktnext; /* linked to a socket */
176
        char *identifier;     /* e.g 102, A22 */
177
        char *name;           /* internal signal name (actually same as netname )  */
178
 
179
        vhdl_t *vhdltype;       /* the subset of the net that the node is connected to */
180
        vhdl_t *orig_vhdltype;  /* how this node was originally declared */
181
        expression_t *lhs_expr; /* if the net is sliced on socket pin assignment LHS */
182
        pindir_t pindir;        /* final pin type input? output? bidir? unknown? */
183
        int pin_group;          /* can say 'any pin in group(n) only  is interchangeable' */
184
        struct net *net;        /* refer to net this node is on (if known) */
185
 
186
        struct net *routed_net; /* which routed net connects to this node */
187
 
188
        int refcount;          /* how many nets refer to this node */
189
        struct socket *socket; /* refer to socket this node is part of */
190
        struct equivalent_node_set *equivalent_nodes; /* member of set of equivalent nodes */
191
 
192
        /* sorting data structure */
193
        char *id_numeric_chars; /* the numeric part of the identifier */
194
        int id_numeric_cnt; /* the number of numeric chars in this part of the identifier */
195
 
196
        char *id_alpha_chars; /* the alphabetic part of the identifier */
197
        int id_alpha_cnt;     /* the number of alpha chars in this part of the ident */
198
 
199
        int pin_row;
200
        int pin_col;
201
        int pin_index;    /*  the ordinal pin number : which would be used in a bundle */
202
        int bundle_index; /* if >=0 then this pin is in a bundle */
203
 
204
        unsigned int fixed_pin : 1;     /* if fixed_pin = 1 then this pin can only be used
205
                                           to connect to the net in a particular
206
                                           direction */
207
        unsigned int in_use : 1;        /* if '1' the node is used by a pin
208
                                           if '0' the node has had a dummy name assigned*/
209
        unsigned int template_flag : 1; /* used in template processing */
210
        unsigned int net_assigned : 1;  /* if '1' the node (name) has a net assigned
211
                                           to it by routing */
212
        unsigned int fix_location : 1;  /* if set then nets referring to this pin
213
                                           have to be connected to it and nowhere else */
214
        unsigned int reservation : 1;   /* mark this as a reserved pin when it is given rsvXXXX
215
                                           ident */
216
 
217
} node_t;
218
 
219
/* different nets may refer to the same nodes
220
   but dependent on whether net is desired or already routed, different rules
221
   apply */
222
 
223
typedef struct noderef
224
{
225
        struct noderef *next;
226
        pindir_t pindir; /* proposed pin type input ? output ? bidir ? unknown ? */
227
        node_t *node;
228
        struct net *join_parent; /* Which net this node reference is joined to (used in
229
                                    alias/jumpering */
230
        struct net *net;
231
        /* the net that owns this node reference */
232
        unsigned int r_flag : 1; /* a routing flag to indicate this node has been
233
                                    found already at this phase of routing  */
234
        /*  char * datatype; */  /* pointer to the data type of this node */
235
 
236
        vhdl_t *vhdltype;       /* what this now has been aliased to in VHDL */
237
        vhdl_t *orig_vhdltype;  /* what this now has been aliased to in VHDL */
238
        expression_t *lhs_expr; /* the expression will be copied over when routing . Bus slice
239
                                   on LHS of pin assignment */
240
        char *orig_name; /* if this pointer is not null then the name of this reference will be
241
                          used in place of the net name when listing the nets  */
242
 
243
        struct noderef *base_noderef; /* used in jumpering to define original node reference
244
                                         that will be renamed: in the original node reference
245
                                         this pointer is to itself */
246
} noderef_t;
247
 
248
/* the aliased net join means that each sub_net keeps its own
249
   signal name while its identiier is common. The Jumpered
250
   net join means that the new signal is to be treated
251
   as a new net entity */
252
 
253
typedef enum
254
{
255
        NotJoined = 0,
256
        Aliased,  /* names are aliased onto same physical piece of wire */
257
        Jumpered, /* separate wires can be joined together */
258
} JoinMode_t;
259
 
260
/* object net : a piece of wire connected to a set of nodes */
261
 
262
typedef struct net
263
{
264
        struct net *next;
265
        struct net *prev;                  /* demand that previous net be referred to */
266
        struct net **list_ref;             /* the membership of which list:
267
                                              routed_list unrouted_list named_list*/
268
        char *identifier;                  /* e.g N1, N2 */
269
        char *name;                        /* signal names */
270
        HowRouted_t how_routed;            /* in fact this indicates how it was routed */
271
        int nodecount;                     /* how many nodes does this net have ? */
272
        noderef_t *nodes;                  /* and all the other nodes on this net */
273
        struct net *join_parent;           /* Which net this net is joined to (used in
274
                                              alias/jumpering */
275
        struct net *subnets;               /* if this net has subnets , refer to them */
276
        struct net *joined_nets;           /* other nets at this level of join */
277
        struct net *unrouted_fix_net;      /* is there an unrouted net fixed to this one ? */
278
        struct net *vhdl_connect_net;      /* pointer to a net connected by VHDL connection */
279
        JoinMode_t how_joined;             /* if subnets, is this an alias join or a
280
                                              jumpered join */
281
        struct net *unrouted_reference;    /* points at the net that is the unrouted
282
                                              original , if this is a routed net. */
283
        node_t *external_node;             /* if not null and there is a jumper then print
284
                                              the external node name rather than the net name*/
285
        unsigned int nodes_reserved : 1;   /* This net has been processed by the
286
                                              ensure_reservation function in routing.c */
287
        unsigned int has_external : 1;     /* one of the net nodes (at least)
288
                                              is an external connection */
289
        unsigned int has_fix_location : 1; /* one of the net nodes (at least)
290
                                              is a FIX_LOCATION pin */
291
                                           /* expanded information for partitioning */
292
        unsigned int leaves_partition : 1; /* '1' : crosses boundary of partition*/
293
        unsigned int inside_partition : 1; /* '1' : in use as internal signal
294
                                              in partition */
295
        unsigned int needs_buff_sig : 1;   /* if '1' then the external connection needs a local
296
                                              signal */
297
        unsigned int force_port : 1;   /* if '1' then the net will be forced to be a port on
298
                                          partition  */
299
        unsigned int type_defined : 1; /* the signal type has been defined so does not need to
300
                                          be patched up by guesswork in the partition
301
                                          calculation Oct 2000*/
302
        /* bundle structures : cause signal renaming when sockets
303
           are converted to a wire bundle leaving the
304
           partition */
305
        unsigned int bundle_member; /* set if the net is a bundle member */
306
        int bundle_index;           /* the ordinal number of the pin of the bundle */
307
 
308
        pindir_t ext_dir;          /* basic boundary crossing direction*/
309
        /*  char *   datatype;  */ /* the string description of the data type */
310
        vhdl_t *vhdltype;          /* what this looks like in VHDL */
311
} net_t;
312
 
313
/* net reference list, attched to a node */
314
typedef struct netref
315
{
316
        struct netref *next;
317
        net_t *net;
318
} netref_t;
319
 
320
/* unrouted node reference, which permits node by node pin  renaming */
321
 
322
typedef struct unrouted_ref
323
{
324
        struct unrouted_ref *next;
325
        net_t **listref;  /* the root pointer of which list this unrouted reference has been
326
                             added to */
327
        char *identifier; /* used to point to the pin identifier before creating unrouted net
328
                           */
329
        char *name;       /* this is the name by which this pin shall be known */
330
        char *orig_name; /* if this pointer is not null then the name of this reference will be
331
                            used in place of the net name when creating the nets !! */
332
        pindir_t pindir; /* proposed pin type input ? output ? bidir ? unknown ? */
333
        int pin_group;
334
        vhdl_t *vhdltype;       /* what this looks like in VHDL */
335
        vhdl_t *orig_vhdltype;  /* place holder for the signal type as originally declared */
336
        expression_t *lhs_expr; /* expression is sliced on the LHS */
337
} unrouted_ref_t;
338
 
339
/* member of list of pins  that carry the same signal on a device */
340
typedef struct equivalent_node
341
{
342
        struct equivalent_node *next;
343
        node_t *node;
344
} equivalent_node_t;
345
 
346
/* pointer to list of lists of pins  that carry the same signal on a device */
347
typedef struct equivalent_node_set
348
{
349
        struct equivalent_node_set *next;
350
        equivalent_node_t *nodes;
351
} equivalent_node_set_t;
352
 
353
/* a chip socket is a socket, as are all the board connectors */
354
/* A lastnode pointer is provided so that new nodes can be added to the     */
355
/* end rather than the beginning of the list */
356
/* reason: so that priority of assigning nodes is kept */
357
/* this will be altered by the sorting of the nodes by identifier */
358
typedef struct socket
359
{
360
        struct socket *next;
361
        struct socket *template_socket; /* the VHDL component for this entity if present */
362
        char *identifier;               /* e.g U1, U2 */
363
        char *type;
364
        char *name;
365
        char *value;
366
        node_t *nodes; /* the nodes attached to this chip */
367
        node_t *lastnode;
368
        unrouted_ref_t *unrouted_refs; /* when an unrouted node is read in the node is added
369
                                          here */
370
        generic_info_t *generics;      /* look in generic.c for more info */
371
        generic_info_t *unrouted_generics;          /* before elaboration */
372
        equivalent_node_set_t *equivalent_node_set; /* these pins carry equivalent signals
373
                                         FPGA context : represent inner through signals
374
                                         component context : represent external jumpers
375
                                         around pins of component. */
376
 
377
        int max_pin_col; /* determine pin identifier limits for later (see sorting.c, */
378
        int min_pin_col; /* sorting device pin IDs for more info.)                    */
379
        int max_pin_row;
380
        int min_pin_row;
381
 
382
        unsigned int is_FPGA : 1; /*  alters interpretation of equivalent nodes */
383
 
384
        unsigned int selected : 1;    /* a '1' here is used in the VHDL printout */
385
        unsigned int is_external : 1; /* a '1' here changes the rules about external ports*/
386
                                      /* If it is external then all nets attached give their
387
                                         names to the pins of the socket rather than calling
388
                                         them 'rsvXXXXXz' */
389
        unsigned int is_template : 1; /*   this chip is a template if it is '1' */
390
        unsigned int socket_type_seen : 1;  /* used in verilog printout to force
391
                                             * printout of only one instance
392
                                             * of a particular type */
393
        struct socket *parent_template_ref; /*   this chip is an alias template if this pointer
394
                                               is non-null  */
395
        int route_flags;      /* any device can have its fasttrack flags set independently */
396
        int named_in_use_cnt; /* counters used by the statistics module */
397
        int named_cnt;
398
        int routed_cnt;
399
        int unrouted_cnt;
400
        int lowest_bundle; /* base for bundle indices */
401
 
402
        int highest_bundle; /* non-zero will create an external net declaration using a bus
403
                               with highest_bundle -1 pins on it in the top level of a
404
                               partition */
405
        int bundle_width;   /* number of valid pins in the bundle */
406
} socket_t;
407
 
408
/* case insensitive strcmp */
409
extern int strcmp2 (char *s, char *t);
410
 
411
/* this is equvalent to 'strdup' but checks null pointer */
412
/* extern char *  allocstr(char * s); */
413
#define allocstr(s) ((s) == NULL ? NULL : strdup (s))
414
 
415
extern vhdl_t *get_vhdl_buswidth (noderef_t *ref);
416
 
417
extern void define_pin (
418
    net_t **listref,
419
    socket_t *chip,
420
    char *name,
421
    int pin_type,
422
    int pin_group,
423
    char *identifier,
424
    vhdl_t *vhdl,
425
    expression_t *lhs_expr);
426
 
427
/* this is a check on a socket ident : if it doesnt have one */
428
 
429
extern void ensure_socket_ident (socket_t *chip);
430
 
431
/* a string that is suffixed to names and identifiers
432
   when read in from the database */
433
 
434
extern void set_board_suffix (char *s);
435
 
436
/* set the socket type for further information */
437
extern void set_socket (socket_t *socket, property_t prop, char *str);
438
 
439
/* Tell the system about a new socket */
440
/* locate a socket by a property */
441
extern socket_t *find_socket (property_t prop, char *str, int srchonly, socket_t **head_ref);
442
 
443
extern void set_net (net_t *net, property_t prop, char *str);
444
 
445
extern net_t *find_net (net_t **listref, property_t prop, char *str, int srchonly);
446
 
447
/* set a node property */
448
extern void set_node (node_t *node, property_t prop, char *str);
449
 
450
/* locate a node on a chip by a property */
451
extern node_t *find_node (socket_t *socket, property_t prop, char *str, int srchonly);
452
 
453
/* joins a node to a net */
454
extern void connect_node_net (
455
    char *orig_name, /* added to allow name aliasing (this will be the OLD name ) */
456
    node_t *cnode,
457
    net_t *cnet,
458
    pindir_t pindir,
459
    vhdl_t *vhdl,
460
    vhdl_t *orig_vhdl,
461
    expression_t *lhs_expr);
462
 
463
/* remove net name attributes from the routed list */
464
extern void del_net_names (char *template);
465
 
466
/* disconnect a node from the netlist */
467
extern void disconnect_node (socket_t *chip, node_t *node);
468
 
469
/* global variables */
470
/* used in setting the routing status attribute of a net */
471
/* these are constant strings  */
472
/*extern char   Routed[]  ;     */ /* "Routed"    */
473
/*extern char   AssignedName[] ;*/ /* "Named"     */
474
/*extern char   Unrouted[] ;    */ /* "Unrouted"  */
475
 
476
extern socket_t *socket_head;
477
extern socket_t *template_head;
478
extern net_t *routed_list;
479
extern net_t *named_list;
480
extern net_t *named_tail;
481
extern net_t *unrouted_list;
482
 
483
extern char nullstr[];
484
 
485
extern char *decode_how_routed[];
486
 
487
extern char *decode_which_list (net_t **list_head);
488
 
489
/* this points at std_logic, std_ulogic etc */
490
extern vhdl_t *default_vhdl_datatype;
491
extern vhdl_t *default_vhdl_bustype;
492
 
493
extern void InitialiseData (void);
494
 
495
#endif