Hi,
I want to reduce the number of lines in my code by iterating though hdl hierarchy with foreach loop so that instead of 10 individual force statement I can write a reduced code.
Example,
module test();
test_interface my_interface[10];
assign my_interface[0].addr = dut.mod0.addr;
assign my_interface[2].addr = dut.mod2.addr;
..
..
assign my_interface[9].addr = dut.mod9.addr;
endmodule
For above code I want to do something like this,
module test();
test_interface my_interface[10];
foreach(my_interface[i]) begin
assign my_interface[i].addr = dut.mod/i/.addr;
end
endmodule
Is it even possible to iterate hdl hierarchy like this? If yes then how it can be achieved?