From a079347a89f69a1942a3704872a36b7c4e1f9da9 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 7 Sep 2026 12:31:45 -0700 Subject: [PATCH] Add regression test for an interface name matching a typedef Check that a forward interface name used in a port declaration can have the same spelling as a visible `typedef`. Access a member through the port to make sure it is interpreted as an interface rather than a named data type. Signed-off-by: Lars-Peter Clausen --- ...v_type_identifier_interface_forward_port.v | 37 +++++++++++++++++++ ivtest/regress-vvp.list | 1 + ...ype_identifier_interface_forward_port.json | 9 +++++ 3 files changed, 47 insertions(+) create mode 100644 ivtest/ivltests/sv_type_identifier_interface_forward_port.v create mode 100644 ivtest/vvp_tests/sv_type_identifier_interface_forward_port.json diff --git a/ivtest/ivltests/sv_type_identifier_interface_forward_port.v b/ivtest/ivltests/sv_type_identifier_interface_forward_port.v new file mode 100644 index 000000000..0a5df6b7f --- /dev/null +++ b/ivtest/ivltests/sv_type_identifier_interface_forward_port.v @@ -0,0 +1,37 @@ +// Check that a forward interface name can match a visible typedef at a port. + +package p; + typedef int IFACE; +endpackage + +import p::*; + +module dut(IFACE i_iface, output logic result); + + assign result = i_iface.value; + +endmodule + +interface IFACE; + logic value; +endinterface + +module test; + + IFACE i_iface(); + logic result; + + dut i_dut(i_iface, result); + + initial begin + i_iface.value = 1'b1; + #1; + + if (result === 1'b1) begin + $display("PASSED"); + end else begin + $display("FAILED"); + end + end + +endmodule diff --git a/ivtest/regress-vvp.list b/ivtest/regress-vvp.list index 45202e3b7..09a0dc44b 100644 --- a/ivtest/regress-vvp.list +++ b/ivtest/regress-vvp.list @@ -565,6 +565,7 @@ sv_type_identifier_implicit_gate_fail vvp_tests/sv_type_identifier_implicit_gate sv_type_identifier_implicit_port_fail vvp_tests/sv_type_identifier_implicit_port_fail.json sv_type_identifier_inherited_property_shadow vvp_tests/sv_type_identifier_inherited_property_shadow.json sv_type_identifier_interface_forward_instance vvp_tests/sv_type_identifier_interface_forward_instance.json +sv_type_identifier_interface_forward_port vvp_tests/sv_type_identifier_interface_forward_port.json sv_type_identifier_modport_name vvp_tests/sv_type_identifier_modport_name.json sv_type_identifier_modport_named_port vvp_tests/sv_type_identifier_modport_named_port.json sv_type_identifier_module_forward_instance vvp_tests/sv_type_identifier_module_forward_instance.json diff --git a/ivtest/vvp_tests/sv_type_identifier_interface_forward_port.json b/ivtest/vvp_tests/sv_type_identifier_interface_forward_port.json new file mode 100644 index 000000000..f0946ce62 --- /dev/null +++ b/ivtest/vvp_tests/sv_type_identifier_interface_forward_port.json @@ -0,0 +1,9 @@ +{ + "type" : "normal", + "source" : "sv_type_identifier_interface_forward_port.v", + "iverilog-args" : [ "-g2005-sv" ], + "vlog95" : { + "__comment" : "Interfaces are not supported", + "type" : "TE" + } +}