Uvm_config_db set in generate loop

In reply to dave_59:

  1. 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.
  2. 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

Thanks for clarifying. Could you still explain with a couple of more words the following things:

  1. By declaring amba_bus_first as a const constant, can it be assigned once somewhere within the module?
  2. Why automatic word is used, to get local copy of amba_bus_first for each generate block? What is the fundamental difference to declare local_label variable with/without automatic in this context? I think with automatic keyword local_label is initialized when execution enters the initial process?

-Vaino