aboutsummaryrefslogtreecommitdiffstats
path: root/passes/opt/opt.cc
diff options
context:
space:
mode:
authorC-Elegans <mtnolan2640@gmail.com>2017-01-15 09:23:04 -0500
committerC-Elegans <mtnolan2640@gmail.com>2017-01-15 13:38:29 -0500
commit943389cdd50e8c77d76f64ba9abffa5190e5106a (patch)
treefb6c956d3ec9bb5f63f4bc04511c8358678fd30e /passes/opt/opt.cc
parentb7cfb7dbd250a8595589f86e1b38b67015c7b9c5 (diff)
downloadyosys-943389cdd50e8c77d76f64ba9abffa5190e5106a.tar.gz
yosys-943389cdd50e8c77d76f64ba9abffa5190e5106a.tar.bz2
yosys-943389cdd50e8c77d76f64ba9abffa5190e5106a.zip
Fix issue #269, optimize signed compare with 0
add opt_compare pass and add it to opt for a < 0: if a is signed, replace with a[max_bit-1] for a >= 0: if a is signed, replace with ~a[max_bit-1]
Diffstat (limited to 'passes/opt/opt.cc')
-rw-r--r--passes/opt/opt.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/passes/opt/opt.cc b/passes/opt/opt.cc
index 021c1a03f..b689be480 100644
--- a/passes/opt/opt.cc
+++ b/passes/opt/opt.cc
@@ -128,6 +128,7 @@ struct OptPass : public Pass {
{
while (1) {
Pass::call(design, "opt_expr" + opt_expr_args);
+ Pass::call(design, "opt_compare");
Pass::call(design, "opt_merge" + opt_merge_args);
design->scratchpad_unset("opt.did_something");
Pass::call(design, "opt_rmdff" + opt_rmdff_args);
@@ -141,6 +142,7 @@ struct OptPass : public Pass {
else
{
Pass::call(design, "opt_expr" + opt_expr_args);
+ Pass::call(design, "opt_compare");
Pass::call(design, "opt_merge -nomux" + opt_merge_args);
while (1) {
design->scratchpad_unset("opt.did_something");