Proper working of set_config

Hi All,

I am writing a code in OVM , over there i have to use set_config(“*”,val,1) to assign val as 1.
so when i am writing this code

function void build();
    set_config_int("*", "disable_ocp_monitor_flag", 1);
    env =lpio_env::type_id::create("env",this);
 endfunction : build

The value of the disable_ocp_monitor_flag is not going to 1.

So i even tried with using get_config

function void build();
  assert(get_config_int("disable_ocp_monitor_flag", disable_ocp_monitor_flag));
  endfunction
function void build();
    set_config_int("*", "disable_ocp_monitor_flag", 1);
    env =lpio_env::type_id::create("env",this);
 endfunction : build

by doing this my test case failed.

So can anyone please suggest how to proceed further

In reply to shiwani chadha:
Not enough information. Where is “over there”? Where is the location of each build() and its relationship in the hierarchy. ordering between set and get is important.

class abc extends xyz;
ovm_component_utils(abc) int disable_ocp_monitor_flag = 0; l_mon mon[NUM_MONS];
l_trk trk;
string inst_name;

function new(string name, ovm_component parent = null);
super.new(name, parent);
endfunction

function void build();
    super.build();
  if ( get_config_int("disable_lpss_ocp_monitor", disable_ocp_monitor_flag) )  begin
 end

//I tried using set_config here also still value did of disable_ocp_monitor_flag does not change
// set_config_int(““, “disable_ocp_monitor_flag”, 1);
if(!disable_ocp_monitor_flag) begin
for(int i=0; i<NUM_MONS; i++) begin $sformat(inst_name, "mon[%0d]", i); ovm_info(get_name(), $psprintf(“Creating monitor %s”, inst_name), OVM_MEDIUM);
end
//I tried using set_config here also still value did of disable_ocp_monitor_flag does not change
set_config_int(”
”, “disable_ocp_monitor_flag”, 1);

end
endfunction

///I tried using the set_config command inside simple function also.
please explain the various usage of set_config and get_config