SkyWater 130nm PDK & Magic VLSI Installation Guide

This document provides a comprehensive, step-by-step guide to installing the open-source SkyWater 130nm Process Design Kit (PDK) and integrating it with Magic VLSI, a powerful open-source layout tool. The SkyWater 130nm PDK is a fully open-source technology, enabling accessible and collaborative chip design. By following these instructions, you will set up your environment to create and verify custom layouts using industry-standard processes.

1. Prerequisites

Before proceeding with the installation, ensure your system meets the following requirements and has the necessary tools installed. These instructions are primarily for **Ubuntu/Debian-based Linux distributions**.

Operating System:

  • Linux (Ubuntu/Debian recommended)
  • For Windows users: Windows Subsystem for Linux (WSL) is highly recommended.

Disk Space:

The SkyWater 130nm PDK is large. Allocate at least **40-50 GB** of free disk space for the PDK and associated tools.

Essential Tools & Libraries:

Update your package list and install common build tools and libraries:

sudo apt update
sudo apt upgrade
sudo apt install -y git build-essential flex bison m4 tcsh csh libx11-dev tcl-dev tk-dev libcairo2-dev libncurses-dev libglu1-mesa-dev mesa-common-dev python3 python3-pip

2. Step-by-Step Installation

This section guides you through installing Magic VLSI from source and then using `volare` to install and manage the SkyWater 130nm PDK.

2.1. Install Magic VLSI (from Source)

It's recommended to install the latest version of Magic directly from its GitHub repository for best compatibility with the PDK.

# Clone the Magic VLSI repository
git clone https://github.com/RTimothyEdwards/magic.git git_magic
cd git_magic

# Configure, compile, and install Magic
./configure
make -j$(nproc) # Use -j followed by the number of CPU cores for faster compilation
sudo make install

# Navigate back to your home directory or desired working directory
cd ..

2.2. Install SkyWater 130nm PDK using `volare`

`volare` is a Python-based tool that simplifies the process of downloading and configuring open-source PDKs.

a. Install `volare` Python Package:

pip install volare

b. Define `PDK_ROOT` Environment Variable:

This variable tells `volare` and other EDA tools where the PDK files are located. It's crucial to set this permanently.

# Set PDK_ROOT for the current session
export PDK_ROOT="$HOME/pdk"
mkdir -p $PDK_ROOT

# Add to .bashrc for permanent setting (open a new terminal after this)
echo 'export PDK_ROOT="$HOME/pdk"' >> ~/.bashrc
source ~/.bashrc

c. List Available SkyWater 130nm Releases:

This command shows the available versions of the PDK, identified by a Git commit hash. Choose a recent, stable one.

volare ls-remote --pdk sky130

Example output (hashes will vary):

Pre-built sky130 PDK versions
├── 44a43c23c81b45b8e774ae7a84899a5a778b6b0b (2022.08.16) (enabled)
├── e8294524e5f67c533c5d0c3afa0bcc5b2a5fa066 (2022.07.29)
└── ...

d. Enable (Install) a Specific PDK Release:

Replace `` with the hash you chose from the previous step. This will download and set up the PDK.

volare enable --pdk sky130 <commit_hash>
# Example: volare enable --pdk sky130 cd1748bb197f9b7af62a54507de6624e30363943

This step can take a considerable amount of time depending on your internet speed, as it downloads several gigabytes of data.

3. Configuring Magic for SkyWater 130nm

Once the PDK is installed, you need to tell Magic where to find the technology files (`sky130A.magicrc`) that define all the layers, design rules, and other process-specific information.

3.1. Create a Project Directory:

It's good practice to create a dedicated directory for your design files. Magic will look for its configuration file (`.magicrc`) in the directory where it's launched.

mkdir -p ~/my_sky130_designs/magic_layouts
cd ~/my_sky130_designs/magic_layouts

3.2. Create a Symbolic Link to the Magic Configuration File:

This link tells Magic to use the SkyWater 130nm technology when you launch it from this directory.

ln -s $PDK_ROOT/sky130A/libs.tech/magic/sky130A.magicrc .magicrc

This command creates a hidden file named `.magicrc` in your current directory, pointing to the actual PDK configuration file installed by `volare`.

3.3. Launch Magic:

Now, simply launch Magic from your project directory.

magic

4. Verification

After launching Magic, verify that the SkyWater 130nm PDK has been loaded successfully.

Check Magic Console Output:

Look for a line similar to this at the beginning of Magic's console output:

Using technology "sky130A", version X.X

If you see `Using technology "minimum"`, it means the PDK's technology file was not loaded. Re-check the `PDK_ROOT` environment variable and the symbolic link creation in the previous steps.

Verify with `tech help` Command:

Inside the Magic command prompt (the Tcl console window), type:

:tech help

You should see `sky130A` listed as an available technology. This confirms Magic recognizes the PDK.

5. Basic Usage Example (Tcl Script)

Now that your environment is set up, let's run a simple Tcl script to create a basic layout using SkyWater 130nm layers. This script will draw an inverter.

Create the Tcl Script (`inverter.tcl`):

Save the following content into a file named `inverter.tcl` in your `~/my_sky130_designs/magic_layouts` directory:

# This script creates a simple inverter layout using SkyWater 130nm layers.

# Define a procedure to create and draw a simple inverter
proc create_inverter {cell_name} {
    # Create a new cell
    puts "Creating cell: $cell_name"
    load $cell_name new

    # Ensure sky130A technology is loaded
    if {![info exists ::tech::current]} {
        if {[catch {tech sky130A} errMsg]} {
            puts "ERROR: Failed to load 'sky130A' technology. Reason: $errMsg"
            puts "Please ensure SkyWater 130nm PDK is correctly installed and configured."
            puts "Exiting script due to technology loading failure."
            exit 1
        }
        puts "Successfully loaded 'sky130A' technology."
    } elseif {$::tech::current ne "sky130A"} {
        puts "Warning: Current technology is '$::tech::current', not 'sky130A'. Attempting to switch."
        if {[catch {tech sky130A} errMsg]} {
            puts "ERROR: Failed to switch to 'sky130A' technology. Reason: $errMsg"
            puts "Exiting script due to technology switching failure."
            exit 1
        }
        puts "Successfully switched to 'sky130A' technology."
    }

    # Define some common SkyWater 130nm layer names
    set NDIFF "ndiff"
    set PDIFF "pdiff"
    set POLY "poly"
    set LI1 "li1"        ; # Local Interconnect 1
    set M1 "met1"        ; # Metal 1
    set VIA "via"        ; # Via between LI1 and M1
    set CONT "contact"   ; # Contact between diffusion/poly and LI1

    # NMOS Transistor (simplified)
    # N-diffusion
    box 0 0 1 1.5
    paint $NDIFF
    box 2 0 3 1.5
    paint $NDIFF
    # Poly gate
    box 0.5 -0.25 2.5 1.75
    paint $POLY
    # Contacts to N-diffusion
    box 0.25 0.25 0.75 0.75
    paint $CONT
    box 2.25 0.25 2.75 0.75
    paint $CONT
    # Local interconnect 1 over contacts
    box 0.25 0.25 0.75 0.75
    paint $LI1
    box 2.25 0.25 2.75 0.75
    paint $LI1

    # PMOS Transistor (simplified)
    # P-diffusion
    box 0 3 1 4.5
    paint $PDIFF
    box 2 3 3 4.5
    paint $PDIFF
    # Poly gate (shared with NMOS)
    box 0.5 2.75 2.5 4.75
    paint $POLY
    # Contacts to P-diffusion
    box 0.25 3.25 0.75 3.75
    paint $CONT
    box 2.25 3.25 2.75 3.75
    paint $CONT
    # Local interconnect 1 over contacts
    box 0.25 3.25 0.75 3.75
    paint $LI1
    box 2.25 3.25 2.75 3.75
    paint $LI1

    # Connect Poly gates (Input)
    box 1 1.5 2 3
    paint $POLY

    # Connect to Metal 1 (VDD, GND, Output)
    # VDD (top)
    box -0.5 4.25 3.5 4.75
    paint $M1
    label VDD -0.5 4.5 $M1
    # GND (bottom)
    box -0.5 -0.5 3.5 0
    paint $M1
    label GND -0.5 -0.25 $M1
    # Output (between NMOS and PMOS)
    box 0.25 1.25 0.75 3.25
    paint $M1
    label OUT 0.5 2.25 $M1
    # Input
    box 1 1.75 2 2.75
    paint $M1
    label IN 1.5 2.25 $M1

    # Add vias/contacts to connect layers
    box 0.25 0.25 0.75 0.75
    paint $VIA ; # Connect LI1 to M1
    box 2.25 0.25 2.75 0.75
    paint $VIA
    box 0.25 3.25 0.75 3.75
    paint $VIA
    box 2.25 3.25 2.75 3.75
    paint $VIA

    # Save the cell
    puts "Saving cell: $cell_name"
    save $cell_name
}

# --- Main execution flow ---

# Call the procedure to create an inverter cell
create_inverter "sky130_inverter"

# Load the newly created cell to make it current
load sky130_inverter

# Perform extraction on the current cell
puts "Performing extraction..."
extract all
extract write spice {current_cell}.spice
puts "Extraction complete. Netlist saved to {current_cell}.spice"

# Fit the view to the current cell
fit

puts "Script finished successfully!"
```

Run the Script in Magic:

With Magic open and running in your `~/my_sky130_designs/magic_layouts` directory, type the following command in the Magic Tcl console:

:source inverter.tcl

Magic will execute the script, create the `sky130_inverter.mag` layout file, and generate a `sky130_inverter.spice` netlist. You should see the inverter layout appear in the Magic layout window.