aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorZachary Snow <zach@zachjs.com>2023-02-12 17:03:37 -0500
committerZachary Snow <zach@zachjs.com>2023-02-12 17:03:37 -0500
commit26a6c604788f947df5142088224b1989320ba467 (patch)
treeb3da0b577aa2ecc561a8a0478fb309a46e56bc66 /tests
parent5ea2c290a58dcc2a2eacacd8b3288d9a1d7037bb (diff)
downloadyosys-26a6c604788f947df5142088224b1989320ba467.tar.gz
yosys-26a6c604788f947df5142088224b1989320ba467.tar.bz2
yosys-26a6c604788f947df5142088224b1989320ba467.zip
Add test for typenames using constants shadowed later on
This possible edge case came up while reviewing #3555. It is currently handled correctly, but there is no clear test coverage.
Diffstat (limited to 'tests')
-rw-r--r--tests/verilog/typedef_const_shadow.sv12
-rw-r--r--tests/verilog/typedef_const_shadow.ys4
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/verilog/typedef_const_shadow.sv b/tests/verilog/typedef_const_shadow.sv
new file mode 100644
index 000000000..e2c331be1
--- /dev/null
+++ b/tests/verilog/typedef_const_shadow.sv
@@ -0,0 +1,12 @@
+module top;
+ localparam W = 5;
+ typedef logic [W-1:0] T;
+ T x; // width 5
+ if (1) begin : blk
+ localparam W = 10;
+ typedef T U;
+ typedef logic [W-1:0] V;
+ U y; // width 5
+ V z; // width 10
+ end
+endmodule
diff --git a/tests/verilog/typedef_const_shadow.ys b/tests/verilog/typedef_const_shadow.ys
new file mode 100644
index 000000000..ecf47181d
--- /dev/null
+++ b/tests/verilog/typedef_const_shadow.ys
@@ -0,0 +1,4 @@
+read_verilog -sv typedef_const_shadow.sv
+select -assert-count 1 w:x s:5 %i
+select -assert-count 1 w:blk.y s:5 %i
+select -assert-count 1 w:blk.z s:10 %i