From 08d80b35cb02ec56fedc67baedde748ac6d3f075 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Thu, 19 Jun 2008 16:15:47 +0100 Subject: [PATCH] Rename signals that would be illegal VHDL names --- tgt-vhdl/scope.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tgt-vhdl/scope.cc b/tgt-vhdl/scope.cc index 51ad1f2c3..3d0ecfa03 100644 --- a/tgt-vhdl/scope.cc +++ b/tgt-vhdl/scope.cc @@ -141,9 +141,20 @@ static void declare_signals(vhdl_arch *arch, ivl_scope_t scope) remember_signal(sig, arch->get_parent()); // Make sure the signal name conforms to VHDL naming rules - std::string name(ivl_signal_basename(sig)); + std::string name(ivl_signal_basename(sig)); if (name[0] == '_') name.insert(0, "VL"); + + const char *vhdl_reserved[] = { + "in", "out", "entity", "architecture", "inout", // Etc... + NULL + }; + for (const char **p = vhdl_reserved; *p != NULL; p++) { + if (name == *p) { + name.insert(0, "VL_"); + break; + } + } rename_signal(sig, name.c_str()); ivl_signal_port_t mode = ivl_signal_port(sig);