aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/ast/simplify.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2019-04-30 15:03:32 +0200
committerClifford Wolf <clifford@clifford.at>2019-04-30 15:03:32 +0200
commit9af825e31e493bec6f0d86b8f30aeee436ed50df (patch)
treeb3efc99c7855e70f22190c8049792d1e62987ed3 /frontends/ast/simplify.cc
parent314ff1e4ca00ef8024bbb0d2f031efd78b01f9a1 (diff)
downloadyosys-9af825e31e493bec6f0d86b8f30aeee436ed50df.tar.gz
yosys-9af825e31e493bec6f0d86b8f30aeee436ed50df.tar.bz2
yosys-9af825e31e493bec6f0d86b8f30aeee436ed50df.zip
Add final loop variable assignment when unrolling for-loops, fixes #968
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'frontends/ast/simplify.cc')
-rw-r--r--frontends/ast/simplify.cc7
1 files changed, 7 insertions, 0 deletions
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();