Callback mechanism in UVM

Source: Internet
Author: User

The callback mechanism, in fact, is a program developer that uses OOP to provide the internal interface of the module to the user of the program. Some of the behaviors of other component can be changed at test_case height.

The callback function pre_randomize,post_randomize already provided in SystemVerilog. For UVM and VIPs, the other callback functions are the developers of their own programs in advance

Left the hook.

Implementation of callback:

1) It is not advisable to extend the new class directly from component to realize PRE_DO and other function. Because the change of component will make the whole UVM tree change.

2) Consider using the composition of OOP to manipulate, define a Class A, and define virtual PRE_DO as function in its class. After the class is added to the component of the UVM, the Do function

Before calling Pre_do. This does not have any effect on component because there is no action in PRE_DO because it is not redefined. After redefining virtual PRE_DO, you will naturally

Added the relevant execution code.

Implementation in UVM and VIP:

First the character Uvm_callback derives a Class A, and the virtual function is defined as virtual Pre_do; (or Uvm_reg_cbs)

Define UVM_REGISTER_CB(Driver, A); in the driver class . This is equivalent to adding a to the driver class.

Define A_pool to hold an instantiated object of a, and in the driver class you can directly determine whether A_pool is empty to perform pre_do.

In the driver class, use uvm_do_callbacks(Driver, A, PRE_DO) to invoke Pre_do, before the Do function.

This completes the reserved hooks,

When users are using:

The next step is to extended a when needed, and define the PRE_DO function as well. and add it by calling the Add function before Connect_phase .

A_pool::add (Env.i_agt.drv, CB); CB is the object of the extended class of a.

Callback mechanism in UVM

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.