From b4e91c87a6dd8d2e502fe78f757b1d4e97f748c8 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Mon, 2 Dec 2024 07:20:40 -0500 Subject: [PATCH] Tests: Add t_interface_find --- test_regress/t/t_interface_find.py | 18 +++++++++++ test_regress/t/t_interface_find.v | 43 +++++++++++++++++++++++++++ test_regress/t/t_interface_find_ifc.v | 9 ++++++ 3 files changed, 70 insertions(+) create mode 100755 test_regress/t/t_interface_find.py create mode 100644 test_regress/t/t_interface_find.v create mode 100644 test_regress/t/t_interface_find_ifc.v diff --git a/test_regress/t/t_interface_find.py b/test_regress/t/t_interface_find.py new file mode 100755 index 000000000..d4f986441 --- /dev/null +++ b/test_regress/t/t_interface_find.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() + +test.execute() + +test.passes() diff --git a/test_regress/t/t_interface_find.v b/test_regress/t/t_interface_find.v new file mode 100644 index 000000000..6566a7381 --- /dev/null +++ b/test_regress/t/t_interface_find.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, 2013 by Wilson Snyder. +// SPDX-License-Identifier: CC0-1.0 + +// Auto-resolved by t_interface_find_ifc.v +// interface t_interface_find_ifc; + +module t (/*AUTOARG*/ + // Inputs + clk + ); + + input clk; + integer cyc=1; + + t_interface_find_ifc itop(); + + sub c1 (.isub(itop), + .i_value(4'h4)); + + always @ (posedge clk) begin + cyc <= cyc + 1; + if (cyc==20) begin + if (c1.i_value != 4) $stop; // 'Normal' crossref just for comparison + if (itop.value != 4) $stop; + $write("*-* All Finished *-*\n"); + $finish; + end + end +endmodule + +module sub + ( + t_interface_find_ifc isub, + input logic [3:0] i_value + ); + + always @* begin + isub.value = i_value; + end +endmodule : sub diff --git a/test_regress/t/t_interface_find_ifc.v b/test_regress/t/t_interface_find_ifc.v new file mode 100644 index 000000000..2866d850b --- /dev/null +++ b/test_regress/t/t_interface_find_ifc.v @@ -0,0 +1,9 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed under the Creative Commons Public Domain, for +// any use, without warranty, 2013 by Wilson Snyder. +// SPDX-License-Identifier: CC0-1.0 + +interface t_interface_find_ifc; + logic [3:0] value; +endinterface