aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/ast
diff options
context:
space:
mode:
authorZachary Snow <zach@zachjs.com>2020-06-26 19:52:36 -0700
committerZachary Snow <zach@zachjs.com>2020-06-29 16:06:17 -0600
commit27cec16cda7d10e94931b25711358da2b382fdbf (patch)
tree0aa166b168110f903e8ac5f3f22d1e0b028ef14b /frontends/ast
parent4160acc0b19532d50435abbc66bd2f6aab9473b6 (diff)
downloadyosys-27cec16cda7d10e94931b25711358da2b382fdbf.tar.gz
yosys-27cec16cda7d10e94931b25711358da2b382fdbf.tar.bz2
yosys-27cec16cda7d10e94931b25711358da2b382fdbf.zip
Allow constant function calls in for loops and generate if and case
Diffstat (limited to 'frontends/ast')
-rw-r--r--frontends/ast/simplify.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc
index 55e7da0aa..c819924a0 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -1126,6 +1126,10 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
bool in_param_here = in_param;
if (i == 0 && (type == AST_REPLICATE || type == AST_WIRE))
const_fold_here = true, in_param_here = true;
+ if (i == 0 && (type == AST_GENIF || type == AST_GENCASE))
+ in_param_here = true;
+ if (i == 1 && (type == AST_FOR || type == AST_GENFOR))
+ in_param_here = true;
if (type == AST_PARAMETER || type == AST_LOCALPARAM)
const_fold_here = true;
if (i == 0 && (type == AST_ASSIGN || type == AST_ASSIGN_EQ || type == AST_ASSIGN_LE))
@@ -1942,7 +1946,7 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
continue;
buf = child->clone();
- while (buf->simplify(true, false, false, stage, width_hint, sign_hint, false)) { }
+ while (buf->simplify(true, false, false, stage, width_hint, sign_hint, true)) { }
if (buf->type != AST_CONSTANT) {
// for (auto f : log_files)
// dumpAst(f, "verilog-ast> ");