Fix for pr2661101

Fixes VHDL compilation errors when signal or instance names collide
after renaming.
This commit is contained in:
Nick Gasson 2010-10-16 15:45:34 +01:00 committed by Stephen Williams
parent 3733c59e49
commit eba8c8ee65
2 changed files with 5 additions and 4 deletions

View File

@ -1,7 +1,7 @@
/* /*
* VHDL code generation for scopes. * VHDL code generation for scopes.
* *
* Copyright (C) 2008-2009 Nick Gasson (nick@nickg.me.uk) * Copyright (C) 2008-2010 Nick Gasson (nick@nickg.me.uk)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -1165,10 +1165,11 @@ extern "C" int draw_hierarchy(ivl_scope_t scope, void *_parent)
} }
// And an instantiation statement // And an instantiation statement
string inst_name(ivl_scope_basename(scope)); string inst_name = ivl_scope_basename(scope);
inst_name += genvar_unique_suffix(ivl_scope_parent(scope)); inst_name += genvar_unique_suffix(ivl_scope_parent(scope));
if (inst_name == ent->get_name() if (inst_name == ent->get_name()
|| parent_scope->have_declared(inst_name) || parent_scope->name_collides(inst_name)
|| find_entity(inst_name) != NULL
|| is_vhdl_reserved_word(inst_name)) { || is_vhdl_reserved_word(inst_name)) {
// Would produce an invalid instance name // Would produce an invalid instance name

View File

@ -80,7 +80,7 @@ bool vhdl_scope::name_collides(const string& name) const
{ {
const vhdl_decl* decl = get_decl(name); const vhdl_decl* decl = get_decl(name);
if (decl) if (decl)
return decl->get_name() != name; return strcasecmp(decl->get_name().c_str(), name.c_str()) == 0;
else else
return false; return false;
} }