verilator/test_regress/t/t_class_class.v

36 lines
918 B
Systemverilog
Raw Normal View History

// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// Note UVM internals do not require classes-in-classes
package P;
2022-11-17 23:15:38 +00:00
class Cls #(type STORE_T=string);
STORE_T imembera;
STORE_T imemberb;
class SubCls;
2022-11-17 23:15:38 +00:00
STORE_T smembera;
STORE_T smemberb;
2020-08-22 23:46:21 +00:00
// TODO put extern function here or in t_class_extern.v to check link
endclass : SubCls
SubCls sc;
endclass : Cls
endpackage : P
module t (/*AUTOARG*/);
2022-11-17 23:15:38 +00:00
P::Cls#(int) c;
initial begin
c = new;
c.imembera = 10;
c.imemberb = 20;
c.sc = new;
c.sc.smembera = 30;
c.sc.smemberb = 40;
if (c.imembera != 10) $stop;
if (c.imemberb != 20) $stop;
if (c.sc.smembera != 30) $stop;
if (c.sc.smemberb != 40) $stop;
end
endmodule