From 9bc86af284ddc24cdb4d1d6d778d420451af2149 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 14 Jun 2026 13:46:25 -0700 Subject: [PATCH] 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 --- elab_scope.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/elab_scope.cc b/elab_scope.cc index bd9065fd3..4b233348d 100644 --- a/elab_scope.cc +++ b/elab_scope.cc @@ -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); }