Quartus® Prime Pro Edition User Guide: Debug Tools

ID 683819
Date 7/08/2024
Public
Document Table of Contents

2.10.5. Signal Tap Data Capture with the MATLAB* MEX Function

When you use MATLAB* for DSP design, you can acquire data from the Signal Tap logic analyzer directly into a matrix in the MATLAB* environment. To use this method, you call the MATLAB* MEX function, alt_signaltap_run, that the Quartus® Prime software includes. If you use the MATLAB* MEX function in a loop, you can perform as many acquisitions in the same amount of time as when using Signal Tap in the Quartus® Prime software environment.
Note: The MATLAB* MEX function for Signal Tap is available in the Windows* version and Linux version of the Quartus® Prime software. This function is compatible with MATLAB* Release 14 Original Release Version 7 and later.

To set up the Quartus® Prime software and the MATLAB* environment to perform Signal Tap acquisitions:

  1. In the Quartus® Prime software, create an .stp file.
  2. In the node list in the Data tab of the Signal Tap logic analyzer Editor, organize the signals and groups of signals into the order in which you want them to appear in the MATLAB* matrix.

    Each column of the imported matrix represents a single Signal Tap acquisition sample, while each row represents a signal or group of signals in the order you defined in the Data tab.

    Note: Signal groups that the Signal Tap logic analyzer acquires and transfers into the MATLAB* MEX function have a width limit of 32 signals. To use the MATLAB* MEX function with a bus or signal group that contains more than 32 signals, split the group into smaller groups that do not exceed the limit.
  3. Save the .stp file and compile your design. Program your device and run the Signal Tap logic analyzer to ensure your trigger conditions and signal acquisition work correctly.
  4. In the MATLAB* environment, add the Quartus® Prime binary directory to your path with the following command:
    addpath <Quartus install directory>\win

    You can view the help file for the MEX function by entering the following command in MATLAB* without any operators:

    alt_signaltap_run

  5. Use the MATLAB* MEX function to open the JTAG connection to the device and run the Signal Tap logic analyzer to acquire data. When you finish acquiring data, close the JTAG connection.

    To open the JTAG connection and begin acquiring captured data directly into a MATLAB* matrix called stp, use the following command:

    stp = alt_signaltap_run \
    ('<stp filename>'[,('signed'|'unsigned')[,'<instance names>'[, \
    '<signalset name>'[,'<trigger name>']]]]);

    When capturing data, you must assign a filename, for example, <stp filename> as a requirement of the MATLAB* MEX function. The following table describes other MATLAB* MEX function options:

    Table 25.   Signal Tap MATLAB* MEX Function Options
    Option Usage Description
    signed

    unsigned

    'signed'

    'unsigned'

    The signed option turns signal group data into 32-bit two’s-complement signed integers. The MSB of the group as defined in the Signal Tap Data tab is the sign bit. The unsigned option keeps the data as an unsigned integer. The default is signed.
    <instance name> 'auto_signaltap_0' Specify a Signal Tap instance if more than one instance is defined. The default is the first instance in the .stp, auto_signaltap_0.
    <signal set name>

    <trigger name>

    'my_signalset'

    'my_trigger'

    Specify the signal set and trigger from the Signal Tap data log if multiple configurations are present in the .stp. The default is the active signal set and trigger in the file.

    During data acquisition, you can enable or disable verbose mode to see the status of the logic analyzer. To enable or disable verbose mode, use the following commands:

    alt_signaltap_run('VERBOSE_ON');-alt_signaltap_run('VERBOSE_OFF');

    When you finish acquiring data, close the JTAG connection with the following command:

    alt_signaltap_run('END_CONNECTION');

    For more information about the use of MATLAB* MEX functions in MATLAB*, refer to the MATLAB* Help.