I don't this is going to be possible to do as this would mean that in your testbench you'd have to have something like the following:
module top
some_interface if1(...);
some_other_interface if2(...);
bing #(SOME_VALUE = 2) (
.my_interfaces[0](if1),
.my_interfaces[1](if2)
);
endmodule
which is illegal syntax. When connecting ports, you can only use the port identifier (in your case my_interfaces
) and you're not allowed to slice it (the BNF defined in 23.3.2 Module instantiation syntax doesn't allow it).
If you want to pass in an array of interfaces of the same type, then you won't have any problem. I don't think the use model you have in mind is compatible with the language. Even if when you define the my_interfaces
port as an array of generic interfaces, it's still an array and it's going to expect an array of a certain type of interface to be connected to it. An array can only hold objects of the same type.
What you can do is use the maximum footprint approach and always connect all interfaces you need. You'd need to explicitly define each as an own port. Based on your parameter you'd just exclude parts of your logic (using generate
statements) and the unused wires should be optimized away by your synthesis tool.