Tuesday, 17 September 2013

Dear Readers,

Came across this interesting topic on UVM discussion forums on linked in and posting on the blog as I found it real interesting! I JUST tried to organize the discussion to understand easily.

-Happy Reading

Topic: What are uvm_component_utils /uvm_object_utils and when to use these macros in UVM TB

As we all know that these uvm_component_utils /uvm_object_utils are the defined macros in UVM
There is a fundamental difference between objects and Components though both are classes that can be dynamically created while. Uvm_component is derived from uvm_object, and it adds the following:

1) Hierarchy management
2) Phasing
3) Reporting
4) configuration support
among other things.

Uvm_component -Should be used for objects that are of a "static" nature for the duration of the simulation
Uvm_object   should be used for other dynamically generated data, 

These macros are used for registering the type of uvm_component and uvm_object type objects respectively to the factory. So when you declare a class which is inherited from uvm_component, use uvm_component_utils and when you declare class inherited from uvm_object, use uvm_object_utils. 

They define uvm_component_registry and uvm_object_registry type proxy objects to register your own component/object types with factory. They are different because mechanism for creation of uvm_object and uvm_component type objects using the factory is different in UVM.

When to use uvm_component_utils /uvm_object_utils

On which factor the decision of using "uvm_component" or/either "uvm_object" depends.
 For eg. While creating "sequence" we use "uvm_seq_item" as base class & in this class we use "uvm_object_utils". Now let’s say in this case, if we use "uvm_component_utils" then what will be its impact.

Using either is not a choice, it’s more a must. One should have UVM class library hierarchy opened somewhere on the computer to see the type of the base class. If it is component then use uvm_component_utils, if object use the other one.

Use `uvm_component_utils for anything that is part of the UVM TB structure, including the top-level test that builds the rest of the TB.
Use `uvm_object_utils for anything that is data, such as your transaction class (extended from uvm_sequence_item) and any test sequences (extended from uvm_sequence).
You will not notice a difference until you try to create the components during the build phase or the data items during the runphase.
 If you declared the components or data with the wrong `_utils macro, you will get messages about the wrong number of formals or that there is no parent formal. Components have parents in the TB tree-structure while data is created as needed and does not have a parent. 

When we  build TB components i.e  Driver, Sequencer, Monitor, Agents, scoreboards , need to use uvm_component to register them, UVM provides individual parent classes for each of the components with in-built methods. so we just need to extend the class and build our  own components. 

UVM_objects is used for the things which are not part of the  TB structure i.e the stimulus. sequences use object, more clearly UVM_sequence and transaction class use UVM_Sequence items both directly derived from UVM_object. To keep the TB separate from the stimulus so that a test writer can alter its stimulus however he wanted a and the TB architecture remains unchanged. so it promotes more re-usability for the  TB


Posting on this blog to learn building UVM test benches, UVCs ,UVM VIPs from various online sources/discussion forums/Attended  training/Seminars /Webinars/Interviews. Am JUST sharing here to Learn from the experts and make this small effort better as i believe learning is a continuous process. Due credit goes to the trainers/online resources 

No comments:

Post a Comment