Do not consome pform defparams in module definition.
The list of defparams in the pform module definitions (in class Module) should not be consumed when they are used. The module may be instantiated moltiple times, so consuming the defparams during elaboration will cause subsequent instantiations to not have the defparams. That's wrong.
This commit is contained in:
parent
ef66ca6498
commit
79e1273814
|
|
@ -316,17 +316,17 @@ bool Module::elaborate_scope(Design*des, NetScope*scope,
|
||||||
// here because the parameter receiving the assignment may be
|
// here because the parameter receiving the assignment may be
|
||||||
// in a scope not discovered by this pass.
|
// in a scope not discovered by this pass.
|
||||||
|
|
||||||
while (! defparms.empty()) {
|
typedef list<Module::named_expr_t>::const_iterator defparms_iter_t;
|
||||||
Module::named_expr_t cur = defparms.front();
|
for (defparms_iter_t cur = defparms.begin()
|
||||||
defparms.pop_front();
|
; cur != defparms.end() ; cur ++) {
|
||||||
|
|
||||||
PExpr*ex = cur.second;
|
PExpr*ex = cur->second;
|
||||||
assert(ex);
|
assert(ex);
|
||||||
|
|
||||||
NetExpr*val = ex->elaborate_pexpr(des, scope);
|
NetExpr*val = ex->elaborate_pexpr(des, scope);
|
||||||
delete ex;
|
|
||||||
if (val == 0) continue;
|
if (val == 0) continue;
|
||||||
scope->defparams.push_back(make_pair(cur.first, val));
|
|
||||||
|
scope->defparams.push_back(make_pair(cur->first, val));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Evaluate the attributes. Evaluate them in the scope of the
|
// Evaluate the attributes. Evaluate them in the scope of the
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue