Difference between handle name and instacne name

Hi All,

Can anyone explain what is the difference between handle name and instacne name? Where to use handle name and where to use instance name?

Thanks,
Sagar

In reply to Sagar Shah:

I am not clear what you mean here … Since in most of scenarios, handle name and instance name are same thing for me …

Could you please show an example here ?

In reply to caowangyang:

Handle name comes only in reference to class. But instance name is a general term used for the instances of anything including class.

In reply to Abhyudha:


my_env extends uvm_env;
  my_agent agent_inst;
  string name;
  `uvm_component_utils (my_env)
  function new (string name="my_env", uvm_component parent = null);
    super.new(name, parent);
    name = this.name;
  endfunction : new
  function void build_phase (uvm_phase phase);
    super.build_phase(phase);
    agent_inst = my_agent :: type_id :: create ($sformatf("%s_agent_inst", name), this);
  endfunction
endclass

// Here, for my_agent class handle name = agent_inst
// while instance name = my_env_agent_inst.

my_test extends uvm_test;
  my_env env_inst;
  int idx;
  `uvm_component_utils (my_test)
  function new (string name="my_test", uvm_component parent = null);
    super.new(name, parent);
    name = this.name;
  endfunction : new
  function void build_phase (uvm_phase phase);
    super.build_phase(phase);
    env_inst = my_env :: type_id :: create ($sformatf("env_inst"), this);
    idx = 5;
    if(!uvm_config_db #(int)::set (this, "env_inst.env_inst_agent_inst", "idx", idx)) // will work (set for instance name)
    //if(!uvm_config_db #(int)::set (this, "env_inst.agent_inst", "idx", idx)) // will not work (set for handle name)
    begin
      `uvm_fatal(get_name(), "not set in config_db")
    end
  endfunction
endclass

This is one case where I need to give instance name in stead of handle name, I want to know more details like where to use handle name and where to use instance name.

static function T create (string name, ovm_component parent, string contxt=“”)

The first argument (string ‘name’) value specified during the usage of create will be used for the construction of child in the component hierarchy during phasing. (in the current example, it is env_inst.env_inst_agent_inst)

Assigning that object to a handle of the same type (agent_inst) doesn’t mean that there will be a change in the hierarchical path.

To avoid any confusions, handle names will usually be the same as child name in the hierarchy.

i.e.,
agent_inst = my_agent :: type_id :: create (“agent_inst”, this);

In reply to Sagar Shah:

Please refer to comments from Rajkumar …

The configuration mechanism is based on component name.

In reply to S.P.Rajkumar.V:

Thanks Rajkumar.