Subido por Fran J. Vila Diaz

jtagtest

Anuncio
JTAGTest User Manual
JTAG Test User Manual
www.jtagtest.com
Version 1.05
Copyright © 2006 – 2011 SECONS Ltd., www.secons.com
Page 1 of 29
JTAGTest User Manual
Table of Contents
Installing JTAG Test.............................................................................................................................4
Installing JTAGTest on Linux..........................................................................................................4
Installing BSDL Library files.......................................................................................................... 5
What are BSDL files?................................................................................................................. 5
Using JTAGTest....................................................................................................................................7
BSDL Library scan.......................................................................................................................... 7
Assigning BSDL file for each device.............................................................................................. 8
Loading additional BSDL files........................................................................................................ 8
Setting JTAG Options......................................................................................................................9
Scripting language..............................................................................................................................10
JTAG Functions............................................................................................................................. 10
CheckVCCIO............................................................................................................................10
DetectChain...............................................................................................................................10
IRScan.......................................................................................................................................10
DRScan..................................................................................................................................... 10
User interface functions.................................................................................................................10
SetTaskProgress........................................................................................................................ 10
SetTaskInfo............................................................................................................................... 10
SetActionProgress.....................................................................................................................10
SetActionInfo............................................................................................................................10
SetStatus....................................................................................................................................10
SetTestTitle................................................................................................................................10
MessageBox..............................................................................................................................10
System functions............................................................................................................................12
Sleep..........................................................................................................................................12
String functions..............................................................................................................................12
chr..............................................................................................................................................12
ord............................................................................................................................................. 12
strval..........................................................................................................................................13
strmatch.....................................................................................................................................13
rtrim...........................................................................................................................................14
ltrim...........................................................................................................................................14
trim............................................................................................................................................15
File object...................................................................................................................................... 16
open(string filename,numeric flags)..............................................................................................16
string read(numeric ReadLen)....................................................................................................... 16
numeric read(numeric ReadLen,Array buff)................................................................................. 16
numeric write(string str)................................................................................................................ 16
numeric write(Array arr,numeric arrlen)....................................................................................... 16
numeric lseek(numeric offset,numeric whence)............................................................................16
numeric size()................................................................................................................................ 17
string fgets(numeric maxchars)..................................................................................................... 17
numeric fputs(string str).................................................................................................................17
Running SVF/XSVF/JAM/STAPL Files............................................................................................18
Lattice Extended Serial Vector Format (.SVF) File.......................................................................18
Page 2 of 29
JTAGTest User Manual
PIO SVF extension........................................................................................................................ 19
Standard Test and Programming (STAPL) Player.................................................................... 19
Boundary Scan....................................................................................................................................20
Boundary scan test mode selection...............................................................................................21
Package (chip) View...................................................................................................................... 22
Pin map file assignment.................................................................................................................22
Package mappings..........................................................................................................................23
Waveform recording / viewing...................................................................................................... 24
JTAG IR/DR Scan.............................................................................................................................. 25
IEEE 1149.1 JTAG chain configuration group..............................................................................25
TCK Control.................................................................................................................................. 26
IR Scan...........................................................................................................................................26
DR Scan......................................................................................................................................... 26
Test Reset.......................................................................................................................................26
JTAG IR/DR Scan example: Reading out Xilinx Spartan-3A DNA............................................. 27
JTAG IR/DR Scan example: Debugging Lattice MachXO design................................................29
Page 3 of 29
JTAGTest User Manual
Installing JTAG Test
Installation files can be downloaded from http://www.jtagtest.com/download. We recommend
installing ViaTAP JTAG Interface drivers before running JTAG Test. Drivers can be downloaded
separately.
Installation is very simple and every skilled computer user should be able to perform it without any
problems if following the on-screen instructions.
Installing JTAGTest on Linux
JTAGTest can run on Linux using Wine. Download setup package, run it using wine (“wine
JTAGTestSetup.exe”). After successful installation JTAGTest menu item should appear in
Applications menu. The following image displays Ubuntu 8.10 distribution:
After launching the application main window should appear. This window may have slightly
different appearance compared to JTAGTest running on Microsoft Windows. This is caused by
several bugs in Wine.
Page 4 of 29
JTAGTest User Manual
If the application does not recognize correctly JTAG-USB ViaTAP interface, please consult ViaTAP
hardware manual for information on how to fix the permissions for ViaTAP USB device /dev
entries.
Installing BSDL Library files
JTAGTest needs the BSDL files in order to know how to handle JTAG ICs connected to the chain.
These BSDL files should be installed in directory C:\BSDL so that the JTAG Test can recognize
them automatically.
We provide BSDL library for most of the common ICs used nowadays. This self-extractable bundle
can be downloaded from http://www.jtagtest.com/download.
What are BSDL files?
BSDL Files contain information about JTAG integrated circuits. The following information is
usually present:
Page 5 of 29
JTAGTest User Manual
–
–
–
–
–
IC name
Package (TQFP100, CS48, etc)
JTAG bus speed
Port mapping
Boundary scan cells description
BSDL File(s) can be automatically assigned to a part present in JTAG chain based on IDCODE.
IDCODE is a unique 32bit number assigned to each part (or die). Please note that IDCODE does
not specify package, voltage, temperature or speed grade. If different BSDL files are present for one
part IDCODE, you will need to select suitable variant manually.
Page 6 of 29
JTAGTest User Manual
Using JTAGTest
You can run JTAG Test from Start menu or by executing the JTAGTest.exe file from program's
directory.
BSDL Library scan
When JTAG Test is started, automatic BSDL
library scan is performed. At the first-time run
each BSDL file has to be completely parsed.
Depending on your BSDL library size, this
operation may take up to several minutes. Next
time you run JTAGTest, only modified or added
files are scanned whilst other files are just
compared against BSDL cache database, this
resulting in faster start-up times.
JTAG Test main window should appear shortly:
If the ViaTAP JTAG Interface is connected, tested board is powered up and JTAG chain is setup
correctly, icon list of present devices should appear. You can click on the device to select it and then
perform intended actions on the selected device.
Page 7 of 29
JTAGTest User Manual
JTAG chain can be re-scanned anytime by clicking on „Re-scan chain“ button. This re-scan
operation cause loosing of any changes you have made to the chain.
Some buttons require properly set-up chain (i.e. selected BSDL models/files). They are inactive
unless all requirements are met.
Assigning BSDL file for each device
Although JTAG chain scan
is able to automatically
detect each device in the
chain, not all information
is provided by integrated
circuits. You need to select
appropriate BSDL file
(model) for your device
manually from the list box
shown on the right hand
side.
Only the BSDL files that
match IDCODE of your part are shown. If you part does not provide IDCODE (which would be
unlikely), you need to load BSDL file manually.
Loading additional BSDL files
If you part does not provide IDCODE
(which would be unlikely) or BSDL file is
not present in global BSDL files library,
you need to load BSDL file manually.
Select “other” from BSDL model selection
list. JTAGTest will then allow you to load
additional BSDL files.
User-added BSDL files are marked with
asterisk (*) and are at the top of the BSDL
selection list. User-added BSDL files are loaded to all devices present in the current chain.
Page 8 of 29
JTAGTest User Manual
Setting JTAG Options
JTAG Options can be changed using
“Options >> JTAG Options” menu.
JTAG Speed defines boundary scan
TCK speed in kHz. Incorrect settings
may result in data corruption, incorrect
chain detection, etc.
Please note that many devices use
internal oscillator in unconfigured state
(i.e. blank ARM7 microprocessor)
which requires slow JTAG
communication.
User BSDL Library is a directory containing user's BSDL files. To change to this option you will
be required restart JTAG Test application in order to reload BSDL libraries.
Page 9 of 29
JTAGTest User Manual
Scripting language
JTAGTest provides scripting language compatible with ECMA-262.
Important: Scripting functionality of JTAGTest is in development phase and information given in
this chapter is for beta testers only.
JTAG Functions
CheckVCCIO
DetectChain
IRScan
DRScan
User interface functions
SetTaskProgress
SetTaskInfo
SetActionProgress
SetActionInfo
SetStatus
SetTestTitle
MessageBox
Displays a modal dialog box that contains a system icon, a set of buttons, and a brief applicationspecific message, such as status or error information. The message box returns an integer value that
indicates which button the user clicked.
numeric Message(string text, string title, numeric flags);
Page 10 of 29
JTAGTest User Manual
Parameters
text
A string that contains the message to be displayed. If the string consists of more
than one line, you can separate the lines using a carriage return and/or linefeed
character between each line.
title
A string that contains the dialog box title.
flags
Compatible with Microsoft Windows API function MessageBox flags parameter
Return value
Return value is compatible with return value of Microsoft Windows API function MessageBox.
Description
The MessageBox() function is fully compatible with Microsoft Window API function MessageBox.
It's definition can be found at MSDN library (http://msdn.microsoft.com/enus/library/ms645505.aspx).
Page 11 of 29
JTAGTest User Manual
System functions
Sleep
Suspend execution for an interval of time.
Sleep(numeric milisecond);
Parameters
milisecond
The time interval for which execution is to be suspended, in milliseconds.
Description
The sleep() function shall cause the calling script to be suspended from execution until the number
of realtime miliseconds specified by the argument milisecond has elapsed. The suspension time may
be longer than requested due to the scheduling of other activity by the system.
String functions
chr
Returns the character associated with the specified ASCII character code.
String chr(numeric charcode);
Parameters
charcode
A numeric expression representing character code, for the character. The valid range
for numb is 0 through 255.
Return value
Returns the specified character.
Description
The chr() function converts an integer numeric value into an ASCII character by returning the
character value, if any, whose ordinal number is equal to the value of its argument. Note that it is an
error if the argument is not within the range 0..255. This function complements to chr() function.
ord
Returns the ASCII value of the first character of a string.
Numeric ord(string char);
Page 12 of 29
JTAGTest User Manual
Parameters
char
The string to get an ASCII value from. First character from string is used.
Return value
Returns the ASCII value of the first character of a string as an numeric integer.
Description
The ord() function returns the ASCII value of the first character of a string as an numeric integer.
This function complements to chr() function.
strval
Converts numeric value to string.
string strval
( numeric var
[, numeric base [, numeric digits
]
] );
Parameters
var
A numeric expression representing value to be converted to a string
base
Base of numeric expression var. If not specified, default value is 10.
digits
Minimum number of digits to be printed. If the value to be printed is shorter than
this number, the result is padded with blank spaces. The value is not truncated even
if the result is larger. If not specified, default value is 1.
Return value
Returns string corresponding to value var.
Description
The strval() function converts an integer numeric value into string.
strmatch
Compares two strings using wildcards.
numeric strmatch(string str, string regstr);
Parameters
str
Simple string, which is compared to regstr.
regstr
String to which str is compared to. This string can containg wildcards (*,?)
Page 13 of 29
JTAGTest User Manual
Return value
Return true(1) if str correspond to reqstr, otherwise return false(0).
Description
The strmatch() function compares its search string regstr, which can contain wildcard characters,
against the input string expression str. The asterisk (*) substitutes as a wildcard character for any
zero or more characters, and the question mark (?) substitutes as a wildcard character for any one
character.
rtrim
Strip whitespace (or other characters) from the end of a string.
String rtrim(string str, [string charlist]);
Parameters
str
The input string
charlist
Defines characters that will be stripped. If not specified, tab and whitespace are
stripped.
Return value
Returns a string with whitespace (or other characters) stripped from the end of str.
Description
The rtrim() function strip whitespace (or other characters) from the end of a string. It removes
characters from the end of the string str until it find character, that is not included in charlist.
Example
rtrim('tech
') //would return 'tech'
rtrim('tech
', ' '); //would return 'tech'
rtrim('123000', '0'); //would return '123'
rtrim('Tech123123', '123'); //would return 'Tech'
rtrim('123Tech123', '123'); //would return '123Tech'
rtrim('Techxyxzyyy', 'xyz'); //would return 'Tech'
rtrim('Tech6372', '0123456789'); //would return 'Tech'
ltrim
Strip whitespace (or other characters) from the beginning of a string.
String ltrim(string str, [string charlist]);
Page 14 of 29
JTAGTest User Manual
Parameters
str
The input string
charlist
Defines characters that will be stripped. If not specified, tab and whitespace are
stripped.
Return value
Returns a string with whitespace (or other characters) stripped from the beginning of str.
Description
The ltrim() function strip whitespace (or other characters) from the beginning of a string. It
removes characters from the beginning of the string str until it find character, that is not included in
charlist.
Example
ltrim('
tech'); //would return 'tech'
ltrim('
tech', ' '); //would return 'tech'
ltrim('000123', '0'); //would return '123'
ltrim('123123Tech', '123'); //would return 'Tech'
ltrim('123123Tech123', '123'); //would return 'Tech123'
ltrim('xyxzyyyTech', 'xyz'); //would return 'Tech'
ltrim('6372Tech', '0123456789'); //would return 'Tech'
trim
Strip whitespace (or other characters) from the beginning and end of a string.
String trim(string str, [string charlist]);
Parameters
str
The input string
charlist
Defines characters that will be stripped. If not specified, tab and whitespace are
stripped.
Return value
Returns a string with whitespace (or other characters) stripped from the beginning and end of str.
Description
The trim() function strip whitespace (or other characters) from the beginning and end of a string. It
removes characters from the beginning and end of the string str until it find character, that is not
included in charlist.
Page 15 of 29
JTAGTest User Manual
File object
open(string filename,numeric flags)
myFileObj = new fileObj();
myFileObj.open("c:\\projekty\\js-diag\\jsdiag\\JS\\jstest1\\textfile.txt",O_RDWR
| O_TEXT);
string read(numeric ReadLen)
myFileObj = new fileObj("c:\\projekty\\jsdiag\\jsdiag\\JS\\jstest1\\textfile.txt",O_RDONLY | O_TEXT);
readStr=myFileObj.read(10);
MessageBox(readStr,"Data read from file",0);
numeric read(numeric ReadLen,Array buff)
readArr = new Array(10);
Len=myFileObj.read(10,readArr);
for (key in readArr)
MessageBox(readArr[key],key,0);
numeric write(string str)
myFileObj = new fileObj("c:\\projekty\\jsdiag\\jsdiag\\JS\\jstest1\\textfile.txt",O_RDWR | O_TEXT);
writeLen=myFileObj.write("bla bla");
MessageBox("Written "+writeLen,"Data written",0);
numeric write(Array arr,numeric arrlen)
writeArr = new Array(0,1,2,3,4,5,6,7,8,9);
writeLen=myFileObj.write(writeArr,10);
numeric lseek(numeric offset,numeric whence)
Page 16 of 29
JTAGTest User Manual
myFileObj.lseek(3,SEEK_SET);
numeric size()
string fgets(numeric maxchars)
readstr=myFileObj.fgets(50);
while(readstr!=null)
{
MessageBox(readstr,"Fgets from file",0);
readstr=myFileObj.fgets(50);
}
numeric fputs(string str)
Page 17 of 29
JTAGTest User Manual
Running SVF/XSVF/JAM/STAPL Files
JTAG Test is capable of running SVF Files (Serial Vector Format), XSVF (Xilinx® Serial Vector
Format), JAM/STAPL (Standard Test and Programming Language).
(X)SVF Files usually contain BCB test vectors or programming sequences. Almost all CPLD or
Non-Volatile FPGAs can be configured using SVF Files. Volatile FPGAs (such as Xilinx®
Spartan® or Altera® Cyclone®) can be configured from SVF Files.
The JTAGTest reads a JAM/STAPL file and executes all routines defines in the JAM file, applying
vectors for programming and testing devices in a JTAG chain. The Jam STAPL Jam (Standard Test
and Programming Language) was adopted as JEDEC standard JESD-71 in August, 1999.
SVF File describes series of JTAG chain operations. For more information about SVF Files please
see our website, www.jtagtest.com. Some of the producers of SVF Files are for instance:
–
–
–
–
–
–
Xilinx® ISE (Xilinx iMPACT)
Altera® Quartus® Programmer
Actel Libero IDE
Lattice Semiconductor® ispLEVER®
Cypress ISR
Atmel .jed to SVF converter
SVF File is executed by clicking on „Run SVF“ from JTAG Test main screen.
Lattice Extended Serial Vector Format (.SVF) File
JTAGTest supports Lattice Extended Serial Vector Format (.SVF) File. Lattice ispVM produces
files which do not comply with the SVF Standard as they contain the LOOP and ENDLOOP
statements, which do not comply with the SVF standard.
The JTAGTest SVF processor will process and repeat the statements in-between the LOOP
statement and the ENDLOOP statement loop_count number of times.
Syntax:
LOOP loop_count;
ENDLOOP;
Example:
LOOP 85 ;
SIR
8
TDI
(52);
RUNTEST
IDLE
SDR
TDI
(0)
TDO
(1);
1
10 TCK
1.00E+000 SEC;
ENDLOOP ;
Page 18 of 29
JTAGTest User Manual
PIO SVF extension
JTAGTest provides proprietary PIO port mapping extension to drive SRST# pin.
Example:
PIOMAP( IN RESET );
PIO( H );
PIO( L );
RUNTEST 5E-2 SEC;
PIO( H );
Standard Test and Programming (STAPL) Player
If you select a JEDEC
Standard Test and
Programming file
(STAPL/JAM/STP),
STAPL (JAM)
Runner window
appears.
To run a STAPL
action, select it from
the action list and
click on “Run”
button.
Logging for
debugging purposes
is provided. If you
enter a file name into
“Logging” box, all
operations will be
logged.
Page 19 of 29
JTAGTest User Manual
Boundary Scan
Boundary Scan function is available after you have selected a part in JTAG chain (by selecting
IC's icon), BSDL file for the selected part is available and correct package BSDL model is selected.
When you click on „Boundary scan“ button the following window appears:
Top area of this window displays the part information, and the test options. Main area contains list
of available pins/ports.
In order to perform „single-shot“ scan, click on „Perform scan“ button. To view ports state in real
time, click on „Realtime scan“ button.
Please note, in single-shot mode (“Perform scan” button), you always see state of pins BEFORE
performing the boundary scan operation. The pin states are captured before scan operation (on
capture-DR state) and updated after shifting all data in and out (update-DR state).
Page 20 of 29
JTAGTest User Manual
Boundary scan test mode selection
JTAG defines various test modes. Before you start realtime or
single-shot scan, you need to choose scan mode (if unsure,
always use SAMPLE):
EXTEST
The required EXTEST instruction places the IC into an
external boundary-test mode and selects the boundary-scan
register to be connected between TDI and TDO. During this
instruction, the boundary-scan register is accessed to drive test
data off-chip via the boundary outputs and receive test data
off-chip via the boundary inputs.
INTEST
The optional INTEST instruction places the IC in an internal boundary-test mode and selects the
boundary-scan register to be connected between TDI and TDO. During this instruction, the
boundary-scan register is accessed to drive test data on-chip via the boundary inputs and receive test
data on-chip via the boundary outputs.
SAMPLE
The required SAMPLE/PRELOAD instruction allows the IC to remain in its functional mode and
selects the boundary-scan register to be connected between TDI and TDO. During this instruction,
the boundary-scan register can be accessed via a data scan operation, to take a sample of the
functional data entering and leaving the IC.
Page 21 of 29
JTAGTest User Manual
Package (chip) View
By clicking on „View
Package>>“ button in main
Boundary Scan window you
can display a window
showing the physical package
layout with corresponding
labels. All common package
types are supported (i.e.
TQFP, PLCC, SOIC, TSSOP,
QFN/CS/MLF, ...), however
some are not. Example of
unsupported
package
is
„BARE_DIE“ or various nonsquare special or custom
packages.
When in „Realtime scan“
mode,
all
pins
are
dynamically
colored
according to their state
(linkage or unused pins are shown in black).
This function is very useful if you are measuring on a printed circuit board, because it enables you
to clearly see the state of each pin.
Pin map file assignment
Port names as specified in BSDL files are sometimes
meaningless, making debugging complicated.
JTAGTest provides the function to load „user pin
names“ or „net names“ in order to allow easier
debugging/testing.
JTAGTest is capable to read pin maps from various
third-party EDA tools such as:
–
–
–
Xilinx® ISE “UCF”
Altera® .PIN
Lattice® .LCT
Import script for Cadsoft Eagle CAD is also provided (available on our website).
When you load pin map file for your design, user pin/net names appear in the third column and chip
Page 22 of 29
JTAGTest User Manual
view window if displayed.
User pin names are also used for waveform recoding function.
Package mappings
JTAGTest will assign package layout based on PHYSICAL_PIN_MAP attribute. If the attribute is
set to some generic layout name (e.g. “DIE”), JTAGTest has no way how to assign correct package.
In such case, please modify the BSD file:
entity RINGO_DEVICE is
generic (PHYSICAL_PIN_MAP : string := "RINGO");
Example of change:
entity RINGO_DEVICE is
generic (PHYSICAL_PIN_MAP : string := "BGA400");
Page 23 of 29
JTAGTest User Manual
Waveform recording / viewing
JTAGTest allows you to record signal waveform during realtime scan. You must select what signals
are to be recorded by clicking on the 4 th column in pin list and by choosing the signal color. Up to
64 signals can be watched at once.
After you selected all desired signals, check the „Record waveform“ at the top of the boundary scan
window and click on „Real-time scan“. When you stop the scan, the „View waveform“ button
becomes functional and allows you to display another window with captured waveform:
Page 24 of 29
JTAGTest User Manual
JTAG IR/DR Scan
This function can be used to manually perform JTAG TAP IR/DR scans. When you click on „JTAG
IR/DR Scan“ button in main JTAGTest window, the following window will appear:
Caution: Use this function very carefully as incorrect usage may destroy your target
device! This function does not check entered values as BSDL files do not provide any
information regarding instructions/registers logic!
Scan data within IR/DR TDI and TDO boxes is expressed as hexadecimal. The scan data cannot
specify a data string that is larger than the specified bit length. Most Significant Bit (MSB) zeroes in
the hex string are not considered when determining if the string is too large. The bit order for scan
data follows the convention that the least significant bit (rightmost bit) is the first bit scanned into
the hardware for TDI scan data and is the first bit scanned out for TDO data. This bit ordering is
consistent with the IEEE 1149.1 convention. Digits can be grouped by 8 bits (i.e. 00 01 02 03 04 is
the same as 0 1 2 3 4 or 01 02 03 04 or 1 02 3 04).
IEEE 1149.1 JTAG chain configuration group
This part of scan dialog defines the chain structure. When this function is selected, it contains
correct values for the selected device, however you may freely modify these values.
Page 25 of 29
JTAGTest User Manual
TCK Control
This function is used to issue TCK clocks in defined state (usually used for flash programming or
other operations that require external JTAG clocking).
IR Scan
This function performs IR scan operation on JTAG chain. TDI
input allows selection from list of opcodes defined in BSDL
file (if BSDL file is assigned to the device). You may choose
from list, enter instruction name (i.e. “IDCODE”) or enter
hexadecimal representation of the instruction (i.e. 01 0B). DR
Length must be always adjusted after performing IR scan.
DR Scan
This function performs DR scan operation on JTAG chain. You must enter hexadecimal
representation of the data register (i.e. 01 23 45 67). If you do not enter any value, all zero bits will
be shifted to DR.
Test Reset
This function will put JTAG TAPs into TEST_RESET state.
Page 26 of 29
JTAGTest User Manual
JTAG IR/DR Scan example: Reading out Xilinx Spartan-3A DNA
Every Spartan-3A device contains unique 56-bit DNA value. Device DNA can be used to provide a
serial number for your own products, it can be useful in hardware and software design security
techniques or it can be used as part of product registration procedures. This chapter provides details
of the reference design which reads out Spartan-3A DNA via JTAG, using JTAGTest. First create
the following Verilog module and configure it as a top module in your Spartan-3A Xilinx ISE
design:
module dna_jtagtest_reader(O1);
output O1;
assign O1 = 1;
wire
wire
wire
wire
wire
wire
wire
wire
wire
wire
wire
CAPTURE;
DRCK1;
DRCK2;
RESET;
SEL1;
SEL2;
SHIFT;
TDI;
UPDATE;
TDO1;
TDO2;
DNA_PORT DNA_PORT_inst (
.DOUT(TDO1),
//
.CLK(DRCK1),
//
.DIN(TDI),
//
.READ(CAPTURE),
//
.SHIFT(SHIFT)
//
);
1-bit
1-bit
1-bit
1-bit
1-bit
DNA output data
clock input
user data input pin
input, active high load DNA, active low read
input, active high shift enable
BSCAN_SPARTAN3A BSCAN_SPARTAN3A_inst (
.CAPTURE(CAPTURE), // CAPTURE output from TAP controller
.DRCK1(DRCK1),
// Data register output for USER1 functions
.DRCK2(DRCK2),
// Data register output for USER2 functions
.RESET(RESET),
// Reset output from TAP controller
.SEL1(SEL1),
// USER1 active output
.SEL2(SEL2),
// USER2 active output
.SHIFT(SHIFT),
// SHIFT output from TAP controller
.TDI(TDI),
// TDI output from TAP controller
.UPDATE(UPDATE),
// UPDATE output from TAP controller
.TDO1(TDO1),
// Data input for USER1 function
.TDO2(TDO2)
// Data input for USER2 function
);
endmodule
Configure the target Spartan-3A device, run JTAGTest, assign BSDL file to the device and run
“JTAG IR/DR Scan” and configure active device:
Then run “IR Scan” with USER1 instruction:
Page 27 of 29
JTAGTest User Manual
And then DR Scan, which reads out the device DNA 56-bit number (marked red):
Page 28 of 29
JTAGTest User Manual
JTAG IR/DR Scan example: Debugging Lattice MachXO design
You can easily debug FPGA design using user JTAG scan. In Lattice MachXO devices user JTAG is
implemented using JTAGD library element. In this example, we will create 61-bit counter which
will be incremented each clock period (using internal oscillator). This counter will be accessible
through JTAG port using IPA scan register.
OSCC is a dedicated oscillator in the MachXO device and the source of the internal clock for
configuration. The oscillator frequency range is 18 to 26 MHz.
The Verilog source can be easily modified to work with other devices, e.g. LatticeSC/M (JTAGA),
LatticeECP/EC (JTAGA), LatticeXP (JTAGB), LatticeECP2/M (JTAGC), LatticeXP2 (JTAGE).
Xilinx Spartan-3A uses BSCAN_SPARTAN3A.
module test;
reg [60:0]counter;
reg [60:0]countersample;
wire clk;
// Counter
// Captured counter for JTAG scan
// Internal oscillator, running 18-26 MHz
OSCC OScInst (.OSC(clk));
// Increment counter
always @(posedge clk)
begin
counter = counter + 1;
end
// JTAG Signals
wire JTCK;
wire JUPDATE;
wire JSHIFT;
// JTAGD port instance
JTAGD JTAGInst (
.JTCK(JTCK),
.JTDO1(countersample[0]), // IPA JTAG bit
.JUPDATE(JUPDATE),
.JSHIFT(JSHIFT)
);
// Main JTAG task, implementing IPA JTAG register
always @(posedge JTCK)
begin
if (JSHIFT) begin
countersample[59:0] <= countersample[60:1];
end
else
begin
countersample <= counter;
end
end
endmodule
Program the FPGA with the above top module
and run “IR/DR Scan” from JTAGTest main
menu. Perform “IPA” IR scan, set length of DR
to 61 bits and click on “DR Scan”. TDO should show current counter value. When you click again
on the “DR Scan” button, TDO should show higher value (counter increments).
Page 29 of 29
Descargar