Any company uses custom cut methodology(uvm/ovm) libraries to suit their environment requirements. If company uses some additional debug mechanisms or company has some common functionality to be shared across multiple components, they use their own library. Below method provides a way of doing that.
Assume UVM is TB Methodology. Assume all the components uses a common method "check_ports". You want this task to be present in every component you extend from uvm_component. Below shown example does that.
Create a base class as below and include all the common features in this base class which have to be shared across the uvm_component classes.
Then, we can create our lib_* class family by just parameterizing this lib_check_ports with appropriate base class.
We can do this for any uvm_component sub classes. In business code, instead of inheriting from uvm_monitor inherit from lib_uvm_monitor and so on....
Assume UVM is TB Methodology. Assume all the components uses a common method "check_ports". You want this task to be present in every component you extend from uvm_component. Below shown example does that.
Create a base class as below and include all the common features in this base class which have to be shared across the uvm_component classes.
class lib_check_ports #(type T = uvm_component) extends T; function new(string name, uvm_component parent); super.new(name, parent); endfunction function void start_of_simulation_phase(uvm_phase phase); check_ports(); endfunction function void check_ports(); `uvm_info("LIB", "I'm checking if all of my ports are connected", UVM_LOW); endfunction endclass
Then, we can create our lib_* class family by just parameterizing this lib_check_ports with appropriate base class.
typedef lib_check_ports #(uvm_component) lib_uvm_component; typedef lib_check_ports #(uvm_monitor) lib_uvm_monitor;
typedef lib_check_ports #(uvm_driver) lib_uvm_driver;
We can do this for any uvm_component sub classes. In business code, instead of inheriting from uvm_monitor inherit from lib_uvm_monitor and so on....
No comments:
Post a Comment