Uvm_object_wrapper

Can you Explain concept of uvm_object_wrapper?
why we use uvm_object_wrapper?
i don’t have a clear idea of uvm_object_wrapper !!
so suggest me good reference for this or explain me

In reply to Ronak Patel:

uvm_object_wrapper is a proxy class used by the UVM factory. A proxy class is a lightweight object whose sole purpose is representing the type of another object. The benefit is that you can pass the object around dynamically, whereas a true type must be statically elaborated.

See the following links for more information about how the factory works.
http://go.mentor.com/SV-OOP (especially the third section)
http://go.mentor.com/yin-and-yang

In reply to dave_59:

In reply to Ronak Patel:
uvm_object_wrapper is a proxy class used by the UVM factory. A proxy class is a lightweight object whose sole purpose is representing the type of another object. The benefit is that you can pass the object around dynamically, whereas a true type must be statically elaborated.
See the following links for more information about how the factory works.
http://go.mentor.com/SV-OOP (especially the third section)
http://go.mentor.com/yin-and-yang

Hi Dave,

Conceptually I understand what you are saying but implementation wise, I am having difficulty understanding this. What is stopping from pointing (handle assigned to the factory object) directly to the factory object in any given class?
Probably one simple example contrasting both the approaches would help.

Thanks

In reply to shatrish:

I’m not sure what your question is. Both links have examples.

When you say “both approaches”, do you mean using the proxy object versus using the direct true object? If that is what you mean, there is a lot of overhead creating an object like those derived from uvm_component. And just creating an object that you never intend to use (by overriding it) can lead to undesirable behaviors like exiting the UVM phase routines. So the proxy/wrapper class avoids this.

Hi Dave,

From my understanding, the factory is a singleton class. In any class that needs to create objects just needs to point to the class object. In other words, some form of association is needed between the class that needs to create new objects and the factory. This is quite normal in OOPS for one class to have reference to another class.
The question is, why do we need a proxy proxy class for this?
As far as the true class you have mentioned above. I dont think this is needed in any case due to factory being a singleton class.