From 596c93ce7e3232b0892f92d8130631964b911cc2 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Tue, 1 Jul 2008 11:05:24 +0100 Subject: [PATCH] Rename instance if it has the same name as the type --- tgt-vhdl/scope.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tgt-vhdl/scope.cc b/tgt-vhdl/scope.cc index 70cf45611..513bd095a 100644 --- a/tgt-vhdl/scope.cc +++ b/tgt-vhdl/scope.cc @@ -404,9 +404,14 @@ static int draw_module(ivl_scope_t scope, ivl_scope_t parent) } // And an instantiation statement - const char *inst_name = ivl_scope_basename(scope); + std::string inst_name(ivl_scope_basename(scope)); + if (inst_name == ent->get_name()) { + // Cannot have instance name the same as type in VHDL + inst_name += "_Inst"; + } + vhdl_comp_inst *inst = - new vhdl_comp_inst(inst_name, ent->get_name().c_str()); + new vhdl_comp_inst(inst_name.c_str(), ent->get_name().c_str()); port_map(scope, parent_ent, inst); parent_arch->add_stmt(inst);