aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2019-04-30 18:09:44 +0200
committerGitHub <noreply@github.com>2019-04-30 18:09:44 +0200
commit9c7d23446df94c14cbb6ff22a86391d23fdfb328 (patch)
treee4c6f142f0ec2b4ac4cf051bffdf205d0c9f1977
parenta27eeff573c685f9a36ba4bd67e56043ab5d4716 (diff)
parent9af825e31e493bec6f0d86b8f30aeee436ed50df (diff)
downloadyosys-9c7d23446df94c14cbb6ff22a86391d23fdfb328.tar.gz
yosys-9c7d23446df94c14cbb6ff22a86391d23fdfb328.tar.bz2
yosys-9c7d23446df94c14cbb6ff22a86391d23fdfb328.zip
Merge pull request #972 from YosysHQ/clifford/fix968
Add final loop variable assignment when unrolling for-loops
-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();