Skywater 130nm PDK Installation

Updated December 2024

This guide assumes you have Windows 10 or 11 installed. If you're natively running Linux many of these steps can be skipped. Because the repositories and build require a large amount of disk space, I've provided instructions based on the assumption that the user either has an external drive with plenty of space or at least 60GB of free space on their primary drive.

This guide assumes basic familiarity with Linux, like "cd" and "sudo apt install". If you have literally never touched a Linux system, it's highly recommended to reference this page on essential commands: https://www.hostinger.com/tutorials/linux-commands

Install WSL using guide here: https://docs.microsoft.com/en-us/windows/wsl/install
Install Ubuntu using guide here and pick a simple and easy to remember username/password : https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-11-with-gui-support#1-overview
Install MobaXterm and launch it
Settings --> X11 --> X11 remote access --> full
Change DPI to auto
Connect to Ubuntu server by double clicking on WSL-Ubuntu on the left side

We will first install all dependencies now so we don't have to worry about any of them later.
> sudo apt update
> sudo apt upgrade
> sudo apt install -y nautilus gedit x11-apps build-essential flex bison m4 tcsh csh libx11-dev tcl-dev tk-dev libcairo2 libcairo2-dev libx11-6 libxcb1 libx11-xcb-dev libxrender1 libxrender-dev libxpm4 libxpm-dev libncurses-dev blt freeglut3-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev tcl-tclreadline libgtk-3-dev tcl8.6 tcl8.6-dev tk8.6 tk8.6-dev gawk graphicsmagick vim-gtk3 libxaw7 libxaw7-dev fontconfig libxft-dev libxft2 libxmu6 libxext-dev libxext6 libxrender1 libxrender-dev libtool readline-common libreadline-dev gawk autoconf libtool automake adms gettext ruby ruby-dev libgit2-dev qtbase5-dev qt5-qmake python3-dev qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5 libqt5xmlpatterns5-dev python3-pyqt5 qtcreator pyqt5-dev-tools qttools5-* libqt5svg5-dev gcc g++ gfortran make cmake bison flex libfl-dev libfftw3-dev libsuitesparse-dev libblas-dev liblapack-dev libtool autoconf automake libopenmpi-dev openmpi-bin python3-pip python3-venv python3-virtualenv python3-numpy rustc libprotobuf-dev protobuf-compiler libopenmpi-dev gnat clang libc++-dev libc++abi-dev gperf liblzma-dev libgtk2.0-dev swig libboost-all-dev libllvm-ocaml-dev llvm llvm-dev llvm-runtime clang-tools libclang-dev libclang1 clang-format lldb lld lyx

#these have been removed since previous, do not install: libllvm9  llvm-9-doc llvm-9-examples  clang-9-doc libclang-common-9-dev  python- libfuzzer-9-dev

> echo "export DISPLAY=:0" >> ~/.bashrc
> sed -i 's/\r//' ~/.bashrc
> . ~/.bashrc
> xcalc
The calculator app should now open in a GUI and it should like just like it's an app you're opening natively in windows

Repository files and compilation will take up 50GB+ of space, so cd to an external drive or something. My external drive is drive F:\ and I've created a folder called sky130repo where all the git respositories will be cloned. Windows drives will be under the /mnt folder, so if you need to transfer files between Windows and Linux you can go to /mnt/c to go to your C drive. MobaXterm also includes a file browser on the left side, you can use that to navigate and transfer files and folders. You can right click on files and open them for editing, but I would not recommend this since Windows and Linux handle certain characters like newlines differently. If you want to edit a text file instead do "gedit <file_name>"

> mkdir /mnt/f/sky130repo
> cd /mnt/f/sky130repo

In this guide, all tools will be installed in the /tools directory while the pdk will be installed in the /openpdk directory. We are first going to install all necessary tools, and then at the very end install the PDK. This way avoids stupid mistakes that can cause lots of frustration.

------MAGIC------
As of the time of this post, there is a readline symbolic link error that occurs during make. Go into the readline folder and rename the folder in there from readline-4.3 to readline. I reached out to the developers about this and they said they may fix it.
> git clone https://github.com/RTimothyEdwards/magic magic-git
> cd magic-git
> ./configure --prefix=/tools/magic
> sudo make
> sudo make install
> cd..

------XSCHEM------
> git clone https://github.com/StefanSchippers/xschem.git xschem-git
> cd xschem-git
> ./configure --prefix=/tools/xschem
> make
> sudo make install
> cd..

------NGSPICE v1 (DIRECT, PREFERRED BY AUTHOR)------
-Download the Linux version of ngspice from https://sourceforge.net/projects/ngspice/ to the sky130repo folder and 
cd into extracted folder
> ./configure --prefix=/tools/ngspice
> make
> sudo make install
> cd ..

------NGSPICE v2 (GIT)------
> git clone git://git.code.sf.net/p/ngspice/ngspice ngspice-git
> cd ngspice-git
> gedit compile_linux.sh
-Comment out line 39 and 40 (autogen.sh and the one right after)
-Uncomment line 45 and 46 (autogen.sh --adms and the one right after)
-Replace line 55 with ../configure --enable-adms --with-x --enable-xspice --enable-cider --with-readline=yes --enable-openmp CFLAGS="-g -m64 -O0 -Wall -Wno-unused-but-set-variable" LDFLAGS="-m64 -g" --prefix=/tools/ngspice/install
-Replace line 62 with ../configure --enable-adms --with-x --enable-xspice --enable-cider --with-readline=yes --enable-openmp --disable-debug CFLAGS="-m64 -O2" LDFLAGS="-m64 -s" --prefix=/tools/ngspice/install
-Add "sudo" to the start of line 78 so it's sudo make install
-Save and close the file
> chmod u+rwx ./compile_linux.sh
> ./compile_linux.sh
> cd ..

------NETGEN------
> git clone git://opencircuitdesign.com/netgen netgen-git
> cd netgen-git
> ./configure --prefix=/tools/netgen
> make
> sudo make install
> cd ..

------GAW------
-Download latest from https://download.tuxfamily.org/gaw/download/ and unzip and cd into extracted folder
> ./configure --prefix=/tools/gaw
> make
> sudo make install
> cd ..

------KLAYOUT------
> git clone https://github.com/KLayout/klayout.git klayout-git
> cd klayout-git
> sudo ./build.sh -prefix /tools/klayout
> cd ..

------XYCE------
-An alternative to ngspice, NOT REQUIRED. It took me almost 8 hours to install
-Xyce is developed and maintained by the Sandia National Labs, a nuclear research lab, and requires Trilinos, a high-performance computing mathematics package also developed by Sandia
-Full official guide can be found  here: https://xyce.sandia.gov/documentation-tutorials/building-guide/
-As of the time of this blog, Xyce only works with Trilinos version 12.12.1. Check the Sandia link above to make sure this is still the case.
> wget https://github.com/trilinos/Trilinos/archive/refs/tags/trilinos-release-12-12-1.tar.gz
> sudo tar -xvzf trilinos-release-12-12-1.tar.gz
> mv trilinos-release-12-12-1.tar.gz trilinos-source
> rm trilinos-release-12-12-1.tar.gz
> cd trilinos-source
> mkdir install
-Create an empty file called reconfigure and copy/paste the text below near the end of this guide into it. Replace SRCDR with whatever your Trilinos source folder actually is. ARCHDIR is set to where I wanted to install it, you should edit accordingly if you intend to keep it elsewhere. ARCHDIR will be used later when installing Xyce
> sudo mkdir /tools/xyce
> chmod u+x reconfigure
> ./reconfigure
> make
> sudo make install
-Download the source code for Xyce from https://xyce.sandia.gov/downloads/source-code/ and unzip it into your repo source folder, and cd into it. You will need to register your email in order to download it. My folder is called xyce-source
> cd xyce-source
> mkdir xyce-build
> cd xyce-build
> echo '../configure \' > reconfigure
-Edit reconfigure and add the lines from the bottom of this document, making sure ARCHDIR matches the same ARCHDIR used for Trilinos
> chmod u+x reconfigure
> ./reconfigure
> make
> sudo make install
> cd ..
> cd ..

------GHDL------
> cd /mnt/f/sky130repo
> git clone https://github.com/ghdl/ghdl ghdl-git
> cd ghdl-git
> ./configure --with-llvm-config=/usr/lib/llvm-18/bin/llvm-config --prefix=/tools/ghdl
> make
> sudo make install
> cd ..

------GTKWAVE------
-Download from http://gtkwave.sourceforge.net/
> wget http://gtkwave.sourceforge.net/gtkwave-3.3.121.tar.gz
> tar -xvzf gtkwave-3.3.121.tar.gz
> mv gtkwave-3.3.121 gtkwave-git
> rm gtkwave-3.3.121.tar.gz
> cd gtkwave-git
> ./configure --prefix=/tools/gtkwave
> make
> sudo make install
> cd ..

------ICARUS VERILOG------
> git clone https://github.com/steveicarus/iverilog.git iverilog-git
> cd iverilog-git
> sh autoconf.sh
> ./configure --prefix=/tools/iverilog
> make
> sudo make install
> cd ..

------YOSYS------
> git clone https://github.com/YosysHQ/yosys.git yosys-git
> cd yosys-git
> gedit makefile
-Edit line 65, so PREFIX is /tools/yosys
> git submodule update --init
> make
> sudo make install
> cd ..

------OPENROAD------
> git clone --recursive https://github.com/The-OpenROAD-Project/OpenROAD.git openroad-git
> cd openroad-git
> sudo ./etc/DependencyInstaller.sh -run
> sudo ./etc/DependencyInstaller.sh -dev
> mkdir build
> cd build
> . ~/.bashrc
> cmake .. -DCMAKE_INSTALL_PREFIX=/tools/openroad
> make
> sudo make install

-We're going to add all the installed tools to the shell so we can launch apps from the terminal
> sudo chmod u+rx /tools
> chmod u+rx ~/.bashrc
> echo "export PATH=/tools/klayout:/tools/magic/bin:/tools/netgen/bin:/tools/ngspice/install/bin:/tools/xschem/bin:/tools/xyce/bin:/tools/gaw/bin:/tools/ghdl/bin/:/tools/gtkwave/bin/:/tools/iverilog/bin:/tools/yosys/bin:/tools/openroad/bin/:$PATH" >> ~/.bashrc
> sed -i 's/\r//' ~/.bashrc

-We're going to restart to make sure that every time we boot up it'll work the way we want
-Close MobaXterm, and then open Powershell in admin mode
> Get-Service WslService| Restart-Service
-Reopen Mobaxterm
-Confirm the tools all work and boot up. Run "magic" and "xschem" and "klayout". If they open as if they were Windows applications without errors, finally time to install the Open PDK!

------SKYWATER 130NM PDK------
-Will download like 30GB and take 3-4 hours
> git clone git://opencircuitdesign.com/open_pdks openpdk-git
> cd openpdk-git
> sudo mkdir /openpdk
> ./configure --enable-sky130-pdk --prefix=/openpdk
> sudo make
> sudo make install

> sudo chmod u+rx /openpdk
> echo "export PDK_ROOT=/openpdk/share/pdk/" >> ~/.bashrc
> echo "export SKY130A=/openpdk/share/pdk/sky130A" >> ~/.bashrc
> sed -i 's/\r//' ~/.bashrc
> . ~/.bashrc

Setup working directories
> cd $
> mkdir workingdir
> cd workingdir
> mkdir layout
> mkdir schematic
> mkdir verilog
> cp /openpdk/share/pdk/sky130A/libs.tech/xschem/xschemrc ./schematic/xschemrc
> cp /openpdk/share/pdk/sky130A/libs.tech/magic/sky130A.magicrc ./layout/.magicrc
-Modify .xschemrc to uncomment line 12 and edit it to say "set XSCHEM_SHAREDIR /tools/xschem/share/xschem"

Confirm the tools are working right
> cd ~/workingdir/schematic
> xschem
It should open up "top.sch" with all the Sky130 PDK devices in a grid, as well as a list of examples on the side. Open a new tab and press Shift-I to open up the device library. There should be three tabs on the side, one for the generic Xschem SPICE devices, one for your current working directory, and one for the Sky130 library. Close Xschem if it looks good.
> cd ~/workingdir/layout
> magic
Go to Options -> Tech Manager, and it should say "sky130A". Next to Options "devices 1" and "devices 2". If it looks good, close Magic.
> klayout
-File, Setup, Editing Mode, check off "use by default"
-Tools, Manage Technologies, General, set base path to /openpdk/share/pdk/sky130A/libs.tech/klayout
-Close and restart Klayout
-File, New Layout, and in the bottom left select the drop down to change to Sky130 and you should see the different devices you can drop in. If all good, close klayout
-Go back to where openroad was cloned. For me or me it's:
> cd /mnt/f/sky130repo/openroad-git
> ./test/regression
-It should run through testing each and every tool and list "pass" next to it, and at the end it should say "Passed all tool regressions"






-------Trilinos reconfigure file--------
#!/bin/sh
SRCDIR=/mnt/f/sky130repo/trilinos-source
ARCHDIR=/tools/xyce/xycelibs/serial
FLAGS="-O3 -fPIC"
cmake \
-G "Unix Makefiles" \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_Fortran_COMPILER=gfortran \
-DCMAKE_CXX_FLAGS="$FLAGS" \
-DCMAKE_C_FLAGS="$FLAGS" \
-DCMAKE_Fortran_FLAGS="$FLAGS" \
-DCMAKE_INSTALL_PREFIX=$ARCHDIR \
-DCMAKE_MAKE_PROGRAM="make" \
-DTrilinos_ENABLE_NOX=ON \
-DNOX_ENABLE_LOCA=ON \
-DTrilinos_ENABLE_EpetraExt=ON \
-DEpetraExt_BUILD_BTF=ON \
-DEpetraExt_BUILD_EXPERIMENTAL=ON \
-DEpetraExt_BUILD_GRAPH_REORDERINGS=ON \
-DTrilinos_ENABLE_TrilinosCouplings=ON \
-DTrilinos_ENABLE_Ifpack=ON \
-DTrilinos_ENABLE_AztecOO=ON \
-DTrilinos_ENABLE_Belos=ON \
-DTrilinos_ENABLE_Teuchos=ON \
-DTrilinos_ENABLE_COMPLEX_DOUBLE=ON \
-DTrilinos_ENABLE_Amesos=ON \
-DAmesos_ENABLE_KLU=ON \
-DTrilinos_ENABLE_Amesos2=ON \
-DAmesos2_ENABLE_KLU2=ON \
-DAmesos2_ENABLE_Basker=ON \
-DTrilinos_ENABLE_Sacado=ON \
-DTrilinos_ENABLE_Stokhos=ON \
-DTrilinos_ENABLE_Kokkos=ON \
-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES=OFF \
-DTrilinos_ENABLE_CXX11=ON \
-DTPL_ENABLE_AMD=ON \
-DAMD_LIBRARY_DIRS="/usr/lib" \
-DTPL_AMD_INCLUDE_DIRS="/usr/include/suitesparse" \
-DTPL_ENABLE_BLAS=ON \
-DTPL_ENABLE_LAPACK=ON \
$SRCDIR



Xyce reconfigure -------------------------------- Add these lines
CXXFLAGS="-O3 -std=c++11" \
--srcdir="/mnt/f/sky130repo/xyce-source" \
ARCHDIR="/tools/xyce/xycelibs/serial" \
--enable-shared \
--enable-xyce-shareable \
CPPFLAGS="-I/usr/include/suitesparse" \
--prefix=/tools/xyce