elab: Elaborate enum types in nested scopes

Enum types declared inside nested scopes are stored separately from typedefs.
The enum sets need to be elaborated when the `NetScope` is created so enum
literals are available for declarations and statements in the same scope.

Module, package and class scopes already do this. Generate, task, function and
named block scopes can also declare enum typedefs, but did not elaborate their
enum sets. Elaborate them while setting up these scopes.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2026-06-14 13:46:25 -07:00
parent 593a97bede
commit 9bc86af284
1 changed files with 8 additions and 0 deletions

View File

@ -1322,6 +1322,8 @@ void PGenerate::elaborate_subscope_(Design*des, NetScope*scope)
collect_scope_signals(scope, wires);
elaborate_scope_enumerations(des, scope, enum_sets);
// Run through the defparams for this scope and save the result
// in a table for later final override.
@ -1662,6 +1664,8 @@ void PFunction::elaborate_scope(Design*des, NetScope*scope) const
collect_scope_signals(scope, wires);
elaborate_scope_enumerations(des, scope, enum_sets);
// Scan through all the named events in this scope.
elaborate_scope_events_(des, scope, events);
@ -1682,6 +1686,8 @@ void PTask::elaborate_scope(Design*des, NetScope*scope) const
collect_scope_signals(scope, wires);
elaborate_scope_enumerations(des, scope, enum_sets);
// Scan through all the named events in this scope.
elaborate_scope_events_(des, scope, events);
@ -1732,6 +1738,8 @@ void PBlock::elaborate_scope(Design*des, NetScope*scope) const
collect_scope_signals(my_scope, wires);
elaborate_scope_enumerations(des, my_scope, enum_sets);
// Scan through all the named events in this scope.
elaborate_scope_events_(des, my_scope, events);
}