1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2025 by Antmicro.
// SPDX-License-Identifier: CC0-1.0
class NodeList;
class Node;
string name;
Node link;
function new();
name = "node";
endfunction
endclass
Node head;
endclass
class NodeTree;
class Node;
int id;
Node link;
endclass
Node root;
endclass
// Based on IEEE 1800-2017 section 8.23 Nested classes
class Outer;
int outerProp;
local int outerLocalProp;
static int outerStaticProp;
static local int outerLocalStaticProp;
class Inner;
function void innerMethod(Outer h);
outerStaticProp = 1;
outerLocalStaticProp = 1;
h.outerProp = 1;
h.outerLocalProp = 1;
endfunction
endclass
endclass
module t(/*AUTOARG*/);
initial begin
NodeList n = new;
NodeList::Node n1 = new;
NodeList::Node n2 = new;
NodeTree tr = new;
NodeTree::Node t1 = new;
NodeTree::Node t2 = new;
Outer o = new;
Outer::Inner i = new;
i.innerMethod(o);
if(o.outerProp != 1) $stop;
if(Outer::outerStaticProp != 1) $stop;
if (n1.name != "node") $stop;
n1.name = "n1";
if (n1.name != "n1") $stop;
n2.name = "n2";
if (n2.name != "n2") $stop;
n.head = n1;
n1.link = n2;
if (n.head.name != "n1") $stop;
if (n.head.link.name != "n2") $stop;
t1.id = 1;
if (t1.id != 1) $stop;
t2.id = 2;
if (t2.id != 2) $stop;
tr.root = t1;
t1.link = t2;
if (tr.root.id != 1) $stop;
if (tr.root.link.id != 2) $stop;
$write("*-* All Finished *-*\n");
$finish;
end
endmodule
|