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

  1. First, set breakpoint in line you want inside class method (it must be non-static class method).

  2. Go to View | Debug Windows | Breakpoints | HDL Code Breakpoints

  3. Right-click the desired breakpoint and select Properties

  4. The Properties window will pop up

  5. 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

  6. 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}
    
  7. Run the simulation

  8. Each time the condition is checked, it will be printed in the Console window. Once the condition is met, the simulation will stop

Ask Us a Question
x
Ask Us a Question
x
Captcha ImageReload Captcha
Incorrect data entered.
Thank you! Your question has been submitted. Please allow 1-3 business days for someone to respond to your question.
Internal error occurred. Your question was not submitted. Please contact us using Feedback form.
We use cookies to ensure we give you the best user experience and to provide you with content we believe will be of relevance to you. If you continue to use our site, you consent to our use of cookies. A detailed overview on the use of cookies and other website information is located in our Privacy Policy.