technický dokument

Simplifying assertion validation using UVM callbacks

Simplifying assertion validation using UVM callbacks

This paper covers how callbacks implemented in Questa Verification IP can be used for assertion validation in designs using the PCIe® protocol.

Callbacks in QVIP

In Questa Verification IP, the callback methods and policies are first defined such that they are common across all protocols. For each specific protocol, the callback methods are subsequently extended from these base classes.

One of these base classes is called cb_policy, which extends itself from uvm_object. It defines methods such as register, get, and return callbacks. These methods are declared as pure virtual tasks or functions so that the derived class can override the base class definition.

A second base class extends from uvm_component and is called cb_manager. The run_phase() of this class is a forever loop in which first we get the sequence item from the BFM and then we return the changed sequence item back to the BFM. In separate external tasks defined inside the cb_manager class, callback sequence items are added and deleted from the callback queue and the register callback method is activated based on the queue size.

For each protocol specific callback implementation, each sequence item peculiar to the protocol extends itself from the aforementioned base classes. The names are assigned as: _ cb_manager for the class extending from cb_manager and _cb_policy for the class extending from cb_policy.

In the class _cb_policy, the register, get, and return callback methods are populated based on the nature of each protocol. The process of enabling callbacks for a particular sequence item starts with enabling the agent settings in the build_phase of a test (the class extending from uvm_test), which instantiates the _cb_manager. In the run_phase of the test, the register callback method is activated by calling the add callback task (defined inside cb_manager).

The main aim of the register callback method is to initiate the callback related task inside the BFM that sets a status variable. The get callback method gets called upon once the status variable inside the BFM is set and is used to get the sequence item from the BFM via DPI calls. The entire logic for manipulating the fields of the sequence item is placed in the do_callback task defined inside _cb_manager. The altered sequence item is then returned back to the BFM via DPI calls, which is eventually driven onto the bus.

Sdílení

Související zdroje informací