Fix a bug where the same instantiation appeared multiple times

This commit is contained in:
Nick Gasson 2008-06-02 18:05:39 +01:00
parent 041925c123
commit 17ae0a6a09
1 changed files with 26 additions and 15 deletions

View File

@ -80,6 +80,12 @@ static int draw_module(ivl_scope_t scope, ivl_scope_t parent)
if (parent != NULL) { if (parent != NULL) {
vhdl_entity *parent_ent = find_entity(ivl_scope_tname(parent)); vhdl_entity *parent_ent = find_entity(ivl_scope_tname(parent));
assert(parent_ent != NULL); assert(parent_ent != NULL);
// Make sure we only collect instantiations from *one*
// example of this module in the hieararchy
if (parent_ent->get_derived_from() == ivl_scope_name(parent)) {
vhdl_arch *parent_arch = parent_ent->get_arch(); vhdl_arch *parent_arch = parent_ent->get_arch();
assert(parent_arch != NULL); assert(parent_arch != NULL);
@ -93,10 +99,15 @@ static int draw_module(ivl_scope_t scope, ivl_scope_t parent)
const char *inst_name = ivl_scope_basename(scope); const char *inst_name = ivl_scope_basename(scope);
vhdl_comp_inst *inst = new vhdl_comp_inst(inst_name, ent->get_name().c_str()); vhdl_comp_inst *inst = new vhdl_comp_inst(inst_name, ent->get_name().c_str());
std::ostringstream ss; std::ostringstream ss;
ss << "Scope name " << ivl_scope_name(scope); ss << "Generated from " << ivl_scope_name(scope);
inst->set_comment(ss.str()); inst->set_comment(ss.str());
parent_arch->add_stmt(inst); parent_arch->add_stmt(inst);
} }
else {
std::cout << "Ignoring instantiation " << ivl_scope_name(scope);
std::cout << " (already accounted for)" << std::endl;
}
}
return 0; return 0;
} }