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

RISC-V on FPGAs: The xv6-riscv-fpga Project

Implement a RISC-V system on an iCE40HX8K-EVB FPGA with the xv6-riscv-fpga project to run UNIX xv6 OS on the FPGA!

Whitney Knitter
2 years agoFPGAs / Communication

For those not familiar, xv6-riscv is a simple educational UNIX operating system written in ANSI-C. It was developed by MIT a few years ago for a class on operating systems to explain the main concepts of an OS by studying an example kernel (the xc6 kernel).

As quoted from that teaching material for the OS class at MIT that xv6-riscv is used for: the job of an OS is to share a computer's resources amongst multiple programs and provide a more useful set of services than the hardware alone would be able to support. Given that FPGAs are touted for their flexibility and hardware acceleration capabilities, it is only natural that these benefits of an OS are desired to take an FPGA design to the next level.

Michael Schröder did just that with his implementation of a 32 bit version of RISC-V CPU on an iCE40HX8K FPGA from Lattice Semiconductor.

Simply titled xv6-riscv-fpga, the project hardware is comprised of three PCB boards found at Olimex Ltd: the iCE40HX8K-EVB FPGA development board, a MOD-SDMMC board for the SD card, and a Olimexino 32u4 to act as a programmer and UART bridge for the FPGA as well as a power supply.

I have to point out that the use of the Olimexino 32u4 microcontroller board as programmer, UART bridge, and power supply for the iCE40HX8K-EVB FPGA development is a quick and neat way to avoid a custom PCB layout in a project where time is limited. This will definitely be a hack I file away for personal use.

The cube enclosure is a 3D printed miniature replica of the classic computer NeXTcube from Steve Jobs' competitor company after his firing from Apple. Each component of the xv6-riscv-fpga is mounted to a tray that can be slid in/out of the cube.

Below is the wiring diagram of each of the components in the xv6-riscv-fpga, with the iCE40HX8K-EVB FPGA development board as the heart & brain and the Olimexino 32u4 as its programmer and UART bridge, with the MOD-SDMMC board for the SD card.

The iCE40HX8K FPGA is programmed with FOSS free and open source software; a toolchain project icestorm called OSS CAD Suite, provided by Clifford Wold located here. The gcc-toolchain for RISC-V is also required to build everything of course.

Schröder provides the steps to build and run the RISCV distribution on the iCE40HX8K-EVB FPGA in his project's GitLab README. He also provides links to all of the software tools used in the project (which are all free and open source so bonus points!). It's definitely a project worth checking out and building for yourself.

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