Project F

FPGA Tooling on Ubuntu 20.04

Published · Updated

In this post, I test common FPGA tools for compatibility with Ubuntu 20.04 (AKA Focal Fossa), and my regular desktop OS: Pop!_OS 20.04. These tests are in no way exhaustive: I have tried using the applications as I usually do to exercise the main functionality. I have also included instructions for building the tools from source when available. This is my final update for this post (July 2020).

Share your thoughts with @WillFlux on Mastodon or Twitter. If you like what I do, sponsor me. 🙏

Detailed Build Instructions
I have added a new page covering Building iCE40 FPGA Toolchain on Linux.

Windows Subsystem for Linux 2

I have added some testing for IceStorm, nextpnr, and Yosys under WSL 2 in Windows 10 update 2004. Simple tests show the tools work under WSL 2, but there are two issues to be aware of:

  1. You can’t program a board via USB due to the lack of USB support in WSL 2 as of July 2020.
  2. Compiling nextpnr and Yosys uses heaps of memory (11 GiB when I tested).
    Restart WSL with PowerShell to reclaim: Get-Service LxssManager | Restart-Service

WSL 2 requires Windows 10 Version 2004, Build 19041 or higher. Run winver to see your version.

OSS CAD Suite provides pre-built Windows binaries for FPGA tools, including USB support.
You can combine these with WSL-built tools, or use their entire pre-built toolchain.

IceStorm Tools

  • Version: Latest from GitHub on 2020-05-19 (WSL 2 used version from 2020-07-27)
  • Source: GitHub
  • OS Tested:
    • Ubuntu 20.04 (native and WSL 2)
    • PopOS 20.04
  • Extra Packages Required: see compiling, below
  • Fixes Required: No
  • Test Result: OK

Tested with iCEBreaker board.

Building IceStorm

I have successfully compiled and installed IceStorm tools based on Claire Wolf’s instructions. Prerequisites are common to this, nextpnr, and Yosys.

apt install build-essential clang bison flex libreadline-dev \
    gawk tcl-dev libffi-dev git graphviz \
    xdot pkg-config python python3 libftdi-dev \
    qt5-default python3-dev libboost-all-dev cmake libeigen3-dev

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

NB. USB support is not yet available in Windows Subsystem for Linux (as of July 2020), so you can’t actually program a board with iceprog.

nextpnr

  • Version: Latest from GitHub on 2020-05-19 (WSL 2 used version from 2020-07-27)
  • Source: GitHub
  • OS Tested:
    • Ubuntu 20.04 (native and WSL 2)
    • PopOS 20.04
  • Extra Packages Required: see compiling, below
  • Fixes Required: No
  • Test Result: iCE40 OK (other architectures not tested)

Building nextpnr

I have successfully compiled and installed nextpnr for iCE40 based on Claire Wolf’s instructions. Prerequisites are common to this, IceStorm Tools, and Yosys.

apt install build-essential clang bison flex libreadline-dev \
    gawk tcl-dev libffi-dev git graphviz \
    xdot pkg-config python python3 libftdi-dev \
    qt5-default python3-dev libboost-all-dev cmake libeigen3-dev

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

nMigen

I’ve only recently started working with nMigen, but it looks like a promising HDL that plays nicely with existing toolchains. nMigen requires Python 3.6+ and Yosys 0.9+; both included in Ubuntu 20.04. However, I recommend updating to the latest version of Yosys from source.

  • Version: Latest from GitHub on 2020-04-07
  • Source: nMigen GitHub
  • OS Tested:
    • Ubuntu 20.04
    • PopOS 20.04
  • Extra Packages: python3-pip
  • Fixes Required: No
  • Test Result: OK

nMigen Extra Packages

On a minimal Ubuntu install you need to install pip to work with Python packages:

apt install python3-pip

Quartus

Quartus 20 lite is not yet available, so I have been trying to get version 19 running following the Ubuntu 18.04 instructions.

  • Version: Intel Quartus Prime 19.1.0.670 Lite
  • Source: intel.com
  • OS Tested: Ubuntu 20.04
  • Extra Packages: see below
  • Fixes Required: TBD
  • Test Result: TBD

I don’t have an Intel/Altera board at the moment, so I’m limited in what I can test.

Quartus Extra Packages

The Quartus installation instructions call for the installation of additional packages on Ubuntu, many of them 32-bit i386. There almost weren’t any i386 packages in Ubuntu 20.04, see Statement on 32-bit i386 packages for Ubuntu 19.10 and 20.04 LTS, but in the end, all but three of them are available in 20.04.

Install the available packages:

apt install libc6:i386 libc6-dev-i386 liblzma-dev libncurses5:i386 \
    libqt5xml5 libstdc++6:i386 libxft2 libxft2:i386 libxtst6:i386 lib32z1

The three missing packages are:

  • lib32bz2-1.0
  • lib32ncurses5
  • libpng12

libpng12 was last part of an LTS release in 16.04 Xenial! Intel suggests you download the Xenial version and install it manually.

The other two haven’t been part of Ubuntu in many years.

Status 2020-07-27: Quartus testing is incomplete. I’m not planning on any additional testing for now.

Verilator

  • Version: Verilator 4.028 2020-02-06 rev v4.026-92-g890cecc1
  • Source: Ubuntu package
  • OS Tested:
    • Ubuntu 20.04
    • PopOS 20.04
  • Extra Packages: None
  • Fixes Required: No
  • Test Result: OK

Verilator is included as a package in Ubuntu 20.04 and is only a couple of minor releases behind veripool.org. In my initial testing, I haven’t seen any issues.

Vivado

Vivado 2019.x supports Ubuntu 18.04 and is straightforward to get running on Ubuntu 20.04. I’ve had occasional crashes after extended use of simulation, but haven’t found the cause.

Quick Update: Vivado 2020.1 fails to install on Ubuntu 20.04.
You need to fake the version in /etc/os-release to get the installer to run.

  • Version: Xilinx Vivado 2019.2
  • Source: xilinx.com
  • OS Tested:
    • Ubuntu 20.04
    • PopOS 20.04
  • Extra Packages: libtinfo5 libncurses5
  • Fixes required: No
  • Test Result:
    • Simulation: OK (occasional crashes)
    • Synthesis: OK
    • Implementation: OK
    • Bitstream Generation: OK
    • DocNav: Not Tested
    • HLS: Not Tested

Vivado Extra Packages

Install these packages:

apt install libtinfo5 libncurses5
  • libtinfo5 [universe] - without this Vivado GUI won’t start
  • libncurses5 [universe] - without this simulation fails to compile

Cable Drivers

After running the Vivado installer on Linux, you need to install cable drivers as root. If you don’t install cable drivers, you won’t be able to connect to boards. This is the case for all Linux installs, not just Ubuntu 20.04, but is a common oversight, so I have included details here.

# change directory to your Vivado install, for example:
cd /opt/Xilinx/Vivado/2019.2

# cd into the drivers directory (the script MUST be run there)
cd data/xicom/cable_drivers/lin64/install_script/install_drivers

# run the cable installer with root privs
sudo ./install_drivers

Yosys

  • Version: Yosys 0.9+2406 (git sha1 026fed31, clang 10.0.0-4ubuntu1 -fPIC -Os)
  • Source: Yosys GitHub on 2020-05-19
  • OS Tested:
    • Ubuntu 20.04 (native and WSL 2)
    • PopOS 20.04
  • Extra Packages Required: see compiling, below
  • Fixes Required: No
  • Test Result: OK

Yosys 0.9 is available as a package for Ubuntu 20.04. I initially tested the package version without any issues, but have since moved to compiling the latest version from GitHub.

Building Yosys

I successfully compiled and installed Yosys based on Claire Wolf’s instructions. Prerequisites are common to this, IceStorm Tools, and nextpnr.

apt install build-essential clang bison flex libreadline-dev \
    gawk tcl-dev libffi-dev git graphviz \
    xdot pkg-config python python3 libftdi-dev \
    qt5-default python3-dev libboost-all-dev cmake libeigen3-dev

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

What’s Next?

Check your Verilog designs with Verilator Lint. Or take a look at all our FPGA Tools posts.