3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 14:13:23 +00:00

Merge pull request #2352 from zachjs/const-func-localparam

Allow localparams in constant functions
This commit is contained in:
clairexen 2020-09-01 17:31:48 +02:00 committed by GitHub
commit a10893072b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View file

@ -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 &&