Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | %{ |
2 | /* |
||
3 | * $Id: frb_yacc.y,v 1.1.1.1 2003/11/04 23:34:59 mjames Exp $ |
||
4 | * |
||
5 | * $Log: frb_yacc.y,v $ |
||
6 | * Revision 1.1.1.1 2003/11/04 23:34:59 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 2002/01/21 09:34:50 mjames |
||
18 | * FRBread adds the ability to ignore .ATT_PIN construct that appears in |
||
19 | * a recent FRB file. |
||
20 | * |
||
21 | * Revision 1.7 2001/10/31 22:20:06 mjames |
||
22 | * Tidying up problematical comments caused by CVS |
||
23 | * 'intelligent' comment guessing |
||
24 | * |
||
25 | * Revision 1.6 2001/10/02 20:53:47 mjames |
||
26 | * Moved documentation about code to main program module. |
||
27 | * |
||
28 | * Revision 1.5 2001/08/31 09:36:41 mjames |
||
29 | * removed DOS line endings |
||
30 | * |
||
31 | * Revision 1.4 2001/06/06 12:10:22 mjames |
||
32 | * Move from HPUX |
||
33 | * |
||
34 | * Revision 1.3 2001/03/29 08:27:07 mjames |
||
35 | * Converted frbread for use with the newer files from the drawing office |
||
36 | * |
||
37 | * Revision 1.2 2000/12/04 13:14:02 mjames |
||
38 | * Imported all of the PCB syntax readers. |
||
39 | * |
||
40 | * Converted "a/b" to mean "a" divided by "b" insted of a single string |
||
41 | * "a/b" in Verilog |
||
42 | * |
||
43 | * Revision 1.1.1.1 2000/10/19 21:58:38 mjames |
||
44 | * Mike put it here |
||
45 | * */ |
||
46 | |||
47 | |||
48 | |||
49 | |||
50 | #include <stdio.h> |
||
51 | #include <stdlib.h> |
||
52 | #include <string.h> |
||
53 | #include "expression.h" |
||
54 | #include "generic.h" |
||
55 | #include "database.h" |
||
56 | |||
57 | |||
58 | static char IDstr[] = "@(#)$Header: C:/cvsroot/Vert03/frb_src/frb_yacc.y,v 1.1.1.1 2003/11/04 23:34:59 mjames Exp $"; |
||
59 | |||
60 | |||
61 | static socket_t * current_chip; |
||
62 | static char curr_net_nam[MAXIDLEN]; |
||
63 | static int curr_pin_dir; |
||
64 | int inside_block; |
||
65 | |||
66 | %} |
||
67 | %union { char * string; } |
||
68 | %token HEADER TIME JOB TYPE APP ADD_COM ADD_TER TER END UNITS |
||
69 | %token ATT_COM ATT_TRE ATT_PIN |
||
70 | %token NL ENDFILE |
||
71 | %token <string> ASTRING |
||
72 | |||
73 | %% |
||
74 | |||
75 | file : objects; |
||
76 | |||
77 | |||
78 | |||
79 | objects : objects object |
||
80 | | object |
||
81 | ; |
||
82 | |||
83 | |||
84 | object : header_line NL |
||
85 | | add_comp_line NL |
||
86 | | add_ter_line NL |
||
87 | | ter_block NL |
||
88 | | gap |
||
89 | | END gap |
||
90 | ; |
||
91 | |||
92 | |||
93 | header_line :junktag { } junk ; |
||
94 | |||
95 | junktag : HEADER | TIME | JOB | APP | TYPE | UNITS | ATT_COM | ATT_TRE | ATT_PIN ; |
||
96 | |||
97 | add_comp_line : ADD_COM ASTRING ASTRING ASTRING { |
||
98 | current_chip = find_socket(Ident,$2,Create,&socket_head); |
||
99 | set_socket(current_chip,Type,$3) ; |
||
100 | set_socket(current_chip,Value,$4) ; |
||
101 | }; |
||
102 | |||
103 | add_ter_line : ADD_TER ASTRING ASTRING ASTRING { |
||
104 | define_pin(&routed_list, |
||
105 | find_socket(Ident,$2,Create,&socket_head), |
||
106 | $4,BIDIR,0,$3,default_vhdl_datatype,NULL); |
||
107 | strcpy(curr_net_nam,$4); |
||
108 | }; |
||
109 | |||
110 | ter_block : TER ter_lines NL; |
||
111 | |||
112 | ter_lines : ter_lines NL ter_line |
||
113 | | ter_line |
||
114 | ; |
||
115 | |||
116 | ter_line: ASTRING ASTRING { |
||
117 | define_pin(&routed_list, |
||
118 | find_socket(Ident,$1,Create,&socket_head), |
||
119 | curr_net_nam,BIDIR,0,$2,default_vhdl_datatype,NULL); |
||
120 | } |
||
121 | ; |
||
122 | |||
123 | |||
124 | junk : any junk |
||
125 | | any |
||
126 | | /* nothing */ |
||
127 | ; |
||
128 | |||
129 | |||
130 | any : ASTRING { } |
||
131 | ; |
||
132 | |||
133 | |||
134 | |||
135 | gap : NL gap |
||
136 | | NL |
||
137 | ; |
||
138 | |||
139 | |||
140 | |||
141 | %% |
||
142 | |||
143 | /* defining lineno here */ |
||
144 | |||
145 | int lineno; |
||
146 | extern char * yytext; |
||
147 | |||
148 | int yyerror(char * x) |
||
149 | { |
||
150 | int token; |
||
151 | printf("-- Error --> %s near string (%s) at line %d\n",x,yytext,lineno); |
||
152 | /* for(token = yylex();token >= 0 && token!=NL;token = yylex()); */ |
||
153 | return 1; |
||
154 | } |
||
155 | |||
156 | int yywrap(void) |
||
157 | { |
||
158 | printf("-- end of file at line %d\n",lineno); |
||
159 | return 1; |
||
160 | } |
||
161 | |||
162 | |||
163 |