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
 * $Id: ext_nets.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $
3
 *
4
 * $Log: ext_nets.c,v $
5
 * Revision 1.1.1.1  2003/11/04 23:34:57  mjames
6
 * Imported into local repositrory
7
 *
8
 * Revision 1.13  2002/09/09 10:26:56  mjames
9
 * Removed set generic range and replaced it with a set generic value command
10
 * that takes both integers and ranges.
11
 *
12
 * Revision 1.12  2002/01/16 10:07:42  mjames
13
 * converted to use #ident
14
 *
15
 * Revision 1.11  2001/10/31 22:20:04  mjames
16
 * Tidying up problematical comments caused by CVS
17
 * 'intelligent' comment guessing
18
 *
19
 * Revision 1.10  2001/10/31 16:22:15  mjames
20
 * Added a datastructure to hide regular expression information from programs.
21
 * Changed call to regexec to indicate 0 subexpressions to be matched
22
 * rather than a number dependent on strlen(string) which was wrong.
23
 *
24
 * Revision 1.9  2001/10/10 20:18:23  mjames
25
 * Added a vert_regcomp function to compile regular expressions
26
 * with '^' (match start string) and  '$' (match end string) bracketing
27
 * this => wildcard must match entire string not just a part of it.
28
 *
29
 * Revision 1.8  2001/10/07 20:50:53  mjames
30
 * Added wildcard checking (warn user about
31
 * using wildcard '*' on the end of a string in stead of wildcard '.*')
32
 *
33
 * Revision 1.7  2001/09/25 23:15:23  mjames
34
 * Converted wildcards to use proper regexp pattern match library
35
 *
36
 * Revision 1.6  2001/07/09 15:36:17  mjames
37
 * Removed verbose diagnostics from the setting and clearing of flags.
38
 *
39
 * Revision 1.5  2001/06/07 14:46:48  mjames
40
 * Corrected conflict
41
 *
42
 * Revision 1.4  2001/06/07 13:38:15  MJAMES
43
 * Removed internal/external detection from jumpering and
44
 * placed it in ext_nets.c so that the properties of nets affected by set/del ext are
45
 * correctly updated
46
 *
47
 * Revision 1.3  2001/06/06 12:10:23  mjames
48
 * Move from HPUX
49
 *
50
 * Revision 1.2  2001/03/29 22:08:56  mjames
51
 * Modified to define the scope of set generic commands : now can be global
52
 * or defined for a socket or a simple wildcarded list of sockets.
53
 *
54
 * In addition the is_FPGA property has been activated so that FPGA components
55
 * are not listed out when used in a Verilog (.vb) file.
56
 *
57
 * Version raised to 11.02
58
 *
59
 * Revision 1.1.1.1  2000/10/19 21:58:37  mjames
60
 * Mike put it here
61
 *
62
 *
63
 * Revision 1.27  2000/10/04  10:37:04  10:37:04  mjames (Mike James)
64
 * Modified for Vertical2 : support COMPONENTS and SIGNALS
65
 *
66
 * Revision 1.27  2000/10/04  10:37:04  10:37:04  mjames (Mike James)
67
 * Part of Release PSAVAT01
68
 *
69
 * Revision 1.26  2000/10/02  11:04:12  11:04:12  mjames (Mike James)
70
 * new_vhdl
71
 *
72
 * Revision 1.25  2000/09/27  14:42:13  14:42:13  mjames (Mike James)
73
 * Part of Release Sep_27_ST_2000
74
 *
75
 * Revision 1.24  2000/09/21  10:15:42  10:15:42  mjames (Mike James)
76
 * Part of Release Sep21Alpha
77
 *
78
 * Revision 1.23  2000/08/25  09:57:11  09:57:11  mjames (Mike James)
79
 * Part of Release Aug25_alpha
80
 *
81
 * Revision 1.22  2000/08/16  08:57:27  08:57:27  mjames (Mike James)
82
 * Part of Release CD01_Aug2000
83
 *
84
 * Revision 1.21  2000/08/14  14:45:08  14:45:08  mjames (Mike James)
85
 * Part of Release Aug_14_2000
86
 *
87
 * Revision 1.20  2000/08/11  08:30:29  08:30:29  mjames (Mike James)
88
 * Part of Release Aug_11_2000
89
 *
90
 * Revision 1.19  2000/08/09  10:31:43  10:31:43  mjames (Mike James)
91
 * Part of Release Aug__9_2000
92
 *
93
 * Revision 1.18  2000/05/31  11:42:51  11:42:51  mjames (Mike James)
94
 * Part of Release May_31_2000
95
 *
96
 * Revision 1.17  2000/05/08  17:01:34  17:01:34  mjames (Mike James)
97
 * Part of Release May__8_2000
98
 *
99
 * Revision 1.16  2000/05/08  16:59:27  16:59:27  mjames (Mike James)
100
 * Part of Release May__8_2000
101
 *
102
 * Revision 1.15  2000/05/08  16:57:04  16:57:04  mjames (Mike James)
103
 * Part of Release May__8_2000
104
 *
105
 * Revision 1.14  2000/03/08  16:18:58  16:18:58  mjames (Mike James)
106
 * New version including PC
107
 *
108
 * Revision 1.11  2000/01/20  15:58:43  15:58:43  mjames (Mike James)
109
 * Part of Release R22
110
 *
111
 * Revision 1.10  99/12/22  11:15:23  11:15:23  mjames (Mike James)
112
 * Part of Release Dec_22_1999
113
 *
114
 * Revision 1.9  99/06/25  14:35:27  14:35:27  mjames (Mike James)
115
 * Added in reference to expression.h, but no changes made
116
 * to the function of acfread yet.
117
 *
118
 * Revision 1.8  99/06/18  09:23:50  09:23:50  mjames (Mike James)
119
 *
120
 * Revision 1.7  98/04/24  14:11:18  14:11:18  mjames (Mike James)
121
 * added generic.h header
122
 *
123
 * Revision 1.6  97/04/23  08:42:50  08:42:50  mjames (Mike James)
124
 * CHecked in for release rel23041997
125
 *
126
 * Revision 1.5  97/01/03  13:37:41  13:37:41  mjames (Mike James)
127
 * Altered the set/del ext functions to make themn stop after
128
 * they have found a match if a wildcarded net identifier was
129
 * not given.
130
 *
131
 * Revision 1.4  96/07/19  14:38:53  14:38:53  mjames (Mike James)
132
 * Update to give to PRL
133
 *
134
 * Revision 1.3  1996/07/12  15:52:12  mjames
135
 * Sorted out things like Alias and Jumpers
136
 * Work Correctly
137
 * Print COrrectly
138
 *
139
 * Revision 1.3  1996/07/12  15:52:12  mjames
140
 * Sorted out things like Alias and Jumpers
141
 * Work Correctly
142
 * Print COrrectly
143
 *
144
 * Revision 1.2  96/06/17  13:01:53  13:01:53  mjames (Mike James)
145
 * Altered the printing of JUMPERED and ALIASED nets
146
 * ,
147
 *
148
 * Revision 1.1  96/06/04  11:54:57  11:54:57  mjames (Mike James)
149
 * Initial revision
150
 *  */
151
 
152
#include "ext_nets.h"
153
 
154
#include "chck_names.h"
155
#include "cmdlog.h"
156
#include "cmdparse.h"
157
#include "database.h"
158
#include "expression.h"
159
#include "generic.h"
160
#include "routing.h"
161
#include "sorting.h"
162
#include "vertcl_main.h"
163
 
164
#include <ctype.h>
165
#include <regex.h>
166
#include <stdio.h>
167
#include <stdlib.h>
168
#include <string.h>
169
#include <sys/types.h>
170
 
171
/* streq() and strneq() declaration */
172
#include "lx_support.h"
173
 
174
#ident                                                                                        \
175
    "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/ext_nets.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $"
176
 
177
/* this function sets the is_external flags on sockets */
178
 
179
typedef enum
180
{
181
        SET_EXT,
182
        DEL_EXT,
183
        SET_FPGA,
184
        DEL_FPGA
185
} flag_change_t;
186
 
187
static void set_clear_flags (char *template, flag_change_t oper)
188
{
189
        int rc;
190
        long count = 0;
191
        socket_t *skt = socket_head;
192
 
193
        int found = 0, pass;
194
        net_t *routed_net = routed_list;
195
        /* compile regular expression */
196
        vert_regex_t *preg;
197
 
198
        rc = vert_regcomp (&preg, template);
199
 
200
        if (rc != 0)
201
        {
202
                char errbuff[100];
203
                regerror (rc, preg->preg, errbuff, 100);
204
                Log (
205
                    LOG_ERROR,
206
                    "-- Problem (rc=%d) %s with '%s' as regular expression\n",
207
                    rc,
208
                    errbuff,
209
                    template);
210
 
211
                return /*TCL_ERROR*/;
212
        }
213
        else
214
        {
215
                Log (LOG_GENERAL, "-- Using '%s' as match pattern\n", template);
216
        }
217
 
218
        while (skt)
219
        {
220
                found = regexec (preg->preg, skt->identifier, 0, preg->regpatt, 0);
221
                if (!found)
222
                {
223
                        switch (oper)
224
                        {
225
                        case SET_EXT:
226
                                if (level & 4)
227
                                        Log (
228
                                            LOG_GENERAL,
229
                                            "-- Set '%s' as external\n",
230
                                            skt->identifier);
231
                                skt->is_external = 1;
232
                                count++;
233
                                break;
234
                        case DEL_EXT:
235
                                if (level & 4)
236
                                        Log (
237
                                            LOG_GENERAL,
238
                                            "-- Set '%s' as internal\n",
239
                                            skt->identifier);
240
                                skt->is_external = 0;
241
                                count++;
242
                                break;
243
                        case SET_FPGA:
244
                                if (level & 4)
245
                                        Log (
246
                                            LOG_GENERAL,
247
                                            "-- Set '%s' as FPGA\n",
248
                                            skt->identifier);
249
                                skt->is_FPGA = 1;
250
                                count++;
251
                                break;
252
                        case DEL_FPGA:
253
                                if (level & 4)
254
                                        Log (
255
                                            LOG_GENERAL,
256
                                            "-- Set '%s' as not FPGA\n",
257
                                            skt->identifier);
258
                                skt->is_FPGA = 0;
259
                                count++;
260
                                break;
261
                        }
262
                }
263
                skt = skt->next;
264
        }
265
 
266
        /* code moved here from jumpering.c as it is needed in several contexts, not just in
267
         * jumpering */
268
        /* firstly, set up the has_external flags on all of the nets, by checking to see if any
269
           nodes on any nets are connected to external sockets.
270
           If connected to an external socket, the net gets the property has_external*/
271
 
272
        pass = 2;
273
        while (pass)
274
        {
275
                if (pass == 2)
276
                {
277
                        routed_net = routed_list;
278
                        pass = 1;
279
                }
280
                else
281
                {
282
                        routed_net = named_list;
283
                        pass = 0;
284
                };
285
                while (routed_net)
286
                {
287
                        noderef_t *noderefs = routed_net->nodes;
288
                        routed_net->has_external = 0;
289
                        while (noderefs)
290
                        {
291
                                if (noderefs->node->socket->is_external &&
292
                                    !routed_net->has_external)
293
                                {
294
                                        routed_net->has_external = 1;
295
                                        /*            Log(LOG_GENERAL,"-- external socket on
296
                                         * net %s\n",routed_net->identifier); */
297
                                }
298
                                noderefs = noderefs->next;
299
                        }
300
                        /*      if(!routed_net->has_external)
301
                                  Log(LOG_GENERAL,"-- no external socket on net
302
                           %s\n",routed_net->identifier); */
303
                        routed_net = routed_net->next;
304
                }
305
        }
306
 
307
        vert_regfree (&preg);
308
        Log (LOG_GENERAL, "-- Set/cleared flag on %d objects\n", count);
309
}
310
 
311
void set_external_flags (char *template)
312
{
313
        Log (LOG_GENERAL, "-- Beginning setting external flags : prefix '%s' --\n", template);
314
        set_clear_flags (template, SET_EXT);
315
        Log (LOG_GENERAL, "-- Finished setting external flags --\n");
316
}
317
 
318
void clear_external_flags (char *template)
319
{
320
        Log (LOG_GENERAL, "-- Beginning clearing external flags : prefix '%s' --\n", template);
321
        set_clear_flags (template, DEL_EXT);
322
        Log (LOG_GENERAL, "-- Finished clearing external flags --\n");
323
}
324
 
325
void set_FPGA_flags (char *template)
326
{
327
        Log (LOG_GENERAL, "-- Beginning setting FPGA flags : prefix '%s' --\n", template);
328
        set_clear_flags (template, SET_FPGA);
329
        Log (LOG_GENERAL, "-- Finished setting FPGA flags --\n");
330
}
331
 
332
void clear_FPGA_flags (char *template)
333
{
334
        Log (LOG_GENERAL, "-- Beginning setting FPGA flags : prefix '%s' --\n", template);
335
        set_clear_flags (template, DEL_FPGA);
336
        Log (LOG_GENERAL, "-- Finished setting FPGA flags --\n");
337
}