How To Install OpenROAD And Other VLSI Tools Under Ubuntu 22.04 Or Linux Mint 21

This HowTo will take you from a blank/brand new install of Ubuntu 22.04 or Linux Mint 21 up to the point where you can run OpenROAD to make a GDS-II file of an RTL design.

Last updated: Thursday 1st September, 2022 (added analog design tools)

Requirements

  • 8GB RAM (16GB or more if you’re dealing with big designs)
  • Minimum of 100Gb HDD (the install process peaks at 93GB, then drops off a bit)

Neither Ubuntu 22.04 or Mint 21 are officially supported at this time. I’m trying it out anyway 😉 . There’s a minor issue with the QT library and one of the scripts, but I provide work-arounds and it appears to be OK.

If you’re using VirtualBox (like I did), you’ll want to set it to the maximum number of CPU cores in the green section, turn on Bidirectional copy/paste and file transfers, turn on 3D acceleration and 64MB Video RAM if you’re using a screen larger than 1920×1080.

Folders

During this installation:

  • The main tools are compiled in ~/Work/vlsi/tools, then installed onto the system at /usr/local
  • Magic VLSI ends up in /opt/magic-8.3
  • PDKs and cell libraries go into /opt/pdks
  • OpenROAD and Yosys end up at: ~/Work/vlsi/tools/OpenROAD-flow-scripts/tools/install

Step 1: Install the OS

Ubuntu 22.04 from here: https://ubuntu.com/#download
or
Linux Mint 21 from here: https://www.linuxmint.com/download.php
(I chose the Cinnamon version)

I prefer Mint because it doesn’t use snaps and I like the Cinnamon desktop. They’re both Debian-based and the commands below should be identical for both. The commands in the article are tested on Mint 21 Cinnamon.

Install the OS and boot into it.

Step 2: Update the System and Install the Basic Build Tools

Choose best/closest Apt mirror repository. On Mint, this is through the Update Manager -> Software Sources.

Once you’ve chosen the fastest local package repository, update your system.

sudo apt update && apt upgrade -y

Reboot.

sudo apt install -y build-essential

If you’re using VirtualBox, then Insert Guest Additions CD Image now and let it auto-run, then reboot.

If you are using a VM, you can copy/paste between the host and guest OS’es now. If you’re not using a VM, you might find it easier to install the SSH server daemon and connect to it for copy/paste.

Next: Install Python and Git.

sudo apt install -y python3-venv python3-pip git gitk

The default ‘sh‘ should be ‘bash‘, not ‘dash‘:

sudo rm /bin/sh && sudo ln -s /bin/bash /bin/sh

Finally, make an area to work in:

mkdir -p Work/vlsi/tools

Step 3: Install Magic VLSI and KLayout

Note: If you just type ‘sudo apt install klayout‘ you get a very old version (0.26.2) and this is too old for OpenRoad.

Download the ‘.deb’ file from the KLayout homepage and install it, as shown below.

# Install KLayout
mkdir -p ~/Work/vlsi/tools/KLayout && cd ~/Work/vlsi/tools/KLayout
wget https://www.klayout.org/downloads/Ubuntu-22/klayout_0.27.11-1_amd64.deb
sudo apt install -y ./klayout_0.27.11-1_amd64.deb

# Install Magic VLSI
sudo apt install -y irsim csh m4 tcsh libx11-dev \
    tcl-dev tk-dev libcairo2 libcairo2-dev \
    mesa-common-dev libglu1-mesa-dev
cd ~/Work/vlsi/tools && git clone https://github.com/RTimothyEdwards/magic
cd magic
./configure --prefix=/opt/magic-8.3
make && sudo make install
printf '\n# Add magic to the path\nPATH=/opt/magic-8.3/bin:$PATH\n' >> ~/.bashrc

Note: That last line adds magic to your execution path, but you can’t type ‘magic‘ to launch it until you open a new shell.

Step 4: Set up OpenPDKs with SkyWater SKY130

Note: By this point, I’ve used 10GB on the HDD. This next step takes it to a peak of about 94GB before it drops back down to 81GB of files.

By default, the standard cell libraries and SRAM samples are not enabled. I want everything so I can see the effects of running different cell libraries on power, performance and area (PPA). The lines below enable much more than the default. Full documentation for these options can be found here.

I’m also using the eFabless PDK folder structure (selected by the ‘--with-ef-style‘). This is apparently a minor tweak to the folder structure and affects how you load files into Magic.

mkdir -p ~/Work/vlsi/pdks && cd ~/Work/vlsi/pdks
git clone https://github.com/RTimothyEdwards/open_pdks && cd open_pdks
# Configure with both "A" and "B" versions of the PDK
./configure --with-ef-style --enable-sky130-pdk --enable-sram-sky130 \
  --enable-osu-t12-sky130 --enable-osu-t15-sky130 --enable-osu-t18-sky130 \
  --enable-alpha-sky130 --prefix=/opt/pdks
make -j$(nproc)
# This step takes about 30 minutes
sudo make install

If you look in ‘/opt/pdks/share/‘, you’ll see 2x PDK folders: ‘sky130A‘ and ‘sky130B‘. The ‘sky130B‘ folder is newer (from open_pdks version 1.0.269) and includes support for ReRAM (a non-volatile RAM), but it’s not being used by eFabless yet.

If you don’t need the ‘B’ version, you should be able to skip the installation (saving half the disk space and half the install time) by specifying “--with-sky130-variants=A” during the configuration step. If you specify “--with-sky130-variants=B“, it fails during the “make install” step because the installer still looks for sky130A.

You can make this PDK available to Magic VLSI like this:

sudo ln -s /opt/pdks/share/pdk/sky130A/libs.tech/magic/* /opt/magic-8.3/lib/magic/sys

And you can also set Magic’s default configuration file to use the SKY130A settings, like this:

printf '\n# Add Skywater PDK magic configuration\nexport SKY130A=opt/pdks/share/pdk/sky130A\n' >> ~/.bashrc
cp /opt/pdks/share/pdk/sky130A/libs.tech/magic/current/sky130A.magicrc ~/.magicrc

Optional Step: Explore the Cell Library

You can explore the libraries in Magic now. There are several to choose from and they are named like alphabet soup. The page that describes what the letters mean is here.

Launch magic and point it to the ‘sky130A’ PDK:

magic -T sky130A

When Magic opens, you have 2 blank windows.

In the top, big one, choose File -> Read GDS, then navigate to ‘/opt/pdks/share/pdk/sky130A/libs.ref/gds/sky130_fd_sc_hd‘ and choose the ‘sky130_fd_sc_hd.gds‘ file.

Loading A Standard Cell Library

Display the cell manager with ‘Options -> Cell Manager’.

Scroll through the list of cell types, pick one, then click ‘Load’ to see it.

Standard Cell Selected And Loaded

If you left-click on a track, then move the mouse a bit and right-click to make a rectangular selection area, you can repeatedly press ‘S’ to cycle through connected circuit elements.

Exit without saving by typing ‘q’ into the console, or selecting ‘File -> Quit’.

Step 5: Install Yosys and OpenROAD using OpenROAD-flow-scripts

You can install Yosys and OpenROAD separately, but there’s a wrapper for the build process that does (almost) everything in the OpenROAD-flow-scripts repository.

cd ~/Work/vlsi/tools
git clone --recursive https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts.git

Before you can go any further, you need to install some prerequisite software packages:

# Packages needed by Yosys
sudo apt install -y clang bison flex \
	libreadline-dev gawk tcl-dev libffi-dev git \
	graphviz xdot pkg-config python3 libboost-system-dev \
	libboost-python-dev libboost-filesystem-dev zlib1g-dev

# Packages needed by OpenROAD
sudo apt install -y cmake qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools \
    libmng2 qt5-image-formats-plugins tcl-tclreadline \
    swig libboost-all-dev libeigen3-dev libspdlog-dev
# Build 'lemon' from source
cd ~/Work/vlsi/tools && mkdir lemon && cd lemon
wget http://lemon.cs.elte.hu/pub/sources/lemon-1.3.1.tar.gz
tar -zxf lemon-1.3.1.tar.gz && cd lemon-1.3.1
cmake -B build .
sudo cmake --build build -j $(nproc) --target install

# Optional: Delete the 'lemon' sources
cd ~/Work/vlsi/tools && rm -fR lemon

Build all the tools needed for OpenROAD:

cd ~/Work/vlsi/tools/OpenROAD-flow-scripts
./build_openroad.sh --local
# This step can take over 30 minutes

# Update '.bashrc' to point to the OpenROAD tools
printf '\n# Add Yosys and OpenROAD environment variables\n' >> ~/.bashrc
printf 'source ~/Work/vlsi/tools/OpenROAD-flow-scripts/setup_env.sh\n' >> ~/.bashrc

Close the terminal and open a new one to pick up the environment variable changes.

Step 6: Add VHDL to Yosys

We need to add VHDL parsing to Yosys. Prerequisites are to install ‘gnat‘, then compile ‘ghdl‘.

sudo apt install -y gnat
cd ~/Work/vlsi/tools && git clone https://github.com/ghdl/ghdl.git && cd ghdl
./configure --prefix=/usr/local
make
sudo make install

Install the ghdl-yosys-plugin:

cd ~/Work/vlsi/tools && git clone https://github.com/ghdl/ghdl-yosys-plugin.git
cd ghdl-yosys-plugin
make
# The plugin's installer detects where 'yosys' is on your system,
#  then installs the plugin to the right folder.
make install

Test the plugin’s integration:

cd ~/Work/vlsi/tools/ghdl-yosys-plugin/examples/icestick/leds/
ghdl -a leds.vhdl
ghdl -a spin1.vhdl
yosys -m ghdl -p 'ghdl leds; synth_ice40 -json leds.json'

You should see something like this in the output:

2.47. Printing statistics.

=== leds ===

   Number of wires:                 25
   Number of wire bits:            130
   Number of public wires:          25
   Number of public wire bits:     130
   Number of memories:               0
   Number of memory bits:            0
   Number of processes:              0
   Number of cells:                 94
     SB_CARRY                       22
     SB_DFFE                         4
     SB_DFFESR                       2
     SB_DFFESS                       2
     SB_DFFSR                       24
     SB_LUT4                        40

Step 7: Test the Installation

OpenROAD is a bit hard to get into without any examples of the toolchain flow. The OpenROAD-flow-scripts repository has example designs, constraints and makefile flows.

Test your installation, according to the OpenROAD Flow Tutorial:

cd ~/Work/vlsi/tools/OpenROAD-flow-scripts/flow
make DESIGN_CONFIG=./designs/sky130hd/ibex/config.mk
# This process takes about 30 minutes

This builds the ‘ibex‘ 32-bit RISC-V CPU core and the results end up here:

~/Work/vlsi/tools/OpenROAD-flow-scripts/flow/results/sky130hd/ibex/base$

To see the results in OpenROAD’s GUI, type:

make DESIGN_CONFIG=./designs/sky130hd/ibex/config.mk gui_final
OpenROAD GUI Showing A Timing Report

The tutorial is fairly essential to understanding how to set up a project and build it, so it is worth reading.

(Optional) Step 8: Analog Design Tools

Analog design is made easier with the use of XSchem, XSschem-Gaw and ngspice.

If you’re going down this path, I recommend joining the open-source-silicon.dev Slack group.

Install netgen:

# Install netgen
cd ~/Work/vlsi/tools &&  git clone git://opencircuitdesign.com/netgen
cd netgen
./configure --prefix=/usr/local/
make
sudo make install

Install XSchem:

# Packages needed by XSchem
sudo apt install -y csh libx11-dev libxrender1 libxrender-dev libxcb1 libxaw7-dev \
  libx11-xcb-dev libcairo2 libcairo2-dev tcl8.6 tcl8.6-dev \
  tk8.6 tk8.6-dev flex bison libxpm4 libxpm-dev gawk adms \
  libreadline6-dev
# Install XSchem from source
cd ~/Work/vlsi/tools && git clone https://github.com/StefanSchippers/xschem.git
cd xschem
./configure --prefix=/opt/xschem
make
sudo make install
printf '\n# Add xschem to the path\nPATH=/opt/xschem/bin:$PATH\n' >> ~/.bashrc

Install ngspice, using this patch file:

# Install ngspice
cd ~/Work/vlsi/tools && git clone git://git.code.sf.net/p/ngspice/ngspice
cd ngspice
wget https://cadhut.com/wp-content/uploads/2022/09/compile.sh_.patch
patch compile_linux.sh < compile.sh_.patch
# The compile script also runs an install process to /usr/local
#  so this must be done with `sudo`.
sudo ./compile_linux.sh

XSchem-gaw is the graphical waveform viewer for XSchem simulations. Install it like this:

sudo apt install gettext libgtk-3-dev
cd ~/Work/vlsi/tools && git clone https://github.com/StefanSchippers/xschem-gaw.git
cd xschem-gaw
gettext -V
# Make a note of the version number; mine was 0.20
# If yours is different, change the 'sed' line below
sed -i 's/0\.18/0\.20/' po/Makefile.in.in
aclocal && automake --add-missing && autoconf
./configure --prefix=/opt/xschem-gaw
make
sudo make install
printf '\n# Add xschem-gaw to the path\nPATH=/opt/xschem-gaw/bin:$PATH\n' >> ~/.bashrc

To test it, run XSchem like this:

xchem

Choose File -> Open, then explore the SkyWater 130A PDk folder:

What Next ?

You can try one of these articles:

https://openroad.readthedocs.io/en/latest/tutorials/FlowTutorial.html

http://opencircuitdesign.com/magic/tutorials/tut1.html

https://www.bananatronics.org/first-steps-with-google-skywater-pdk-free-open-source-silicon-for-everyone/

https://openroad.readthedocs.io/en/latest/user/GettingStarted.html#running-a-design