This tutorial serves as documentation on the installation procedure for the SKY130A PDK and the required tooling for analog design under Windows Subsystem for Linux (WSL). The tools tend to come with a bunch of bugs. Therefore, in this tutorial, I’ve opted to go for their bleeding edge, rather than older distro versions. The software will be installed under ~/tools and the pdk will be installed under ~/pdk.

WSL

Use a Windows terminal to run:

wsl --install -d Ubuntu-24.04
wsl

This will drop you into the Linux terminal. You can now update the installed distribution by running:

sudo apt update
sudo apt upgrade

Tools

Currently the tools used are:

  • Schematic editor: xschem
  • Simulator: ngspice
  • Layout: magic & klayout

Development Environment Installation

Since most of the tools are going to be built from source, we first need to install basic build tooling

sudo apt install gcc g++ gdb make

TODO: There might be missing items here.

xschem

mkdir ~/tools/xschem; cd ~/tools/xschem
git clone https://github.com/StefanSchippers/xschem.git ./
# install prerequisites
sudo apt install tcl-dev tk-dev libx11-dev 
sudo apt install libxrender-dev libx11-xcb-dev 
sudo apt install libcairo2-dev bison libxpm-dev libjpeg-dev
# build and install
./configure --prefix=$HOME/tools
make
make install

ngspice

mkdir ~/tools/ngspice; cd ~/tools/ngspice
git clone https://git.code.sf.net/p/ngspice/ngspice ./
# install prerequisites
sudo apt install autoconf libtool automake 
sudo apt install libxaw7-dev bison flex libreadline-dev
# build and install
./autoconf.sh
mkdir release; cd release
../configure --prefix=$HOME/tools --with-x --enable-cider --enable-predictor --enable-openmp --enable-osdi --enable-pss
make -j 16
make install

magic

mkdir ~/tools/magic; cd ~/tools/magic
git clone https://github.com/RTimothyEdwards/magic ./
# install prerequisites
sudo apt install m4 python3 libx11-dev tcl-dev tk-dev 
sudo apt install libcairo2-dev mesa-common-dev 
sudo apt install libgl-dev libglu1-mesa-dev zlib1g-dev
# build and install
./configure --prefix=$HOME/tools
make -j 16
make install

klayout

mkdir ~/tools/klayout; cd ~/tools/klayout
git clone https://github.com/KLayout/klayout ./
# install prerequisites
sudo apt install qt5-default qttools5-dev libqt5xmlpatterns5-dev
sudo apt install qtmultimedia5-dev libqt5multimediawidgets5 libqt5svg5-dev
sudo apt install ruby ruby-dev
sudo apt install python3 python3-dev
sudo apt install zlib1g-dev
sudo apt install libgit2-dev
# build - this will take a while
./build.sh

klayout places all its executables and libraries under a bin-release folder. Instead of copying these to ~/tools/bin we’re going to directly refer to them by adding the build artifacts to PATH and LD_LIBRARY_PATH.

klayout also requires the gdsfactory python package to run the pcells defined in the pdk. Install these packages to the default python instance via:

pip install gdsfactory
pip install --upgrade attrs

PDK

mdkir ~/pdk
mkidr ~/pdk/open_pdks; cd ~/pdk/open_pdks
git clone https://github.com/RTimothyEdwards/open_pdks ./
# build and install
./configure --prefix=$HOME/pdk --enable-sky130-pdk --with-sky130-variants=A
make -j 16
make install

Workarea Setup

MVP Experimentation Workarea

Create a simple workarea

mkdir -p ~/wa; cd ~/wa

Create a source.sh file in this workarea. We source this before running any of the tooling.

# add the tooling to the path
export PATH=$HOME/tools/bin:$PATH
export PATH=$HOME/tools/klayout/bin-release:$PATH
export LD_LIBRARY_PATH=$HOME/tools/klayout/bin-release:$LD_LIBRARY_PATH
# define some useful environment variables
export PDK_ROOT=$HOME/pdk/share/pdk
export PDK=sky130A
export WA_ROOT=`pwd`

xschem

Copy xschemrc into the local workarea and modify it to look for the correct location for the SKY130A libraries.

cp $HOME/pdk/share/pdk/sky130A/libs.tech/xschem/xschemrc ./
append XSCHEM_LIBRARY_PATH :${PDK_ROOT}/${PDK}/libs.tech/xschem

You can now start the schematic editor by:

xschem

magic

Copy the sky130A.magicrc file into the local workarea:

cp $PDK_ROOT/$PDK/libs.tech/magic/sky130A.magicrc ./.magicrc

You can now start the layout editor by:

magic

klayout

You can launch klayout in editor mode by:

klayout -e

When launching klayout for the first time, you need to import the technology files. To do this:

  1. Run Tools -> Technology Manager
  2. Right click on the technology list and choose Import technology
    1. Choose ~/pdk/share/pdk/sky130A/libs.tech/klayout/tech/sky130A.lyt
    2. sky130 - SkyWater 130nm technology should appear in the technology list
  3. Change the paths to point to the correct locations
    1. Change Base path to ~/pdk/share/pdk/sky130A/libs.tech/klayout
    2. Change Layer properties to tech/sky130A.lyp
  4. Restart klayout. It should now come with the Efabless sky130 menu loaded by default.