MATLAB捕捉signalTap数据

一、Quartus路径下有signalTap Mex Function可以提供给MATLAB。

 1、在系统环境变量PATH中加入路径:

C:\altera\15.1\quartus\bin64

 2、在matlabrc.m中追加路径:(matlabrc.m位于C:\Program Files\MATLAB\R2017b\toolbox\local)

addpath C:\altera\15.1\quartus\bin64  % signalTap Mex Path

二、使用方法。

使用说明:

Quartus Prime SignalTap II MATLAB Mex Function
Version 15.1.0 Build 185 10/21/2015 SJ Standard Edition
Copyright (C) 1991-2015 Altera Corporation. All rights reserved.
 
Usage:
------
 
<variable> = alt_signaltap_run ( '<stp filename>' [, ('signed'|'unsigned') [, '<instance name>' [, '<signalset name>' [, '<trigger name>']]]] );
alt_signaltap_run ( 'END_CONNECTION' )
alt_signaltap_run ( 'VERBOSE_ON' )
alt_signaltap_run ( 'VERBOSE_OFF' ) 
 
Description:
------------
 
Quartus Prime SignalTap II MATLAB Mex Function allows you to use SignalTap II
to initiate an acquisition and retrieve data in a vector of signed or unsigned
integers in MATLAB.  You must configure the SignalTap II (.stp) file completely
before acquiring data from the device in the Quartus Prime software. You can group
the nodes into a bus and order the nodes and buses in the SignalTap II Data tab.
The acquired data is returned in the same order as it appears in the Data tab.
Only buses up to 32 bits are supported.  Each column of the returned vector matches
either a single node or a bus; each row of the returned vector represents one sample.
You can use the MEX Function to start an acquisition and manipulate the returned
vector in MATLAB.
 
The function to start an acquisition is in the following format:
<variable> = alt_signaltap_run ( '<stp filename>' [, ('signed'|'unsigned') [, '<instance name>' [, '<signalset name>' [, '<trigger name>']]]] );
 
The first argument specifies the SignalTap II file to use.  This function will not 
change the SignalTap II file.
 
The optional second argument specifies the data type, which is either a signed or unsigned
integer.  If you do not specify an argument, the integer defaults to the signed integer.
 
The optional third argument specifies the instance name.  If you do not specify an argument,
the first instance is used.
 
The optional fourth and fifth arguments specify the signalset and trigger name.  If you do not
specify an argument, it uses the current active configuration last used.  This helps when you
use the logging feature to save multiple trigger conditions, and want to select different ones
for different acquisitions.
 
For example:

 X = alt_signaltap_run( 'my_stp_file.stp' );
 X = alt_signaltap_run( 'my_stp_file.stp', 'signed' );
 X = alt_signaltap_run( 'my_stp_file.stp', 'signed', 'auto_signaltap_0' );
 X = alt_signaltap_run( 'my_stp_file.stp', 'signed', 'auto_signaltap_0', 'my_signalset', 'my_trigger' );
 
The MATLAB Mex function is optimized for repetitive acquisition.  It keeps the JTAG communication
channel open.  When you finish acquiring data, alt_signaltap_run( 'END_CONNECTION' ) must be called
to close the JTAG connection; otherwise, the Quartus Prime software tools that require an exclusive 
JTAG connection to the device, such as Programmer, would fail.
 
By default, no message, such as acquisition state, is printed.  You can use
alt_signaltap_run('VERBOSE_ON'|'VERBOSE_OFF') to turn the message display on or off.
 
Example:
--------
 
fprint('Start SignalTap II');
 
x=alt_signaltap_run('FilteringLab_mod.stp');
figure(1); clf;
N=length(x);
 
for i=1:100;
%subplot(2,1,1); plot(1:N,x(:,1),'r',1:N,x(:,2)); axis ([1 2040 -10000 10000]);
%subplot(2,1,2); plot(1:N,x(:,3)); axis ([1 2040 -5e7 5e7]);
x=alt_signaltap_run('FilteringLab_mod.stp');
%drawnow;
%pause(0.05);
end
 
alt_signaltap_run('END_CONNECTION');
fprintf('Done\n');

基本操作:1、读取signalTap中的数据。

STP_NAME = 'D:\Quartus\newSRP_12\stp_Conste.stp';
din = alt_signaltap_run(STP_NAME, 'signed');

2、结束对signalTap的操作和访问。

alt_signaltap_run('END_CONNECTION');

 

posted @ 2020-04-03 13:36  ygpygp1234  阅读(888)  评论(0编辑  收藏  举报