aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-02-14 20:45:30 +0100
committerClifford Wolf <clifford@clifford.at>2014-02-14 20:45:30 +0100
commit45d2b6ffce24c3a4254ef7f80f300cc7840fec25 (patch)
tree63764f50040db0c0ce164be9381ac499ee3ce31b
parente8af3def7fbefa1608e72609e1c534091fc7c88e (diff)
downloadyosys-45d2b6ffce24c3a4254ef7f80f300cc7840fec25.tar.gz
yosys-45d2b6ffce24c3a4254ef7f80f300cc7840fec25.tar.bz2
yosys-45d2b6ffce24c3a4254ef7f80f300cc7840fec25.zip
Be more conservative with new const-function code
-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 236843d5d..2ae3cae08 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -148,10 +148,14 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
// activate const folding if this is anything that must be evaluated statically (ranges, parameters, attributes, etc.)
if (type == AST_WIRE || type == AST_PARAMETER || type == AST_LOCALPARAM || type == AST_DEFPARAM || type == AST_PARASET || type == AST_RANGE || type == AST_PREFIX)
- const_fold = true, in_param = true;
+ const_fold = true;
if (type == AST_IDENTIFIER && current_scope.count(str) > 0 && (current_scope[str]->type == AST_PARAMETER || current_scope[str]->type == AST_LOCALPARAM))
const_fold = true;
+ // in certain cases a function must be evaluated constant. this is what in_param controls.
+ if (type == AST_PARAMETER || type == AST_LOCALPARAM || type == AST_DEFPARAM || type == AST_PARASET || type == AST_PREFIX)
+ in_param = true;
+
std::map<std::string, AstNode*> backup_scope;
// create name resolution entries for all objects with names