verilator/test_regress/t/t_interface_array_parameter...

48 lines
914 B
Systemverilog
Raw Normal View History

// DESCRIPTION: Verilator: Get parameter from array of interfaces
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2024 Todd Strader
// SPDX-License-Identifier: CC0-1.0
2026-03-08 23:26:40 +01:00
interface intf #(
parameter int FOO = 4
) (
input wire clk,
input wire rst
);
modport modp(input clk, rst);
endinterface
2026-03-08 23:26:40 +01:00
module sub (
intf.modp the_intf_port[4],
intf.modp single_intf_port
);
localparam intf_foo = the_intf_port[0].FOO;
localparam single_foo = single_intf_port.FOO;
2026-03-08 23:26:40 +01:00
initial begin
if (intf_foo != 4) $stop;
if (single_foo != 4) $stop;
end
endmodule
module t (
clk
);
2026-03-08 23:26:40 +01:00
logic rst;
input clk;
2026-03-08 23:26:40 +01:00
intf the_intf[4] (.*);
intf single_intf (.*);
2026-03-08 23:26:40 +01:00
sub the_sub (
.the_intf_port(the_intf),
.single_intf_port(single_intf)
);
2026-03-08 23:26:40 +01:00
always @(posedge clk) begin
$write("*-* All Finished *-*\n");
$finish;
end
endmodule