Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!

QNICE-FPGA: A Nice Addition to Your FPGA

Add the processing power of a 16-bit computer system to your FPGA with the QNICE-FPGA SoC in portable VHDL.

The QNICE-FPGA monitor demo project running

FPGAs are a great tool for hobbyists/makers/engineers to have in their toolbox due to their nearly infinite reprogrammability and pipelining capabilities. An immense amount of processing can be done in the programmable logic (aka fabric) of an FPGA in a HDL language such as VHDL or Verilog, but there are some processes that just don't translate well into HDL. This is where soft processors such as Xilinx's MicroBlaze and the RISC-V architecture gain their footholds in the FPGA developer community. They provide a computer processor architecture that can much more easily implement those more iterative tasks written in a higher level language such as C. QNICE-FPGA is an open source soft processor written in VHDL, implementing a 16-bit CPU architecture.

Soft processors like the QNICE-FPGA turn your FPGA design into a system on a chip (SoC) design. Everything about QNICE-FPGA is open source, the full VHDL source code of the CPU architecture itself is available in the project's Github repository. The creators of QNICE also created a custom toolchain for the QNICE processor based on the GNU compiler toolchain that can be installed on Mac OS X and Linux machines to work ready out of the box. Windows users will either need to install the Ubuntu Bash or the MiniGW environment.

QNICE-FPGA is packs a huge punch with some impressive features given it's only 16-bit CPU with a total of 16 general purpose registers. A 115200 baud UART port, SD card port with FAT32 support, 80x40 character textmode display VGA output, PS/2 keyboard support, 4-digit 7-segment display output, and 16 bits worth of GPIO for toggle switches are all packed into the VHDL implementation of the QNICE CPU.

The QNICE developers chose the 16-bit width data bus as it makes the implementation of a CPU architecture easier on circuitry such as TTL chips and FPGAs. QNICE works with a fixed instruction format where every instruction is 16-bits wide in little endian format. QNICE also has both 32k words of ROM (64kB) and 32k words of RAM (64kB). The first 8 registers of the 16 total general purpose registers have access to a high speed RAM in the QNICE architecture. This window into the high speed RAM can actually be shifted across the other 8 of the 16 registers using a single operation so instead of using a stack with push and pop operations for data storage, this window can simply be slide across the register banks. This is just one of the demonstrations of how amazingly efficient the QNICE-FPGA architecture is. If you want to get a feel for QNICE before installing it, the creators have an online emulator available on the project's website using uses WebAssembly and WebGL.

Overall, QNICE is composed of 18 basic instructions making the demo projects for it even more impressive. A full Tetris clone called Q-Tris utilizing the PS2/USB keyboard and VGA port is probably the most fun of the demo projects and the creators have even been tracking who has been able to achieve the highest score in a text file of the project repository.

QNICE-FPGA first appeared as a Hackster.io project back in 2016 implemented on a Xilinx-based Nexys 4 DDR board (which has since been rebranded as the Nexys A7). After an inspection of the project repository, the files as is are targeted for the Nexys board. However, since all of the source files are available, it would be pretty straightforward to import the VHDL core into an IDE of choice to synthesize QNICE for a different Xilinx development board or a different FPGA chip family altogether.

Whitney Knitter
All thoughts/opinions are my own and do not reflect those of any company/entity I currently/previously associate with.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles