verilator/test_regress/t/t_constraint.v

32 lines
509 B
Systemverilog
Raw Normal View History

// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2023 Wilson Snyder
// SPDX-License-Identifier: CC0-1.0
class Packet;
2026-03-08 23:26:40 +01:00
rand int one;
2026-03-08 23:26:40 +01:00
constraint a {one > 0 && one < 2;}
2026-03-08 23:26:40 +01:00
constraint empty {}
2024-12-12 14:16:19 +01:00
endclass
module t;
2026-03-08 23:26:40 +01:00
Packet p;
2026-03-08 23:26:40 +01:00
int v;
2026-03-08 23:26:40 +01:00
initial begin
p = new;
v = p.randomize();
if (v != 1) $stop;
if (p.one != 1) $stop;
2026-03-08 23:26:40 +01:00
$write("*-* All Finished *-*\n");
$finish;
end
endmodule