summaryrefslogtreecommitdiff
path: root/frontends/ast
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/ast')
-rw-r--r--frontends/ast/genrtlil.cc4
-rw-r--r--frontends/ast/simplify.cc21
2 files changed, 25 insertions, 0 deletions
diff --git a/frontends/ast/genrtlil.cc b/frontends/ast/genrtlil.cc
index 1453d13a..e9c689ac 100644
--- a/frontends/ast/genrtlil.cc
+++ b/frontends/ast/genrtlil.cc
@@ -576,6 +576,10 @@ struct AST_INTERNAL::ProcessGenerator
}
break;
+ case AST_WIRE:
+ log_error("Found wire declaration in block without label at at %s:%d!\n", ast->filename.c_str(), ast->linenum);
+ break;
+
case AST_TCALL:
case AST_FOR:
break;
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc
index 80cf230e..0a32e950 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -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)
{