laanwj / yosys-ice-experiments

Experiments for iCEstick evaluation board with iCE40HX-1k FPGA - using open source toolchain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Experiments for iCEstick evaluation board with iCE40HX-1k FPGA.

Wladimir J. van der Laan, 2015.

Using Yosys + Arachne-pnr + IceStorm open source Verilog FPGA toolchain.

General usage progression:

cd X
make          # build FPGA bitstream (requires yosys toolchain in PATH)
iceprog X.bin # flash and run FPGA bitstream
python x.py   # run host component

The python scripts require Python 3 and python3-serial (some may work in Python 2: no guarantees). Some require numpy installed too. They are supposed to auto-detect the USB serial port that the iCEstick is connected to, although this will only work if there is only one such device connected.

iCEstick

The iCEstick is a low cost ($25) evaluation board for iCE range of FPGAs from Lattice Semiconductor.

The FPGA on the board is a iCE40HX1K-TQ144. The bitstream format as well as connectivity and logic of this FPGA has been reverse-engineered and an open-source toolchain has been developed. This toolchain goes all the way - it can synthesize from Verilog, does place and route, and produces working bitstreams.

It is programmed as well as powered through USB. Various peripherals can be connected conveniently through a 2x6 pin so-called Pmod connector.

The combination of low cost and readily available tooling makes it very attractive for experimentation, as well as for learning Verilog in an unburdened free software environment.

Installing toolchain

Install dependencies (see yosys/README):

$ yosys_deps="build-essential clang bison flex libreadline-dev gawk
       tcl-dev libffi-dev git mercurial graphviz xdot pkg-config python3"
$ sudo apt-get install $yosys_deps

I use the following script to fetch, build and install the toolchain to a local /opt path.

DESTDIR=/opt/yosys
git clone https://github.com/cliffordwolf/yosys.git
git clone https://github.com/cseed/arachne-pnr.git
git clone https://github.com/cliffordwolf/icestorm.git
( cd icestorm
make
make install DESTDIR=$DESTDIR
)
( cd arachne-pnr
make ICEBOX=$DESTDIR/share/icebox
make install DESTDIR=$DESTDIR ICEBOX=$DESTDIR/share/icebox
)
( cd yosys
make
make install DESTDIR=$DESTDIR
)

It may be necessary to first install prerequisites (for Ubuntu 14.04):

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

Don't forget to add the toolchain to your shell's path before usage:

export PATH="$PATH:/opt/yosys/bin"

pmodoled2

Experiment driving Digilent PmodOLED module (128x32 grid SSD1306 module), using 4-wire SPI (10MHz max). The FPGA acts as SPI controller driven from host.

  • pmodoled2.v main verilog source
  • pmodoled2.py simple test screens
  • mandelbrot.py zoom into random points on Mandelbrot set
  • rawbench.py measure FPS
  • clear.py clear screen and exit
  • cursestest.py type input (read using ncurses) directly to display

README

Links

Tutorials:

Other projects that work with, or are mainly developed with this toolchain:

About

Experiments for iCEstick evaluation board with iCE40HX-1k FPGA - using open source toolchain

License:MIT License


Languages

Language:Verilog 59.6%Language:Python 36.6%Language:Makefile 2.3%Language:Shell 1.5%