Tuesday, 17 December 2013

Dear Readers

One of our friends had a small confusion in build Phase of a UVM component.

Question:-   In some components the sub components  are initialized by “new()” function, sometimes the sub components  are initialized using “create()” method  inside build method.
So how to understand in what scenario this different ways is followed.

Victor Lyuboslavsky of has explained it  nicely as below ,due credit goes to Victor

Using create() method does two things:

- register the component in the UVM hierarchy. create() must be used for structural components such as uvm_env, uvm_scoreboard, uvm_driver, etc.
- allow the code at a higher level (like at uvm_test) to override the type of component returned. It is a use of the Factory design pattern ( )

So, in short, only use new() if the component is not part of the UVM hierarchy (like a sequence item) AND you will never need to override that component with something else (like another subclass).

Hope you find this useful. All due credit to Victor Lyuboslavsky  ,thanks a lot Victor

-Happy Reading

Disclaimer : This is JUST a small place where i keep updating of small things i know of.
Am NO expert in UVM and  i learn from all possible resources  available and post it here for my OWN understanding.Due credit  goes to the resources/authors 

No comments:

Post a Comment