From 2fbd41e13b1e9b45ee8c278955d6aee8890ecd54 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 15 Sep 2023 07:59:06 -0400 Subject: [PATCH] Tests: Add t_queue_persistence.pl as broken test (#3385) (#4489) --- test_regress/t/t_func_complex.v | 2 + test_regress/t/t_queue_persistence.pl | 31 +++++++++++++++ test_regress/t/t_queue_persistence.v | 43 +++++++++++++++++++++ test_regress/t/t_queue_persistence_noinl.pl | 31 +++++++++++++++ 4 files changed, 107 insertions(+) create mode 100755 test_regress/t/t_queue_persistence.pl create mode 100644 test_regress/t/t_queue_persistence.v create mode 100755 test_regress/t/t_queue_persistence_noinl.pl diff --git a/test_regress/t/t_func_complex.v b/test_regress/t/t_func_complex.v index 142088d35..d249426b5 100644 --- a/test_regress/t/t_func_complex.v +++ b/test_regress/t/t_func_complex.v @@ -12,6 +12,7 @@ module t(); // verilator no_inline_task `endif q.push_back(42); + if (q.size() != 1) $stop; endfunction function void queue_check_nref(q_t q); @@ -39,6 +40,7 @@ module t(); initial begin q_t iq; queue_set(iq); + if (iq.size() != 1) $stop; queue_check_ref(iq); iq[0] = 44; diff --git a/test_regress/t/t_queue_persistence.pl b/test_regress/t/t_queue_persistence.pl new file mode 100755 index 000000000..c9515ce9b --- /dev/null +++ b/test_regress/t/t_queue_persistence.pl @@ -0,0 +1,31 @@ +#!/usr/bin/env perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2023 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); + +top_filename("t/t_queue_persistence.v"); + +if (!$Self->have_coroutines) { + skip("No coroutine support"); +} +else { + compile( + timing_loop => 1, + verilator_flags2 => ["--timing"], + ); + + execute( + fails => $Self->{vlt_all}, # bug3385 need to fix "ref" + check_finished => !$Self->{vlt_all}, + ); +} + +ok(1); +1; diff --git a/test_regress/t/t_queue_persistence.v b/test_regress/t/t_queue_persistence.v new file mode 100644 index 000000000..a0ee23905 --- /dev/null +++ b/test_regress/t/t_queue_persistence.v @@ -0,0 +1,43 @@ +// 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 + +`define checkd(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got=%0d exp=%0d\n", `__FILE__,`__LINE__, (gotv), (expv)); $stop; end while(0); + +module t(/*AUTOARG*/); + + int q[$]; + + task automatic func(ref int vrefed); +`ifdef TEST_NOINLINE + // verilator no_inline_task +`endif + `checkd(vrefed, 2); + #100; + vrefed = 10; + `checkd(vrefed, 10); + endtask + + initial begin + q.push_back(1); + q.push_back(2); + q.push_back(3); + `checkd(q[0], 1); + `checkd(q[1], 2); + `checkd(q[2], 3); + func(q[1]); + end + + initial begin + #50; + `checkd(q[1], 2); + q.delete(); + #100; + + $write("*-* All Finished *-*\n"); + $finish; + end + +endmodule diff --git a/test_regress/t/t_queue_persistence_noinl.pl b/test_regress/t/t_queue_persistence_noinl.pl new file mode 100755 index 000000000..afaa948eb --- /dev/null +++ b/test_regress/t/t_queue_persistence_noinl.pl @@ -0,0 +1,31 @@ +#!/usr/bin/env perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2023 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); + +top_filename("t/t_queue_persistence.v"); + +if (!$Self->have_coroutines) { + skip("No coroutine support"); +} +else { + compile( + timing_loop => 1, + verilator_flags2 => ["--timing --fno-inline +define+TEST_NOINLINE"], + ); + + execute( + fails => $Self->{vlt_all}, # bug3385 need to fix "ref" + check_finished => !$Self->{vlt_all}, + ); +} + +ok(1); +1;