Skip to content

Commit 273b60d

Browse files
committed
Verilog: allow top-level package items
This adds the System Verilog grammar rules to allow top-level package items.
1 parent 4901a33 commit 273b60d

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

src/verilog/parser.y

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -616,16 +616,13 @@ description:
616616
| interface_declaration
617617
| program_declaration
618618
| package_declaration
619+
// | type_declaration
620+
// { PARSER.parse_tree.create_typedef(stack_expr($1)); }
621+
| attribute_instance_brace package_item
619622
| attribute_instance_brace bind_directive
620623
| config_declaration
621-
| type_declaration
622-
{ PARSER.parse_tree.create_typedef(stack_expr($1)); }
623624
;
624625

625-
/*
626-
| attribute_instance_brace package_item
627-
*/
628-
629626
module_nonansi_header:
630627
attribute_instance_brace
631628
module_keyword
@@ -842,6 +839,19 @@ bind_directive:
842839
// A.1.11 Package items
843840

844841
package_item:
842+
package_or_generate_item_declaration
843+
// | anonymous_program
844+
// | package_export_declaration
845+
// | timeunits_declaration
846+
;
847+
848+
package_or_generate_item_declaration:
849+
net_declaration
850+
| data_declaration
851+
| task_declaration
852+
| function_declaration
853+
| local_parameter_declaration ';'
854+
| parameter_declaration ';'
845855
;
846856

847857
// System Verilog standard 1800-2017
@@ -1958,15 +1968,6 @@ generate_item_or_null:
19581968

19591969
constant_expression: expression;
19601970

1961-
package_or_generate_item_declaration:
1962-
net_declaration
1963-
| data_declaration
1964-
| task_declaration
1965-
| function_declaration
1966-
| local_parameter_declaration ';'
1967-
| parameter_declaration ';'
1968-
;
1969-
19701971
// System Verilog standard 1800-2017
19711972
// A.5.1 UDP declaration
19721973

0 commit comments

Comments
 (0)