Commentary: Changes update

This commit is contained in:
Wilson Snyder 2026-04-13 21:09:24 -04:00
parent ec4f66120c
commit 2770e649ba
4 changed files with 50 additions and 24 deletions

View File

@ -53,6 +53,7 @@ Verilator 5.047 devel
* Support sequence consecutive repetition `[*N:M]`, `[+]`, and `[*]` (#7379). [Yilou Wang]
* Support sequence `first_match` operator (#7392). [Yilou Wang]
* Support nonconsecutive repetition [=N] in sequence expressions (#7397). [Yilou Wang]
* Support per-process RNG for process::srandom() and object seeding (#7408) (#7415) (#7408). [Yilou Wang]
* Add VPI callback support to --main (#7145).
* Add V3LiftExpr pass to lower impure expressions and calls (#7141) (#7164). [Geza Lore, Testorrent USA, Inc.]
* Add --func-recursion-depth CLI option (#7175) (#7179).
@ -79,7 +80,7 @@ Verilator 5.047 devel
* Fix recursive default assignment for sub-arrays (#4589) (#7202). [Julian Carrier]
* Fix virtual interface member trigger convergence (#5116) (#7323). [Yilou Wang]
* Fix shift width mismatch in constraint solver SMT emission (#5420) (#7265). [Yilou Wang]
* Fix returning wrong type from static function in parameterized class (#5479) (#7387). [em2machine]
* Fix returning wrong type from static function in parameterized class (#5479) (#7387) (#7411) (#7418). [em2machine]
* Fix randomize size+element queue constraints (#5582) (#7225). [Rahul Behl, Testorrent USA, Inc.]
* Fix null assignment to virtual interfaces (#5974) (#5990). [Maxim Fonarev]
* Fix typedef scope resolution for parameterized class aliases (#5977) (#7319). [Nick Brereton]
@ -90,6 +91,7 @@ Verilator 5.047 devel
* Fix false recursive definition error (#6769) (#7118). [Alex Zhou]
* Fix port assignment to large arrays (#6904).
* Fix interface localparam dependencies and arbitrary nesting (#6936) (#7128) (#7188) (#7190). [em2machine]
* Fix parameterized class typedef as interface type parameter (#7000) (#7006). [Leela Pakanati]
* Fix errant integer promotion (#7012). [Todd Strader]
* Fix randc solver hang with wide variables (#7068) (#7248). [Yilou Wang]
* Fix coroutine trace setters (#7078 repair) (#7296). [Igor Zaworski, Antmicro Ltd.]
@ -141,6 +143,8 @@ Verilator 5.047 devel
* Fix sampling of hierarchical references (#7386). [Ryszard Rozak, Antmicro Ltd.]
* Fix virtual class inheritance false error (#7403) (#7405). [Nikolay Puzanov]
* Fix CMake compiler coroutine flags (#7404). [Shogo Yamazaki]
* Fix delete inside foreach skipping elements (#7407) (#7410)
* Fix std::randomize in parameterized-derived class (#7409) (#7416). [Yilou Wang]
Verilator 5.046 2026-02-28

View File

@ -8,14 +8,19 @@
// when the class itself has type parameters (issue #7000).
// Class with single type parameter
class C #(parameter type T = logic);
typedef struct packed { T data; } td_t;
class C #(
parameter type T = logic
);
typedef struct packed {T data;} td_t;
endclass
// Class with multiple type parameters and multiple typedefs
class multi_param #(parameter type ADDR_T = logic, parameter type DATA_T = logic);
typedef struct packed { ADDR_T addr; } addr_td_t;
typedef struct packed { DATA_T data; } data_td_t;
class multi_param #(
parameter type ADDR_T = logic,
parameter type DATA_T = logic
);
typedef struct packed {ADDR_T addr;} addr_td_t;
typedef struct packed {DATA_T data;} data_td_t;
endclass
// verilog_format: off
@ -24,46 +29,58 @@ endclass
// verilog_format: on
// Leaf interface: holds a value of parameterized type
interface l0 #(type P = logic);
interface l0 #(
type P = logic
);
P p;
endinterface
// 1-level nesting: wraps l0 with a class typedef parameter
interface l1 #(parameter type X = C#(logic));
l0 #(.P(X::td_t)) sub();
interface l1 #(
parameter type X = C#(logic)
);
l0 #(.P(X::td_t)) sub ();
endinterface
// 2-level nesting: forwards type param through l1 to l0
interface l2 #(parameter type X = C#(logic));
l1 #(.X(X)) sub();
interface l2 #(
parameter type X = C#(logic)
);
l1 #(.X(X)) sub ();
endinterface
// Multi-param leaf: holds two values of different parameterized types
interface multi_l0 #(type P = logic, type Q = logic);
interface multi_l0 #(
type P = logic,
type Q = logic
);
P p;
Q q;
endinterface
// Multi-param nesting: accesses different typedefs from same class
interface multi_l1 #(
parameter type CFG = multi_param#(logic, logic)
parameter type CFG = multi_param#(logic, logic)
);
multi_l0 #(.P(CFG::addr_td_t), .Q(CFG::data_td_t)) sub();
multi_l0 #(
.P(CFG::addr_td_t),
.Q(CFG::data_td_t)
) sub ();
endinterface
module t;
// Test 1-level nesting with different parameterizations
l1 #(.X(C#(logic[7:0]))) l1_i1();
l1 #(.X(C#(logic[15:0]))) l1_i2();
l1 #(.X(C #(logic [7:0]))) l1_i1 ();
l1 #(.X(C #(logic [15:0]))) l1_i2 ();
// Test default type parameter (C#(logic) -> td_t is struct packed { logic data; })
l1 l1_default();
l1 l1_default ();
// Test 2-level nesting - type parameter passed through multiple levels
l2 #(.X(C#(logic[31:0]))) l2_i();
l2 #(.X(C #(logic [31:0]))) l2_i ();
// Test multiple type params - different parameterizations accessing multiple typedefs
multi_l1 #(.CFG(multi_param#(logic[7:0], logic[31:0]))) ml1_i1();
multi_l1 #(.CFG(multi_param#(logic[15:0], logic[63:0]))) ml1_i2();
multi_l1 #(.CFG(multi_param #(logic [7:0], logic [31:0]))) ml1_i1 ();
multi_l1 #(.CFG(multi_param #(logic [15:0], logic [63:0]))) ml1_i2 ();
initial begin
// 1-level nesting
@ -75,7 +92,7 @@ module t;
`checkd($bits(l2_i.sub.sub.p), 32);
// Multiple type params passed to sub-interface - two different typedefs
`checkd($bits(ml1_i1.sub.p), 8); // addr_td_t from ADDR_T=logic[7:0]
`checkd($bits(ml1_i1.sub.p), 8); // addr_td_t from ADDR_T=logic[7:0]
`checkd($bits(ml1_i1.sub.q), 32); // data_td_t from DATA_T=logic[31:0]
`checkd($bits(ml1_i2.sub.p), 16); // addr_td_t from ADDR_T=logic[15:0]
`checkd($bits(ml1_i2.sub.q), 64); // data_td_t from DATA_T=logic[63:0]

View File

@ -13,7 +13,7 @@
module sub #(
parameter int dims_p = 2,
parameter int dirs_lp = dims_p*2 + 1,
parameter int dirs_lp = dims_p * 2 + 1,
parameter bit [1:0][dirs_lp-1:0][dirs_lp-1:0] matrix_p = '0
) ();
endmodule
@ -27,7 +27,10 @@ module t;
sub #(.matrix_p(big_matrix)) s1 ();
// Second instance overrides dims_p=1, so dirs_lp must recompute to 3.
sub #(.dims_p(1), .matrix_p(small_matrix)) s2 ();
sub #(
.dims_p(1),
.matrix_p(small_matrix)
) s2 ();
initial begin
if (s1.dirs_lp !== 5) begin

View File

@ -55,7 +55,9 @@ package my_pkg;
endpackage
// std::randomize outside package, multi-level parameterized inheritance
class base_c #(type T = int);
class base_c #(
type T = int
);
T item;
endclass