aboutsummaryrefslogtreecommitdiffstats
path: root/tests/proc
diff options
context:
space:
mode:
authorZachary Snow <zach@zachjs.com>2021-07-28 17:34:24 -0400
committerZachary Snow <zachary.j.snow@gmail.com>2021-07-29 20:55:59 -0400
commitc016f6a4236fb970196f35c2afb0f2c7c237a77f (patch)
tree6d7902946f6a5b662217fbd2d9a63a513c10e70c /tests/proc
parent4fec3a85cd7d0fcd35f958bfc89090df25f7de3c (diff)
downloadyosys-c016f6a4236fb970196f35c2afb0f2c7c237a77f.tar.gz
yosys-c016f6a4236fb970196f35c2afb0f2c7c237a77f.tar.bz2
yosys-c016f6a4236fb970196f35c2afb0f2c7c237a77f.zip
proc_rmdead: use explicit pattern set when there are no wildcards
If width of a case expression was large, explicit patterns could cause the existing logic to take an extremely long time, or exhaust the maximum size of the underlying set. For cases where all of the patterns are fully defined and there are no constants in the case expression, this change uses a simple set to track which patterns have been seen.
Diffstat (limited to 'tests/proc')
-rw-r--r--tests/proc/rmdead.v46
-rw-r--r--tests/proc/rmdead.ys4
2 files changed, 50 insertions, 0 deletions
diff --git a/tests/proc/rmdead.v b/tests/proc/rmdead.v
new file mode 100644
index 000000000..2be89e533
--- /dev/null
+++ b/tests/proc/rmdead.v
@@ -0,0 +1,46 @@
+module top (
+ input wire signed x,
+ output reg [31:0] y
+);
+ wire signed fail = ~x;
+
+ always @*
+ case (x)
+ 1'b0: y = 0;
+ 1'b1: y = 1;
+ default: y = fail;
+ endcase
+
+ always @*
+ case (x)
+ 2'sb00: y = 0;
+ 2'sb00: y = fail;
+ endcase
+
+ always @*
+ case (x)
+ 2'sb00: y = 0;
+ default: y = fail;
+ 2'sb01: y = 1;
+ 2'sb10: y = 2;
+ 2'sb11: y = 3;
+ 2'sb00: y = fail;
+ 2'sb01: y = fail;
+ 2'sb10: y = fail;
+ 2'sb11: y = fail;
+ endcase
+
+
+ always @*
+ case ({x, x})
+ 2'b00: y = 0;
+ 2'b01: y = 1;
+ 2'b10: y = 2;
+ 2'b11: y = 3;
+ default: y = fail;
+ 2'b00: y = fail;
+ 2'b01: y = fail;
+ 2'b10: y = fail;
+ 2'b11: y = fail;
+ endcase
+endmodule
diff --git a/tests/proc/rmdead.ys b/tests/proc/rmdead.ys
new file mode 100644
index 000000000..697d899e3
--- /dev/null
+++ b/tests/proc/rmdead.ys
@@ -0,0 +1,4 @@
+read_verilog rmdead.v
+proc
+opt_clean
+select -assert-count 0 w:fail