verilator/test_regress/t/t_interface1.v

46 lines
815 B
Systemverilog
Raw Normal View History

// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2013 Wilson Snyder
// SPDX-License-Identifier: CC0-1.0
// Very simple test for interface pathclearing
interface ifc;
2026-03-08 23:26:40 +01:00
logic [3:0] value;
endinterface
2026-03-08 23:26:40 +01:00
module t (
input clk
);
2026-03-08 23:26:40 +01:00
integer cyc = 1;
2026-03-08 23:26:40 +01:00
ifc itop ();
2026-03-08 23:26:40 +01:00
sub c1 (
.isub(itop),
.i_value(4'h4)
);
2026-03-08 23:26:40 +01:00
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
2026-03-08 23:26:40 +01:00
module sub (
ifc isub,
input logic [3:0] i_value
);
2026-03-08 23:26:40 +01:00
always @* begin
isub.value = i_value;
end
endmodule : sub