I have a lower level module that implements an array of interfaces. At a higher level I would like to break out that interface array and assign it to individual ports (the code is just an example . . . no special functionality intended).
// -------- INTERFACE --------
interface my_if;
logic d;
endinterface
// -------- INTERMEDIATE MODULE --------
module intermediate(
my_if i1,
my_if i2
);
sub mySub(
.a ('{i1,i2}),
.w1 (1'b1)
);
endmodule
// -------- SUB MODULE --------
module sub(
my_if a[2],
input wire w1
);
assign a[0].d = w1;
assign a[1].d = ~w1;
endmodule
The above code gives me an error:
The interface port 'a' of module 'sub' whose type is interface 'my_if' is illegally connected.
Two questions:
- how can I implement the above?
- how do I assign an interface to another of the same type? ie in the code above I tried assigning and aliasing the array interface to an intermediate one (alias i1 = ii[0]) . . . but I can't figure out how to do that.