aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2019-01-02 17:34:04 +0100
committerGitHub <noreply@github.com>2019-01-02 17:34:04 +0100
commit0fc6e2bfcfcac166d07ed3f70ec63954e914eb28 (patch)
tree950ae505a4cf9d86b1ad78720975433ddc7c7b86 /tests
parent56ca1e6afc66542666e73356cbe62f6ca64215a7 (diff)
parentbf8db55ef36f6839827cd8bc69f673fd3fd43cca (diff)
downloadyosys-0fc6e2bfcfcac166d07ed3f70ec63954e914eb28.tar.gz
yosys-0fc6e2bfcfcac166d07ed3f70ec63954e914eb28.tar.bz2
yosys-0fc6e2bfcfcac166d07ed3f70ec63954e914eb28.zip
Merge pull request #770 from whitequark/opt_expr_cmp
opt_expr: refactor and improve simplification of comparisons
Diffstat (limited to 'tests')
-rw-r--r--tests/opt/opt_expr_cmp.v40
-rw-r--r--tests/opt/opt_expr_cmp.ys4
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/opt/opt_expr_cmp.v b/tests/opt/opt_expr_cmp.v
new file mode 100644
index 000000000..5aff4b80f
--- /dev/null
+++ b/tests/opt/opt_expr_cmp.v
@@ -0,0 +1,40 @@
+module top(...);
+ input [3:0] a;
+
+ output o1_1 = 4'b0000 > a;
+ output o1_2 = 4'b0000 <= a;
+ output o1_3 = 4'b1111 < a;
+ output o1_4 = 4'b1111 >= a;
+ output o1_5 = a < 4'b0000;
+ output o1_6 = a >= 4'b0000;
+ output o1_7 = a > 4'b1111;
+ output o1_8 = a <= 4'b1111;
+
+ output o2_1 = 4'sb0000 > $signed(a);
+ output o2_2 = 4'sb0000 <= $signed(a);
+ output o2_3 = $signed(a) < 4'sb0000;
+ output o2_4 = $signed(a) >= 4'sb0000;
+
+ output o3_1 = 4'b0100 > a;
+ output o3_2 = 4'b0100 <= a;
+ output o3_3 = a < 4'b0100;
+ output o3_4 = a >= 4'b0100;
+
+ output o4_1 = 5'b10000 > a;
+ output o4_2 = 5'b10000 >= a;
+ output o4_3 = 5'b10000 < a;
+ output o4_4 = 5'b10000 <= a;
+ output o4_5 = a < 5'b10000;
+ output o4_6 = a <= 5'b10000;
+ output o4_7 = a > 5'b10000;
+ output o4_8 = a >= 5'b10000;
+
+ output o5_1 = 5'b10100 > a;
+ output o5_2 = 5'b10100 >= a;
+ output o5_3 = 5'b10100 < a;
+ output o5_4 = 5'b10100 <= a;
+ output o5_5 = a < 5'b10100;
+ output o5_6 = a <= 5'b10100;
+ output o5_7 = a > 5'b10100;
+ output o5_8 = a >= 5'b10100;
+endmodule
diff --git a/tests/opt/opt_expr_cmp.ys b/tests/opt/opt_expr_cmp.ys
new file mode 100644
index 000000000..214ce8b11
--- /dev/null
+++ b/tests/opt/opt_expr_cmp.ys
@@ -0,0 +1,4 @@
+read_verilog opt_expr_cmp.v
+equiv_opt -assert opt_expr -fine
+design -load postopt
+select -assert-count 0 t:$gt t:$ge t:$lt t:$le