From 0a8d993c81ea548b128d559ecf64b50b2acfc45b Mon Sep 17 00:00:00 2001 From: Daniel Kroening Date: Fri, 1 Dec 2023 12:26:52 -0800 Subject: [PATCH] Verilog: grammar rules in section A.4.2 generated instantiation This re-sorts and renames the rules in section A.4.2 Generated instantiation to match those in the System Verilog standard 1800-2017. --- src/verilog/parser.y | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/verilog/parser.y b/src/verilog/parser.y index fef5f9c4c..642c21c42 100644 --- a/src/verilog/parser.y +++ b/src/verilog/parser.y @@ -726,6 +726,12 @@ port_declaration_brace: } ; +port_declaration: + attribute_instance_brace inout_declaration { $$=$2; } + | attribute_instance_brace input_declaration { $$=$2; } + | attribute_instance_brace output_declaration { $$=$2; } + ; + module_port_declaration: attribute_instance_brace module_port_inout_declaration { $$=$2; } | attribute_instance_brace module_port_input_declaration { $$=$2; } @@ -1864,32 +1870,18 @@ if_generate_construct: { init($$, ID_generate_if); mto($$, $3); mto($$, $5); mto($$, $7); } ; -generate_item: - conditional_generate_construct - | loop_generate_construct - | generate_block - | module_or_generate_item - ; - -generate_item_or_null: - generate_item - | ';' { init($$, ID_generate_skip); } - ; - -constant_expression: expression; - case_generate_construct: TOK_CASE '(' constant_expression ')' - genvar_case_item_brace TOK_ENDCASE + case_generate_item_brace TOK_ENDCASE { init($$, ID_generate_case); mto($$, $3); } ; -genvar_case_item_brace: - genvar_case_item - | genvar_case_item_brace genvar_case_item +case_generate_item_brace: + case_generate_item + | case_generate_item_brace case_generate_item ; -genvar_case_item: +case_generate_item: expression_brace TOK_COLON generate_item_or_null | TOK_DEFAULT TOK_COLON generate_item_or_null | TOK_DEFAULT generate_item_or_null @@ -1906,12 +1898,20 @@ generate_block: stack_expr($$).set(ID_identifier, stack_expr($3).id()); } ; -port_declaration: - attribute_instance_brace inout_declaration { $$=$2; } - | attribute_instance_brace input_declaration { $$=$2; } - | attribute_instance_brace output_declaration { $$=$2; } +generate_item: + conditional_generate_construct + | loop_generate_construct + | generate_block + | module_or_generate_item ; +generate_item_or_null: + generate_item + | ';' { init($$, ID_generate_skip); } + ; + +constant_expression: expression; + package_or_generate_item_declaration: net_declaration | data_declaration