jtag_uart_example
jtag_uart_example copied to clipboard
Mini CPU design with JTAG UART support
Intel FPGA JTAG UART Example
This project contains a simple design with a VexRiscv CPU, a bit of RAM, a control register to set the value of 3 LEDs and a status register to read back the value of a button, and a JTAG UART.
It's an example design that goes with my The Intel JTAG UART - Add a Serial Console to Your Design without Extra IO Pins and Write Your Own C and Python Clients for the Intel JTAG UART blog posts.
Contents
-
./rtl: RTL filesThe Verilog of the
VexRiscv.vfile was generated from a SpinalHDL (which is not included in the project.) -
./sw: firmware for the CPU systemA small C project that toggles 3 LEDs in sequence. When a button in pressed, the LEDs toggle at double the speed.
When the design is loaded into an FPGA, doing
nios2-terminalwill print a "Hello World!" message, and pressing 'r' will reverse the order in which LEDs are toggled.Do
maketo create a firmware image. -
./tb: TestbenchTo verify that the design works in simulation.
Do
maketo simulate. -
./quartus_max10_deca: Quartus project for an Arrow DECA FPGA boardIn addition to all the standard files that are needed for a Quartus project, the
./quartus_max10_decadirectory also contains a makefile to compile the design from the command line.Do
maketo compile the whole design from scratch.Do
make update_ramto only update the RAM contains of an already built bitstream.This makefile can trivially be adapted for projects that use different versions of Quartus, and for different designs.
-
./miscContains helps scripts. In this case, the
create_mif.rbscript which converts binary files into MIF file (and other formats as well...) -
./c_clientShows how to use Intel's
jtag_atlanticshared library to create your own JTAG UART clients in C. -
./py_clientUses my
intel-jtag-uartpackage to create a JTAG UART client in Python.
Required software
-
Intel Quartus
Make sure that the Nios2 SDK is installed, because you need
nios2-terminalto connected to the JTAG UART. -
RISC-V GCC toolchain to compile a firmware image
Precompiled binaries can be downloaded here.
-
Icarus Verilog Simulator
On Ubuntu:
sudo apt install iverilog -
GTKWave Waveform viewer
On Ubuntu:
sudo apt install gtkwave
License
See LICENSE. Use this anyway you want, except for:
./rtl/VexRiscv.v, which is released under the MIT license../c_client, also released under the MIT license../py_client,also released under the MIT license.