IHP SG13G2 Analog Flow on WSL - Fedora 43 Update
I previously had published an article about setting up the analog flow for open-source circuit design tools on WSL, using the default Ubuntu distribution that was available and the SkyWater 130nm PDK.
The Ubuntu version I was using (22.04) was getting too old for development work and I desperately needed an upgrade. It was a pleasant surprise to see that WSL now supported Fedora out of the box, which has been my go-to choice for a distro for a while. I like using the bleeding-edge versions of the development packages, and things breaking occasionally makes life interesting.
This tutorial will provide a guide to install and bring-up the basic toolkit. The installation paths will look like:
~/analog- root directory for all work~/analog/tools- open source EDA software~/analog/tools/bin- binaries~/analog/tools/src- source files
~/analog/pdk- pdk installation~/analog/wa- workarea directories for development
Installation
WSL
Installing Fedorra under WSL in Windows 11 is pretty straightforward.
wsl --install FedoraLinux-43
You can now use the newly installed WSL distribution by:
wsl ~
It’s a good idea to upgrade the packages before continuing any further.
sudo dnf upgrade
Tools
The toolset is the same as before.
- Schematic editor:
xschem - Simulator:
ngspice - VerilogA Model Interface:
openvaf - Layout:
&magicklayout
Development Environment
sudo dnf install gcc g++ gdb make
xschem
Install prerequisites:
sudo dnf install flex bison
sudo dnf install libX11-devel libXrender-devel libXpm-devel
sudo dnf install tcl8-devel tk8-devel
sudo dnf install libjpeg-turbo-devel
sudo dnf install xterm # required for the simulate command
The tcl8-devel and tk8-devel packages are chosen for compatibilty with magic, the Tcl 9.0 versions of these packages (tcl-devel and tk-devel) seemed to have a lot of issues with magic scripts; altough both tools compile and run with the latest versions as well.
Build and install xschem from the GitHub repository:
mkdir -p ~/analog/tools/src/xschem; cd ~/analog/tools/src/xschem
git clone https://github.com/StefanSchippers/xschem.git ./
# build and install
./configure --prefix=$HOME/analog/tools
make -j 16
make install
ngspice
Install prerequisites:
sudo dnf install autoconf libtool automake
sudo dnf install libXaw-devel
Build and install ngspice from the SourceForge repository:
mkdir -p ~/analog/tools/src/ngspice; cd ~/analog/tools/src/ngspice
git clone https://git.code.sf.net/p/ngspice/ngspice ./
# build and install
./autogen.sh
mkdir release; cd release
../configure --prefix=$HOME/analog/tools --with-x --enable-cider --with-readline=yes --enable-predictor --enable-openmp --enable-osdi --enable-pss
make -j 16
make install
openvaf
OpenVAF is a Verilog-A compiler that compiles a restricted subset of the language into a OSDI (Open Source Device Interface) model; which can be loaded by the circuit simulators. The IHP SG13G2 PDK requires openvaf to compile the PSP 103 MOSFET, MOS varactor and 3-terminal resistor models.
Compiling OpenVAF is a challenge. Also, it’s development seems to have gone through a break and a revival, which makes compiling it from source a bit of a higher challenge.
For now, simply download the pre-compiled binary from here. I chose the latest 0.3 version ( openvaf-reloaded-osdi_0.3-31-gf47d557-linux_x64.tar.gz to be exact) and copied the binary to $HOME/analog/tools/bin.
magic
magic main branch does not compile successfully for Fedora 43. termio.h was removed from glibc 2.42 (April 2025) after ~37 years when it was deprecated by the standardization of termios.h in 1998. Thankfully, the replacements only constitute a small patch, which I hope will be merged to the main branch soon.
I have not detailed the changes here, as the developers seem to be aware fixes are under discussion here.
Install prerequisites:
sudo dnf install mesa-libGL-devel mesa-libGLU-devel
mkdir ~/analog/tools/src/magic; cd ~/analog/tools/src/magic
git clone https://github.com/RTimothyEdwards/magic ./
Patching for Fedora 43
Compiling directly seems to cause some issues with old-style function declarations, where their prototypes are declared without the arguments. You need to change the configure script to the following:
( CFLAGS=${CFLAGS:-"-g -std=gnu89"}; export CFLAGS; cd scripts ; ./configure "$@" )
Afterwards, you can build and install magic:
# build and install
./configure --prefix=$HOME/analog/tools
make -j 16
make install
klayout
Install prerequisites:
sudo dnf install qt6-qtbase-devel qt6-qt5compat-devel
sudo dnf install qt6-qtmultimedia-devel qt6-qtsvg-devel qt6-qttools-devel
sudo dnf install ruby-devel python-devel
sudo dnf install libgit2-devel
mkdir ~/analog/tools/klayout; cd ~/analog/tools/klayout
git clone https://github.com/KLayout/klayout ./
# build - this will take a while
./build.sh -option -j16
klayout places all its executables and libraries under a bin-release folder.
Instead of copying these to ~/analog/tools/bin we’re going to directly refer to them by prepending these 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 - IHP SG13G2
The IHP 130nm BiCMOS Open Source PDK is available at https://github.com/IHP-GmbH/IHP-Open-PDK. Unlike SKY130 in the open_pdks flow, the PDK does not need to be built and can be used directly after cloning the repository.
mkdir -p ~/analog/pdk/IHP-Open-PDK; cd ~/analog/pdk/IHP-Open-PDK
git clone https://github.com/IHP-GmbH/IHP-Open-PDK.git ./
After cloning, you also need to populate all the submodules the repository is referencing via:
git submodule update --init --recursive
Workarea Setup
Create a simple workarea:
mkdir -p ~/analog/wa/dev; cd ~/analog/wa/dev
Create a source.sh file in this workarea. Source this before running any of the tooling.
# add the tools to the path
export PATH=$HOME/analog/tools/bin:$PATH
export PATH=$HOME/analog/tools/src/klayout/bin-release:$PATH
export LD_LIBRARY_PATH=$HOME/analog/tools/src/klayout/bin-release:$LD_LIBRARY_PATH
# some useful environment variables
export PDK_ROOT=$HOME/analog/pdk/share/pdk
export PDK=ihp-sg13g2
export WA_ROOT=`pwd`
xschem
The PDK comes with an install script that does a couple of things: compile the Verilog-A model libraries and copy the required xschemrc to the current workarea, and the .spiceinit file to $HOME/.
$PDK_ROOT/$PDK/libs.tech/xschem/install.py
I’m not a big fan of cluttering my $HOME/ (unlike in real life), so another option is to place the .spiceinit file under $WA_ROOT/simulations/.spiceinit.
You can now start xschem and the example simulations should work.
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:
- Run Tools -> Manage Technologies
- Right click on the technology list and choose Import technology
- Choose
$PDK_ROOT/$PDK/libs.tech/klayout/tech/sg13g2.lyt - “sg13g2 - IHP SiGe 130nm Technology” should appear in the technology list
- Choose
- Restart klayout. It should now come with the SG13G2 PDK menu loaded by default.