Getting Started with Alchitry CU

I found that getting started with the Alchitry CU from unboxing to writing a “Hello World” to the device can be a little confusing. There are a lot of tools and outdated guides, particularly if you are using Linux and open source tools. If you are reading this Alchitry, get your tutorials organized!

This was tested and written using both Debian 11 and Linux Mint 20, but should work just as well for any other Debian-based distribution.

First, let’s install some dependencies. We’ll be compiling everything from source, so there are several build tools we will need.

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 gperf \
    libboost-program-options-dev autoconf libgmp-dev \
    cmake python3-dev libboost-all-dev libeigen3-dev

Next thing you will need is Yosys. This will convert your Verilog into a JSON format that will be ingested by tools installed in subsequent steps.

git clone https://github.com/YosysHQ/yosys.git yosys
cd yosys
make -j$(nproc)
sudo make install

Next is IceStorm. This has details about board properties for numerous FPGAs, including the ice40 in the Alchitry CU. There are several tools installed, used both independently and by subsequent steps.

git clone https://github.com/YosysHQ/icestorm.git icestorm
cd icestorm
make -j$(nproc)
sudo make install

Finally, NextPNR. This is the tool that handles placement and routing (the P and R in NextPNR). Among other things, this converts the JSON output from Yosys into the format required by the FPGA.

git clone https://github.com/YosysHQ/nextpnr nextpnr
cd nextpnr
cmake -DARCH=ice40 -DCMAKE_INSTALL_PREFIX=/usr/local .
make -j$(nproc)
sudo make install

Now that we have the tools in place, we can upload some test code. I wrote a small binary counter test using the built-in LEDs on the board (without the IO expansion, but the expansion will not interfere if you have it).

git clone git@github.com:codysnider/alchitry-cu-tutorial.git alchitry_tutorial
cd alchitry_tutorial
make clean && make all

Assuming you have no errors, plug in your device and upload:

make upload