Subversion Repositories Vertical

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
/*
2
 * $id: c:\\cygwin\\cvsroot/vertical/bundle.c,v 1.9 2001/10/31 16:23:44 mjames Exp $
3
 *
4
 * $Log: bundle.c,v $
5
 * Revision 1.2  2004/06/22 21:44:14  mjames
6
 * Firrst build most files
7
 *
8
 * Revision 1.13  2002/09/09 10:18:04  mjames
9
 * Moved pin remapping function to pin ident editing function from
10
 * sorting pin name routine.
11
 *
12
 * Revision 1.12  2002/08/23 14:21:21  mjames
13
 * Cleared the bundle_index of a pin that does not have bundle membership
14
 *
15
 * Revision 1.11  2001/12/20 13:52:15  mjames
16
 * Removed lost variables
17
 *
18
 * Revision 1.10  2001/10/31 22:19:57  mjames
19
 * Tidying up problematical comments caused by CVS
20
 * 'intelligent' comment guessing
21
 *
22
 * Revision 1.9  2001/10/31 16:23:44  mjames
23
 * Added a datastructure to hide regular expression information from programs.
24
 * Changed call to regexec to indicate 0 subexpressions to be matched
25
 * rather than a number dependent on strlen(string) which was wrong.
26
 *
27
 * Revision 1.8  2001/10/23 21:16:46  mjames
28
 * Removed highest_bundle attribute if someone is removing the bundle
29
 *
30
 * Revision 1.7  2001/10/10 20:18:45  mjames
31
 * Added a vert_regcomp function to compile regular expressions
32
 * with '^' (match start string) and  '$' (match end string) bracketing
33
 * this => wildcard must match entire string not just a part of it.
34
 *
35
 * Revision 1.6  2001/10/07 20:50:55  mjames
36
 * Added wildcard checking (warn user about
37
 * using wildcard '*' on the end of a string in stead of wildcard '.*')
38
 *
39
 * Revision 1.5  2001/09/25 23:15:24  mjames
40
 * Converted wildcards to use proper regexp pattern match library
41
 *
42
 * Revision 1.4  2001/09/16 20:36:04  mjames
43
 * Second attempt to modify wire bundles to be connector rather than net
44
 * centric. Allows more than one connector to carry the same net,
45
 *
46
 * Revision 1.3  2001/09/16 19:50:07  mjames
47
 * Second attempt at bundling the pins on sockets
48
 *
49
 * Revision 1.2  2001/09/13 21:09:51  mjames
50
 * Using correct pointer references
51
 *
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
54
 * with the same name as the connector and a width the same as the pins
55
 * on the connector
11 mjames 56
 *
57
*/
58
#include <stdio.h>
59
#include <string.h>
60
#include <stdlib.h>
61
#include <ctype.h>
62
#include <sys/types.h>
63
#include <regex.h>
64
 
65
 
66
#include "vertcl_main.h"
2 mjames 67
#include "expression.h"
68
#include "generic.h"
11 mjames 69
#include "database.h"
70
#include "cmdparse.h"
71
#include "cmdlog.h"
2 mjames 72
#include "printout.h"
73
#include "sorting.h"
74
 
75
#include <stdio.h>
76
 
77
#ident "@(#)$Header: C:/cvsroot/Vert03/vertlib/bundle.c,v 1.2 2004/06/22 21:44:14 mjames Exp $"
78
 
11 mjames 79
 
2 mjames 80
/* this function sets or clears all of the bundle group related to a socket */
81
/* it allocates a unique integer to each net on the port list of the socket */
82
 
83
/* faults : Does not check pin directions yet */
84
/*          assumes a net is only on one socket. not true for rings ! */
85
 
11 mjames 86
static void set_bundle(socket_t * socket, int set_or_clear )
87
  {
88
  node_t * node;
89
  int rows,columns;
90
  int bundle;
91
  int bundle_base;
92
/* Use generics to set up the bundle base */
2 mjames 93
 
11 mjames 94
  generic_info_t gen[1];
2 mjames 95
 
11 mjames 96
  if(!socket)
97
    return;
2 mjames 98
 
11 mjames 99
/* is the array going from 130:1 or 129:0 ... */
100
  bundle_base = 1;
101
  if (get_generic_value(&socket->generics, "bundle_base",gen) == IS_INTEGER)
102
    {
103
    bundle_base = eval_expression(gen->expr, &global_generics);
104
    }
2 mjames 105
 
11 mjames 106
 
107
/* Removed Nov 2008 MDJ
108
  if (get_generic_value(&global_generics, "bundle_base",gen) == IS_INTEGER)
109
    {
110
    bundle_base = eval_expression(gen->expr, &global_generics);
111
    }
112
*/
113
/*
114
    printf("bundle base \n",bundle_base);
115
*/
2 mjames 116
 
117
 
11 mjames 118
  sort_nodes(socket,EXTRACT_XY);
119
 
120
  /* the sort routine tells me pin row and column limits */
121
  /* rows are defined as numbers, columns defined as letters */
122
  rows    = socket->max_pin_row - socket->min_pin_row+1;
123
  columns = socket->max_pin_col - socket->min_pin_col+1;
124
  node = socket-> nodes;
125
  bundle = 0;
126
  while (node)
127
    {
128
    net_t * net = node->net;
129
/*
130
    printf("node %s\n",node->identifier);
131
*/
132
    if(net)
133
      {
134
      if(set_or_clear && net->how_routed != Not_Routable)
135
        {
136
        node->bundle_index  = node->pin_row - socket->min_pin_row +
137
                             (node->pin_col - socket->min_pin_col) * rows +bundle_base;
138
        net->bundle_member =1;
139
        bundle++;
140
/*
141
        printf("net %s -> %s[%d]\n",net->identifier,net->bundle_parent->identifier,net->bundle_index);
142
*/
2 mjames 143
        }
11 mjames 144
      else /* clear */
2 mjames 145
        {
11 mjames 146
        node->bundle_index = -1;
147
        net->bundle_member = 0;
2 mjames 148
        }
11 mjames 149
      }
150
    else
151
      {
152
      node->bundle_index = -1;
153
      }
154
   node = node->sktnext;
155
    }
156
  if (set_or_clear)
157
    {
158
    socket->highest_bundle  = rows * columns+bundle_base-1  ; /* one more than bundle pins */
159
    socket->lowest_bundle   = bundle_base;
160
    socket->bundle_width    = bundle;
161
    }
162
  else
163
    {
164
    socket->highest_bundle = 0;
165
    socket->lowest_bundle  = 0;
166
    socket->bundle_width   = 0;
167
    }
168
  /* for further declarations */
169
  }
2 mjames 170
 
171
 
172
 
11 mjames 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;
2 mjames 179
 
11 mjames 180
/*  create_unrouted_list(); */
181
  /* compile regular expression */
182
  vert_regex_t * preg;
2 mjames 183
 
184
 
11 mjames 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
  }
221
 
222