Skip to content

Commit 7449360

Browse files
committed
Verilog: allow typedefs as block identifiers
This changes the Verilog grammar to allow typedef identifiers to be reused as block identifiers.
1 parent 94fa46a commit 7449360

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

regression/verilog/named_block/named_block_vs_typedef1.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG
1+
CORE
22
named_block_vs_typedef1.sv
33

44
^EXIT=10$

src/verilog/parser.y

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3341,8 +3341,8 @@ generate_block:
33413341
generate_item
33423342
| TOK_BEGIN generate_item_brace TOK_END
33433343
{ init($$, ID_generate_block); swapop($$, $2); }
3344-
| TOK_BEGIN TOK_COLON generate_block_identifier
3345-
{ push_scope(stack_expr($3).id(), ".", verilog_scopet::BLOCK); }
3344+
| TOK_BEGIN TOK_COLON any_identifier
3345+
{ push_scope(stack_expr($3).get(ID_base_name), ".", verilog_scopet::BLOCK); }
33463346
generate_item_brace TOK_END
33473347
{ pop_scope();
33483348
init($$, ID_generate_block);
@@ -3654,8 +3654,8 @@ seq_block:
36543654
block_item_declaration_or_statement_or_null_brace
36553655
TOK_END
36563656
{ init($$, ID_block); swapop($$, $2); }
3657-
| TOK_BEGIN TOK_COLON block_identifier
3658-
{ push_scope(stack_expr($3).id(), ".", verilog_scopet::BLOCK); }
3657+
| TOK_BEGIN TOK_COLON any_identifier
3658+
{ push_scope(stack_expr($3).get(ID_base_name), ".", verilog_scopet::BLOCK); }
36593659
block_item_declaration_or_statement_or_null_brace
36603660
TOK_END
36613661
{ init($$, ID_block);
@@ -3668,11 +3668,12 @@ seq_block:
36683668
par_block:
36693669
TOK_FORK statement_or_null_brace TOK_JOIN
36703670
{ init($$, ID_fork); swapop($$, $2); }
3671-
| TOK_FORK TOK_COLON block_identifier
3671+
| TOK_FORK TOK_COLON any_identifier
36723672
statement_or_null_brace TOK_JOIN
36733673
{ init($$, ID_block);
36743674
swapop($$, $4);
3675-
addswap($$, ID_base_name, $3); }
3675+
stack_expr($$).set(ID_base_name, stack_expr($3).get(ID_base_name));
3676+
}
36763677
;
36773678

36783679
// System Verilog standard 1800-2017
@@ -4804,8 +4805,6 @@ ps_type_identifier: type_identifier;
48044805

48054806
parameter_identifier: TOK_NON_TYPE_IDENTIFIER;
48064807

4807-
generate_block_identifier: TOK_NON_TYPE_IDENTIFIER;
4808-
48094808
udp_identifier: TOK_NON_TYPE_IDENTIFIER;
48104809

48114810
task_identifier: hierarchical_identifier

0 commit comments

Comments
 (0)