diff options
author | Zachary Snow <zach@zachjs.com> | 2021-02-06 23:54:17 -0500 |
---|---|---|
committer | Zachary Snow <zach@zachjs.com> | 2021-02-07 11:48:39 -0500 |
commit | 1d5f3fe5064146955dafdabafe7180ff79c95d08 (patch) | |
tree | ccc9c6a40e9ea885b693f6c2e51202f4217453d2 /tests | |
parent | eff18a2b1519428b11400979f116342086c13e13 (diff) | |
download | yosys-1d5f3fe5064146955dafdabafe7180ff79c95d08.tar.gz yosys-1d5f3fe5064146955dafdabafe7180ff79c95d08.tar.bz2 yosys-1d5f3fe5064146955dafdabafe7180ff79c95d08.zip |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/simple/genblk_port_shadow.v | 10 | ||||
-rw-r--r-- | tests/verilog/genblk_port_decl.ys | 12 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/simple/genblk_port_shadow.v b/tests/simple/genblk_port_shadow.v new file mode 100644 index 000000000..a04631a20 --- /dev/null +++ b/tests/simple/genblk_port_shadow.v @@ -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 diff --git a/tests/verilog/genblk_port_decl.ys b/tests/verilog/genblk_port_decl.ys new file mode 100644 index 000000000..589d3d2e1 --- /dev/null +++ b/tests/verilog/genblk_port_decl.ys @@ -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 |