aboutsummaryrefslogtreecommitdiffstats
path: root/passes/hierarchy
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-11-27 12:47:33 +0100
committerClifford Wolf <clifford@clifford.at>2014-11-27 12:47:33 +0100
commit51cfcd8331bb06b1fea3ec62a48fcbb092e7df70 (patch)
tree6a96867098101ce89b9716fcf7224e7a01b3ed12 /passes/hierarchy
parent76c83283c44267969b96dc53bf02775aa950b5be (diff)
downloadyosys-51cfcd8331bb06b1fea3ec62a48fcbb092e7df70.tar.gz
yosys-51cfcd8331bb06b1fea3ec62a48fcbb092e7df70.tar.bz2
yosys-51cfcd8331bb06b1fea3ec62a48fcbb092e7df70.zip
Fixed bug in "hierarchy -top" with array of instances
Diffstat (limited to 'passes/hierarchy')
-rw-r--r--passes/hierarchy/hierarchy.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/passes/hierarchy/hierarchy.cc b/passes/hierarchy/hierarchy.cc
index 0ea26eb9e..e070afdd5 100644
--- a/passes/hierarchy/hierarchy.cc
+++ b/passes/hierarchy/hierarchy.cc
@@ -259,9 +259,16 @@ void hierarchy_worker(RTLIL::Design *design, std::set<RTLIL::Module*> &used, RTL
log("Used module: %*s%s\n", indent, "", mod->name.c_str());
used.insert(mod);
- for (auto &it : mod->cells_) {
- if (design->modules_.count(it.second->type) > 0)
- hierarchy_worker(design, used, design->modules_[it.second->type], indent+4);
+ for (auto cell : mod->cells()) {
+ std::string celltype = cell->type.str();
+ if (celltype.substr(0, 7) == "$array:") {
+ int pos_idx = celltype.find_first_of(':');
+ int pos_num = celltype.find_first_of(':', pos_idx + 1);
+ int pos_type = celltype.find_first_of(':', pos_num + 1);
+ celltype = celltype.substr(pos_type + 1);
+ }
+ if (design->module(celltype))
+ hierarchy_worker(design, used, design->module(celltype), indent+4);
}
}