I'm wondering why some new
constructor has been implemented with argument and some new
constructor has been implemented with no argument in UVM as the below example.
class mem_monitor extends uvm_monitor;
uvm_analysis_port #(mem_seq_item) item_collected_port;
// Placeholder to capture transaction information.
mem_seq_item trans_collected;
`uvm_component_utils(mem_monitor)
// new - constructor
function new (string name, uvm_component parent);
super.new(name, parent);
trans_collected = new();
item_collected_port = new("item_collected_port", this);
endfunction : new
As you can see in the above, trans_collected = new();
has been implemented with no argument, and item_collected_port = new("item_collected_port", this);
has arguments.
Is there any special rule for implementing new
constructor?