Sending whether an agent is active or passive via config db to a spesific component

Hi,

I wrote a simple RAL code, link : My Basic RAL Code

I am confused about sending something via uvm_config_db to a spesific component. For example.

I use get in agent for uvn_config db to take is_active from test:


     // get from test config_db whether the agent will be active
    if(!uvm_config_db#(uvm_active_passive_enum)::get(this, "", "is_active", is_active))
      `uvm_fatal(get_type_name,"agent activity couldn't be taken")

And later I check whether is active or not:


    //get_is_active --> Returns UVM_ACTIVE is the agent is acting as an active agent and UVM_PASSIVE if it is acting as a passive agent.
    if(get_is_active() == UVM_ACTIVE) begin 
      // = if(is_active == UVM_ACTIVE) uvm_agent has an internal variable called is_active which is of enum type uvm_active_passive_enum.By default, all agents are active.
      driver = dma_driver::type_id::create("driver", this);
      sequencer = dma_sequencer::type_id::create("sequencer", this);
    end  
    else begin
      `uvm_fatal("AGENT", "AGENT IS PASSIVE")
    end


If I sent from test with “" it is okay. As far as I know, "” is wildcard and means all classes below test as direction.


    // set agent activity from test to agent via config db -------------
    // is_active is a variable inside agent defaultly, which is uvm_active_passive_enum - enum type. 
    uvm_config_db#(uvm_active_passive_enum)::set(this, "*", "is_active", UVM_ACTIVE); //--> to all below test

But when I tried to sent only to agent I took error. It couldn’t get it to agent.


    uvm_config_db#(uvm_active_passive_enum)::set(this, "*.dma_agnt.*", "is_active", UVM_ACTIVE);

I also tried that given below but the result is the same, error.


    uvm_config_db#(uvm_active_passive_enum)::set(this, "*.dma.env.dma_agnt", "is_active", UVM_ACTIVE);

Thanks,
Hakan

In reply to hcglu:

The active/passive configuration is a little bit strange. You should look to the UVM Reference Manual. It say to make the setting you have to use a command like this:

 uvm_config_int::set(this, "*dma_agnt*", "is_active",  UVM_PASSIVE);

And in the agent you are simply using

get_is_active()

See the your code here

In reply to chr_sue:

Thank you chr_seu.

I tried but I realized it did not work properly. In the code updated by you, agent is passive but the test passed. I think it did not send.

I also tried Cadence, writing “dma_env.dma_agnt” or “.dma_agnt.”, which did not worked.

Do you have any other idea?

I also tried to build a configuration object. It worked. Code with config object

In reply to hcglu:

I made some more detailed invetsigations. Something goes wrong with the object naming of the dam_agent.
When you are set is_active like this (in test):
uvm_config_int::set(this, “dma_env.dma_agent”, “is_active”, UVM_PASSIVE);
Anything is fine and the dam_agwewnt is set to UVM_PASSIVE.
If you are using
uvm_config_int::set(this, “dma_env.dma_agnt”, “is_active”, UVM_PASSIVE);
it fails. And the agent is still UVM_ACTIVE.
See my code here

When you are stting the agent ACTIVE you can also see the topology. In the topology the agent object is also named dma_agent instead of dma_agnt.

In reply to chr_sue:

Meanwhile I found the problem. It si in the build_phase of your en.

  function void build_phase(uvm_phase phase);   
    super.build_phase(phase); 
    //create agent
    dma_agnt = dma_agent::type_id::create("dma_agnt", this); // this
    //Create and build reg model
    regmodel = dma_reg_model::type_id::create("regmodel");
    regmodel.build();
    //create adapter
    m_adapter = dma_adapter::type_id::create("m_adapter"/*,, get_full_name()*/);   
  endfunction

This is now as it works.
Your mistake was here:

dma_agnt = dma_agent::type_id::create("dma_agent", this);

The component name and the component are different.
This is why it worked with dma_agent.
See here the solution.

In reply to chr_sue:

Thank you so much. I understand now.

And thank you, maybe I read more than 100 of your answers. You help me and others a lot sharing your experience. Please keep shining :sparkles: