[Libre-soc-dev] VERSA_ECP5 JTAG TAP interface confirmed functional

Luke Kenneth Casson Leighton lkcl at lkcl.net
Thu Apr 15 16:27:13 BST 2021

i completed the test of the c4m-jtag TAP interface today using an
FT232 usb device from DCD Tech.  that's "actual JTAG implemented
entirely in nmigen" not "the ECP5's own JTAG port which is only
accessible via an undocumented series of shift registers".  (here is
some links to how that undocumented interface access is done in


we are instead *actually* implementing *actual* JTAG TAP in Libre-SOC
using Chips4Makers c4m-jtag HDL, written in nmigen:

connecting up in litex was done by specifying an io extension (with
thanks to daveshah on how to do that):


where litex imports the LibreSOC lnstance and provides the 4 JTAG signals here:


the Chips4Makers JTAG TAP instance is declared here:


and its default behaviour is to create an idcode with a manufacturing
id of 0x18ff.  we then add a full boundary scan of all litex
peripherals (SDRAM, UART, I2C, SPI, GPIO), a wishbone master so as to
be able to access the full memory bus and also memory-mapped
peripherals and associated CSRs, and a DMI interface that conforms to
that used by Microwatt.


the DMI interface allows the OpenPOWER registers to be read, and also
allows it to be stopped, single stepped, and reset.  a simple
"firmware uploader" program was written which can be used to program a
LibreSOC core fully over JTAG:


this program uses OpenOCD "remote interface" protocol (bitbanging over
TCP socket) so if openocd is connected back-to-back with a live ECP5
FPGA the firmware_upload.py program can reset it, pause it, send a
program into memory over JTAG, and set it running then monitor

[the exact same firmware upload program has also been successfully run
against the litex sim.py (verilator simulation): this was enabled
through modifying litex to enable the jtagremote module].

also of potential interest is that we are also doing pre- and post-
layout simulation of Libre-SOC using cocotb to access the exact same
(simulated) JTAG TAP interface:


this includes a boundary scan, as well as the ability to read and run
a SVF file:


the idea here is that when the ASIC comes back from IMEC TSMC 180nm,
the exact same tests as above can be run, by either running the exact
same SVF files through openocd, or by using an FT232-to-remote-bitbang
adapter and running the same firmware_upload.py script, this time
against the actual ASIC rather than an FPGA or a simulation.

overall these comprehensive tests gives us confidence that the ASIC
will at least be functional in some fashion, and keep us from
introducing errors at each stage, from HDL, to FPGA, to layout as an
actual ASIC.


More information about the Libre-soc-dev mailing list