Previous

Debugging the Device

To display the states output by your device in a waveform instead of on your board digital display, use the debugging feature of the Hardware Debugger. To debug your design, you must set the debugging mode, set the Trigger type, and include signals and signal groups in your display list.

Setting the Debugging Mode

To debug the Calc design, you must use the asynchronous mode because the Hardware Debugger is not set up to control the design clock.

To set the debugging mode, follow these steps.

  1. Select the Debug Asynchronous Mode or click the following toolbar button.

    figures/basyncdb.gif

    The appropriate options are enabled in the Debug Control Panel as shown in the “Debug Control Panel” figure.

    Figure 9.3 Debug Control Panel

  2. In the Debug Control Panel, click the Triggers button to display the Asynchronous Trigger dialog box.

  3. Select Immediately from the Trigger On pull-down menu.

  4. Click OK.

Specifying Signal Groups

You now need to specify which signals to view. Follow these steps to add signals to the list of signals to display.

  1. In the Debug Control Panel, click the Groups button to display the Signal Groups dialog box from which you can group signals into a bus for easy viewing.

    The Signal Groups dialog box appears as shown in the “Signal Groups Dialog Box” figure.

    Figure 9.4 Signal Groups Dialog Box

  2. To create a new group, click New in the Groups group box. The Group Name box appears, as shown in the “Group Name Dialog Box” figure.

    Figure 9.5 Group Name Dialog Box

  3. Type the name of the bus you are creating in the Group Name dialog box

    Use the data in the “Signal Groups” table to create groups that reflect the state of the switches. Each time you create a group, it is added to the pull-down menu in the Groups group box.



    Table 9_7 Signal Groups

    Group Name
    Grouped Signals
    Group Representation
    SWITCHES
    SWI6, 5, 4, 3, 2, 1, 0
    switches
    OPCODE1
    SWI6, 5, 4
    3-digit opcodes
    OPCODE2
    SWI6, 5, 4, 3, 2, 1
    6-digit opcodes
    DATA
    SWI3, 2, 1, 0
    data you use as input to the register
    ALU
    ALUVAL3, 2, 1, 0
    7-segment display
    STACK
    STACKOUT3, 2, 1, 0
    digital display




    NOTE

    Bus indices may appear with delimiters, <>, [ ], or ( ), depending on your design entry tool.


  4. After entering a group name, click OK.

    The new group name appears in the Groups field of the Signal Groups dialog box. 

  5. Select the signals to be grouped from the list of Available Signals and add them to the list of Grouped Signals. The top signal in the Grouped Signals list is the MSB of the bus.

    You can globally define the signals to display in the selection list-box by typing the first characters of the signals followed by a wildcard character (*) in the Filter For Signals box and clicking Apply.

  6. Click Close when you are done adding groups.

Adding Signal Groups to Your Display List

In this section, you use the Display Signals dialog box to select the signals to view and debug. To add the groups you just defined to your display list, follow these steps.

  1. In the Debug Control Panel, click Display to invoke the Display Signals dialog box.

  2. Use the Display Signals dialog box, shown in the “Display Signals Dialog Box” figure, to include the SWITCHES, ALU, OPCODE1, DATA, and STACK groups to your list of Displayed Signals.

    Figure 9.6 Display Signals Dialog Box

  3. Click the Groups radio button in the Display group box to show the available signal groups that you just defined.

  4. Click the >> button to move the Available Signals to the Displayed Signals list.

  5. Remove the OPCODE2 signal group from the list of Displayed Signals by selecting it and clicking the < button to move it to the list of Available Signals. This signal group will be used later in the tutorial.

Adding the EIN Signal to the Display List

You still need to add the EIN signal to your display list. The EIN signal registers the state of the EXC_P switch.

  1. Click the Signals radio button in the Display group box of the Display Signals dialog box to view the list of available signals.

  2. Select the EIN signal from the Available Signals list.

  3. Click the > button to move the signal to the Displayed Signals column.

  4. Click OK.

Reading the Device States

To read the states of the device, follow these steps.

  1. Set the opcode switches (SW3-1 through SW3-8) High on your device.

  2. Select File New Waveform to open a new waveform display window.

  3. Select Read from the Debug Control Panel to read back a snapshot from the demonstration board and display the values for the selected signals on the waveform display.

    When you read the device, the switches inputs are fed to the SWITCH7 module flip-flops. The oscillator clock (OSC_4) moves the input values to the flip-flops of the SWITCH7 module. The values you read back reflect the current opcode and data you defined.

    The clock does not affect the values of the SWITCH7 module flip-flops unless you change their inputs by modifying the switches settings. The inputs appear on the 7-segment display (ALU group) only after the EIN output goes High. EIN is High when you toggle EXEC High and Low again (EXEC corresponds to switch 1 on your demonstration board). By setting the opcode correctly, you can push the value currently stored in the register to the stack.

Changing the Signals Groups Radix

To improve the legibility of the waveform signal values, you can modify the radices of the signal groups.

  1. In the Waveform window, click on the DATA and ALU groups.

  2. Select View Group Radix Hexadecimal to change the radices of the DATA and ALU groups to HEX.

    The radix that is displayed for DATA and ALU is HEX.

Next