From: Clifford Wolf Date: Tue, 30 Apr 2019 13:03:32 +0000 (+0200) Subject: Add final loop variable assignment when unrolling for-loops, fixes #968 X-Git-Tag: yosys-0.9~142^2~8^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9af825e31e493bec6f0d86b8f30aeee436ed50df;p=yosys.git Add final loop variable assignment when unrolling for-loops, fixes #968 Signed-off-by: Clifford Wolf --- diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index 3e453bd7f..a342bf5d9 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -1172,6 +1172,13 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage, varbuf->children[0] = buf; } + if (type == AST_FOR) { + AstNode *buf = next_ast->clone(); + delete buf->children[1]; + buf->children[1] = varbuf->children[0]->clone(); + current_block->children.insert(current_block->children.begin() + current_block_idx++, buf); + } + current_scope[varbuf->str] = backup_scope_varbuf; delete varbuf; delete_children();