Open Toolchain Installation

Blow-By-Blow description of the issues encountered during the Installation of the Analogue Toolchain for Sky130

Target Audience

Placeholder

Credit Where it's due

This installation builds on the work of many people, but most importantly the work of Thomas Parry, who has created a 'minimum viable' design example on his his Github.

My Setup

Installing Git

In order to pull in Thomas Parry's Github, it is required to first install git as it isn't included in Ubuntu by default.
To install git, open a Terminal and run the following:
sudo apt update
sudo apt install git
Enter the password for your linux account (with root access) if prompted
apt will ask to confirm the install, press the Y key:
.............
Need to get 5,228 kB/5,254 kB of archives.
After this operation, 37.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
If the installation was successful, running the command:
git help
should return:
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
   clone             Clone a repository into a new directory
   init              Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
   add               Add file contents to the index
   mv                Move or rename a file, a directory, or a symlink
   restore           Restore working tree files
   rm                Remove files from the working tree and from the index
   sparse-checkout   Initialize and modify the sparse-checkout

Cloning Thomas Parry's Analogue Design Example

As a starting point, Thomas Parry's Analogue Design Example will be used to validate the install. Clone his github repo to your home directory:
cd ~
git clone https://github.com/yrrapt/analogue_design_example
If the clone is successful, you can see that the analogue_design_example directory is present in your home directory. Enter this directory by:
cd ~/analogue_design_example
There is a makefile which installs the pdk and all the required tools. This is located in analogue_design_example/env/Makefile. Before running the makefile however, the toolchain directory must be created at /tools:
sudo mkdir /tools
Once the tools directory has been made, the makefile can be run: cd ~/analogue_design_example/env
sudo make


Error when running the makefile:
cloning into 'xschem'...
Warning: Permanently added the ECDSA host key for IP address '140.82.121.3' to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
This is some weird clone syntax... Retrying with:
sudo git clone https://github.com/StefanSchippers/xschem
Pre-emptively making the same change for the xschem_sky130 section of the makefile:
sudo git clone https://github.com/StefanSchippers/xschem_sky130


Error when configuring magic (running the /tools/magic/configure script):
configure: error: cannot find /bin/csh---cannot compile!
It looks like the cshell isn't installed by default on Ubuntu 20.04. Installing it with:
sudo apt install csh
configuration ran successfully after installing csh!

Make sure the user is given rwx access to /tools and /pdk in the tutorial so that they can do all the commands without sudo!

There doesn't appear to be a /usr/share/pdk/sky130A/libs.tech/magic/sky130A.magicrc file. I think this is because we extracted into /pdk rather than /usr/share/pdk. Need to modify the open_pdks copy file to reflect this change:
cp -f /pdk/open_pdks/sky130/magic/sky130.magicrc
and same with adding the environment variable to the .bashrc file:
echo "export SKY130A=/pdk/sky130A" >> ~/.bashrc


In order to run ./autogen.sh to compile ngspice, autoconf, libtool and automake must be installed. Make sure to run:
sudo apt install autoconf libtool automake
before running ./autogen --adms in the ngspice section

Replacing the git clone for Klayout, similar to those above:
git clone https://github.com/klayout/klayout
Qmake is required to build KLayout, make sure it is installed by running:
sudo apt install qt5-default
before running ./build.sh in Klayout. It is also required to have the python3 development files installed before running this script:
sudo apt install python3-dev
Some QT (qmake) libraries also have to be installed: xmlpatterns, designer, multimedia, multimediawidgets, svg. Install them before running ./build.sh:
sudo apt install qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5 libqt5xmlpatterns5-dev python3-pyqt5 qtcreator pyqt5-dev-tools qttools5-* libqt5svg5-dev
Klayout should be built into a place on the system where it can be accessed. The build script should be thus modified:
sudo ./build.sh -prefix /usr/local/bin/
It should also be added to the $LD_LIBRARY_PATH variable so that the library files can be found? No, it turns out just specifying the prefix without the $LD_LIBRARY_PATH works:
./build.sh -prefix /tools/klayout/bin
Klayout should now launch correctly!

Check if the $(PWD) path in the makefile script is correct, it looks like it may be trying to go one /env too deep in line:
cd $(PWD)/env; \
confirm this when running the edited script as a whole. In order to install yaaade, the submodule must be initialised and updated:
cd ~/analogue_design_exmple
git submodule init
git submodule update
BUT: This method doesn't work. The submodule is trying to install via git@github.com:yrrapt/yaaade.git, which results in the same
Please make sure you have the correct access rights
and the repository exists
error as before. We should revert to SSH access to GitHub.

Edit back to the start of the process: Check if SSH keys have been generated on your machine:
ls -l ~/.ssh/id_*.pub
If they have, skip the key generation step. If not, generate keys using the command:
ssh-keygen -t rsa -b 4096 -C "email@domain.com"
replacing the email with your email. Do not enter a passphrase, leave it blank and hit enter through the process. You can now retrieve your ssh key: cat ~/.ssh/id_rsa.pub
Add this key to GitHub and SSH access should be enabled.

Once this is done, the yaaade submodule can be cloned and installed using pip.

When installing xyce, the trilinos build fails. It looks like there's a syntax error in the reconfigure script generation. The final line of the reconfigure script generation should read (removing the extra $ sign before SRCDIR:
echo '$SRCDIR' >> reconfigure; \
This was the case with all $ arguments in the reconfigure script. Figure out a way to ensure there are no duplicate $ symbols, namely in lines:
-DCMAKE_CXX_FLAGS="$FLAGS" \
-DCMAKE_C_FLAGS="$FLAGS" \
-DCMAKE_Fortran_FLAGS="$FLAGS" \
-DCMAKE_INSTALL_PREFIX=$ARCHDIR \


It is worth investigating whether Verilog-A(MS) support could be added using ADMS and its integrations with xyce and ngspice



It is required to source the script in the analogue_design_example directory before running xschem.

It doesn't look like any binary for ngspice actually installed, just the libraries at /user/local/include/ngspice. I haven't figured out why the binary isn't being generated yet, my workaround is to install ngspice using apt. This problem has been solved!! I compiled using the compile_linux.sh file. I then Needed to change the CFLAGS and LDFLAGS in the configure command to both be blank (these are specific to aarch64). It seems they are set up for x86_64 but not for aarch64 or x86. For aarch64, CFLAGS="" and LDFLAGS="". Also remember to enable adms in the compile script (see configure section and --enable-adms option to be passed to the compile script. Actually this is giving a make clean error when trying to compile using --enable-adms... Leaving it out for now! Remember to use sudo when running configure_linux.sh so make install has the required permissions
Make sure that the terminal used in xschemrc (which is used to invoke simulators etc) is actually installed on the system. I have switched the terminal from xterm to gnome-terminal

Make sure the environment variable $SKYWATER_MODELS is set correctly in the xschemrc, along with $SKYWATER_STDCELLS. It looks like the PDK didn't fully install to /usr/share/pdk. Retrying by setting CFLAGS="" and LDFLAGS="" ...