« Prev | Next » Setting a Breakpoint on a particular Class instances Introduction Users have the capability to set a breakpoint condition on an object value. This allows users to stop the simulation at a specific location within the source code. It is especially useful to users that need to debug a particular instance of a class. Overview Before setting any breakpoints, the source files need to be compiled with debugging enabled. Users can do this within the GUI by going to Tools | Preferences | Compilation | SystemVerilog | General and selecting Generate debug information for the specific language. To enable debugging in a script file, use the –dbg switch with the alog command. To set a breakpoint, users can right-click the desired line and select Toggle Breakpoint or press F9 as a shortcut. To view the list of breakpoints, users can open the HDL Code Breakpoints window by going to View | Debug Windows | Breakpoints | HDL Code Breakpoints, or by using the bp <file_name> command. For this application note, in ubus_slave_monitor.sv, there is a class ubus_slave_monitor that has more than one instance. By placing a breakpoint without setting a condition, the simulation will always stop once it reaches that point. However, by setting a condition, the simulation will only stop once that condition has been reached. In this particular example, the condition is a value equal to a particular class instance name. How to set a condition First, set breakpoint in line you want inside class method (it must be non-static class method). Go to View | Debug Windows | Breakpoints | HDL Code Breakpoints Right-click the desired breakpoint and select Properties The Properties window will pop up Select the Expression option. This option allows the user to select an object of a particular instance and the value of the object that will stop the simulation Path to object of a particular instance should be the one Riviera’s environment sees (not the one SV language path). Sample expression may look like: Full object path this.[uvm_monitor].[uvm_component].m_name=="uvm_test_top.ubus_example_tb0.ubus0.slaves[2].monitor" Object name this.[uvm_monitor].[uvm_component].[uvm_object].m_leaf_name=="monitor" Object path can be defined as: this.[<base_class1>].[<base_class2>].[...].[<base_classN>].<field_name> You can get value of the object from Riviera by dragging the interesting field from the locals window into the console window: To get the value of the object field, you can use the exa command and use the returned value in breakpoint expression. exa {this.[uvm_monitor].[uvm_component].m_name} {uvm_test_top.ubus_example_tb0.ubus0.slaves[2].monitor} Run the simulation Each time the condition is checked, it will be printed in the Console window. Once the condition is met, the simulation will stop Previous article Next article