aboutsummaryrefslogtreecommitdiffstats
path: root/tests/simple
diff options
context:
space:
mode:
authorZachary Snow <zach@zachjs.com>2021-12-15 18:15:09 -0700
committerZachary Snow <zachary.j.snow@gmail.com>2021-12-17 21:22:08 -0700
commit7608985d2c6237b869a4774c6b1659282e7473ad (patch)
tree129bc1352eca95a6f789ef601a7f7d15ef373566 /tests/simple
parent60c3ea367c942459a95e610ed98f277ce46c0142 (diff)
downloadyosys-7608985d2c6237b869a4774c6b1659282e7473ad.tar.gz
yosys-7608985d2c6237b869a4774c6b1659282e7473ad.tar.bz2
yosys-7608985d2c6237b869a4774c6b1659282e7473ad.zip
fix width detection of array querying function in case and case item expressions
I also removed the unnecessary shadowing of `width_hint` and `sign_hint` in the corresponding case in `simplify()`.
Diffstat (limited to 'tests/simple')
-rw-r--r--tests/simple/case_expr_extend.sv11
-rw-r--r--tests/simple/case_expr_query.sv32
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/simple/case_expr_extend.sv b/tests/simple/case_expr_extend.sv
new file mode 100644
index 000000000..61bd14df1
--- /dev/null
+++ b/tests/simple/case_expr_extend.sv
@@ -0,0 +1,11 @@
+module top(
+ output logic [5:0] out
+);
+always_comb begin
+ out = '0;
+ case (1'b1 << 1)
+ 2'b10: out = '1;
+ default: out = '0;
+ endcase
+end
+endmodule
diff --git a/tests/simple/case_expr_query.sv b/tests/simple/case_expr_query.sv
new file mode 100644
index 000000000..63a0a8b7a
--- /dev/null
+++ b/tests/simple/case_expr_query.sv
@@ -0,0 +1,32 @@
+module top(
+ output logic [5:0] out
+);
+always_comb begin
+ out = '0;
+ case ($bits (out)) 6:
+ case ($size (out)) 6:
+ case ($high (out)) 5:
+ case ($low (out)) 0:
+ case ($left (out)) 5:
+ case ($right(out)) 0:
+ case (6) $bits (out):
+ case (6) $size (out):
+ case (5) $high (out):
+ case (0) $low (out):
+ case (5) $left (out):
+ case (0) $right(out):
+ out = '1;
+ endcase
+ endcase
+ endcase
+ endcase
+ endcase
+ endcase
+ endcase
+ endcase
+ endcase
+ endcase
+ endcase
+ endcase
+end
+endmodule