- You only need to name a generate block if you plan to reference things (ie. variables or instances) declared inside the generate block from outside the generate block.
- It’s not illegal to assign
amba_buses in the generate loop. However, it is not a good programming practice to have multiple processes simultaneously writing and reading to the same global variable. A better approach would be using the argument to next() to specify the position of the enum label.
const amba_bus_t amba_bus_first;
// Actual interface (amba_interface) array instance named “i_amba_interface”
amba_interface i_amba_interface[AMBA_BUS_QUANTITY}]();
for (genvar i = 0; i < AMBA_BUS_QUANTITY; i++) begin
initial begin
automatic amba_bus_t local_label = amba_bus_first.next(i);
uvm_config_db#(virtual amba_interface)::set(uvm_root::get(), "uvm_test_top", local_label.name(), top.i_amba_interface[i]);
end
end