1
0
mirror of https://github.com/verilator/verilator.git synced 2025-04-21 12:06:55 +00:00
verilator/test_regress/t/t_constraint.v

32 lines
556 B
Systemverilog

// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2023 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
class Packet;
rand int one;
constraint a { one > 0 && one < 2; }
endclass
module t (/*AUTOARG*/);
Packet p;
int v;
initial begin
p = new;
v = p.randomize();
if (v != 1) $stop;
`ifndef VERILATOR
if (p.one != 1) $stop;
`endif
$write("*-* All Finished *-*\n");
$finish;
end
endmodule