Why can not my agent be passive

In reply to lagnaray:

Created the simple example that uses is_active from uvm_config_db. You can use this example and try to match with yours.


import uvm_pkg::*;
`include "uvm_macros.svh"


module top ;
  
initial begin 
  run_test("test");
end 

  initial begin 
    uvm_config_db#(int)::set(uvm_root::get(),"*","is_active",UVM_PASSIVE);
  end 
  typedef class agent ;
  class env extends uvm_env ;
    `uvm_component_utils(env)
    agent agt;
    function new (string name="env",uvm_component parent);
      super.new(name,parent);
    endfunction 
    
    function void build_phase(uvm_phase phase);
      super.build_phase(phase);
      agt = agent::type_id::create("agt",this);
    endfunction 
  endclass 
  
  class agent extends uvm_agent ;
    `uvm_component_utils(agent)
    
    uvm_active_passive_enum is_active ;
    
    function new (string name="agent",uvm_component parent);
      super.new(name,parent);
    endfunction 
    
    function void build_phase(uvm_phase phase);
      super.build_phase(phase);
    endfunction 
    
    function void connect_phase(uvm_phase phase);
      super.connect_phase(phase);
      if(uvm_config_db#(int)::get(this,"","is_active",is_active))
        $display("%s",is_active.name());
      if(is_active == UVM_PASSIVE)
        $display("agent is in passive mode");
         
    endfunction 
  endclass 
  
  class test extends uvm_test ;
    `uvm_component_utils(test)
    env ev ;
    function new (string name="test",uvm_component parent);
      super.new(name,parent);
    endfunction 
    function void build_phase(uvm_phase phase);
      super.build_phase(phase);
      ev = env::type_id::create("ev",this);
    endfunction 
    
  endclass 
  
  
endmodule 

output :
UVM_INFO @ 0: reporter [RNTST] Running test test…
UVM_PASSIVE
agent is in passive mode