Fix bug when resolving nexus to VHDL signal
This commit is contained in:
parent
e08e29c8b4
commit
4e73b1b133
|
|
@ -38,6 +38,9 @@ vhdl_var_ref *nexus_to_var_ref(vhdl_scope *arch_scope, ivl_nexus_t nexus)
|
|||
|
||||
ivl_signal_t sig;
|
||||
if ((sig = ivl_nexus_ptr_sig(nexus_ptr))) {
|
||||
if (!seen_signal_before(sig))
|
||||
continue;
|
||||
|
||||
const char *signame = get_renamed_signal(sig).c_str();
|
||||
|
||||
vhdl_decl *decl = arch_scope->get_decl(signame);
|
||||
|
|
@ -215,6 +218,8 @@ static void declare_signals(vhdl_entity *ent, ivl_scope_t scope)
|
|||
ent->get_scope()->add_decl
|
||||
(new vhdl_port_decl(name.c_str(), sig_type, VHDL_PORT_INOUT));
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -331,7 +336,9 @@ static void port_map(ivl_scope_t scope, vhdl_entity *parent,
|
|||
case IVL_SIP_INOUT:
|
||||
map_signal(sig, parent, inst);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,12 +90,17 @@ void remember_entity(vhdl_entity* ent)
|
|||
g_entities.push_back(ent);
|
||||
}
|
||||
|
||||
bool seen_signal_before(ivl_signal_t sig)
|
||||
{
|
||||
return g_known_signals.find(sig) != g_known_signals.end();
|
||||
}
|
||||
|
||||
/*
|
||||
* Remeber the association of signal to entity.
|
||||
*/
|
||||
void remember_signal(ivl_signal_t sig, const vhdl_scope *scope)
|
||||
{
|
||||
assert(g_known_signals.find(sig) == g_known_signals.end());
|
||||
assert(!seen_signal_before(sig));
|
||||
|
||||
signal_defn_t defn = { ivl_signal_basename(sig), scope };
|
||||
g_known_signals[sig] = defn;
|
||||
|
|
@ -106,21 +111,21 @@ void remember_signal(ivl_signal_t sig, const vhdl_scope *scope)
|
|||
*/
|
||||
void rename_signal(ivl_signal_t sig, const std::string &renamed)
|
||||
{
|
||||
assert(g_known_signals.find(sig) != g_known_signals.end());
|
||||
assert(seen_signal_before(sig));
|
||||
|
||||
g_known_signals[sig].renamed = renamed;
|
||||
}
|
||||
|
||||
const vhdl_scope *find_scope_for_signal(ivl_signal_t sig)
|
||||
{
|
||||
assert(g_known_signals.find(sig) != g_known_signals.end());
|
||||
assert(seen_signal_before(sig));
|
||||
|
||||
return g_known_signals[sig].scope;
|
||||
}
|
||||
|
||||
const std::string &get_renamed_signal(ivl_signal_t sig)
|
||||
{
|
||||
assert(g_known_signals.find(sig) != g_known_signals.end());
|
||||
assert(seen_signal_before(sig));
|
||||
|
||||
return g_known_signals[sig].renamed;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ vhdl_entity *get_active_entity();
|
|||
|
||||
vhdl_var_ref *nexus_to_var_ref(vhdl_scope *arch_scope, ivl_nexus_t nexus);
|
||||
|
||||
bool seen_signal_before(ivl_signal_t sig);
|
||||
void remember_signal(ivl_signal_t sig, const vhdl_scope *scope);
|
||||
void rename_signal(ivl_signal_t sig, const std::string &renamed);
|
||||
const vhdl_scope *find_scope_for_signal(ivl_signal_t sig);
|
||||
|
|
|
|||
Loading…
Reference in New Issue