My question is about how to use predefined array element in hierarchical path in Verilog (SystemVerilog).
So for example I have defined the following string array:
string my_modules [0:1] = {"my_module_0","my_module_1"};
After, in my code I try to use them in some hierarchy:
generate
for (genvar i = 0; i < 2; i++) begin: BLOCK
wire a = top_module.my_modules[i].a;
end
endgenerate
But I'm getting simulation error, because it cannot find the hierarchy as it is looking for my_modules module instead of its defined value (i.e my_module_0 and my_module_1).
Can someone advise on this ?
Thanks.