Subversion Repositories Vertical

Rev

Details | 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
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"
67
#include "expression.h"
68
#include "generic.h"
69
#include "database.h"
70
#include "cmdparse.h"
71
#include "cmdlog.h"
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
 
79
 
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
 
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 */
93
 
94
  generic_info_t gen[1];
95
 
96
  if(!socket)
97
    return;
98
 
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
    }
105
 
106
 
107
  if (get_generic_value(&global_generics, "bundle_base",gen) == IS_INTEGER) 
108
    {
109
    bundle_base = eval_expression(gen->expr, &global_generics);
110
    }
111
/*
112
    printf("bundle base \n",bundle_base);
113
*/
114
 
115
 
116
  sort_nodes(socket,EXTRACT_XY);
117
 
118
  /* the sort routine tells me pin row and column limits */
119
  /* rows are defined as numbers, columns defined as letters */
120
  rows    = socket->max_pin_row - socket->min_pin_row+1;
121
  columns = socket->max_pin_col - socket->min_pin_col+1;
122
  node = socket-> nodes;
123
  bundle = 0;
124
  while (node) 
125
    {
126
    net_t * net = node->net;
127
/*
128
    printf("node %s\n",node->identifier);
129
*/
130
    if(net)
131
      {
132
      if(set_or_clear && net->how_routed != Not_Routable) 
133
        { 
134
        node->bundle_index  = node->pin_row - socket->min_pin_row +
135
                             (node->pin_col - socket->min_pin_col) * rows +bundle_base;
136
        net->bundle_member =1;
137
        bundle++;
138
/*
139
        printf("net %s -> %s[%d]\n",net->identifier,net->bundle_parent->identifier,net->bundle_index);
140
*/
141
        }
142
      else /* clear */
143
        {
144
        node->bundle_index = -1;
145
        net->bundle_member = 0;
146
        }
147
      }
148
    else
149
      {
150
      node->bundle_index = -1;
151
      }
152
   node = node->sktnext; 
153
    }
154
  if (set_or_clear) 
155
    {
156
    socket->highest_bundle  = rows * columns+bundle_base-1  ; /* one more than bundle pins */
157
    socket->lowest_bundle   = bundle_base;
158
    socket->bundle_width    = bundle;
159
    }
160
  else
161
    {
162
    socket->highest_bundle = 0;
163
    socket->lowest_bundle  = 0;
164
    socket->bundle_width   = 0;
165
    }
166
  /* for further declarations */
167
  }
168
 
169
 
170
 
171
void wildcard_bundle(char * chip_id_template, int create_or_delete) 
172
  {
173
  int rc;
174
  socket_t * skt = socket_head;
175
  int count = 0;
176
  int found = 0;
177
 
178
/*  create_unrouted_list(); */
179
  /* compile regular expression */
180
  vert_regex_t * preg;
181
 
182
 
183
  if(!chip_id_template) {
184
    chip_id_template = ".*";
185
    }
186
 
187
  rc = vert_regcomp(&preg,chip_id_template);
188
  if (rc != 0 ) 
189
    {
190
    char errbuff[100];
191
    regerror(rc,preg->preg,errbuff,100);
192
    Log(LOG_ERROR,"-- Problem (rc=%d) %s with '%s' as regular expression\n",rc,errbuff,chip_id_template);
193
 
194
/*    return TCL_ERROR;
195
*/
196
    return;
197
    }
198
  else 
199
    {
200
    Log(LOG_GENERAL,"-- Using '%s' as match pattern\n",chip_id_template);
201
    }
202
  while(skt )
203
    {
204
 
205
    found  = regexec(preg->preg,skt->identifier,0,preg->regpatt,0);
206
 
207
    if(!found) {
208
/*
209
      Log(LOG_GENERAL,"found %s\n",skt->identifier);
210
*/
211
      count++;
212
      set_bundle(skt,create_or_delete);
213
      }
214
    skt = skt->next;
215
    }
216
  Log(LOG_GENERAL,"-- matched %d sockets\n",count);
217
  vert_regfree(&preg);
218
  }
219
 
220