Check for enum constants when declaring implicit nets

This commit is contained in:
Cary R 2021-02-13 23:33:13 -08:00
parent 2cc41a4639
commit 18e7406dd0
1 changed files with 14 additions and 0 deletions

View File

@ -386,6 +386,18 @@ PEIdent::~PEIdent()
{
}
static bool find_enum_constant(LexicalScope*scope, perm_string name)
{
for (set<enum_type_t*,netenum_t*>::const_iterator cur = scope->enum_sets.begin() ;
cur != scope->enum_sets.end() ; ++ cur) {
for (list<named_pexpr_t>::const_iterator idx = (*cur)->names->begin() ;
idx != (*cur)->names->end() ; ++ idx) {
if (idx->name == name) return true;
}
}
return false;
}
void PEIdent::declare_implicit_nets(LexicalScope*scope, NetNet::Type type)
{
/* We create an implicit wire if:
@ -409,6 +421,8 @@ void PEIdent::declare_implicit_nets(LexicalScope*scope, NetNet::Type type)
return;
if (ss->events.find(name) != ss->events.end())
return;
if (find_enum_constant(ss, name))
return;
/* Strictly speaking, we should also check for name clashes
with tasks, functions, named blocks, module instances,
and generate blocks. However, this information is not