3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 14:13:23 +00:00

Added support for local regs in named blocks

This commit is contained in:
Clifford Wolf 2013-12-04 09:10:16 +01:00
parent b5afd75b0a
commit 507c63d112
3 changed files with 30 additions and 2 deletions

View file

@ -350,6 +350,8 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
break;
if (type == AST_GENBLOCK)
break;
if (type == AST_BLOCK && !str.empty())
break;
if (type == AST_PREFIX && i >= 1)
break;
while (did_something_here && i < children.size()) {
@ -678,6 +680,25 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
did_something = true;
}
// transform block with name
if (type == AST_BLOCK && !str.empty())
{
std::map<std::string, std::string> name_map;
expand_genblock(std::string(), str + ".", name_map);
std::vector<AstNode*> new_children;
for (size_t i = 0; i < children.size(); i++)
if (children[i]->type == AST_WIRE) {
children[i]->simplify(false, false, false, stage, -1, false);
current_ast_mod->children.push_back(children[i]);
} else
new_children.push_back(children[i]);
children.swap(new_children);
did_something = true;
str.clear();
}
// simplify unconditional generate block
if (type == AST_GENBLOCK && children.size() != 0)
{