mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 00:55:32 +00:00
verlog: allow shadowing module ports within generate blocks
This is a somewhat obscure edge case I encountered while working on test cases for earlier changes. Declarations in generate blocks should not be checked against the list of ports. This change also adds a check forbidding declarations within generate blocks being tagged as inputs or outputs.
This commit is contained in:
parent
eff18a2b15
commit
1d5f3fe506
3 changed files with 29 additions and 4 deletions
10
tests/simple/genblk_port_shadow.v
Normal file
10
tests/simple/genblk_port_shadow.v
Normal file
|
@ -0,0 +1,10 @@
|
|||
module top(x);
|
||||
generate
|
||||
if (1) begin : blk
|
||||
wire x;
|
||||
assign x = 0;
|
||||
end
|
||||
endgenerate
|
||||
output wire x;
|
||||
assign x = blk.x;
|
||||
endmodule
|
12
tests/verilog/genblk_port_decl.ys
Normal file
12
tests/verilog/genblk_port_decl.ys
Normal file
|
@ -0,0 +1,12 @@
|
|||
logger -expect error "Cannot declare module port `\\x' within a generate block\." 1
|
||||
read_verilog <<EOT
|
||||
module top(x);
|
||||
generate
|
||||
if (1) begin : blk
|
||||
output wire x;
|
||||
assign x = 1;
|
||||
end
|
||||
endgenerate
|
||||
output wire x;
|
||||
endmodule
|
||||
EOT
|
Loading…
Add table
Add a link
Reference in a new issue