If the component is a parameterized class, then there is no type name string associated with the object.
I do not use get_type_name or get_name when printing messages. The full pathname of the component is already included. I prefer to use a unique code that can be used to control the message later if needed.
Your problem is that you are not assigning names to your components when constructing them. The COMP_1234 names are created so that the testbench hierarchy can be properly constructed. You did this properly for driver and sequencer, but I’m guessing you did not do this for the pkt_env and test. Try this example
import uvm_pkg::*;
`include "uvm_macros.svh"
class pkt_env extends uvm_env;
`uvm_component_utils(pkt_env)
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction
virtual function void connect_phase(uvm_phase phase);
`uvm_info(get_type_name(), "connect_phase() type name", UVM_LOW)
`uvm_info(get_full_name(), "connect_phase() full name", UVM_LOW)
$display({"full name: ", get_full_name()});
endfunction
endclass : pkt_env
module top;
pkt_env p1,p2;
initial begin
p1 = new("p1", null);
p1.connect_phase(null);
p2 = new("", null); // no name
p2.connect_phase(null);
end
endmodule : top
I got a compiler error with just ‘name’. I thought that was just a copy paste typo. It should have failed because ‘name’ will get defined as a 1-bit logic by default and the call to super.new(name,parent) will be trying to assign a 1-bit logic to a string, which is illegal according to the SystemVerlog LRM