diff options
author | whitequark <whitequark@whitequark.org> | 2019-01-02 05:04:28 +0000 |
---|---|---|
committer | whitequark <whitequark@whitequark.org> | 2019-01-02 15:45:28 +0000 |
commit | bf8db55ef36f6839827cd8bc69f673fd3fd43cca (patch) | |
tree | 4223f7318822ddd87ebb511a59d21d4d17de4faf /tests/opt/opt_expr_cmp.v | |
parent | 4fd458290c3da4c3f372f2e1fdd99829a9462a38 (diff) | |
download | yosys-bf8db55ef36f6839827cd8bc69f673fd3fd43cca.tar.gz yosys-bf8db55ef36f6839827cd8bc69f673fd3fd43cca.tar.bz2 yosys-bf8db55ef36f6839827cd8bc69f673fd3fd43cca.zip |
opt_expr: improve simplification of comparisons with large constants.
The idea behind this simplification is that a N-bit signal X being
compared with an M-bit constant where M>N and the constant has Nth
or higher bit set, it either always succeeds or always fails.
However, the existing implementation only worked with one-hot signals
for some reason. It also printed incorrect messages.
This commit adjusts the simplification to have as much power as
possible, and fixes other bugs.
Diffstat (limited to 'tests/opt/opt_expr_cmp.v')
-rw-r--r-- | tests/opt/opt_expr_cmp.v | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/opt/opt_expr_cmp.v b/tests/opt/opt_expr_cmp.v index 500b15f1b..5aff4b80f 100644 --- a/tests/opt/opt_expr_cmp.v +++ b/tests/opt/opt_expr_cmp.v @@ -19,4 +19,22 @@ module top(...); 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 |