Forum Discussion
4 Replies
- Altera_Forum
Honored Contributor
You can do it, but you have to do it a certain way for Quartus to synthesize it. The module port must be an unpacked array of interface modport's. You need an unpacked array of interfaces to connect to it. When you instantiate the module, make the port connection with the name of the interface array only, not the modports.
interface iface(); logic a; logic b; modport mport(input a, output b); endinterface module mod ( iface.mport iface_array ); ... endmodule module top (); iface top_iface_array (); mod mod_inst(.iface_array(top_iface_array)); ... endmodule - Altera_Forum
Honored Contributor
thanks!
followup question - in case I do exactly like you showed above. how can I forward an interface-array to a submodule?? (this is my main problem...) - Altera_Forum
Honored Contributor
You can forward the whole array to the sub-module like this:
Or you can break out the array to a set of sub-modules like this:interface iface(); logic a; logic b; modport mport(input a, output b); endinterface module submod ( iface.mport iface_array ); ... endmodule module mod ( iface.mport iface_array ); submod submod_inst(.iface_array(iface_array)); endmodule module top (); iface top_iface_array (); mod mod_inst(.iface_array(top_iface_array)); endmoduleinterface iface(); logic a; logic b; modport mport(input a, output b); endinterface module submod ( iface.mport iface_port ); ... endmodule module mod ( iface.mport iface_array ); genvar i; generate for(i=0; i<4; i++) begin : submod_lp submod submod_inst(.iface_port(iface_array)); end endgenerate endmodule module top (); iface top_iface_array (); mod mod_inst(.iface_array(top_iface_array)); endmodule - Altera_Forum
Honored Contributor
Does anyone know how to deal with the array of interface scenario presented in this thread if you were to add some input ports to the interface?
Example: interface iface(input logic clk) logic a; logic b; modport mport (input a, output b); endinterface ** How would you instantiate the array of interfaces so each interface in the array could have it's own clk wired to a unique clock? If I do as follows: iface top_iface_array [3:0] (.clk (my_clk)); I have only wired up to a single clock and it really doesn't make sense when I'm referencing an array of interfaces. Thanks. ---------------------------------- --- Quote Start --- You can do it, but you have to do it a certain way for Quartus to synthesize it. The module port must be an unpacked array of interface modport's. You need an unpacked array of interfaces to connect to it. When you instantiate the module, make the port connection with the name of the interface array only, not the modports.
--- Quote End ---interface iface(); logic a; logic b; modport mport(input a, output b); endinterface module mod ( iface.mport iface_array ); ... endmodule module top (); iface top_iface_array (); mod mod_inst(.iface_array(top_iface_array)); ... endmodule