Subversion Repositories Vertical

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
%{
2
/* 
3
 * $Id: cdi_yacc.y,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $ 
4
 *
5
 * $Log: cdi_yacc.y,v $
6
 * Revision 1.1.1.1  2003/11/04 23:34:57  mjames
7
 * Imported into local repositrory
8
 *
9
 * Revision 1.8  2002/10/02 19:37:30  MJAMES
10
 * Moved dummy functions to a separate support file.
11
 *
12
 * Used correct number of arguments to define_pin
13
 *
14
 * Revision 1.7  2002/09/09 10:36:19  mjames
15
 * Checkpoint checkin
16
 *
17
 * Revision 1.6  2001/10/31 22:19:58  mjames
18
 * Tidying up problematical comments caused by CVS
19
 * 'intelligent' comment guessing
20
 *
21
 * Revision 1.5  2001/10/02 20:55:37  mjames
22
 * Moved documentation about code to main program module.
23
 *
24
 * Revision 1.4  2001/09/16 19:59:47  mjames
25
 * tidying
26
 *
27
 * Revision 1.3  2001/06/06 12:10:26  mjames
28
 * Move from HPUX
29
 *
30
 * Revision 1.2  2000/12/04 13:14:02  mjames
31
 * Imported all of the PCB syntax readers.
32
 *
33
 * Converted "a/b" to mean "a" divided by "b" insted of a single string
34
 * "a/b" in Verilog
35
 *
36
 * Revision 1.1.1.1  2000/10/19 21:58:34  mjames
37
 * Mike put it here
38
 *
39
 *
40
 * Revision 1.32  2000/10/04  10:37:01  10:37:01  mjames (Mike James)
41
 * Modified to become part of vertical2, complete
42
 * with VHDL COMPONENT and SIGNAL declarations.
43
 * 
44
 * Revision 1.29  2000/09/27  10:41:53  10:41:53  mjames (Mike James)
45
 * Modified to use correct return code from yyparse.
46
 * 
47
 * Revision 1.28  2000/09/21  10:15:37  10:15:37  mjames (Mike James)
48
 * Part of Release Sep21Alpha
49
 * 
50
 * Revision 1.27  2000/08/25  09:57:06  09:57:06  mjames (Mike James)
51
 * Part of Release Aug25_alpha
52
 * 
53
 * Revision 1.26  2000/08/16  08:57:23  08:57:23  mjames (Mike James)
54
 * Part of Release CD01_Aug2000
55
 * 
56
 * Revision 1.25  2000/08/14  14:45:06  14:45:06  mjames (Mike James)
57
 * Part of Release Aug_14_2000
58
 * 
59
 * Revision 1.24  2000/08/11  08:30:26  08:30:26  mjames (Mike James)
60
 * Part of Release Aug_11_2000
61
 * 
62
 * Revision 1.23  2000/08/09  10:31:39  10:31:39  mjames (Mike James)
63
 * Part of Release Aug__9_2000
64
 * 
65
 * Revision 1.22  2000/05/31  11:42:45  11:42:45  mjames (Mike James)
66
 * Part of Release May_31_2000
67
 * 
68
 * Revision 1.21  2000/05/08  17:01:31  17:01:31  mjames (Mike James)
69
 * Part of Release May__8_2000
70
 * 
71
 * Revision 1.20  2000/05/08  16:59:24  16:59:24  mjames (Mike James)
72
 * Part of Release May__8_2000
73
 * 
74
 * Revision 1.19  2000/05/08  16:57:00  16:57:00  mjames (Mike James)
75
 * Part of Release May__8_2000
76
 * 
77
 * Revision 1.18  2000/05/08  16:42:54  16:42:54  mjames (Mike James)
78
 * Added a null action to a terminal pattern .
79
 * Makes Bison happy.
80
 * 
81
 * Revision 1.17  2000/03/08  16:17:30  16:17:30  mjames (Mike James)
82
 * Removed syntactically confused 'junk'
83
 * 
84
 * Revision 1.14  2000/01/20  15:58:39  15:58:39  mjames (Mike James)
85
 * Part of Release R22
86
 * 
87
 * Revision 1.13  99/12/22  11:15:19  11:15:19  mjames (Mike James)
88
 * Part of Release Dec_22_1999
89
 * 
90
 * Revision 1.12  99/06/25  14:34:27  14:34:27  mjames (Mike James)
91
 * Added in reference to expression.h, but no changes made 
92
 * to the function of acfread yet.
93
 * 
94
 * Revision 1.11  99/06/18  09:06:38  09:06:38  mjames (Mike James)
95
 * Checkin before major design changes
96
 * 
97
 * Revision 1.10  1999/06/14  10:47:18  mjames
98
 * *** empty log message ***
99
 *
100
 * Revision 1.10  1999/06/14  10:47:18  mjames
101
 * *** empty log message ***
102
 *
103
 * Revision 1.9  1999/06/11  14:21:15  mjames
104
 * *** empty log message ***
105
 *
106
 * Revision 1.9  1999/06/11  14:21:15  mjames
107
 * *** empty log message ***
108
 *
109
 * Revision 1.8  99/05/04  09:48:19  09:48:19  mjames (Mike James)
110
 * 
111
 * 
112
 * Revision 1.5  98/07/14  13:22:06  13:22:06  mjames (Mike James)
113
 * Altered calling of some database functions
114
 * 
115
 * Revision 1.4  98/03/16  11:35:31  11:35:31  mjames (Mike James)
116
 * Made compatible with newer example of .cdi file
117
 * 
118
 * Revision 1.3  98/02/11  11:24:59  11:24:59  mjames (Mike James)
119
 * Checked in for version 6.2a
120
 * 
121
 * Revision 1.2  97/04/23  08:45:08  08:45:08  mjames (Mike James)
122
 * CHecked in for release rel23041997
123
 * 
124
 * Revision 1.1  97/01/03  13:43:13  13:43:13  mjames (Mike James)
125
 * Initial revision
126
 * 
127
 *
128
 *  */
129
 
130
#include <stdio.h>
131
#include <stdlib.h>
132
#include <string.h>
133
#include "expression.h"
134
#include "generic.h"
135
#include "database.h"
136
 
137
 
138
static char IDstr[] = "@(#)$Header: C:/cvsroot/Vert03/cdi_src/cdi_yacc.y,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $";
139
 
140
 
141
static socket_t * current_chip;
142
static char curr_net_id[MAXIDLEN];
143
int inside_block;
144
%}
145
%union { char * string; }
146
%token ASS  IMP  COM CSP PCB CON COD REM EOD NL QUOTE
147
%token <string> ASTRING
148
%%
149
 
150
 
151
 
152
 
153
objects : objects object
154
        | object
155
        ;
156
 
157
 
158
object  : junk_line
159
        | junk_block
160
        | CON NL netlist EOD
161
        | gap
162
        ;
163
 
164
 
165
/* Get rid of anything boring at present */
166
junk_line : junk_line_start words ;
167
 
168
junk_line_start :  CSP | PCB | REM | IMP ;
169
 
170
words : words ASTRING
171
      | ASTRING { } 
172
      | /* nothing */
173
      ;
174
 
175
junk_block : junk_block_start NL lines ;
176
 
177
 
178
junk_block_start : ASS | COM ;
179
 
180
lines : line lines
181
      | line
182
      ;
183
 
184
line  : words NL;
185
 
186
 
187
 
188
 
189
netlist : netlist netnodes
190
        | netnodes
191
        ;
192
 
193
 
194
 
195
netnodes:  rem_part   /* tree nnn */
196
          | name_part   /* named net */ 
197
          | cod_part  /* no action as this is a net width */
198
          | nodelines 
199
          | NL ;
200
 
201
rem_part   : REM ASTRING ASTRING NL { sprintf(curr_net_id,"%s_%s",$2,$3); };
202
 
203
name_part : QUOTE ASTRING QUOTE NL {  strcpy(curr_net_id,$2); };
204
 
205
cod_part  : COD ASTRING NL; 
206
 
207
nodelines : nodelines nodeline
208
          | nodeline
209
          ;
210
 
211
nodeline  : nodes  NL;
212
 
213
 
214
nodes     : nodes node 
215
          | node
216
          ;
217
 
218
 
219
node : ASTRING ASTRING { current_chip =find_socket(Ident,
220
                                $1,Create,&socket_head);
221
                         define_pin(&routed_list,current_chip,
222
                              curr_net_id,BIDIR,0,$2,
223
                              default_vhdl_datatype,NULL); };
224
 
225
 
226
 
227
gap              : NL gap
228
                  | NL
229
                  |
230
                  ;
231
 
232
 
233
%%
234
 
235
/* defining lineno here */
236
 
237
int lineno;
238
extern char * yytext;
239
 
240
int yyerror(char * x)
241
  {
242
  int token;
243
  printf("Error --> %s near string (%s) at line %d\n",x,yytext,lineno);
244
/*  for(token = yylex();token >= 0 && token!=NL;token = yylex()); */
245
  return 1;
246
  }
247
 
248
int yywrap(void)
249
  {
250
  return 1;
251
  }
252
 
253
 
254