Multpile Dimensions for a interface/agents

Hi,
I was trying to create multiple dimension interface to be connected to a multi-dimension agent. But I am facing compile time errors

module xyz();
if my_if[3]10;
…initializing the interface values…
virtual if my_if2[3][10];
initial begin
my_if2=my_if;
for(int i=0;i<3;i++)begin
foreach(my_if2[,j])begin
uvm_config_db#(virtual if)::set(null, $sformatf(“.agent[%0d][%0d]*”,i,j),“vif”,my_if2[i][j]);
end
end
end
endmodule

The error that I get is in the declaration of first interface “Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.”. Could you please help me here.
Thank you.

In reply to usnath:

I’m assuming in your real code, “if” is not the actual name of your interface as it is a reserved keyword.

You cannot use procedural code to loop through instances, they are not true arrays. You will need to use a nested generate-for loop.


itf my_if[3][10]();
...initializing the interface values...
virtual itf my_if2[3][10];

for(genvar i=0;i<3;i++)
  for(genvar j=0;j<3;j++)
    initial begin
       uvm_config_db#(virtual if)::set(null, $sformatf(".agent[%0d][%0d]*",i,j),"vif",my_if[i][j]);
       my_if2[i][j] = my_if[i][j]; // not sure if you really need to do this
   end

Thanks for the reply, Dave. I tried it but that does not seem to be the issue.I’m getting error in the first line itself(ERR: Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope). I made sure The interface type is visible in the scope. Error seems to go away when I make the interface single dimension.

In reply to usnath:

It seems you have a tool specific issue. Other tools compile that code fine.