Getting fatal error while doing uvm_config_db get method in scoreboard

Hi,

I’m new to handling multi env in single testbench.
one env is apb env another one is main env.
Inside the user_defined_apb_env, i set the ral model using config db like below

if (model == null) begin
        model = ral_model::type_id::create("model");
        model.build();
        model.set_hdl_path_root(hdl_path);
        model.lock_model();
    end

    uvm_config_db#(uvm_reg_block)::set(this,"user_defined_apb_env.*", "regmodel", model)

in base test , again i set the ral block using config data base like below.

ral_block_pro m_model;
function void connect_phase(uvm_phase phase);
      m_model = main_env_inst.apb_env_inst.model;
       if(!$cast(m_model, this.m_model))
       `uvm_fatal(get_type_name(),"can't get ral model");
      uvm_config_db#(ral_block_pro)::set(null, "*","REG_MODEL",m_model);
     endfunction

==================================================
in scoreboard, i need to access ral block so i tried like below

ral_block_pro m_model;
function void connect_phase(uvm_phase phase);
if(!uvm_config_db#(ral_block_pro)::get(null,"","REG_MODEL",m_model)) 
   `uvm_error("", "could not get ral block inside scoreboard"
  endfunction

am getting below fatal error.
could not get ral block inside scoreboard

Please help me on this.

Two potential problems

You are doing a set() and get() in the same phase in different components. You need to make sure the set() comes first. You might have to do the get() in a later phase.

You passed get(null,"",..) as arguments. You should pass get(this,"",...) if the scoreboard is under base_test environment.

Thank you dave! it’s working now. I have one more doubt.
Initially, i set the ral model in ral _env only. i tried to get a ral model inside sequece and scoreboard using config_deb get method. i got some issue. so again i set the ral model inside base test. after that can able get ral model inside SB and seq.
May i know the reason why I need to set ral data base 2 types.

You do not need to pass the RAL model to the sequence using the config_db.
You are starting your sequence from your test which is a component. You can directly connet your RAL model in the sequence from your test.

1 Like