verilator/test_regress/t/t_dynarray_init.v
Arkadiusz Kozdra 5b839699ac
Support empty queue as dynarray default value (#5055)
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
2024-04-18 11:53:23 -05:00

40 lines
918 B
Systemverilog

// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
`define stop $stop
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0)
module t (/*AUTOARG*/);
int a1[] = '{12, 13};
int a2[] = {14, 15};
int a3[] = '{16};
int a4[] = {17};
int a5[] = {};
initial begin
`checkh(a1.size, 2);
`checkh(a1[0], 12);
`checkh(a1[1], 13);
`checkh(a2.size, 2);
`checkh(a2[0], 14);
`checkh(a2[1], 15);
`checkh(a3.size, 1);
`checkh(a3[0], 16);
`checkh(a4.size, 1);
`checkh(a4[0], 17);
`checkh(a5.size, 0);
$write("*-* All Finished *-*\n");
$finish;
end
endmodule