Sometimes we need to verify corner cases that take long simulation run. An example would be testing the functionality of the wraparound counter.
In order to test the wraparound, depending on the maximum value of the counter, it might require very long simulation to test if the counter is working correctly after reaching this value.
One of the techniques is to force the counter in the RTL to the value that is near the maximum and check afterwards that the counter did wraparound.
The best way to manipulate with RTL signals from UVM classes is to use UVM HDL Backdoor Access support routines.
In this case we used:
function int uvm_hdl_deposit(string path,uvm_hdl_data_t value) in following way:
Deposit sets the given HDL path to the specified value, and after that RTL continues to increment the counter.
Beside deposit function, there are several more predefined UVM functions that can help with controlling the RTL signals:
uvm_hdl_force – Forces the value on the given path.
uvm_hdl_force_time – Forces the value on the given path for the specified amount of force time.
uvm_hdl_release_and_read – Releases a value previously set with uvm_hdl_force.
uvm_hdl_release – Releases a value previously set with uvm_hdl_force.
uvm_hdl_read() – Gets the value at the given path.