Tests: Add t_dynarray_unpacked (#2314)

This commit is contained in:
Wilson Snyder 2020-12-12 20:56:35 -05:00
parent 8e25d2c61d
commit 6061744c4d
4 changed files with 56 additions and 9 deletions

View File

@ -0,0 +1,34 @@
// 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*/);
byte dyn [][1:0];
initial begin
begin
dyn = new [3];
dyn[0] = '{101, 100};
dyn[1] = '{111, 110};
dyn[2] = '{121, 120};
`ifndef verilator // bug2314
`checkh(dyn[0][0], 100);
`checkh(dyn[0][1], 101);
`checkh(dyn[1][0], 110);
`checkh(dyn[1][1], 111);
`checkh(dyn[2][0], 120);
`checkh(dyn[2][1], 121);
`endif
end
$write("*-* All Finished *-*\n");
$finish;
end
endmodule

View File

@ -0,0 +1,21 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2019 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(simulator => 1);
compile(
);
execute(
check_finished => 1,
);
ok(1);
1;

View File

@ -7,15 +7,7 @@
`define stop $stop
`define checks(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='%s' exp='%s'\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0);
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
integer i;
module t (/*AUTOARG*/);
typedef string sarray_t[2];
typedef sarray_t q_sarray_t[$];