diff options
author | Zachary Snow <zach@zachjs.com> | 2020-08-20 20:09:54 -0400 |
---|---|---|
committer | Zachary Snow <zach@zachjs.com> | 2020-08-20 20:10:24 -0400 |
commit | 74abc3bbfde7477994a0a88f93a69fad5a2a8f23 (patch) | |
tree | 9c6057995690f11df6adaebd2bca348ff94a521f /frontends | |
parent | 082cbcb4c7c4fa6984f86f8edb2e1d16e8ad3a41 (diff) | |
download | yosys-74abc3bbfde7477994a0a88f93a69fad5a2a8f23.tar.gz yosys-74abc3bbfde7477994a0a88f93a69fad5a2a8f23.tar.bz2 yosys-74abc3bbfde7477994a0a88f93a69fad5a2a8f23.zip |
Allow localparams in constant functions
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/ast/simplify.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index 7f9795d29..b8e4f941c 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -4488,6 +4488,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 && |