Subversion Repositories Vertical

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
%{
2
/* 
3
 * $Header: C:/cvsroot/Vert03/gen_src/gen_yacc.y,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $
4
 *
5
 * $Log: gen_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.10  2002/10/02 19:37:29  MJAMES
10
 * Moved dummy functions to a separate support file.
11
 *
12
 * Used correct number of arguments to define_pin
13
 *
14
 * Revision 1.9  2002/09/09 10:36:20  mjames
15
 * Checkpoint checkin
16
 *
17
 * Revision 1.8  2001/10/31 22:20:07  mjames
18
 * Tidying up problematical comments caused by CVS
19
 * 'intelligent' comment guessing
20
 *
21
 * Revision 1.7  2001/10/02 20:53:46  mjames
22
 * Moved documentation about code to main program module.
23
 *
24
 * Revision 1.6  2001/09/16 19:59:20  mjames
25
 * tidying
26
 *
27
 * Revision 1.5  2001/06/07 10:28:06  MJAMES
28
 * Removed ] symbol dropped in by mistake
29
 *
30
 * Revision 1.4  2001/06/06 14:46:02  mjames
31
 * Added further Verilog support.
32
 * Corrected write ext command to not require additional argument.
33
 * Added write quartus for creation of a pinfit file relevant to Quartus
34
 *
35
 * Revision 1.3  2001/06/06 12:10:21  mjames
36
 * Move from HPUX
37
 *
38
 * Revision 1.2  2000/12/04 13:14:03  mjames
39
 * Imported all of the PCB syntax readers.
40
 *
41
 * Converted "a/b" to mean "a" divided by "b" insted of a single string
42
 * "a/b" in Verilog
43
 *
44
 * Revision 1.1.1.1  2000/10/19 21:58:38  mjames
45
 * Mike put it here
46
 *
47
 *
48
 * Revision 1.18  2000/10/04  10:37:06  10:37:06  mjames (Mike James)
49
 * Modified for Vertical2 : support COMPONENTS and SIGNALS
50
 * 
51
 * Revision 1.15  2000/09/27  10:45:41  10:45:41  mjames (Mike James)
52
 * Corrected to use correct return code from yyparse()
53
 * 
54
 * Revision 1.14  2000/09/21  10:15:45  10:15:45  mjames (Mike James)
55
 * Part of Release Sep21Alpha
56
 * 
57
 * Revision 1.13  2000/08/25  09:57:18  09:57:18  mjames (Mike James)
58
 * Part of Release Aug25_alpha
59
 * 
60
 * Revision 1.12  2000/08/16  08:57:35  08:57:35  mjames (Mike James)
61
 * Part of Release CD01_Aug2000
62
 * 
63
 * Revision 1.11  2000/08/14  14:45:15  14:45:15  mjames (Mike James)
64
 * Part of Release Aug_14_2000
65
 * 
66
 * Revision 1.10  2000/08/11  08:30:36  08:30:36  mjames (Mike James)
67
 * Part of Release Aug_11_2000
68
 * 
69
 * Revision 1.9  2000/08/09  10:31:52  10:31:52  mjames (Mike James)
70
 * Part of Release Aug__9_2000
71
 * 
72
 * Revision 1.8  2000/05/31  11:43:03  11:43:03  mjames (Mike James)
73
 * Part of Release May_31_2000
74
 * 
75
 * Revision 1.7  2000/05/08  17:01:42  17:01:42  mjames (Mike James)
76
 * Part of Release May__8_2000
77
 * 
78
 * Revision 1.6  2000/05/08  16:59:35  16:59:35  mjames (Mike James)
79
 * Part of Release May__8_2000
80
 * 
81
 * Revision 1.5  2000/05/08  16:57:11  16:57:11  mjames (Mike James)
82
 * Part of Release May__8_2000
83
 * 
84
 * Revision 1.4  2000/03/08  16:19:07  16:19:07  mjames (Mike James)
85
 * New version including PC
86
 * 
87
 * Revision 1.1  2000/02/23  13:17:00  13:17:00  mjames (Mike James)
88
 * Initial revision
89
 * 
90
 * Revision 1.10  2000/01/20  15:58:46  15:58:46  mjames (Mike James)
91
 * Part of Release R22
92
 * 
93
 * Revision 1.9  99/12/22  11:15:27  11:15:27  mjames (Mike James)
94
 * Part of Release Dec_22_1999
95
 * 
96
 * Revision 1.8  99/06/25  14:35:45  14:35:45  mjames (Mike James)
97
 * Added in reference to expression.h, but no changes made 
98
 * to the function of acfread yet.
99
 * 
100
 * Revision 1.7  99/05/04  09:52:32  09:52:32  mjames (Mike James)
101
 * General checkin
102
 * 
103
 * Revision 1.5  98/07/14  13:24:51  13:24:51  mjames (Mike James)
104
 * Altered calling of some database functions
105
 * 
106
 * Revision 1.4  98/02/11  11:26:46  11:26:46  mjames (Mike James)
107
 * Checked in for version 6.2a
108
 * 
109
 * Revision 1.3  97/04/23  08:45:10  08:45:10  mjames (Mike James)
110
 * CHecked in for release rel23041997
111
 * 
112
 * Revision 1.2  96/12/23  15:16:50  15:16:50  mjames (Mike James)
113
 * Altered because find_socket takes a reference
114
 * to the head-of-list-pointer noth the pointer itself.
115
 * 
116
 * Revision 1.1  96/12/13  08:43:46  08:43:46  mjames (Mike James)
117
 * Initial revision
118
 * 
119
 *
120
 *  */
121
 
122
/*
123
@title
124
PROGRAM genread: Converter for .GEN files
125
@text
126
PCB netlist to ACFP converter. Looks for netlists in ASCII containing tags like:
127
@listing
128
$PACKAGES
129
$NETS   
130
$END    
131
 
132
@text
133
Commonly seen with a '.GEN' file suffix. Lots of exclamation marks '!' in the
134
netlist file. Mentor Graphics ?
135
@end
136
*/
137
 
138
 
139
 
140
#include <stdio.h>
141
#include <stdlib.h>
142
#include <string.h>
143
#include "expression.h"
144
#include "generic.h"
145
#include "database.h"
146
 
147
 
148
 
149
static char IDstr[] = "@(#)$Header: C:/cvsroot/Vert03/gen_src/gen_yacc.y,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $";
150
 
151
 
152
static socket_t * current_chip;
153
static char curr_net_nam[MAXIDLEN];
154
int inside_block;
155
%}
156
%union { char * string; }
157
%token PACKAGES NETS END NL PLING SEMI DOT COMMA
158
%token <string> ASTRING
159
 
160
%%
161
 
162
 
163
 
164
 
165
objects : objects object
166
        | object
167
        ;
168
 
169
 
170
object  : package_list
171
        | nets_list
172
        | END  NL
173
        | gap
174
        ;
175
 
176
 
177
package_list : PACKAGES NL component_lines gap;
178
nets_list    : NETS     NL nets gap ;
179
 
180
component_lines : component_lines component_line
181
                | component_line
182
                ;
183
 
184
 
185
component_line :  ASTRING PLING ASTRING SEMI ASTRING NL {
186
                 current_chip = find_socket(Ident,$5,Create,&socket_head);
187
                 set_socket(current_chip,Type,$1) ;
188
                 set_socket(current_chip,Value,$3) ;
189
                 };
190
 
191
 
192
nets            : net nets
193
                | net
194
                ;
195
 
196
 
197
net  : net_name pins gap;
198
 
199
 
200
pins       : pins pin
201
                | pin
202
                | pins COMMA NL pins
203
                ;
204
 
205
net_name   : ASTRING SEMI { strcpy(curr_net_nam,$1); };
206
 
207
 
208
pin           : ASTRING DOT ASTRING { define_pin(&routed_list,
209
                              find_socket(Ident,$1,Create,&socket_head),
210
                              curr_net_nam,BIDIR,0,$3,
211
                              default_vhdl_datatype,NULL); };
212
 
213
 
214
 
215
 
216
gap              : NL gap
217
                  | NL
218
                  |
219
                  ;
220
 
221
 
222
%%
223
 
224
/* defining lineno here */
225
 
226
int lineno;
227
extern char * yytext;
228
 
229
int yyerror(char * x)
230
  {
231
  int token;
232
  printf("Error --> %s near string (%s) at line %d\n",x,yytext,lineno);
233
/*  for(token = yylex();token >= 0 && token!=NL;token = yylex()); */
234
  return 1;
235
  }
236
 
237
int yywrap(void)
238
  {
239
  return 1;
240
  }
241
 
242
 
243