Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 11 | ||
---|---|---|---|
Line 51... | Line 51... | ||
51 | * |
51 | * |
52 | * Revision 1.1 2001/09/12 21:27:21 mjames |
52 | * Revision 1.1 2001/09/12 21:27:21 mjames |
53 | * Bundling for Certify .vb files. Bundle up all wires on a connector into a bus |
53 | * Bundling for Certify .vb files. Bundle up all wires on a connector into a bus |
54 | * with the same name as the connector and a width the same as the pins |
54 | * with the same name as the connector and a width the same as the pins |
55 | * on the connector |
55 | * on the connector |
56 | * |
56 | * |
57 | */ |
57 | */ |
- | 58 | #include <stdio.h> |
|
- | 59 | #include <string.h> |
|
58 | #include "cmdlog.h" |
60 | #include <stdlib.h> |
59 | #include "cmdparse.h" |
61 | #include <ctype.h> |
- | 62 | #include <sys/types.h> |
|
- | 63 | #include <regex.h> |
|
- | 64 | ||
- | 65 | ||
60 | #include "database.h" |
66 | #include "vertcl_main.h" |
61 | #include "expression.h" |
67 | #include "expression.h" |
62 | #include "generic.h" |
68 | #include "generic.h" |
- | 69 | #include "database.h" |
|
- | 70 | #include "cmdparse.h" |
|
- | 71 | #include "cmdlog.h" |
|
63 | #include "printout.h" |
72 | #include "printout.h" |
64 | #include "sorting.h" |
73 | #include "sorting.h" |
65 | #include "vertcl_main.h" |
- | |
66 | 74 | ||
67 | #include <ctype.h> |
- | |
68 | #include <regex.h> |
- | |
69 | #include <stdio.h> |
75 | #include <stdio.h> |
70 | #include <stdlib.h> |
- | |
71 | #include <string.h> |
- | |
72 | #include <sys/types.h> |
- | |
73 | 76 | ||
74 | #ident "@(#)$Header: C:/cvsroot/Vert03/vertlib/bundle.c,v 1.2 2004/06/22 21:44:14 mjames Exp $" |
77 | #ident "@(#)$Header: C:/cvsroot/Vert03/vertlib/bundle.c,v 1.2 2004/06/22 21:44:14 mjames Exp $" |
75 | 78 | ||
- | 79 | ||
76 | /* this function sets or clears all of the bundle group related to a socket */ |
80 | /* this function sets or clears all of the bundle group related to a socket */ |
77 | /* it allocates a unique integer to each net on the port list of the socket */ |
81 | /* it allocates a unique integer to each net on the port list of the socket */ |
78 | 82 | ||
79 | /* faults : Does not check pin directions yet */ |
83 | /* faults : Does not check pin directions yet */ |
80 | /* assumes a net is only on one socket. not true for rings ! */ |
84 | /* assumes a net is only on one socket. not true for rings ! */ |
81 | 85 | ||
82 | static void set_bundle (socket_t *socket, int set_or_clear) |
86 | static void set_bundle(socket_t * socket, int set_or_clear ) |
83 | { |
87 | { |
84 | node_t *node; |
88 | node_t * node; |
85 | int rows, columns; |
89 | int rows,columns; |
86 | int bundle; |
90 | int bundle; |
87 | int bundle_base; |
91 | int bundle_base; |
88 | /* Use generics to set up the bundle base */ |
92 | /* Use generics to set up the bundle base */ |
89 | 93 | ||
90 | generic_info_t gen[1]; |
94 | generic_info_t gen[1]; |
91 | 95 | ||
92 | if (!socket) |
96 | if(!socket) |
93 | return; |
97 | return; |
94 | 98 | ||
95 | /* is the array going from 130:1 or 129:0 ... */ |
99 | /* is the array going from 130:1 or 129:0 ... */ |
96 | bundle_base = 1; |
100 | bundle_base = 1; |
97 | if (get_generic_value (&socket->generics, "bundle_base", gen) == IS_INTEGER) |
101 | if (get_generic_value(&socket->generics, "bundle_base",gen) == IS_INTEGER) |
98 | { |
102 | { |
99 | bundle_base = eval_expression (gen->expr, &global_generics); |
103 | bundle_base = eval_expression(gen->expr, &global_generics); |
100 | } |
104 | } |
101 | 105 | ||
102 | /* Removed Nov 2008 MDJ |
106 | |
103 | if (get_generic_value(&global_generics, "bundle_base",gen) == IS_INTEGER) |
107 | /* Removed Nov 2008 MDJ |
104 | { |
108 | if (get_generic_value(&global_generics, "bundle_base",gen) == IS_INTEGER) |
105 | bundle_base = eval_expression(gen->expr, &global_generics); |
109 | { |
106 | } |
110 | bundle_base = eval_expression(gen->expr, &global_generics); |
107 | */ |
111 | } |
108 | /* |
112 | */ |
109 | printf("bundle base \n",bundle_base); |
113 | /* |
110 | */ |
114 | printf("bundle base \n",bundle_base); |
111 | 115 | */ |
|
112 | sort_nodes (socket, EXTRACT_XY); |
116 | |
113 | 117 | ||
114 | /* the sort routine tells me pin row and column limits */ |
118 | sort_nodes(socket,EXTRACT_XY); |
115 | /* rows are defined as numbers, columns defined as letters */ |
119 | |
116 | rows = socket->max_pin_row - socket->min_pin_row + 1; |
120 | /* the sort routine tells me pin row and column limits */ |
117 | columns = socket->max_pin_col - socket->min_pin_col + 1; |
121 | /* rows are defined as numbers, columns defined as letters */ |
118 | node = socket->nodes; |
122 | rows = socket->max_pin_row - socket->min_pin_row+1; |
119 | bundle = 0; |
123 | columns = socket->max_pin_col - socket->min_pin_col+1; |
120 | while (node) |
124 | node = socket-> nodes; |
121 | { |
125 | bundle = 0; |
122 | net_t *net = node->net; |
126 | while (node) |
123 | /* |
127 | { |
124 | printf("node %s\n",node->identifier); |
128 | net_t * net = node->net; |
125 | */ |
129 | /* |
126 | if (net) |
130 | printf("node %s\n",node->identifier); |
127 | { |
131 | */ |
128 | if (set_or_clear && net->how_routed != Not_Routable) |
132 | if(net) |
129 | { |
133 | { |
130 | node->bundle_index = |
134 | if(set_or_clear && net->how_routed != Not_Routable) |
131 | node->pin_row - socket->min_pin_row + |
135 | { |
132 | (node->pin_col - socket->min_pin_col) * rows + bundle_base; |
136 | node->bundle_index = node->pin_row - socket->min_pin_row + |
133 | net->bundle_member = 1; |
137 | (node->pin_col - socket->min_pin_col) * rows +bundle_base; |
134 | bundle++; |
138 | net->bundle_member =1; |
135 | /* |
139 | bundle++; |
136 | printf("net %s -> |
140 | /* |
137 | %s[%d]\n",net->identifier,net->bundle_parent->identifier,net->bundle_index); |
141 | printf("net %s -> %s[%d]\n",net->identifier,net->bundle_parent->identifier,net->bundle_index); |
138 | */ |
142 | */ |
139 | } |
143 | } |
140 | else /* clear */ |
144 | else /* clear */ |
141 | { |
145 | { |
142 | node->bundle_index = -1; |
146 | node->bundle_index = -1; |
143 | net->bundle_member = 0; |
147 | net->bundle_member = 0; |
144 | } |
148 | } |
145 | } |
149 | } |
146 | else |
150 | else |
147 | { |
151 | { |
148 | node->bundle_index = -1; |
152 | node->bundle_index = -1; |
149 | } |
153 | } |
150 | node = node->sktnext; |
154 | node = node->sktnext; |
151 | } |
155 | } |
152 | if (set_or_clear) |
156 | if (set_or_clear) |
153 | { |
157 | { |
154 | socket->highest_bundle = |
158 | socket->highest_bundle = rows * columns+bundle_base-1 ; /* one more than bundle pins */ |
155 | rows * columns + bundle_base - 1; /* one more than bundle pins */ |
159 | socket->lowest_bundle = bundle_base; |
156 | socket->lowest_bundle = bundle_base; |
160 | socket->bundle_width = bundle; |
157 | socket->bundle_width = bundle; |
161 | } |
158 | } |
162 | else |
159 | else |
163 | { |
160 | { |
164 | socket->highest_bundle = 0; |
161 | socket->highest_bundle = 0; |
165 | socket->lowest_bundle = 0; |
162 | socket->lowest_bundle = 0; |
166 | socket->bundle_width = 0; |
163 | socket->bundle_width = 0; |
167 | } |
164 | } |
168 | /* for further declarations */ |
165 | /* for further declarations */ |
169 | } |
166 | } |
170 | |
- | 171 | ||
- | 172 | ||
- | 173 | void wildcard_bundle(char * chip_id_template, int create_or_delete) |
|
- | 174 | { |
|
- | 175 | int rc; |
|
- | 176 | socket_t * skt = socket_head; |
|
- | 177 | int count = 0; |
|
- | 178 | int found = 0; |
|
- | 179 | ||
- | 180 | /* create_unrouted_list(); */ |
|
- | 181 | /* compile regular expression */ |
|
- | 182 | vert_regex_t * preg; |
|
- | 183 | ||
- | 184 | ||
- | 185 | if(!chip_id_template) { |
|
- | 186 | chip_id_template = ".*"; |
|
- | 187 | } |
|
- | 188 | ||
- | 189 | rc = vert_regcomp(&preg,chip_id_template); |
|
- | 190 | if (rc != 0 ) |
|
- | 191 | { |
|
- | 192 | char errbuff[100]; |
|
- | 193 | regerror(rc,preg->preg,errbuff,100); |
|
- | 194 | Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,chip_id_template); |
|
- | 195 | ||
- | 196 | /* return TCL_ERROR; |
|
- | 197 | */ |
|
- | 198 | return; |
|
- | 199 | } |
|
- | 200 | else |
|
- | 201 | { |
|
- | 202 | Log(LOG_GENERAL,"-- Using '%s' as match pattern\n",chip_id_template); |
|
- | 203 | } |
|
- | 204 | while(skt ) |
|
- | 205 | { |
|
- | 206 | ||
- | 207 | found = regexec(preg->preg,skt->identifier,0,preg->regpatt,0); |
|
- | 208 | ||
- | 209 | if(!found) { |
|
- | 210 | /* |
|
- | 211 | Log(LOG_GENERAL,"found %s\n",skt->identifier); |
|
- | 212 | */ |
|
- | 213 | count++; |
|
- | 214 | set_bundle(skt,create_or_delete); |
|
- | 215 | } |
|
- | 216 | skt = skt->next; |
|
- | 217 | } |
|
- | 218 | Log(LOG_GENERAL,"-- matched %d sockets\n",count); |
|
- | 219 | vert_regfree(&preg); |
|
- | 220 | } |
|
167 | 221 | ||
168 | void wildcard_bundle (char *chip_id_template, int create_or_delete) |
- | |
169 | { |
- | |
170 | int rc; |
- | |
171 | socket_t *skt = socket_head; |
- | |
172 | int count = 0; |
- | |
173 | int found = 0; |
- | |
174 | - | ||
175 | /* create_unrouted_list(); */ |
- | |
176 | /* compile regular expression */ |
- | |
177 | vert_regex_t *preg; |
- | |
178 | 222 | ||
179 | if (!chip_id_template) |
- | |
180 | { |
- | |
181 | chip_id_template = ".*"; |
- | |
182 | } |
- | |
183 | - | ||
184 | rc = vert_regcomp (&preg, chip_id_template); |
- | |
185 | if (rc != 0) |
- | |
186 | { |
- | |
187 | char errbuff[100]; |
- | |
188 | regerror (rc, preg->preg, errbuff, 100); |
- | |
189 | Log ( |
- | |
190 | LOG_ERROR, |
- | |
191 | "-- Problem (rc=%d) %s with '%s' as regular expression\n", |
- | |
192 | rc, |
- | |
193 | errbuff, |
- | |
194 | chip_id_template); |
- | |
195 | - | ||
196 | /* return TCL_ERROR; |
- | |
197 | */ |
- | |
198 | return; |
- | |
199 | } |
- | |
200 | else |
- | |
201 | { |
- | |
202 | Log (LOG_GENERAL, "-- Using '%s' as match pattern\n", chip_id_template); |
- | |
203 | } |
- | |
204 | while (skt) |
- | |
205 | { |
- | |
206 | found = regexec (preg->preg, skt->identifier, 0, preg->regpatt, 0); |
- | |
207 | - | ||
208 | if (!found) |
- | |
209 | { |
- | |
210 | /* |
- | |
211 | Log(LOG_GENERAL,"found %s\n",skt->identifier); |
- | |
212 | */ |
- | |
213 | count++; |
- | |
214 | set_bundle (skt, create_or_delete); |
- | |
215 | } |
- | |
216 | skt = skt->next; |
- | |
217 | } |
- | |
218 | Log (LOG_GENERAL, "-- matched %d sockets\n", count); |
- | |
219 | vert_regfree (&preg); |
- | |
220 | } |
- |