Do we need get_full_name() in sequence item creation? If so, why?

Which of the below is correct?

task body();
        apb_rw rw_trans;
        repeat(10) begin
            rw_trans  = apb_rw::type_id::create(.name("rw_trans"),.contxt(get_full_name()));
            start_item(rw_trans);
            assert(rw_trans.randomize());
            finish_item(rw_trans);
        end
    endtask
task body();
        apb_rw rw_trans;
        repeat(10) begin
            rw_trans  = apb_rw::type_id::create("rw_trans");
            start_item(rw_trans);
            assert(rw_trans.randomize());
            finish_item(rw_trans);
        end
    endtask

Why are .name and .contxt used? Is it necessary?

Thanks

In reply to sriharifoxtrot:

This should have been a compiler error. The context is supposed to be a uvm_component not a string. And the contxt argument is only used when creating other uvm_components to create the component hierarchy.

The name argument is used to build a sequence call chain, similar to the component hierarchy.It’s used for reporting a debugging.

In reply to dave_59:

Hi Dave,

Since this is a useful pattern in sequences:

item = item_type::type_id::create( "item", null, get_full_name() );

Is there some reason that this function:

static function T uvm_object_registry #(T,Tname)::create (
   	string 	        name	 = 	"",
   	uvm_component   parent	 = 	null,
   	string          contxt	 = 	""
)

Isn’t defined like this:

static function T uvm_object_registry #(T,Tname)::create (
   	string 	        name	 = 	"",
   	uvm_object      parent	 = 	null, // <-- now works for both sequences and components
   	string          contxt	 = 	""
)

Then the pattern:

obj = obj_type::type_id::create( "obj", this );

Would work in both components and sequences. Maybe the implementation would need to perform a test cast so it knows whether the parent is a component or a sequence, but I don’t see why this wouldn’t work. This would even be a backwards compatible change to the UVM library.

-Ryan