From d1a0bad3347b4d35972b0493848d99bb33c7d9f1 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 6 Apr 2025 10:24:34 -0400 Subject: [PATCH] Tests: Add test for (#4040). --- Changes | 2 +- test_regress/t/t_sys_monitor_changes.out | 6 +++++ test_regress/t/t_sys_monitor_changes.py | 18 ++++++++++++++ test_regress/t/t_sys_monitor_changes.v | 31 ++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 test_regress/t/t_sys_monitor_changes.out create mode 100755 test_regress/t/t_sys_monitor_changes.py create mode 100644 test_regress/t/t_sys_monitor_changes.v diff --git a/Changes b/Changes index f8643da99..10e627476 100644 --- a/Changes +++ b/Changes @@ -316,7 +316,7 @@ Verilator 5.028 2024-08-21 * Add parsing but otherwise ignore std::randomize (#5354). [Arkadiusz Kozdra, Antmicro Ltd.] * Add Verilated cc define when `--timing` used (#5383). [Kaleb Barrett] * Improve emitted code to use a reference for VlSelf (#5254). [Yangyu Chen] -* Fix monitor block sensitivity items (#4400) (#5294). [Udaya Raj Subedi] +* Fix monitor block sensitivity items (#4040) (#4400) (#5294). [Udaya Raj Subedi] * Fix fusing macro arguments to not ignore whitespace (#5061). [Tudor Timi] * Fix optimized-out sensitivity trees with `--timing` (#5080) (#5349). [Krzysztof Bieganski, Antmicro Ltd.] * Fix classes/modules of case-similar names (#5109). [Arkadiusz Kozdra] diff --git a/test_regress/t/t_sys_monitor_changes.out b/test_regress/t/t_sys_monitor_changes.out new file mode 100644 index 000000000..ae8ca4da9 --- /dev/null +++ b/test_regress/t/t_sys_monitor_changes.out @@ -0,0 +1,6 @@ +[0] a=0 b=0 +[101] a=10 b=0 +[111] a=10 b=20 +[121] a=11 b=20 +[131] a=11 b=22 +*-* All Finished *-* diff --git a/test_regress/t/t_sys_monitor_changes.py b/test_regress/t/t_sys_monitor_changes.py new file mode 100755 index 000000000..1407fff26 --- /dev/null +++ b/test_regress/t/t_sys_monitor_changes.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2024 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 + +import vltest_bootstrap + +test.scenarios('simulator') + +test.compile(verilator_flags2=["--binary"]) + +test.execute(expect_filename=test.golden_filename) + +test.passes() diff --git a/test_regress/t/t_sys_monitor_changes.v b/test_regress/t/t_sys_monitor_changes.v new file mode 100644 index 000000000..aa864b6df --- /dev/null +++ b/test_regress/t/t_sys_monitor_changes.v @@ -0,0 +1,31 @@ +// 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 + +module t; + + bit clk; + int a, b; + + always #10 clk = ~clk; + + initial begin + $monitor("[%0t] a=%0d b=%0d", $time, a, b); + #1; // So not on clock edge + #100; + a = 10; + #10; + b = 20; + #10; + a = 11; + #10; + b = 22; + #100; + #10; + $monitoroff; + $write("*-* All Finished *-*\n"); + $finish; + end +endmodule