diff options
author | Jannis Harder <me@jix.one> | 2022-05-24 14:32:14 +0200 |
---|---|---|
committer | Zachary Snow <zachary.j.snow@gmail.com> | 2022-05-24 23:03:31 -0400 |
commit | cffec1f95f0ac4bad1deb24bf7f921bd93145a16 (patch) | |
tree | c66eeb0e812b0519e8f72791c70e2b6dc44d7df3 /tests/verilog | |
parent | c525b5f91925bd51194ead99a4ecace313f9945c (diff) | |
download | yosys-cffec1f95f0ac4bad1deb24bf7f921bd93145a16.tar.gz yosys-cffec1f95f0ac4bad1deb24bf7f921bd93145a16.tar.bz2 yosys-cffec1f95f0ac4bad1deb24bf7f921bd93145a16.zip |
verilog: fix signedness when removing unreachable cases
Diffstat (limited to 'tests/verilog')
-rw-r--r-- | tests/verilog/unreachable_case_sign.ys | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/verilog/unreachable_case_sign.ys b/tests/verilog/unreachable_case_sign.ys new file mode 100644 index 000000000..25bc0c6f0 --- /dev/null +++ b/tests/verilog/unreachable_case_sign.ys @@ -0,0 +1,33 @@ +logger -expect-no-warnings + +read_verilog -formal <<EOT +module top(input clk); + reg good = 0; + + always @(posedge clk) begin + case (4'sb1111) 15: good = 1; 4'b0000: ; endcase + assert (good); + end +endmodule +EOT + +prep -top top +sim -n 3 -clock clk + +design -reset + +read_verilog -formal <<EOT +module top(input clk); + reg good = 1; + reg signed [1:0] case_value = -1; + + always @(posedge clk) begin + case (4'sb1111) 4'b0000: ; case_value: good = 0; endcase + assert (good); + end +endmodule +EOT + +prep -top top +sim -n 3 -clock clk + |