From 52f15498b97be4438d9bfe51d71fb6832494fe02 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Mon, 11 Jun 2012 20:57:22 +0100 Subject: [PATCH] V0.9: Fix elaboration order in generate blocks. Currently, localparam declarations inside generate blocks are elaborated after any nested generate constructs are elaborated. This prevents the localparams being used by the nested constructs. Reversing the elaboration order fixes this bug. --- elab_scope.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/elab_scope.cc b/elab_scope.cc index 69afc212a..34216b553 100644 --- a/elab_scope.cc +++ b/elab_scope.cc @@ -1017,6 +1017,14 @@ void PGenerate::elaborate_subscope_(Design*des, NetScope*scope) scope->add_genvar((*cur).first, (*cur).second); } + // Scan the localparams in this scope, and create stub parameter + // entries in the scope for the parameter names. + collect_scope_localparams_(scope, localparams); + + // Now scan the localparams again, this time elaborating them + // for use as parameter values. + elaborate_scope_localparams_(des, scope, localparams); + // Scan the generated scope for nested generate schemes, // and *generate* new scopes, which is slightly different // from simple elaboration. @@ -1027,14 +1035,6 @@ void PGenerate::elaborate_subscope_(Design*des, NetScope*scope) (*cur) -> generate_scope(des, scope); } - // Scan the localparams in this scope, and create stub parameter - // entries in the scope for the parameter names. - collect_scope_localparams_(scope, localparams); - - // Now scan the localparams again, this time elaborating them - // for use as parameter values. - elaborate_scope_localparams_(des, scope, localparams); - // Scan through all the task and function declarations in this // scope. elaborate_scope_tasks(des, scope, *this, tasks);