Qualcomm Interview Question

Set_type_override -- how do you use it

Interview Answers

Anonymous

Jul 22, 2020

The set_type_override can be used in several ways : 1- set_type_override_by_type( original_type, override_type) :- When we are using overriding by type here the original_type and override_type are the handles to the type of objects , thus the preregistration of the objects are not required . 2- set_type_override_by_name(original_type_name, override_type_name) :- When we are using overriding by name then the original_type_name must be registered to the factory . Here the type_name refers to the name of the object/component registered to the factory using `uvm_component_utils macros . 3- type override can also be done by uvm registry method : uvm_component_registry#(T,Tname)::set_type_override(override_type) How to use it ? 1- Register all the uvm types with the factory method ( `uvm_component_utils(class_name) / `uvm_object_utils(object_name) 2- Create the instances using the factory create call method . We must ensure that all the objects /components must be create() method rather than new() for factory overriding . 3- After which write the object /component u wnat to override and then call the override method For example I want specific stimulus to be generated thus I have created another transaction class (short_yapp class) extending the original transaction class (yapp_packet class) . -> If want to override this by set_type_override_by_type :- Syntax :- set_type_override_by_type( yapp_packet::get_type(), short_yapp::get_type()) -> if we want to override by set_type_override_by_name :- Syntax :- set_type_override_by_type( yapp_packet::type_name, short_yapp::type_name)

1

Anonymous

Mar 13, 2020

We can use set_type_override by two ways: set_type_override_by_type and set_type_override_by_name. set_type_override_by_type uses get_type method to access particular type. While set_type_override_by_name uses string to access the type. For example, we have a packet which has packet length 16 bits. For another test case we want to change packet length to 32 bits. We can extend the old packet to get new size packet. In test case we can use set_type_override_by_type or set_type_override_by_name method to override 16 bit packet. These methods are factory methods. So we have to use ‘uvm_object_utils() and ‘uvm_component_utils to use them.