4 * Copyright (c) 1998-2007 Stephen Williams (steve@icarus.com)
6 * This source code is free software; you can redistribute it
7 * and/or modify it in source code form under the terms of the GNU
8 * General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22 extern
int sdflex
(void);
23 static void yyerror(const char*msg
);
24 # include "vpi_user.h"
25 # include "sdf_parse_priv.h"
26 # include "sdf_priv.h"
29 /* This is the hierarchy separator to use. */
30 static char use_hchar
= '.';
35 unsigned long int_val
;
40 %token K_ABSOLUTE K_CELL K_CELLTYPE K_DATE K_DELAYFILE K_DELAY K_DESIGN
41 %token K_DIVIDER K_INCREMENT K_INSTANCE K_IOPATH
42 %token K_PROCESS K_PROGRAM K_SDFVERSION K_TEMPERATURE K_TIMESCALE
43 %token K_VENDOR K_VERSION K_VOLTAGE
45 %token
<string_val
> QSTRING IDENTIFIER
46 %token
<real_val
> REAL_NUMBER
47 %token
<int_val
> INTEGER
49 %type
<string_val
> celltype
50 %type
<string_val
> cell_instance
51 %type
<string_val
> hierarchical_identifier
52 %type
<string_val
> port port_instance port_spec
57 : '(' K_DELAYFILE sdf_header_list cell_list
')'
61 : sdf_header_list sdf_header_item
80 : '(' K_SDFVERSION QSTRING
')'
86 : '(' K_DESIGN QSTRING
')'
87 { vpi_printf
("SDF Design: %s\n", $3);
93 : '(' K_DATE QSTRING
')'
94 { vpi_printf
("SDF Date: %s\n", $3);
99 vendor
: '(' K_VENDOR QSTRING
')'
100 { vpi_printf
("SDF Vendor: %s\n", $3);
105 program_name
: '(' K_PROGRAM QSTRING
')'
106 { vpi_printf
("SDF Program: %s\n", $3);
111 program_version
: '(' K_VERSION QSTRING
')'
112 { vpi_printf
("SDF Program Version: %s\n", $3);
118 : '(' K_DIVIDER
'.' ')' { use_hchar
= '.'; }
119 |
'(' K_DIVIDER
'/' ')' { use_hchar
= '/'; }
123 : '(' K_VOLTAGE rtriple
')'
124 |
'(' K_VOLTAGE signed_real_number
')'
127 process
: '(' K_PROCESS QSTRING
')'
128 { vpi_printf
("SDF Process: %s\n", $3);
134 : '(' K_TEMPERATURE rtriple
')'
135 |
'(' K_TEMPERATURE signed_real_number
')'
139 : '(' K_TIMESCALE REAL_NUMBER IDENTIFIER
')'
140 { vpi_printf
("SDF TIMESCALE : %f%s\n", $3, $4);
151 : '(' K_CELL celltype cell_instance
152 { sdf_select_instance
($3, $4); /* find the instance in the design */}
157 |
'(' K_CELL
error ')'
158 { vpi_printf
("%s:%d: Syntax error in CELL\n",
159 sdf_parse_path
, @
2.first_line
); }
163 : '(' K_CELLTYPE QSTRING
')'
168 : '(' K_INSTANCE hierarchical_identifier
')'
170 |
'(' K_INSTANCE
'*' ')'
175 : timing_spec_list timing_spec
180 : '(' K_DELAY deltype_list
')'
181 |
'(' K_DELAY
error ')'
182 { vpi_printf
("%s:%d: Syntax error in CELL DELAY SPEC\n",
183 sdf_parse_path
, @
2.first_line
); }
187 : deltype_list deltype
192 : '(' K_ABSOLUTE del_def_list
')'
193 |
'(' K_INCREMENT del_def_list
')'
195 { vpi_printf
("%s:%d: Invalid/malformed delay type\n",
196 sdf_parse_path
, @
1.first_line
); }
200 : del_def_list del_def
205 : '(' K_IOPATH port_spec port_instance delval_list
')'
206 { sdf_iopath_delays
($3, $4);
210 |
'(' K_IOPATH
error ')'
211 { vpi_printf
("%s:%d: Invalid/malformed IOPATH\n",
212 sdf_parse_path
, @
2.first_line
); }
225 : hierarchical_identifier
227 /* | hierarchical_identifier '[' INTEGER ']' */
237 |
'(' rvalue rvalue
')'
238 |
'(' rvalue rvalue rvalue
')'
242 : '(' signed_real_number
')'
246 hierarchical_identifier
252 : signed_real_number
':' signed_real_number
':' signed_real_number
263 void yyerror(const char*msg
)
265 fprintf
(stderr
, "SDF ERROR: %s\n", msg
);