Wednesday, 15 February 2017

Instance overriding using UVM factory

In instance overriding, as name indicates it substitutes only a particular instance of the component. In UVM, below are the methods by which we can override the instance of particular class:
  • set_inst_override_by_type
  • set_inst_override_by_name

There's no difference in the final result either we override by type or name.

In below example, our purpose is to override driver instance without making change in existing environment, so we created extended class which is extended from the original driver class.

Factory Code:


Driver Code:


Extended driver Code:


In test, we can override the driver class by using "set_inst_override_by_type" function.

Overriding in Test:


Output:


In test, we can override the driver class by using "set_inst_override_by_name" function.

Overriding in Test:


Output:




No comments:

Post a Comment