Skip to content

Verilog: fix for named generate block scopes #1150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# EBMC 5.7

* Verilog: `elsif preprocessor directive
* Verilog: fix for named generate blocks
* LTL/SVA to Buechi with --buechi

# EBMC 5.6
Expand Down
7 changes: 7 additions & 0 deletions regression/verilog/typedef/typedef2.sv
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ module main();
end
endtask

// module item inside a named generate block
if (1) begin: some_block
typedef logic some_type;
some_type some_var;
end // checks

// named procedural block
always @my_type2_var begin : named_block
typedef bit my_type5;
my_type5 my_type5_var;
Expand Down
9 changes: 6 additions & 3 deletions src/verilog/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -3163,9 +3163,12 @@ generate_block:
generate_item
| TOK_BEGIN generate_item_brace TOK_END
{ init($$, ID_generate_block); swapop($$, $2); }
| TOK_BEGIN TOK_COLON generate_block_identifier generate_item_brace TOK_END
{ init($$, ID_generate_block);
swapop($$, $4);
| TOK_BEGIN TOK_COLON generate_block_identifier
{ push_scope(stack_expr($3).id(), ".", verilog_scopet::BLOCK); }
generate_item_brace TOK_END
{ pop_scope();
init($$, ID_generate_block);
swapop($$, $5);
stack_expr($$).set(ID_base_name, stack_expr($3).id()); }
;

Expand Down
Loading