This commit is contained in:
Edmund Lam 2026-06-09 13:46:58 -04:00
parent af121fcb3e
commit 59863f43dc
3 changed files with 26 additions and 26 deletions

View File

@ -2234,13 +2234,13 @@ public:
// Walk every subtree reachable from `rootp` for deferred work V3LinkDot left behind // Walk every subtree reachable from `rootp` for deferred work V3LinkDot left behind
// when `class#(...)::member` couldn't yet be resolved: // when `class#(...)::member` couldn't yet be resolved:
// (1) `AstDot` with a ClassOrPackageRef lhs a `class::lparam` value Dot to // (1) `AstDot` with a ClassOrPackageRef lhs - a `class::lparam` value Dot to
// constify (e.g. `c8::b` in a pin expression). // constify (e.g. `c8::b` in a pin expression).
// (2) `AstRefDType` with a typedefp descend into the typedef's subDType // (2) `AstRefDType` with a typedefp - descend into the typedef's subDType
// to find buried Dots (typedef range like `logic [(CFG::w - 1):0]`) and // to find buried Dots (typedef range like `logic [(CFG::w - 1):0]`) and
// unresolved class-scoped struct-member RefDTypes (`CFG::input_meta_t` // unresolved class-scoped struct-member RefDTypes (`CFG::input_meta_t`
// as a struct member). // as a struct member).
// (3) `AstVarRef` to a deferred lparam descend into its valuep so the // (3) `AstVarRef` to a deferred lparam - descend into its valuep so the
// chain `pin -> lparam -> ... -> class::lparam Dot` reaches the Dot. // chain `pin -> lparam -> ... -> class::lparam Dot` reaches the Dot.
// Discoveries of (2) and (3) feed back into the walk worklist; (1) and (2) // Discoveries of (2) and (3) feed back into the walk worklist; (1) and (2)
// are also kept in lists for the resolution passes at the end. // are also kept in lists for the resolution passes at the end.

View File

@ -47,11 +47,11 @@ module t;
typedef B#(5) BInst; typedef B#(5) BInst;
typedef C#(2) CInst; typedef C#(2) CInst;
// (1) Standalone localparam resolves via deferred-lparam path // (1) Standalone localparam - resolves via deferred-lparam path
localparam int two_level = BInst::width; // = A#(6)::v = 12 localparam int two_level = BInst::width; // = A#(6)::v = 12
localparam int three_level = CInst::total; // = B#(6)::width = A#(7)::v = 14 localparam int three_level = CInst::total; // = B#(6)::width = A#(7)::v = 14
// (2) Cell pin uses the nested-class value directly exercises the // (2) Cell pin uses the nested-class value directly - exercises the
// recursive Dot resolution inside resolveDotToTypedef // recursive Dot resolution inside resolveDotToTypedef
Sub #(BInst::width) m_pin_direct (); Sub #(BInst::width) m_pin_direct ();
Sub #(CInst::total) m_pin_deep (); Sub #(CInst::total) m_pin_deep ();

View File

@ -18,37 +18,37 @@
// verilog_format: on // verilog_format: on
package pkg; package pkg;
virtual class C #(parameter int W = 1); virtual class C #(parameter int W = 1);
typedef logic [W-1:0] data_t; typedef logic [W-1:0] data_t;
endclass endclass
endpackage endpackage
module Sink #(parameter int BITS = 1) (); module Sink #(parameter int BITS = 1) ();
logic [BITS-1:0] data; logic [BITS-1:0] data;
endmodule endmodule
module Sub #(parameter int W = 8) (); module Sub #(parameter int W = 8) ();
typedef pkg::C#(W) CFG; typedef pkg::C#(W) CFG;
// Struct typedef whose member is a class-scope-resolved typedef from // Struct typedef whose member is a class-scope-resolved typedef from
// a parameterized-class typedef alias. Without the V3Param fix, the // a parameterized-class typedef alias. Without the V3Param fix, the
// member's RefDType stays UNLINKED and the cell pin's $bits trips an // member's RefDType stays UNLINKED and the cell pin's $bits trips an
// internal error. // internal error.
typedef struct packed { typedef struct packed {
CFG::data_t payload; CFG::data_t payload;
logic v; logic v;
} wrap_t; } wrap_t;
Sink #(.BITS($bits(wrap_t))) u_sink (); Sink #(.BITS($bits(wrap_t))) u_sink ();
endmodule endmodule
module t; module t;
Sub #(.W(8)) u (); Sub #(.W(8)) u ();
initial begin initial begin
// $bits(wrap_t) = 8 (payload) + 1 (v) = 9 // $bits(wrap_t) = 8 (payload) + 1 (v) = 9
`checkh($bits(u.u_sink.data), 32'd9); `checkh($bits(u.u_sink.data), 32'd9);
$write("*-* All Finished *-*\n"); $write("*-* All Finished *-*\n");
$finish; $finish;
end end
endmodule endmodule