Merge pull request #972 from YosysHQ/clifford/fix968

Add final loop variable assignment when unrolling for-loops
This commit is contained in:
Clifford Wolf 2019-04-30 18:09:44 +02:00 committed by GitHub
commit 9c7d23446d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -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();