Create() Vs new()
The recommended method in UVM for creating components or transaction objects is to use the built-in method::type_id::create() instead of calling the constructor new() directly.
The create method internally makes a call to the factory to look up the requested type and then calls the constructor new() to actually create an object. This allows type overriding easily as in the test, you can specify the type of class (base or one or derived) and all the other testbench components will be able to create an object of that class type without any code change.
A new() constructor will only create an object of a given type and therefore using a new() will not allow run-time changing of class types. Hence, using a new() means the testbench code will need to change based on the different types to be used.
Hii , i am a verification trainee and i need some suggestions regarding verification so that i can be a better verification engineer
Hi Sewanjali,
Thanks, for visiting my blog posts. Can you please let me know what kind of guidance you actually seek? So I can try to guide you better.
Thank you