Can multiple interfaces be instansed together in system verilog?

Status
Not open for further replies.

littlebu

Member level 1
Joined
May 19, 2007
Messages
33
Helped
4
Reputation
8
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,453

Code Verilog - [expand]
1
2
interface_instantiation ::=
interface_identifier [ parameter_value_assignment ] module_instance { , module_instance } ;



above is interface instantiation syntax, seems multi interfaces (like an interface array) cannot be clarified together, is that ture?

what im looking for is:


Code Verilog - [expand]
1
axi_interface #(d_w(32)) [nr_of_ports-1:0] my_interface;



is that possible?

Thanks
 
Last edited by a moderator:

You can certainly do that because if you dive into module_instance , it allows

Code:
name_of_instance ::=
      instance_identifier { unpacked_dimension }
The correct syntax will be

Code Verilog - [expand]
1
axi_interface #(d_w(32))  my_interface[nr_of_ports-1:0]();



Note that you cannot use a variable to dynamically index into an instance array. The index must be a constant or generate loop variable. genver.
 

Thanks! !

And more questions about interface:

1. Can such 2d interface array as a port?
2. How can I use modport in that case if Q1 is OK?

3. for example:


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module axi_slave(
    my_axi_interface axi_master_interface[nr_of_axi_ports-1:0];
    clk,
    rstn
    );
    generate
    .*
    axi_mastere_interface[i].awready = '1;      // is that working?
    endgenerate
    endmodule
    
    module bench();
    my_axi_interface axi_master_interface[nr_of_axi_ports-1:0];
    axi_slave u_axi_slave(
    .axi_master_interface(axi_master_interface),            // Q: is this right?
    .*);
    endmodule




Thanks
 
Last edited by a moderator:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…