Getting Started

There are a few ways to get started with programming FPGAs on a non vendor supported platform such as a Mac or Raspberry Pi - I will mainly be considering the open source options here.


Writing hardware for FPGAs is most easily facilitated with a workflow. Mine usually consist of an HDL simulator, an HDL synthesizer, and an FPGA specific toolchain. While many of the vendor specific FPGA softwares will provide an all in one solution, I usually find them rather clunky and slow. In addition, licenses are very expensive, which means that anyone lacking a license cannot contribute to or modify any of my designs.

To solve this, I turn to open source. Lattice's entire ICE40 FPGA line, along with most of their ECP5 FPGA device line have been fully reverse engineered boasting up to 8000 and 90,000 LUTS respectively. The open source toolchain for the ICE40 is called ICESTORM, the open source toolchain for the ECP5 is called prjtrellis. Since prjtrellis proved particularly difficult to install, I will document that process here.


Visit software and make sure your system has a matching configuration. You will also need to install

brew install qt5
brew install boost
brew install boost-python


Official GitHub Page

Since I use a Mac, my tutorial will be focused on getting PrjTrellis up and running on MacOS and should be somewhat transferrable to similar UNIX platforms. You'll want to clone the prjtrellis directory and follow the instructions in the README. I use brew to build all my packages.


  • A few things to watch out for that could trip out your installation.
  • If you choose /usr as your install prefix, you may have to disable MacOS SIP. To get around this, just set /usr/local as your installation prefix.
  • Make sure you can execute $python3
  1. mkdir build
  2. cmake -DCMAKE_INSTALL_PREFIX=/usr . or preferably cmake -DCMAKE_INSTALL_PREFIX=/usr/local .
  3. make
  4. make install



If you want to build nextpnr with GUI for MacOS at the time of this writing - you will need to clone from the ajeakins fork of nextpnr on github instead. At the time of this writing, commit 7f950a18524bf4cc6181c5c6e7210dad859b7983 works for GUI on MacOS.

Ajeakins fork: git clone

Build Process

  • git clone
  • for MacOS, make sure you have gnucoreutils installed. See software
  • for MacOS, change readlinkin /path/to/prjtrellis/ to greadlink
  • source “/path/to/prjtrellis/”
  • when building nextpnr-ecp5, if make complains about being unable to import database, you'll need to add the following 3 lines to /nextpnr/ecp5/ right after the line #!/usr/bin/env python3 * . Be sure to replace /path/to/prjtrellis with your actual path.
import sys
  • cmake ../ -DARCH=ecp5 -DBUILD_PYTHON=OFF -DBUILD_GUI=OFF -DTRELLIS_ROOT=/usr/local/share/trellis
  • make -j($nproc)
  • /var/www/html/container/dokuwiki-2018-04-22a/data/pages/fpga_design.txt
  • Last modified: 2018/12/28 16:05
  • by yehowshua