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: partition.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $
2
 * $Id: partition.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $  
3
 *
3
 *
4
 * $Log: partition.c,v $
4
 * $Log: partition.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
7
 *
7
 *
Line 80... Line 80...
80
 * Mike put it here
80
 * Mike put it here
81
 *
81
 *
82
 *
82
 *
83
 * Revision 1.36  2000/10/12  15:32:31  15:32:31  mjames (Mike James)
83
 * Revision 1.36  2000/10/12  15:32:31  15:32:31  mjames (Mike James)
84
 * Removed <cr>
84
 * Removed <cr>
85
 *
85
 *
86
 * Revision 1.35  2000/10/12  14:25:49  14:25:49  mjames (Mike James)
86
 * Revision 1.35  2000/10/12  14:25:49  14:25:49  mjames (Mike James)
87
 * removed <cr>
87
 * removed <cr>
88
 *
88
 *
89
 * Revision 1.34  2000/10/04  10:37:07  10:37:07  mjames (Mike James)
89
 * Revision 1.34  2000/10/04  10:37:07  10:37:07  mjames (Mike James)
90
 * Modified for Vertical2 : support COMPONENTS and SIGNALS
90
 * Modified for Vertical2 : support COMPONENTS and SIGNALS
91
 *
91
 *
92
 * Revision 1.34  2000/10/04  10:37:07  10:37:07  mjames (Mike James)
92
 * Revision 1.34  2000/10/04  10:37:07  10:37:07  mjames (Mike James)
93
 * Part of Release PSAVAT01
93
 * Part of Release PSAVAT01
94
 *
94
 *
95
 * Revision 1.33  2000/10/03  10:05:31  10:05:31  mjames (Mike James)
95
 * Revision 1.33  2000/10/03  10:05:31  10:05:31  mjames (Mike James)
96
 * Added CONSTANTS and SIGNALS to architecture
96
 * Added CONSTANTS and SIGNALS to architecture
97
 *
97
 *
98
 * Revision 1.31  2000/09/27  14:42:17  14:42:17  mjames (Mike James)
98
 * Revision 1.31  2000/09/27  14:42:17  14:42:17  mjames (Mike James)
99
 * Part of Release Sep_27_ST_2000
99
 * Part of Release Sep_27_ST_2000
100
 *
100
 *
101
 * Revision 1.30  2000/09/21  10:15:48  10:15:48  mjames (Mike James)
101
 * Revision 1.30  2000/09/21  10:15:48  10:15:48  mjames (Mike James)
102
 * Part of Release Sep21Alpha
102
 * Part of Release Sep21Alpha
103
 *
103
 *
104
 * Revision 1.29  2000/08/25  09:57:13  09:57:13  mjames (Mike James)
104
 * Revision 1.29  2000/08/25  09:57:13  09:57:13  mjames (Mike James)
105
 * Part of Release Aug25_alpha
105
 * Part of Release Aug25_alpha
106
 *
106
 *
107
 * Revision 1.28  2000/08/16  08:57:30  08:57:30  mjames (Mike James)
107
 * Revision 1.28  2000/08/16  08:57:30  08:57:30  mjames (Mike James)
108
 * Part of Release CD01_Aug2000
108
 * Part of Release CD01_Aug2000
109
 *
109
 *
110
 * Revision 1.27  2000/08/14  14:45:11  14:45:11  mjames (Mike James)
110
 * Revision 1.27  2000/08/14  14:45:11  14:45:11  mjames (Mike James)
111
 * Part of Release Aug_14_2000
111
 * Part of Release Aug_14_2000
112
 *
112
 *
113
 * Revision 1.26  2000/08/11  08:30:32  08:30:32  mjames (Mike James)
113
 * Revision 1.26  2000/08/11  08:30:32  08:30:32  mjames (Mike James)
114
 * Part of Release Aug_11_2000
114
 * Part of Release Aug_11_2000
115
 *
115
 *
116
 * Revision 1.25  2000/08/09  10:31:46  10:31:46  mjames (Mike James)
116
 * Revision 1.25  2000/08/09  10:31:46  10:31:46  mjames (Mike James)
117
 * Part of Release Aug__9_2000
117
 * Part of Release Aug__9_2000
118
 *
118
 *
119
 * Revision 1.24  2000/05/31  11:42:56  11:42:56  mjames (Mike James)
119
 * Revision 1.24  2000/05/31  11:42:56  11:42:56  mjames (Mike James)
120
 * Part of Release May_31_2000
120
 * Part of Release May_31_2000
121
 *
121
 *
122
 * Revision 1.23  2000/05/31  11:30:18  11:30:18  mjames (Mike James)
122
 * Revision 1.23  2000/05/31  11:30:18  11:30:18  mjames (Mike James)
123
 * Added acfread.ini file reading
123
 * Added acfread.ini file reading
124
 *
124
 *
125
 * Revision 1.22  2000/05/08  17:01:37  17:01:37  mjames (Mike James)
125
 * Revision 1.22  2000/05/08  17:01:37  17:01:37  mjames (Mike James)
126
 * Part of Release May__8_2000
126
 * Part of Release May__8_2000
127
 *
127
 *
128
 * Revision 1.21  2000/05/08  16:59:30  16:59:30  mjames (Mike James)
128
 * Revision 1.21  2000/05/08  16:59:30  16:59:30  mjames (Mike James)
129
 * Part of Release May__8_2000
129
 * Part of Release May__8_2000
130
 *
130
 *
131
 * Revision 1.20  2000/05/08  16:57:07  16:57:07  mjames (Mike James)
131
 * Revision 1.20  2000/05/08  16:57:07  16:57:07  mjames (Mike James)
132
 * Part of Release May__8_2000
132
 * Part of Release May__8_2000
133
 *
133
 *
134
 * Revision 1.19  2000/03/08  16:19:20  16:19:20  mjames (Mike James)
134
 * Revision 1.19  2000/03/08  16:19:20  16:19:20  mjames (Mike James)
135
 * New version including PC
135
 * New version including PC
136
 *
136
 *
137
 * Revision 1.16  2000/01/20  15:58:47  15:58:47  mjames (Mike James)
137
 * Revision 1.16  2000/01/20  15:58:47  15:58:47  mjames (Mike James)
138
 * Part of Release R22
138
 * Part of Release R22
139
 *
139
 *
140
 * Revision 1.15  99/12/22  11:15:27  11:15:27  mjames (Mike James)
140
 * Revision 1.15  99/12/22  11:15:27  11:15:27  mjames (Mike James)
141
 * Part of Release Dec_22_1999
141
 * Part of Release Dec_22_1999
142
 *
142
 *
143
 * Revision 1.14  99/11/23  13:52:12  13:52:12  mjames (Mike James)
143
 * Revision 1.14  99/11/23  13:52:12  13:52:12  mjames (Mike James)
144
 * Addded syntax to support special generics for Certify support
144
 * Addded syntax to support special generics for Certify support
145
 *
145
 *
146
 * Revision 1.13  99/06/25  14:35:46  14:35:46  mjames (Mike James)
146
 * Revision 1.13  99/06/25  14:35:46  14:35:46  mjames (Mike James)
147
 * Added in reference to expression.h, but no changes made
147
 * Added in reference to expression.h, but no changes made
148
 * to the function of acfread yet.
148
 * to the function of acfread yet.
149
 *
149
 *
150
 * Revision 1.12  99/06/18  09:25:37  09:25:37  mjames (Mike James)
150
 * Revision 1.12  99/06/18  09:25:37  09:25:37  mjames (Mike James)
151
 * Added generics exported upwards
151
 * Added generics exported upwards
152
 *
152
 *
153
 * Revision 1.11  98/10/01  15:25:30  15:25:30  mjames (Mike James)
153
 * Revision 1.11  98/10/01  15:25:30  15:25:30  mjames (Mike James)
154
 * Added templates (name*) or * to set/del port
154
 * Added templates (name*) or * to set/del port
155
 *
155
 *
156
 * Revision 1.10  98/04/24  13:49:07  13:49:07  mjames (Mike James)
156
 * Revision 1.10  98/04/24  13:49:07  13:49:07  mjames (Mike James)
157
 * Added extra force_port flag to net for 'set port' command
157
 * Added extra force_port flag to net for 'set port' command
158
 *
158
 *
159
 * Revision 1.9  98/02/11  11:26:53  11:26:53  mjames (Mike James)
159
 * Revision 1.9  98/02/11  11:26:53  11:26:53  mjames (Mike James)
160
 * Checked in for version 6.2a
160
 * Checked in for version 6.2a
161
 *
161
 *
162
 * Revision 1.8  97/04/23  08:43:20  08:43:20  mjames (Mike James)
162
 * Revision 1.8  97/04/23  08:43:20  08:43:20  mjames (Mike James)
163
 * CHecked in for release rel23041997
163
 * CHecked in for release rel23041997
164
 *
164
 *
165
 * Revision 1.7  96/12/23  15:15:51  15:15:51  mjames (Mike James)
165
 * Revision 1.7  96/12/23  15:15:51  15:15:51  mjames (Mike James)
166
 * Altered because find_socket takes a reference
166
 * Altered because find_socket takes a reference
167
 * to the head-of-list-pointer noth the pointer itself.
167
 * to the head-of-list-pointer noth the pointer itself.
168
 *
168
 *
169
 * Revision 1.6  96/07/19  14:38:47  14:38:47  mjames (Mike James)
169
 * Revision 1.6  96/07/19  14:38:47  14:38:47  mjames (Mike James)
170
 * Update to give to PRL
170
 * Update to give to PRL
171
 *
171
 *
172
 * Revision 1.5  1996/05/23  10:32:26  mjames
172
 * Revision 1.5  1996/05/23  10:32:26  mjames
173
 * Altered BUFFER and OUT pin rules to decide whether a
173
 * Altered BUFFER and OUT pin rules to decide whether a
174
 * signal crosses a partition boundary.
174
 * signal crosses a partition boundary.
175
 *
175
 *
176
 * Revision 1.4  96/05/21  14:16:07  14:16:07  mjames (Mike James)
176
 * Revision 1.4  96/05/21  14:16:07  14:16:07  mjames (Mike James)
177
 * Added the concept ogf buffered pins to get some Shoamra2
177
 * Added the concept ogf buffered pins to get some Shoamra2
178
 * partitions to work properly.
178
 * partitions to work properly.
179
 *
179
 *
180
 * Revision 1.3  96/04/26  16:01:55  16:01:55  mjames (Mike James)
180
 * Revision 1.3  96/04/26  16:01:55  16:01:55  mjames (Mike James)
181
 * Altered inside/outside determination of signal directions
181
 * Altered inside/outside determination of signal directions
182
 *
182
 *
183
 * Revision 1.2  96/04/15  14:19:31  14:19:31  mjames (Mike James)
183
 * Revision 1.2  96/04/15  14:19:31  14:19:31  mjames (Mike James)
184
 * Checkin before datatype printing
184
 * Checkin before datatype printing
185
 *
185
 *
186
 * Revision 1.1  96/03/29  14:46:13  14:46:13  mjames (Mike James)
186
 * Revision 1.1  96/03/29  14:46:13  14:46:13  mjames (Mike James)
187
 * Initial revision
187
 * Initial revision
188
 *
188
 *
189
 *  */
189
 *  */
190
/* The Partition module. This combines VHDL for the purposes of creating
190
/* The Partition module. This combines VHDL for the purposes of creating
191
   EPLDs */
191
   EPLDs */
192
 
192
 
193
#include "partition.h"
193
#include <stdio.h>
-
 
194
#include <string.h>
-
 
195
#include <stdlib.h>
-
 
196
#include <sys/types.h>
-
 
197
#include <regex.h>
194
 
198
 
195
#include "acf_yacc.h"
199
#include "vertcl_main.h" 
196
#include "chck_names.h"
-
 
197
#include "cmdlog.h"
-
 
198
#include "cmdparse.h"
-
 
199
#include "database.h"
-
 
200
#include "expression.h"
200
#include "expression.h"
201
#include "generic.h"
201
#include "generic.h"
-
 
202
#include "database.h"
-
 
203
 
-
 
204
 
202
#include "routing.h"
205
#include "partition.h"
-
 
206
#include "cmdparse.h"
203
#include "sorting.h"
207
#include "cmdlog.h"
204
#include "vertcl_main.h"
208
#include "acf_yacc.h"
205
#include "vertcl_main.h"
209
#include "vertcl_main.h"
-
 
210
#include "chck_names.h"
-
 
211
#include "sorting.h"
-
 
212
 
-
 
213
#include "routing.h"
-
 
214
 
-
 
215
#ident "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/partition.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $"
206
 
216
 
207
#include <regex.h>
-
 
208
#include <stdio.h>
-
 
209
#include <stdlib.h>
-
 
210
#include <string.h>
-
 
211
#include <sys/types.h>
-
 
212
 
217
 
213
#ident                                                                                        \
-
 
214
    "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/partition.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $"
-
 
215
 
218
 
216
/* nets created as a result of partition are ripped up when a new partition
219
/* nets created as a result of partition are ripped up when a new partition
217
   is created */
220
   is created */
218
 
221
   
219
void clear_partition_nets (void)
222
void clear_partition_nets(void)
220
{
223
  {
221
        net_t *net = named_list; /* only interested in nets carrying a signal */
224
  net_t * net = named_list; /* only interested in nets carrying a signal */
222
        while (net)
225
  while(net){
223
        {
-
 
224
                net->leaves_partition = 0; /* not leaving partition */
226
    net->leaves_partition = 0; /* not leaving partition */
225
                net->inside_partition = 0; /* not used inside partition */
227
    net->inside_partition = 0; /* not used inside partition */
226
 
228
 
227
#if defined BLOB
229
#if defined BLOB
228
                if (!net->type_defined && net->vhdltype)
230
    if(!net->type_defined && net->vhdltype) {
229
                {
-
 
230
                        if (net->vhdltype->basetype)
231
      if(net->vhdltype->basetype) {
231
                        {
-
 
232
                                /* ought to free it */
232
        /* ought to free it */  
233
                                free (net->vhdltype->basetype);
233
        free(net->vhdltype->basetype);      
234
                                net->vhdltype->basetype = NULL;
234
        net->vhdltype->basetype = NULL;
235
                        }
235
        }
236
                        if (net->vhdltype->expr)
236
      if(net->vhdltype->expr) {
237
                        {
-
 
238
                                net->vhdltype = NULL;
237
        net->vhdltype = NULL;
239
                                free_expression (net->vhdltype->expr);
238
        free_expression(net->vhdltype->expr);
240
                        }
-
 
241
                }
-
 
242
#endif
-
 
243
                net = net->next;
-
 
244
        }
239
        }
245
}
240
 
-
 
241
      }
-
 
242
#endif
-
 
243
    net = net->next;
-
 
244
        }
-
 
245
  }
246
 
246
 
247
/* all nets that are in the routed list are named and placed in the named list */
247
/* all nets that are in the routed list are named and placed in the named list */
248
 
248
 
249
void name_routed_nets (void)
249
void name_routed_nets(void)
250
{
250
  {
251
        net_t *link;
251
  net_t * link;
252
        net_t *net = routed_list; /* check each net in turn */
252
  net_t * net = routed_list; /* check each net in turn */
253
                                  /* this code is here : shoould it be ? */
253
/* this code is here : shoould it be ? */
254
        while (net)
254
  while(net) {
255
        {
-
 
256
                noderef_t *noderefs = net->nodes;
255
    noderef_t *  noderefs = net->nodes;
257
                link = net->next;
256
    link = net->next;
258
                if (IS_ROUTABLE (noderefs->net->how_routed))
257
    if(IS_ROUTABLE(noderefs->net->how_routed)) {
259
                {
-
 
260
                        if (ISNULLSTR (net->name))
258
      if (ISNULLSTR(net->name))
261
                                net->name = net->identifier;
259
        net->name = net->identifier;
262
                        while (noderefs)
260
      while(noderefs){
263
                        {
-
 
-
 
261
 
264
                                /*      noderefs->node->in_use = 1; */
262
/*      noderefs->node->in_use = 1; */
265
                                noderefs->node->name = net->name;
263
        noderefs->node->name = net->name;
266
                                noderefs = noderefs->next;
264
        noderefs = noderefs->next;
267
                        }
265
        }
268
                        combine_routed_and_unrouted (net, net);
266
          combine_routed_and_unrouted (net, net);
269
                        transfer_net_to_named (&routed_list, net);
267
          transfer_net_to_named (&routed_list, net);
270
                }
268
      }
271
                net = link;
269
    net = link;
272
        }
270
    }      
273
}
271
}
274
 
272
 
275
int set_clear_partition (char *expr, int set_clear)
-
 
276
{
-
 
277
        int rc;
-
 
278
        socket_t *skt = socket_head;
-
 
279
        int found = 0;
-
 
280
        int process_count = 0;
-
 
281
 
-
 
282
        /* compile regular expression */
-
 
283
        vert_regex_t *preg;
-
 
284
 
273
 
285
        rc = vert_regcomp (&preg, expr);
-
 
286
 
-
 
287
        if (rc != 0)
-
 
288
        {
-
 
289
                char errbuff[100];
-
 
290
                regerror (rc, preg->preg, errbuff, 100);
-
 
291
                Log (
-
 
292
                    LOG_ERROR,
-
 
293
                    "-- Problem (rc=%d) %s with '%s' as regular expression\n",
-
 
294
                    rc,
-
 
295
                    errbuff,
-
 
296
                    expr);
-
 
297
 
274
 
-
 
275
int set_clear_partition(char * expr,int set_clear)
-
 
276
{
-
 
277
  int rc;
-
 
278
  socket_t * skt = socket_head;
-
 
279
  int found = 0;
-
 
280
  int process_count = 0;
-
 
281
 
-
 
282
  /* compile regular expression */
-
 
283
  vert_regex_t * preg;
-
 
284
 
-
 
285
 
-
 
286
 
-
 
287
  rc = vert_regcomp(&preg,expr);
-
 
288
 
-
 
289
  if (rc != 0 )
-
 
290
    {
-
 
291
    char errbuff[100];
-
 
292
    regerror(rc,preg->preg,errbuff,100);
-
 
293
    Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,expr);
-
 
294
   
298
                return /*TCL_ERROR*/;
295
    return /*TCL_ERROR*/;
299
        }
296
    }
300
        else
297
  else
301
        {
298
    {
302
                Log (LOG_GENERAL, "-- Using '%s' as match pattern\n", expr);
299
    Log(LOG_GENERAL,"-- Using '%s' as match pattern\n",expr);
-
 
300
    }
-
 
301
 
-
 
302
  while(skt) {
-
 
303
    found  = regexec(preg->preg,skt->identifier,0,preg->regpatt,0);
-
 
304
    if(!found)
-
 
305
      {
-
 
306
      if (skt && ISNULLSTR(skt->name))
-
 
307
        {
-
 
308
        skt->name = skt->identifier;
303
        }
309
        }
-
 
310
      skt->selected = set_clear;  
-
 
311
      process_count++;
-
 
312
      }
-
 
313
    skt = skt->next;
-
 
314
    }
-
 
315
 
-
 
316
  vert_regfree(&preg);
-
 
317
  Log(LOG_GENERAL,"-- Processed %d sockets\n",process_count++);  
-
 
318
  return OKCMD;
-
 
319
  }
304
 
320
 
305
        while (skt)
-
 
306
        {
-
 
307
                found = regexec (preg->preg, skt->identifier, 0, preg->regpatt, 0);
-
 
308
                if (!found)
-
 
309
                {
-
 
310
                        if (skt && ISNULLSTR (skt->name))
-
 
311
                        {
-
 
312
                                skt->name = skt->identifier;
-
 
313
                        }
-
 
314
                        skt->selected = set_clear;
-
 
315
                        process_count++;
-
 
316
                }
-
 
317
                skt = skt->next;
-
 
318
        }
-
 
319
 
321
 
320
        vert_regfree (&preg);
-
 
321
        Log (LOG_GENERAL, "-- Processed %d sockets\n", process_count++);
-
 
322
        return OKCMD;
-
 
323
}
-
 
324
 
322
 
325
int add_all_to_partition (void)
323
int add_all_to_partition(void)
326
{
324
{
-
 
325
 
327
        return set_clear_partition (".*", 1);
326
  return set_clear_partition(".*",1);
328
}
327
}
329
 
328
 
-
 
329
 
330
/* printout the sockets that are selected inside the partition */
330
/* printout the sockets that are selected inside the partition */
331
void list_partition (FILE *f)
331
void list_partition(FILE * f)
332
{
332
{
333
        socket_t *skt = socket_head;
333
  socket_t * skt = socket_head;
334
        fprintf (f, "Partition includes the following blocks:\n");
334
  fprintf(f,"Partition includes the following blocks:\n");
335
        while (skt)
335
  while(skt){
336
        {
-
 
337
                if (skt->selected) /* selected */
336
    if(skt->selected) /* selected */
338
                        fprintf (f, "  '%s'\n", skt->name);
337
      fprintf(f,"  '%s'\n",skt->name);
339
                skt = skt->next;
338
    skt = skt->next;
340
        }
339
  }
341
        fprintf (f, "-- End list -- \n");
340
  fprintf(f,"-- End list -- \n");
342
}
341
}
343
 
342
 
344
/* the partitioning algorithm is implemented here */
343
/* the partitioning algorithm is implemented here */
345
/*
344
/*
346
     for each net on the named list -- Made it to routing
345
     for each net on the named list -- Made it to routing
347
     if the only nodes on the list that are 'in use' only connect
346
     if the only nodes on the list that are 'in use' only connect
348
       to 'selected' sockets and there is an output or buffer pin inside the          then the
347
       to 'selected' sockets and there is an output or buffer pin inside the          then the net is inside the partition.
349
   net is inside the partition. if the net is all inputs the the net has to leave the partition
348
           if the net is all inputs the the net has to leave the
350
   as an input.
349
           partition as an input.
351
*/
350
*/
352
void perform_partition (void)
351
void perform_partition(void)
353
{
352
{
354
        net_t *net = named_list; /* check each net in turn */
353
  net_t * net = named_list; /* check each net in turn */
355
        int ports = 0;
354
  int ports = 0;
356
        int port_wires = 0;
355
  int port_wires = 0;
357
        int signals = 0;
356
  int signals = 0;
358
        int signal_wires = 0;
357
  int signal_wires = 0;
359
 
358
 
360
        while (net)
359
  while(net) {
361
        {
-
 
362
                noderef_t *noderefs = net->nodes;
360
    noderef_t *  noderefs = net->nodes;
363
                char used_outside = 0; /* set if the net goes outside */
361
    char      used_outside = 0; /* set if the net goes outside */
364
                char used_inside = 0;  /* set if the net used inside */
362
    char      used_inside = 0;  /* set if the net used inside */
365
                char inputs_on_net = 0;
363
    char      inputs_on_net = 0;
366
                char outputs_on_net = 0;
364
    char      outputs_on_net = 0;
367
                char buffers_on_net = 0; /* another pin type that we must handle */
365
    char      buffers_on_net = 0; /* another pin type that we must handle */
368
                char bidirs_on_net = 0;
366
    char      bidirs_on_net = 0;
369
                char default_drive = 0; /* Was this net defined with a default value ? */
367
    char      default_drive = 0; /* Was this net defined with a default value ? */
370
 
368
   
371
                int width = 0; /* how many wires in the bundle */
369
    int width = 0;              /* how many wires in the bundle */
372
                int high = 0;
370
    int high  = 0;
373
                int low = 1000;
371
    int low   = 1000;
374
 
372
 
375
                expression_t *exp, *variable_seen, *high_ref, *low_ref, *high_exp, *low_exp,
373
    expression_t * exp,* variable_seen,
376
                    *highest_exp, *lowest_exp;
374
            *high_ref, * low_ref,  * high_exp, *low_exp, * highest_exp, * lowest_exp ;
377
 
375
 
378
                highest_exp = NULL;
376
    highest_exp = NULL;
379
                lowest_exp = NULL;
377
    lowest_exp  = NULL;
380
                high_ref = NULL; /* reference to expression containing highest expr */
378
    high_ref = NULL; /* reference to expression containing highest expr */
381
                low_ref = NULL;
379
    low_ref  = NULL;
382
                variable_seen = NULL;
380
    variable_seen = NULL;
383
                net->ext_dir = NONE; /* not yet known */
381
    net->ext_dir = NONE; /* not yet known */
384
 
382
   
385
                /* set flag if the net was defined as "signal x : type := value;" */
383
    /* set flag if the net was defined as "signal x : type := value;" */
386
                default_drive =
-
 
387
                    net->type_defined && net->vhdltype && net->vhdltype->default_expr;
384
    default_drive = net->type_defined && net->vhdltype && net->vhdltype->default_expr;
-
 
385
   
388
 
386
   
389
                /* predefined net type definition, can already know upper ansd lower bounds */
387
    /* predefined net type definition, can already know upper ansd lower bounds */
390
#if defined DEBUG_EXPRESSION
388
#if defined DEBUG_EXPRESSION
391
                printf ("net %s \n", net->identifier);
389
    printf("net %s \n",net->identifier);
392
#endif
390
#endif
393
                while (noderefs)
391
    while(noderefs){
394
                {
-
 
395
                        node_t *n = noderefs->node;
-
 
396
 
392
 
397
                        if (n->in_use)
393
      node_t * n = noderefs->node;
-
 
394
     
398
                        {
395
      if(n->in_use) {
399
                                int h, l;
396
        int h,l;
400
                                vhdl_t *vhdl;
397
        vhdl_t * vhdl;
401
                                vhdl = noderefs->vhdltype;
398
        vhdl = noderefs->vhdltype;
402
                                if (vhdl && vhdl->expr)
399
        if(vhdl && vhdl->expr)
403
                                        exp = vhdl->expr;
400
          exp = vhdl->expr;
404
                                else
401
        else
405
                                        exp = NULL;
402
          exp = NULL;
406
 
403
 
407
#if defined DEBUG_EXPRESSION
404
#if defined DEBUG_EXPRESSION
408
                                if (exp)
-
 
409
                                {
405
        if(exp) {
410
                                        printf ("expression vhdl%p expr%p", vhdl, exp);
406
          printf("expression vhdl%p expr%p",vhdl,exp);
411
                                        print_range_expression (stdout, exp, 0);
407
          print_range_expression(stdout,exp,0);
412
                                        printf ("\n");
408
          printf("\n");
413
                                }
409
          }
414
#endif
410
#endif   
415
                                /* if we have a variable defining width,
411
        /* if we have a variable defining width,
416
                                   remember what the top level variable is called,
412
           remember what the top level variable is called,
417
                                   then keep expanding it until we get an expression
413
           then keep expanding it until we get an expression
418
                                   rather than a variable */
414
           rather than a variable */
419
                                if (exp && exp->opcode == EXP_VARIABLE)
415
        if(exp && exp->opcode == EXP_VARIABLE) {
420
                                {
416
           variable_seen = exp;
421
                                        variable_seen = exp;
-
 
422
                                        while (exp->opcode == EXP_VARIABLE)
417
           while(exp->opcode == EXP_VARIABLE)
423
                                                exp = exp->left.g->expr;
418
             exp = exp->left.g->expr;
424
                                }
419
           }
425
                                if (exp)
420
        if(exp) {
426
                                {
421
          if (exp->opcode == TO) {
427
                                        if (exp->opcode == TO)
-
 
428
                                        {
-
 
429
                                                high_exp = exp->right.e;
422
            high_exp = exp->right.e;
430
                                                low_exp = exp->left.e;
423
            low_exp  = exp->left.e;
431
                                        }
424
            }
432
                                        else if (exp->opcode == DOWNTO)
425
          else if (exp->opcode == DOWNTO) {
433
                                        {
-
 
434
                                                high_exp = exp->left.e;
426
            high_exp = exp->left.e;
435
                                                low_exp = exp->right.e;
427
            low_exp  = exp->right.e;
436
                                        }
428
            }
437
                                        else
429
          else
438
                                                high_exp = low_exp =
-
 
439
                                                    exp; /* not a range, just a single value */
430
            high_exp = low_exp = exp; /* not a range, just a single value */
440
 
431
         
441
                                        l = eval_expression (low_exp, NULL);
432
          l = eval_expression(low_exp, NULL);  
442
                                        h = eval_expression (high_exp, NULL);
433
          h = eval_expression(high_exp, NULL);
443
                                        /* sort out the highest and lowest bound of any logic
434
        /* sort out the highest and lowest bound of any logic vector pins
444
                                           vector pins on the net (high and low are zero for
-
 
445
                                           single bits so calculation applies here) */
435
             on the net (high and low are zero for single bits so calculation
446
                                        if (h > high)
436
             applies here) */
447
                                        {
437
        if (h > high) {
448
                                                highest_exp = high_exp;
438
          highest_exp = high_exp;
449
                                                high_ref = exp;
439
          high_ref    = exp;
450
                                                high = h;
440
          high = h;
451
                                        }
441
          }
452
                                        if (l < low)
-
 
453
                                        {
442
        if (l  < low){
454
                                                lowest_exp = low_exp;
443
          lowest_exp = low_exp;
455
                                                low_ref = exp;
444
          low_ref    = exp;
456
                                                low = l;
-
 
457
                                        }
445
          low  = l;
458
                                }
446
           }
459
                                else
447
         }  
460
                                {
448
        else {
461
                                        high = 0;
449
          high=0;
462
                                        low = 0;
450
          low=0;
463
                                };
451
          };
-
 
452
       
-
 
453
 
-
 
454
 
464
 
455
 
-
 
456
 
465
                                /* discover it is routed outside - it links to an unselected
457
        /* discover it is routed outside - it links to an unselected socket */
466
                                 * socket */
-
 
467
                                /* but if it only links to unselected sockets,
458
        /* but if it only links to unselected sockets,
468
                                   used_inside wont be set as well */
459
           used_inside wont be set as well */
469
                                if (!n->socket->selected)
460
        if(!n->socket->selected)
470
                                        used_outside = 1;
461
          used_outside = 1;
471
                                else
462
        else{
472
                                {
463
          used_inside = 1;
473
                                        used_inside = 1;
-
 
474
                                        if (noderefs->pindir == INPUT)
464
          if (noderefs->pindir == INPUT)
475
                                                inputs_on_net = 1;
465
            inputs_on_net = 1;
476
                                        if (noderefs->pindir == OUTPUT)
466
          if (noderefs->pindir == OUTPUT)
477
                                                outputs_on_net = 1;
467
            outputs_on_net = 1;
478
                                        if (noderefs->pindir == BIDIR)
468
          if (noderefs->pindir == BIDIR)
479
                                                bidirs_on_net = 1;
469
            bidirs_on_net = 1;
480
                                        if (noderefs->pindir == BUFFER)
470
          if (noderefs->pindir == BUFFER)
481
                                                buffers_on_net = 1;
471
            buffers_on_net = 1;
482
 
472
 
483
                                        /* I was  using the ordinal value of the pindir_t type
473
          /* I was  using the ordinal value of the pindir_t type
484
                                      if  (noderefs->pindir >= net->ext_dir ) ||  */
474
        if  (noderefs->pindir >= net->ext_dir ) ||  */
485
 
475
       
486
                                        /* now June 1999 takes on the type of the first node ,
476
           /* now June 1999 takes on the type of the first node ,
487
                                          or if one of the nodes has a bus connection use that
477
             or if one of the nodes has a bus connection use that : still a
488
                                          : still a guess. Alternatively if the net was
-
 
489
                                          declared so it has a type defined then keep that as
478
             guess. Alternatively if the net was declared so it has a
490
                                          it is more correct...  */
479
             type defined then keep that as it is more correct...  */
491
 
480
 
492
                                        if (!net->type_defined &&
-
 
-
 
481
 
493
                                            (!net->vhdltype || !net->vhdltype->basetype ||
482
        if(!net->type_defined && ( !net->vhdltype || !net->vhdltype->basetype ||
494
                                             (!net->vhdltype->is_vector && vhdl->is_vector)))
483
              (!net->vhdltype->is_vector && vhdl->is_vector))) {
495
                                        {
-
 
496
                                                /* copy over base VHDL type and vector/single
-
 
497
                                                 * signal attribute*/
484
            /* copy over base VHDL type and vector/single signal attribute*/
498
 
485
           
499
                                                net->vhdltype = copy_vhdl (vhdl, NULL);
486
            net->vhdltype = copy_vhdl(vhdl,NULL);          
500
                                        }
487
           
501
                                }
488
            }
502
                        }
489
        }      
-
 
490
      }
503
                        noderefs = noderefs->next;
491
    noderefs = noderefs->next;
504
                }
492
    }    
-
 
493
 
-
 
494
 
-
 
495
 
505
 
496
 
506
/* nets with a VHDL type will simply use this type as the definition of the expression */
497
/* nets with a VHDL type will simply use this type as the definition of the expression */
507
#if defined IGNORE_DEFINED
498
#if defined IGNORE_DEFINED
508
                if (net->type_defined && net->vhdltype)
499
    if(net->type_defined && net->vhdltype ) {
509
                {
-
 
510
                        exp = net->vhdltype->expr;
500
      exp = net->vhdltype->expr;
511
                        if (exp && exp->opcode == EXP_VARIABLE)
501
      if(exp && exp->opcode == EXP_VARIABLE)
512
                                exp = exp->left.g->expr;
502
         exp = exp->left.g->expr;
513
                        if (exp)
-
 
514
                        {
503
      if(exp) {
515
                                if (exp->opcode == TO)
504
        if (exp->opcode == TO) {
516
                                {
-
 
517
                                        highest_exp = exp->right.e;
505
          highest_exp = exp->right.e;
518
                                        lowest_exp = exp->left.e;
506
          lowest_exp  = exp->left.e;
519
                                }
507
          }
520
                                else if (exp->opcode == DOWNTO)
508
        else if (exp->opcode == DOWNTO) {
521
                                {
-
 
522
                                        highest_exp = exp->left.e;
509
          highest_exp = exp->left.e;
523
                                        lowest_exp = exp->right.e;
510
          lowest_exp  = exp->right.e;
524
                                }
511
          }
525
                                else
512
        else
526
                                        highest_exp = lowest_exp = exp->left.e;
513
          highest_exp = lowest_exp = exp->left.e;
527
                                low = eval_expression (lowest_exp, NULL);
514
        low = eval_expression(lowest_exp,NULL);  
528
                                high = eval_expression (highest_exp, NULL);
515
        high = eval_expression(highest_exp,NULL);
529
                        }
516
        }
530
                }
517
      }
531
#endif
518
#endif
532
 
519
 
533
                if (!net->type_defined && net->vhdltype && net->vhdltype->is_vector)
520
    if ( !net->type_defined && net->vhdltype && net->vhdltype->is_vector) {
534
                {
-
 
535
                        if (variable_seen)
521
      if(variable_seen)
536
                                net->vhdltype->expr = variable_seen;
522
        net->vhdltype->expr  = variable_seen;
537
 
523
 
538
                        else if (highest_exp && lowest_exp)
524
      else if(highest_exp && lowest_exp) {
539
                        {
-
 
540
                                if (high_ref && (high_ref == low_ref))
525
         if (high_ref && (high_ref == low_ref))
541
                                        net->vhdltype->expr = high_ref;
526
           net->vhdltype->expr = high_ref;
542
                                else
527
         else
543
                                        net->vhdltype->expr = compile_expression (
-
 
544
                                            DOWNTO, highest_exp, lowest_exp);
528
           net->vhdltype->expr = compile_expression(DOWNTO,highest_exp,lowest_exp);
545
                        }
529
         }
546
                        else
530
      else
547
                                net->vhdltype->expr = compile_constant (0);
531
         net->vhdltype->expr = compile_constant(0);
548
                }
532
      }
-
 
533
 
-
 
534
 
-
 
535
   
-
 
536
 
-
 
537
 
-
 
538
 
549
 
539
 
550
                /* pin will appear on port list if : */
540
    /* pin will appear on port list if : */
551
                /* routed inside & outside */
541
                            /* routed inside & outside */
552
                net->leaves_partition =
-
 
553
                    (used_inside && used_outside) ||
542
    net->leaves_partition = (used_inside && used_outside) ||
554
                    /* inputs but not any sort of outputs, or default drive (a kind of output)
543
                            /* inputs but not any sort of outputs, or default drive (a kind of output) */
555
                     */
-
 
556
                    (inputs_on_net && !(default_drive || outputs_on_net || buffers_on_net)) ||
544
                            (inputs_on_net && !( default_drive || outputs_on_net || buffers_on_net)) ||
557
                    /* any sort of outputs but not inputs */
545
                            /* any sort of outputs but not inputs */
558
                    ((outputs_on_net || buffers_on_net) && !inputs_on_net) ||
546
                            ((outputs_on_net || buffers_on_net) && !inputs_on_net) ||
559
                    /* any bidirectional pins */
547
                            /* any bidirectional pins */
560
                    bidirs_on_net ||
548
                            bidirs_on_net ||
561
                    /* net is forced as a port */
549
                            /* net is forced as a port */
562
                    net->force_port;
550
                            net->force_port;
-
 
551
 
-
 
552
 
-
 
553
 
563
 
554
 
-
 
555
    net->needs_buff_sig   = inputs_on_net &&
564
                net->needs_buff_sig = inputs_on_net && (outputs_on_net || buffers_on_net) &&
556
                            (outputs_on_net || buffers_on_net) &&
565
                                      net->leaves_partition;
557
                            net->leaves_partition;                          
566
 
558
 
567
                /* sort out the pin directions */
559
    /* sort out the pin directions */
568
                /* any bidirectional pins */
560
    /* any bidirectional pins */
569
                if (bidirs_on_net)
561
    if(bidirs_on_net)
570
                        net->ext_dir = BIDIR;
562
      net->ext_dir  = BIDIR;
571
                /* inputs but not any sort of outputs */
563
    /* inputs but not any sort of outputs */  
572
                else if (inputs_on_net && !(outputs_on_net || buffers_on_net))
564
    else if(inputs_on_net && !(outputs_on_net || buffers_on_net))
573
                        net->ext_dir = INPUT;
565
      net->ext_dir  = INPUT;
574
                /* any sort of outputs but not inputs */
566
    /* any sort of outputs but not inputs */
575
                else if (outputs_on_net || buffers_on_net)
567
    else if (outputs_on_net || buffers_on_net)
576
                        net->ext_dir = OUTPUT;
568
      net->ext_dir  = OUTPUT;
577
                else
569
    else
578
                        net->ext_dir = NONE;
570
      net->ext_dir  = NONE;
579
                /* net will appear in local signal definition if : */
571
    /* net will appear in local signal definition if : */
580
                /* it is used inside  */
572
                            /* it is used inside  */
581
                /* and either only inside or it is a BUFFER
573
                            /* and either only inside or it is a BUFFER
582
                   port in which
574
                               port in which
583
                   case a temporary signal is provided by
575
                               case a temporary signal is provided by
584
                   printout.c */
576
                               printout.c */
-
 
577
    net->inside_partition =  used_inside && (
585
                net->inside_partition =
578
                               (!net->leaves_partition) ||
586
                    used_inside && ((!net->leaves_partition) || (net->needs_buff_sig));
579
                               (net->needs_buff_sig));
587
 
580
 
588
                width = high - low + 1;
581
       
589
                if (level & 1)
582
    width = high-low+1;
590
                {
583
    if(level & 1)
591
                        printf (
584
      {                              
592
                            "Partition : Net %-20s Inside %d Outside %d Crossing Dir %d width "
585
      printf("Partition : Net %-20s Inside %d Outside %d Crossing Dir %d width %d %c%c%c%c%c\n",
593
                            "%d %c%c%c%c%c\n",
-
 
594
                            net->name,
-
 
595
                            net->inside_partition,
-
 
596
                            net->leaves_partition,
586
            net->name,net->inside_partition,net->leaves_partition,
597
                            net->ext_dir,
-
 
598
                            width,
587
            net->ext_dir,width,
599
                            outputs_on_net ? 'O' : 'o',
588
            outputs_on_net?'O':'o',
600
                            inputs_on_net ? 'I' : 'i',
589
            inputs_on_net ?'I':'i',
601
                            bidirs_on_net ? 'B' : 'b',
590
            bidirs_on_net ?'B':'b',
602
                            buffers_on_net ? 'U' : 'u',
591
            buffers_on_net?'U':'u',
603
                            default_drive ? 'D' : 'd');
592
            default_drive ?'D':'d');
604
                }
593
      }
-
 
594
 
605
 
595
 
606
                /* compute the bus width unless it is already defined  */
596
    /* compute the bus width unless it is already defined  */
607
 
597
 
608
                if (net->leaves_partition)
598
    if(net->leaves_partition) {
609
                {
-
 
610
                        port_wires += width;
599
      port_wires+= width;    
611
                        ports++;
600
      ports++;
612
                };
601
      };
613
                if (net->inside_partition)
602
    if(net->inside_partition) {
614
                {
-
 
615
                        signal_wires += width;
603
      signal_wires+= width;
616
                        signals++;
604
      signals++;
617
                };
605
      };
618
                net = net->next;
606
    net = net->next;
619
        }
607
  }
620
        Log (
-
 
621
            LOG_GENERAL,
-
 
622
            "-- %5d Nets    (%5d wires) leaving partition\n"
608
  Log(LOG_GENERAL,"-- %5d Nets    (%5d wires) leaving partition\n"
623
            "-- %5d Signals (%5d wires) inside partition\n",
609
                  "-- %5d Signals (%5d wires) inside partition\n",
624
            ports,
-
 
625
            port_wires,
-
 
626
            signals,
-
 
627
            signal_wires);
610
                  ports,port_wires,signals,signal_wires);
628
}
611
}
629
 
612
 
630
/* remove a port from the partition as I dont want it outside */
613
/* remove a port from the partition as I dont want it outside */
631
void delete_port (char *template)
614
void delete_port(char * template)
632
{
615
{
633
        int rc;
616
  int rc;
634
        net_t *net = named_list;
617
  net_t * net = named_list;
635
        int found = 0;
618
  int found = 0;
636
        int net_count = 0;
619
  int net_count = 0;
637
        /* compile regular expression */
620
  /* compile regular expression */
638
        vert_regex_t *preg;
621
  vert_regex_t  * preg;
-
 
622
 
-
 
623
 
-
 
624
  rc = vert_regcomp(&preg,template);
-
 
625
 
-
 
626
  if (rc != 0 )
-
 
627
    {
-
 
628
    char errbuff[100];
-
 
629
    regerror(rc,preg->preg,errbuff,100);
-
 
630
    Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,template);
-
 
631
   
-
 
632
    return /*TCL_ERROR */;
-
 
633
    }
-
 
634
 
-
 
635
 
-
 
636
 
-
 
637
  Log(LOG_GENERAL,"-- Beginning removing ports : prefix '%s' --\n",template );
-
 
638
 
-
 
639
  while(net)
-
 
640
    {
-
 
641
    found  = regexec(preg->preg,net->name,0,preg->regpatt,0);
-
 
642
    if(found && found!=REG_NOMATCH)
-
 
643
      {
-
 
644
      char errbuff[100];
-
 
645
      regerror(found,preg->preg,errbuff,100);
-
 
646
      Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",found,errbuff,template);
-
 
647
   
-
 
648
      }
-
 
649
 
-
 
650
      if (level & 1)
-
 
651
        {
-
 
652
        Log(LOG_GENERAL,"-- Net '%s'%s",net->name,found?"\n":"");
-
 
653
        }
-
 
654
 
-
 
655
    if(!found)
-
 
656
      {
-
 
657
      if (level & 1)
-
 
658
        {
-
 
659
        Log(LOG_GENERAL,"inside=%d leaves=%d buffer=%d force_port=%d\n",
-
 
660
            net->inside_partition,
-
 
661
            net->leaves_partition,
-
 
662
            net->needs_buff_sig,
-
 
663
            net->force_port);
-
 
664
        }
-
 
665
   
-
 
666
      net->force_port = 0;
-
 
667
   /* now to delete the port the following is needed to be done */
-
 
668
    /* Is it going outside ? If not , forget it */
-
 
669
    /* otherwise ensure its used inside, not a port and its not needing a buffer */
-
 
670
     
-
 
671
       if( net->leaves_partition  || net->needs_buff_sig )
-
 
672
         {
-
 
673
         net->leaves_partition = 0;
-
 
674
         net->inside_partition = 1;
-
 
675
         net->needs_buff_sig = 0;
-
 
676
         if (level & 1)
-
 
677
           Log(LOG_GENERAL,"-- Removed port '%s' from partion\n",net->name);
-
 
678
         net_count++;
-
 
679
         }
-
 
680
      }
-
 
681
  net = net->next;
-
 
682
  }
639
 
683
 
640
        rc = vert_regcomp (&preg, template);
-
 
641
 
684
 
642
        if (rc != 0)
-
 
643
        {
-
 
644
                char errbuff[100];
-
 
645
                regerror (rc, preg->preg, errbuff, 100);
-
 
646
                Log (
-
 
647
                    LOG_ERROR,
-
 
648
                    "-- Problem (rc=%d) %s with '%s' as regular expression\n",
-
 
649
                    rc,
-
 
650
                    errbuff,
-
 
651
                    template);
-
 
652
 
685
 
653
                return /*TCL_ERROR */;
-
 
654
        }
-
 
655
 
686
 
656
        Log (LOG_GENERAL, "-- Beginning removing ports : prefix '%s' --\n", template);
-
 
657
 
687
 
658
        while (net)
-
 
659
        {
-
 
660
                found = regexec (preg->preg, net->name, 0, preg->regpatt, 0);
-
 
661
                if (found && found != REG_NOMATCH)
-
 
662
                {
-
 
663
                        char errbuff[100];
-
 
664
                        regerror (found, preg->preg, errbuff, 100);
-
 
665
                        Log (
-
 
666
                            LOG_ERROR,
-
 
667
                            "-- Problem (rc=%d) %s with '%s' as regular expression\n",
-
 
668
                            found,
-
 
669
                            errbuff,
-
 
670
                            template);
-
 
671
                }
-
 
672
 
-
 
673
                if (level & 1)
-
 
674
                {
-
 
675
                        Log (LOG_GENERAL, "-- Net '%s'%s", net->name, found ? "\n" : "");
-
 
676
                }
-
 
677
 
-
 
678
                if (!found)
-
 
679
                {
-
 
680
                        if (level & 1)
-
 
681
                        {
-
 
682
                                Log (
-
 
683
                                    LOG_GENERAL,
-
 
684
                                    "inside=%d leaves=%d buffer=%d force_port=%d\n",
-
 
685
                                    net->inside_partition,
-
 
686
                                    net->leaves_partition,
-
 
687
                                    net->needs_buff_sig,
-
 
688
                                    net->force_port);
-
 
689
                        }
-
 
690
 
-
 
691
                        net->force_port = 0;
-
 
692
                        /* now to delete the port the following is needed to be done */
-
 
693
                        /* Is it going outside ? If not , forget it */
-
 
694
                        /* otherwise ensure its used inside, not a port and its not needing a
-
 
695
                         * buffer */
-
 
696
 
-
 
697
                        if (net->leaves_partition || net->needs_buff_sig)
-
 
698
                        {
-
 
699
                                net->leaves_partition = 0;
-
 
700
                                net->inside_partition = 1;
-
 
701
                                net->needs_buff_sig = 0;
-
 
702
                                if (level & 1)
-
 
703
                                        Log (
-
 
704
                                            LOG_GENERAL,
-
 
705
                                            "-- Removed port '%s' from partion\n",
-
 
706
                                            net->name);
-
 
707
                                net_count++;
-
 
708
                        }
-
 
709
                }
-
 
710
                net = net->next;
-
 
711
        }
-
 
712
 
-
 
713
        Log (LOG_GENERAL, "-- Removed %d ports from partiton\n", net_count);
688
   Log(LOG_GENERAL,"-- Removed %d ports from partiton\n",net_count);
714
        Log (LOG_GENERAL, "-- Done removing ports \n");
689
   Log(LOG_GENERAL,"-- Done removing ports \n");
715
        vert_regfree (&preg);
690
   vert_regfree(&preg);
716
}
691
}
717
 
692
   
718
/* force a net to be a port on the partition as I want it outside */
693
/* force a net to be a port on the partition as I want it outside */
719
void force_port (char *template)
694
void force_port(char * template)
720
{
695
{
721
        int rc;
696
  int rc;
722
        net_t *net = named_list;
697
  net_t * net = named_list;
723
        int found;
698
  int found ;
724
        int net_count = 0;
699
  int net_count = 0;
725
        /* compile regular expression */
700
  /* compile regular expression */
726
        vert_regex_t *preg;
701
  vert_regex_t * preg;
727
 
702
 
728
        rc = vert_regcomp (&preg, template);
703
  rc = vert_regcomp(&preg,template);
729
 
704
 
730
        if (rc != 0)
705
  if (rc != 0 )
731
        {
706
    {
732
                char errbuff[100];
707
    char errbuff[100];
733
                regerror (rc, preg->preg, errbuff, 100);
708
    regerror(rc,preg->preg,errbuff,100);
734
                Log (
-
 
735
                    LOG_ERROR,
-
 
736
                    "-- Problem (rc=%d) %s with '%s' as regular expression\n",
709
    Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,template);
737
                    rc,
-
 
738
                    errbuff,
-
 
739
                    template);
-
 
740
 
710
   
741
                return /*TCL_ERROR */;
711
    return /*TCL_ERROR */;
742
        }
712
    }
743
 
713
 
744
        Log (LOG_GENERAL, "-- Beginning setting ports : prefix '%s' --\n", template);
714
  Log(LOG_GENERAL,"-- Beginning setting ports : prefix '%s' --\n",template );
745
 
715
 
746
        while (net)
716
  while(net) {
747
        {
-
 
748
                found = regexec (preg->preg, net->name, 0, preg->regpatt, 0);
717
    found  = regexec(preg->preg,net->name,0,preg->regpatt,0);
749
 
718
 
750
                if (!found)
719
    if(!found) {
751
                {
720
      if(level &1)
752
                        if (level & 1)
-
 
753
                                Log (
-
 
754
                                    LOG_GENERAL,
-
 
755
                                    "-- Set '%s' as a port if it is inside partition\n",
721
        Log(LOG_GENERAL,"-- Set '%s' as a port if it is inside partition\n",net->name);
756
                                    net->name);
-
 
757
                        net->force_port = 1;
722
      net->force_port = 1;
758
                        net_count++;
723
      net_count++;
759
                }
724
      }
760
                net = net->next;
725
    net = net->next;
761
        }
726
    }
762
        Log (LOG_GENERAL, "-- Forced %d ports on partion\n", net_count);
727
   Log(LOG_GENERAL,"-- Forced %d ports on partion\n",net_count);
763
        Log (LOG_GENERAL, "-- Port forcing done\n");
728
   Log(LOG_GENERAL,"-- Port forcing done\n");
764
        vert_regfree (&preg);
729
  vert_regfree(&preg);
765
}
730
}
-
 
731
   
-
 
732
 
-
 
733