Welcome To UVM World

Tuesday, 3 January 2017

Inside UVM Factory Part-2

Hi all, in the last post we understood how factory registration works and today we will understand different methods which are associated with UVM factory mainly overriding methods. All the methods should be called with factory instance only.
  1. register(object_wrapper): This method is called internally to register particular object wrapper to factory. This is the same method which is called by get() in object_registry class.
  2. set_type_override_by_type(original_type, override_type): This method is used when a particular object/component needs to be overridden by another object/component. Typically override type is a child class of original type. when original type is created overridden type will be created. Object wrapper of particular class has to be passed as argument.                 example:: factory.set_type_override_by_type(A::get_type(), B::get_type());
  3.  set_type_override_by_name(original_name, override_name): This method is same above one, but only difference is instead of type_name, we need to pass class name itself. example:: factory.set_type_override_by_name(A,B);
  4. set_inst_override_by_type(original_type,override_type, full_path): This method is used to override only in particular instance path and it is same as second method except extra instance path. instance path can contain wildcard characters also and it should be given in string.
  5.  set_inst_override_by_name(original_name, override_name, inst_path): This method is same as above one but instead of type name we need to pass class name itself.
  6. create_object_by_type(object_wrapper,parent_inst_path,name): This is used to create the request object and return the created object to local handle. This will be used internally when type_id create method is called.
  7. create_component_by_type(object_wrapper, parent_inst_path,parent,name): This is same as above method but is used to create components. It is used internally when type_id create method is called.
  8. Same as above methods we have create_object_by_name() and create_component_by_name() in which class name need to be passed.
This post informed you about different methods present in factory class. In the next post we will understand what happens inside when these override methods are called. See you soon!!

2 comments:

  1. Hi Raghu,
    Nice explanation.After reading this concept I got one doubt.

    -> Can we use set_inst_override_by_type for overriding an Object class instead of component class?

    If possible please provide an example. Thanks in advance.

    ReplyDelete
  2. HI Raghu,
    Thx for the detailed explanation on UVM factory!!! this will surely help!!!!!!

    ReplyDelete