diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-04-30 18:09:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-30 18:09:44 +0200 |
commit | 9c7d23446df94c14cbb6ff22a86391d23fdfb328 (patch) | |
tree | e4c6f142f0ec2b4ac4cf051bffdf205d0c9f1977 | |
parent | a27eeff573c685f9a36ba4bd67e56043ab5d4716 (diff) | |
parent | 9af825e31e493bec6f0d86b8f30aeee436ed50df (diff) | |
download | yosys-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.cc | 7 |
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(); |