verilator/test_regress/t/t_class_extends_default.v

33 lines
572 B
Systemverilog
Raw Normal View History

2025-04-09 04:09:40 +02:00
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2020 Wilson Snyder
2025-04-09 04:09:40 +02:00
// SPDX-License-Identifier: CC0-1.0
class Base1;
2026-03-08 23:26:40 +01:00
int s = 2;
function new(int def = 3);
s = def;
endfunction
2025-04-09 04:09:40 +02:00
endclass
class Cls1 extends Base1(default);
2026-03-08 23:26:40 +01:00
// Gets new(int def)
2025-04-09 04:09:40 +02:00
endclass
module t;
2026-03-08 23:26:40 +01:00
initial begin
Cls1 c1;
Cls1 c5;
c1 = new(57);
if (c1.s !== 57) $stop;
2025-04-09 04:09:40 +02:00
2026-03-08 23:26:40 +01:00
c5 = new;
if (c5.s !== 5) $stop;
2025-04-09 04:09:40 +02:00
2026-03-08 23:26:40 +01:00
$write("*-* All Finished *-*\n");
$finish;
end
2025-04-09 04:09:40 +02:00
endmodule