Function new constructor

  1. Is it necessary to use function new costructor in every component if not,what happens then what is the advantage of create method please explain.

In reply to GADDAM VINOD BABU:

Create() is a factory method that helps you to select the object to be created dynamically at the run time(based on the type/inst override before calling create). You can think of create() method as: factory lookup to identify an overridden type + call to the new() constructor to create the object. Where as, if you use new() it is always the same type of object that gets created.

new() constructor in the component helps to specify the default name, parent and so useful in creating the component class hierarchy/topology. If you don’t specify one, the new() inherited from the base class (uvm_component) might be considered while building the UVM enviornment (though I have never tried it). Any reason for why you’d not want to specify new() constructor in the derived component?