aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/ast
diff options
context:
space:
mode:
authorclairexen <claire@symbioticeda.com>2020-09-01 17:31:48 +0200
committerGitHub <noreply@github.com>2020-09-01 17:31:48 +0200
commita10893072b328cdaa00bcd92c1a302494585c60b (patch)
tree49be56ed1e1189dfa0a2652b1ae0bfbfda715023 /frontends/ast
parentc1a6097376488282c0106ec34e3bde2884c9db2d (diff)
parent74abc3bbfde7477994a0a88f93a69fad5a2a8f23 (diff)
downloadyosys-a10893072b328cdaa00bcd92c1a302494585c60b.tar.gz
yosys-a10893072b328cdaa00bcd92c1a302494585c60b.tar.bz2
yosys-a10893072b328cdaa00bcd92c1a302494585c60b.zip
Merge pull request #2352 from zachjs/const-func-localparam
Allow localparams in constant functions
Diffstat (limited to 'frontends/ast')
-rw-r--r--frontends/ast/simplify.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc
index bf375aa1b..0ba2ab6ac 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -4507,6 +4507,18 @@ AstNode *AstNode::eval_const_function(AstNode *fcall)
log_assert(variables.count(str) != 0);
+ if (stmt->type == AST_LOCALPARAM)
+ {
+ while (stmt->simplify(true, false, false, 1, -1, false, true)) { }
+
+ if (!backup_scope.count(stmt->str))
+ backup_scope[stmt->str] = current_scope[stmt->str];
+ current_scope[stmt->str] = stmt;
+
+ block->children.erase(block->children.begin());
+ continue;
+ }
+
if (stmt->type == AST_ASSIGN_EQ)
{
if (stmt->children.at(0)->type == AST_IDENTIFIER && stmt->children.at(0)->children.size() != 0 &&