mirror of
https://github.com/verilator/verilator.git
synced 2025-01-24 15:24:04 +00:00
Tests: Better virtual test
This commit is contained in:
parent
1dce6b2500
commit
fefe731105
@ -1,4 +1,7 @@
|
||||
%Error-UNSUPPORTED: t/t_class_virtual.v:8:25: Unsupported: 'virtual' class method
|
||||
8 | virtual function int hello;
|
||||
| ^~~~~
|
||||
%Error-UNSUPPORTED: t/t_class_virtual.v:7:9: Unsupported: virtual class
|
||||
7 | virtual class VC;
|
||||
7 | virtual class VBase;
|
||||
| ^~~~~
|
||||
%Error: Exiting due to
|
||||
|
@ -4,5 +4,36 @@
|
||||
// any use, without warranty, 2019 by Wilson Snyder.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
virtual class VC;
|
||||
virtual class VBase;
|
||||
virtual function int hello;
|
||||
return 1;
|
||||
endfunction
|
||||
endclass
|
||||
|
||||
`ifndef VERILATOR
|
||||
virtual class VA extends VBase;
|
||||
virtual function int hello;
|
||||
return 2;
|
||||
endfunction
|
||||
endclass
|
||||
|
||||
virtual class VB extends VBase;
|
||||
virtual function int hello;
|
||||
return 3;
|
||||
endfunction
|
||||
endclass
|
||||
|
||||
module t;
|
||||
initial begin
|
||||
VA va = new;
|
||||
VB vb = new;
|
||||
VBase b;
|
||||
b = va;
|
||||
if (b.hello() != 2) $stop;
|
||||
b = vb;
|
||||
if (b.hello() != 3) $stop;
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
endmodule
|
||||
`endif
|
||||
|
Loading…
Reference in New Issue
Block a user