mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
This commit is contained in:
+11
-1
@@ -1442,9 +1442,19 @@ class ParamProcessor final {
|
||||
// Cast/CastSize default values are not yet folded by V3Width.
|
||||
// Constify here so the comparison below sees a Const node.
|
||||
// Other node kinds are handled in the branches above.
|
||||
//
|
||||
// Only fold when the cast is self-contained. modvarp is the
|
||||
// parameter on the shared module template and constifyParamsEdit
|
||||
// is destructive: a default that reads another parameter
|
||||
// (VarRef) or a type parameter (RefDType) must be evaluated per
|
||||
// instance, and folding it here would evaluate it against the
|
||||
// template's own defaults and bake that in for every later
|
||||
// instance that relies on the default.
|
||||
if (modvarp->valuep()
|
||||
&& (VN_IS(modvarp->valuep(), Cast) || VN_IS(modvarp->valuep(), CastSize))) {
|
||||
V3Const::constifyParamsEdit(modvarp->valuep());
|
||||
const bool dependent = modvarp->valuep()->exists(
|
||||
[](AstNode* np) { return VN_IS(np, VarRef) || VN_IS(np, RefDType); });
|
||||
if (!dependent) V3Const::constifyParamsEdit(modvarp->valuep());
|
||||
}
|
||||
UINFO(9, "cellPinCleanup: after constify " << pinp);
|
||||
// String constants are parsed as logic arrays and converted to strings in V3Const.
|
||||
|
||||
Reference in New Issue
Block a user