Fpga open toolchain

From Hack Manhattan Wiki
Jump to: navigation, search

FPGA Open Toolchain

The IceStorm flow (Yosys, Arachne-pnr, and IceStorm) is a fully open source Verilog-to-Bitstream flow for iCE40 FPGAs.

This wiki page contains instructions for acquiring a development board, setting up and using the toolchain, and programming the FPGA. For the most up to date information consult the project icestorm website. Also, here are some slides.

Currently the only FPGAs compatible with the toolchain are the Lattice iCE HX1K and HX8K.

Compatible Boards

Toolchain

Install these tools:

If you are on Ubuntu:

$ sudo apt-get install build-essential clang bison flex libreadline-dev \
                       gawk tcl-dev libffi-dev git mercurial graphviz   \
                       xdot pkg-config python python3 libftdi-dev

And if you are on macOS/OS X and have [1](homebrew) installed:

> brew install bison flex gawk libftdi git mercurial graphviz xdot \
                       python python3

Example

Assuming you are using the icestick, download this code: icestick-example

To synthesize, place and route, run the Makefile or equivalently the following commands:

$ yosys -p 'synth_ice40 -top top -blif example.blif' example.v
$ arachne-pnr -d 1k -o example.asc -p icestick.pcf example.blif
$ icetime -d hx1k -mtr example.rpt example.asc
$ icepack example.asc example.bin

To program the icestick with the generated bitstream, plugin the icestick and execute:

$ sudo iceprog example.bin

And if you are having trouble with programming in macOS/OS X - you will need to unload the FTDI USB Serial Driver kernel extension:

> kextstat | grep FTDIUSBSerialDriver
> sudo kextunload -b com.FTDI.driver.FTDIUSBSerialDriver

Gaze in awe at the blinking lights.

When you are done gazing in awe, check out all of these cool projects.

Projects

  • picorv32 A RISC V cpu with a GCC / bintools toolchain. Uses less than half of the icesticks resources (~3000 LUTs?).
  • SwapForth A minimal 16-bit Verilog CPU with an interactive Forth environment. (If you use their python scripts to connect to the icestick, you need to use python2. (Their docs fail to mention this.))