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');

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM