Skip to content

Commit 6866dfe

Browse files
committed
SystemVerilog: endmodule identifiers
SystemVerilog allows repeating the module identifier at after the endmodule keyword.
1 parent 03b292a commit 6866dfe

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
endmodule_identifier.sv
3+
--show-modules
4+
.*Name:.* some_module$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module some_module;
2+
// endmodule identifiers are a SystemVerilog feature
3+
endmodule : some_module
4+

src/verilog/parser.y

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ module_ansi_header:
641641
;
642642

643643
module_declaration:
644-
module_nonansi_header module_item_brace TOK_ENDMODULE module_identifier_opt
644+
module_nonansi_header module_item_brace TOK_ENDMODULE endmodule_identifier_opt
645645
{
646646
PARSER.parse_tree.create_module(
647647
stack_expr($1).operands()[0],
@@ -654,7 +654,7 @@ module_declaration:
654654
// close the module scope
655655
pop_scope();
656656
}
657-
| module_ansi_header module_item_brace TOK_ENDMODULE module_identifier_opt
657+
| module_ansi_header module_item_brace TOK_ENDMODULE endmodule_identifier_opt
658658
{
659659
PARSER.parse_tree.create_module(
660660
stack_expr($1).operands()[0],
@@ -3677,9 +3677,9 @@ interface_identifier:
36773677
36783678
module_identifier: TOK_NON_TYPE_IDENTIFIER;
36793679
3680-
module_identifier_opt:
3680+
endmodule_identifier_opt:
36813681
/* Optional */
3682-
| module_identifier
3682+
| TOK_COLON module_identifier
36833683
;
36843684
36853685
net_identifier: identifier;

0 commit comments

Comments
 (0)