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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2024 by Antmicro.
// SPDX-License-Identifier: CC0-1.0
module t(input logic clk);
unsupported_ctl_type unsupported_ctl_type(clk ? 1 : 2);
unsupported_ctl_type_expr unsupported_ctl_type_expr();
bad_assertcontrol_ctl_type bad_assertcontrol_ctl_type();
assert_class assert_class();
assert_iface assert_iface();
assert_iface_class assert_iface_class();
endmodule
module unsupported_ctl_type(input int a);
initial begin
$assertcontrol(1, a);
$assertcontrol(2);
$assertcontrol(6);
$assertcontrol(7);
$assertcontrol(8);
$assertcontrol(9);
$assertcontrol(10);
$assertcontrol(11);
end
endmodule
module unsupported_ctl_type_expr;
int ctl_type = 1;
initial begin
$assertcontrol(ctl_type);
end
endmodule
module bad_assertcontrol_ctl_type;
initial begin
$assertcontrol(0);
$assertcontrol(100);
end
endmodule
module assert_class;
virtual class AssertCtl;
pure virtual function void virtual_assert_ctl();
endclass
class AssertCls;
static function void static_function();
assert(0);
endfunction
static task static_task();
assert(0);
endtask
function void assert_function();
assert(0);
endfunction
task assert_task();
assert(0);
endtask
virtual function void virtual_assert();
assert(0);
endfunction
endclass
class AssertOn extends AssertCtl;
virtual function void virtual_assert_ctl();
$asserton;
endfunction
endclass
class AssertOff extends AssertCtl;
virtual function void virtual_assert_ctl();
$assertoff;
endfunction
endclass
AssertCls assertCls;
AssertOn assertOn;
AssertOff assertOff;
initial begin
$assertoff;
AssertCls::static_function();
AssertCls::static_task();
$asserton;
AssertCls::static_function();
AssertCls::static_task();
assertCls = new;
assertOn = new;
assertOff = new;
assertOff.virtual_assert_ctl();
assertCls.assert_function();
assertCls.assert_task();
assertCls.virtual_assert();
assertOn.virtual_assert_ctl();
assertCls.assert_function();
assertCls.assert_task();
assertCls.virtual_assert();
assertOff.virtual_assert_ctl();
assertCls.assert_function();
end
endmodule
interface Iface;
function void assert_func();
assert(0);
endfunction
function void assertoff_func();
$assertoff;
endfunction
initial begin
assertoff_func();
assert(0);
assert_func();
$asserton;
assert(0);
assert_func();
end
endinterface
module assert_iface;
Iface iface();
virtual Iface vIface = iface;
initial begin
vIface.assert_func();
vIface.assertoff_func();
vIface.assert_func();
iface.assert_func();
iface.assertoff_func();
iface.assert_func();
end
endmodule
interface class IfaceClass;
pure virtual function void assertoff_func();
pure virtual function void assert_func();
endclass
class IfaceClassImpl implements IfaceClass;
virtual function void assertoff_func();
$assertoff;
endfunction
virtual function void assert_func();
assert(0);
endfunction
endclass
module assert_iface_class;
IfaceClassImpl ifaceClassImpl = new;
initial begin
ifaceClassImpl.assertoff_func();
ifaceClassImpl.assert_func();
end
endmodule
|