verilator/test_regress/t/t_class_method.v
Ryszard Rozak 371b8310d9
Support method calls without parenthesis (#4034)
* Support method class without parenthesis

Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>

* Delete replaced nodes

Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>

---------

Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
2023-03-17 13:25:39 +01:00

32 lines
871 B
Systemverilog

// 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
typedef class Cls;
class Cls;
int imembera;
function int get_methoda; return imembera; endfunction
task set_methoda(input int val); imembera = val; endtask
function void setv_methoda(input int val); imembera = val; endfunction
endclass : Cls
module t (/*AUTOARG*/);
initial begin
Cls c;
if (c != null) $stop;
c = new;
c.imembera = 10;
if (c.get_methoda() != 10) $stop;
c.set_methoda(20);
if (c.get_methoda() != 20) $stop;
c.setv_methoda(30);
if (c.get_methoda() != 30) $stop;
if (c.get_methoda != 30) $stop;
$write("*-* All Finished *-*\n");
$finish;
end
endmodule