verilator/test_regress/t/t_oob_2state_array.v

30 lines
774 B
Systemverilog

// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2026 Antmicro
// SPDX-License-Identifier: CC0-1.0
// verilog_format: off
`define stop $stop
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got=%0x exp=%0x (%s !== %s)\n", `__FILE__,`__LINE__, (gotv), (expv), `"gotv`", `"expv`"); `stop; end while(0);
// verilog_format: on
module t;
logic clk = 1'b0;
always #1 clk = ~clk;
int idx = 0;
bit a[0:2] = {1, 1, 1};
always @(posedge clk) begin
if (idx == 4) begin
$write("*-* All Finished *-*\n");
$finish;
end
else begin
idx <= idx + 1;
`checkh(a[idx], idx <= 2 ? 1 : 0);
end
end
endmodule