Electronic – FPGA Jtag Hooking to User Logic

fpgaintel-fpgajtagmax10testing

After some primer reading on jtag it looks to be a nifty means to test a FPGA logic design in a consistent and sustainable way.

Let's use altera max 10 as an example. I've read this MAX 10 JTAG Boundary-Scan Testing User Guide. My reading is, to be able to access the user logic the jtag tester (a host pc most likely) will send USER0 or USER1 instructions.

Questions are:

  • How do you implement some logic in the user logic design to catch the commands and parameters, and return some results? Examples?

  • On the host, how do you send those commands, preferably with a low-cost or open-source tool? With some experience, I know Olimex produces some good jtag adapters, and also altera usb blaster is a popular tool. Openocd may be a popular software candidate.

It will be great if somebody can shed lights on any part of the questions.

Best Answer

Boundary scan (and internal scan) testing, whether using JTAG or not are intended for production test. This is completely different to using JTAG or SWD for software debug. Sometimes the same pins will be used, but this is not a given.

It looks like the Altera USER0, USER1 instructions are used to access internal (user connected) scan chains. This permits you to connect (with a test-mode mux on each flop) all your design flops together into (here two) long scan chains. You have the ability to read and pre-load all of the logic in your design.

Internal scan chains like this can be used to check for manufacturing faults in the actual silicon. If you use scan for the external pins, it gives you a way to test for solder open/short on the PCB.

Scan can be used to debug a design, but it's the last resort. If you experience a lockup which no other debug method can shed any light on the cause, it's possible to use scan to extract the design state just after your failure (before is possible, but that would need a trigger or deterministic failure). This state can be used to guide your investigation into what the design state that causes the failure is, and help reproduce in simulation.

Tools like SignalTap now provide a more user-accessible approach to real-time FPGA debug, these are much more akin to having a logic analyzer hooked in to a pre-defined selection of internal nodes - remember scan is a 1 cycle at-a-time approach.