Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | /* |
2 | * $Id: unrouted.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $ |
||
3 | * |
||
4 | * $Log: unrouted.c,v $ |
||
5 | * Revision 1.1.1.1 2003/11/04 23:34:57 mjames |
||
6 | * Imported into local repositrory |
||
7 | * |
||
8 | * Revision 1.5 2002/09/27 22:27:37 MJAMES |
||
9 | * Added lhs_expr for cases like |
||
10 | * |
||
11 | * x(0) <= y |
||
12 | * |
||
13 | * where x is std_logic_vector(0 downto 0) and y is std_logic. |
||
14 | * |
||
15 | * Revision 1.4 2002/01/16 10:08:53 mjames |
||
16 | * converted to use #ident |
||
17 | * |
||
18 | * Revision 1.3 2001/10/31 22:20:19 mjames |
||
19 | * Tidying up problematical comments caused by CVS |
||
20 | * 'intelligent' comment guessing |
||
21 | * |
||
22 | */ |
||
23 | |||
24 | #include "unrouted.h" |
||
25 | |||
26 | #include "cmdlog.h" |
||
27 | #include "cmdparse.h" |
||
28 | #include "database.h" |
||
29 | #include "expression.h" |
||
30 | #include "generic.h" |
||
31 | #include "lx_support.h" |
||
32 | #include "statistics.h" |
||
33 | #include "vertcl_main.h" |
||
34 | |||
35 | #include <ctype.h> |
||
36 | #include <stdio.h> |
||
37 | #include <stdlib.h> |
||
38 | #include <string.h> |
||
39 | |||
40 | #ident \ |
||
41 | "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/unrouted.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $" |
||
42 | |||
43 | /* function that creates the node reference lists for one chip in the list , |
||
44 | these functions perform operations that were done inside database.c. |
||
45 | */ |
||
46 | |||
47 | int create_nodes_from_refs (socket_t *socket, int donesomething) |
||
48 | { |
||
49 | unrouted_ref_t *ref, *prev; |
||
50 | node_t *cnode; |
||
51 | net_t *cnet; |
||
52 | char null_name; |
||
53 | char *netname; |
||
54 | int errseen = 0; |
||
55 | if (!socket) |
||
56 | { |
||
57 | Log (LOG_ERROR, "-- missing socket \n"); |
||
58 | return (1); |
||
59 | } |
||
60 | |||
61 | ref = socket->unrouted_refs; |
||
62 | while (ref) |
||
63 | { |
||
64 | /* pick up any new pin identifiers */ |
||
65 | cnode = find_node (socket, Ident, ref->identifier, Create); |
||
66 | |||
67 | /* if this node is already on a net on the routed list, |
||
68 | it has already been linked up |
||
69 | so it should not be duplicated !! */ |
||
70 | /* iterate each node on the chip */ |
||
71 | |||
72 | if ((ref->listref == &routed_list) && cnode->net) /* duplicate !!! */ |
||
73 | { |
||
74 | if (!errseen) |
||
75 | { |
||
76 | errseen = 1; |
||
77 | Log ( |
||
78 | LOG_ERROR, |
||
79 | "-- Errors while creating unrouted list from pins :\n"); |
||
80 | } |
||
81 | Log ( |
||
82 | LOG_ERROR, |
||
83 | "-- Error ! node %s(%s) is already in existence on routed net " |
||
84 | "%s\n", |
||
85 | socket->identifier, |
||
86 | ref->identifier, |
||
87 | cnode->net->name); |
||
88 | } |
||
89 | else |
||
90 | { |
||
91 | netname = ref->name; |
||
92 | null_name = ISNULLSTR (netname); |
||
93 | /* bidir pins are essentially free for routing */ |
||
94 | if (null_name || socket->is_template) |
||
95 | { |
||
96 | if (ref->pindir != BIDIR) |
||
97 | cnode->fixed_pin = 1; |
||
98 | cnode->pindir = ref->pindir; |
||
99 | } |
||
100 | if (socket->is_template || ref->listref == &routed_list) |
||
101 | { |
||
102 | cnode->pin_group = ref->pin_group; |
||
103 | |||
104 | cnode->vhdltype = ref->vhdltype; |
||
105 | #if defined DEBUG_EXPRESSION |
||
106 | if (cnode->vhdltype) |
||
107 | { |
||
108 | print_msg_expression ( |
||
109 | stdout, "COPYING ", cnode->vhdltype->expr); |
||
110 | } |
||
111 | #endif |
||
112 | if (!null_name) |
||
113 | cnode->name = strdup (netname); |
||
114 | } |
||
115 | if (!socket->is_template && !null_name) |
||
116 | { |
||
117 | cnet = find_net (ref->listref, Ident, netname, Create); |
||
118 | connect_node_net ( |
||
119 | ref->orig_name, |
||
120 | cnode, |
||
121 | cnet, |
||
122 | ref->pindir, |
||
123 | ref->vhdltype, |
||
124 | ref->orig_vhdltype, |
||
125 | ref->lhs_expr); |
||
126 | donesomething = 1; |
||
127 | }; |
||
128 | } |
||
129 | prev = ref; |
||
130 | ref = ref->next; |
||
131 | free (prev); |
||
132 | } |
||
133 | socket->unrouted_refs = NULL; /* remove any references to unrouted stuff, |
||
134 | they are all free()'d now */ |
||
135 | |||
136 | return 0; |
||
137 | } |
||
138 | |||
139 | /* creates the unrouted list from unrouted_refs list for all sockets */ |
||
140 | |||
141 | void create_unrouted_list (void) |
||
142 | { |
||
143 | socket_t *socket = socket_head; |
||
144 | int donesomething = 0; |
||
145 | while (socket) |
||
146 | { |
||
147 | donesomething = create_nodes_from_refs (socket, donesomething); |
||
148 | socket = socket->next; |
||
149 | } |
||
150 | if (donesomething) |
||
151 | Log (LOG_GENERAL, "-- New pins converted to unrouted net\n"); |
||
152 | } |
||
153 | |||
154 | void rename_unrouted_pin_socket ( |
||
155 | socket_t *socket, char *old_name, char *new_name, vhdl_t *vhdl_type) |
||
156 | { |
||
157 | unrouted_ref_t *ref; |
||
158 | char *socket_name; |
||
159 | |||
160 | socket_name = socket->identifier; |
||
161 | |||
162 | ref = socket->unrouted_refs; |
||
163 | |||
164 | if (!ref) |
||
165 | Log ( |
||
166 | LOG_ERROR, "# ERROR pin rename : no pin '%s.%s'\n", socket_name, old_name); |
||
167 | |||
168 | while (ref) |
||
169 | { |
||
170 | if (strcmp2 (old_name, ref->name) == 0) |
||
171 | { |
||
172 | /* do rename only if there is a rename */ |
||
173 | if (strcmp2 (ref->orig_name, ref->name) != 0) |
||
174 | { |
||
175 | ref->orig_name = ref->name; /* keep old name in alias part */ |
||
176 | ref->name = |
||
177 | strdup (new_name); /* and rename the unrouted node */ |
||
178 | } |
||
179 | /* if it does not have a base type then copy it */ |
||
180 | if (!vhdl_type->basetype) |
||
181 | vhdl_type->basetype = default_vhdl_datatype->basetype; |
||
182 | |||
183 | /* do pinslicing only if there is a pin slice involved */ |
||
184 | |||
185 | if (vhdl_type != default_vhdl_datatype) |
||
186 | { |
||
187 | ref->orig_vhdltype = |
||
188 | ref->vhdltype; /* keep old VHDL type around */ |
||
189 | if (vhdl_type) |
||
190 | ref->vhdltype = copy_vhdl ( |
||
191 | vhdl_type, socket); /* assign the new vhdl type */ |
||
192 | } |
||
193 | |||
194 | if (level & 16) |
||
195 | { |
||
196 | Log ( |
||
197 | LOG_GENERAL, |
||
198 | "# renaming '%s.%s' to be '%s'\n", |
||
199 | socket_name, |
||
200 | ref->orig_name, |
||
201 | ref->name); |
||
202 | } |
||
203 | break; |
||
204 | } |
||
205 | ref = ref->next; |
||
206 | } |
||
207 | } |
||
208 | |||
209 | void rename_unrouted_pin (char *socket_name, char *old_name, char *new_name, vhdl_t *vhdl_type) |
||
210 | { |
||
211 | socket_t *socket; |
||
212 | socket = find_socket (Ident, socket_name, Search, &socket_head); |
||
213 | if (!socket) |
||
214 | { |
||
215 | Log ( |
||
216 | LOG_ERROR, |
||
217 | "# ERROR connecting port : Cannot Locate socket identified as '%s'\n", |
||
218 | socket_name); |
||
219 | } |
||
220 | else |
||
221 | rename_unrouted_pin_socket (socket, old_name, new_name, vhdl_type); |
||
222 | } |