verilator/test_regress/t/t_trace_class.v

35 lines
710 B
Systemverilog
Raw Normal View History

2024-03-28 01:07:46 +01:00
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2024 Wilson Snyder
2024-03-28 01:07:46 +01:00
// SPDX-License-Identifier: CC0-1.0
`define STRINGIFY(x) `"x`"
2026-03-10 02:38:29 +01:00
class Cls #(
parameter int PARAM
);
static int s_cls_static = 123;
2024-03-28 01:07:46 +01:00
endclass
2026-03-10 02:38:29 +01:00
module top ();
typedef Cls#(.PARAM(0)) Cls_t;
2024-03-28 01:07:46 +01:00
2026-03-10 02:38:29 +01:00
Cls_t obj;
2024-03-28 01:07:46 +01:00
2026-03-10 02:38:29 +01:00
initial begin
obj = new;
2024-03-28 01:07:46 +01:00
`ifdef verilator
2026-03-10 02:38:29 +01:00
obj.s_cls_static = $c("100"); // no-opt
2024-03-28 01:07:46 +01:00
`else
2026-03-10 02:38:29 +01:00
obj.s_cls_static = 100;
2024-03-28 01:07:46 +01:00
`endif
2026-03-10 02:38:29 +01:00
if (obj.s_cls_static != 100) $stop;
if (obj.PARAM != 0) $stop;
$dumpfile(`STRINGIFY(`TEST_DUMPFILE));
$dumpvars(0);
$write("*-* All Finished *-*\n");
$finish;
end
2024-03-28 01:07:46 +01:00
endmodule