Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate hspice models #244

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# syntax = docker/dockerfile:1.0-experimental
FROM centos:centos8 as build

RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

# Common development tools and libraries (kitchen sink approach)
RUN yum groupinstall -y "Development Tools"
# "Development Libraries"
Expand Down
18 changes: 2 additions & 16 deletions .github/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

OPEN_PDKS_ROOT ?= $(shell pwd)/..
THREADS ?= $(shell nproc)
STD_CELL_LIBRARY ?= sky130_fd_sc_hd
SKYWATER_COMMIT ?= b5ff6174d9aa921f670f12a2893969fe4a516f6c

.DEFAULT_GOAL := all
Expand All @@ -38,19 +37,7 @@ skywater-pdk: $(PDK_ROOT)/skywater-pdk
.PHONY: skywater-library
skywater-library: $(PDK_ROOT)/skywater-pdk
cd $(PDK_ROOT)/skywater-pdk && \
git submodule update --init libraries/$(STD_CELL_LIBRARY)/latest && \
$(MAKE) -j$(THREADS) $(STD_CELL_LIBRARY)

.PHONY: all-skywater-libraries
all-skywater-libraries: skywater-pdk
cd $(PDK_ROOT)/skywater-pdk && \
git submodule update --init libraries/sky130_fd_sc_hd/latest && \
git submodule update --init libraries/sky130_fd_sc_hs/latest && \
git submodule update --init libraries/sky130_fd_sc_hdll/latest && \
git submodule update --init libraries/sky130_fd_sc_ms/latest && \
git submodule update --init libraries/sky130_fd_sc_ls/latest && \
git submodule update --init libraries/sky130_fd_sc_hvl/latest && \
$(MAKE) -j$(THREADS) timing
git submodule update --init libraries/sky130_fd_pr/latest

.PHONY: build-pdk
build-pdk: $(PDK_ROOT)/skywater-pdk
Expand All @@ -67,5 +54,4 @@ build-pdk: $(PDK_ROOT)/skywater-pdk
&& \
cd sky130 && \
$(MAKE) veryclean && \
$(MAKE) && \
$(MAKE) install-local
$(MAKE) primitive-A
23 changes: 1 addition & 22 deletions .github/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,9 @@ echo ::endgroup::

echo ::group::make skywater-pdk
make skywater-pdk
make skywater-library
echo ::endgroup::

if [ x"$STD_CELL_LIBRARY" = xall ]; then
cnt=0
until make all-skywater-libraries; do
cnt=$((cnt+1))
if [ $cnt -eq 5 ]; then
exit 2
fi
rm -rf $PDK_ROOT/skywater-pdk
make skywater-pdk
done
else
cnt=0
until make skywater-library; do
cnt=$((cnt+1))
if [ $cnt -eq 5 ]; then
exit 2
fi
rm -rf $PDK_ROOT/skywater-pdk
make skywater-pdk
done
fi

cd ..

docker run \
Expand Down
32 changes: 5 additions & 27 deletions .github/capture.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@

mkdir -p ${GITHUB_WORKSPACE}/output/

# Copy build log.
cp ./sky130/sky130A_install.log ${GITHUB_WORKSPACE}/output/

# Copy any core dupmps into the output directory.
find . -name core -not \( -path '*/skywater-pdk/*' -prune \) | \
awk -v ln=1 '{print "cp " $0 " ${GITHUB_WORKSPACE}/output/core." ln++ }' | \
Expand All @@ -29,15 +26,15 @@ cp .github/magic.tar.gz ${GITHUB_WORKSPACE}/output/
# Try to create a deterministic tar file
# https://reproducible-builds.org/docs/archives/
(
SKY130_DIR="$(pwd)/pdks/pdk/sky130A"
if ! [[ -d $SKY130_DIR ]]; then
echo "Missing $SKY130_DIR"
HSPICE_DIR="$(pwd)/sky130/sky130A/libs.tech/hspice"
if ! [[ -d $HSPICE_DIR ]]; then
echo "Missing $HSPICE_DIR"
exit -1
fi

echo ::group::PDK tarball

cd ${SKY130_DIR}
cd ${HSPICE_DIR}
tar \
--create \
--bzip2 \
Expand All @@ -50,30 +47,11 @@ cp .github/magic.tar.gz ${GITHUB_WORKSPACE}/output/
--numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
\
--file ${GITHUB_WORKSPACE}/output/pdk-SKY130A-${STD_CELL_LIBRARY}.tar.bz2 .
--file ${GITHUB_WORKSPACE}/output/hspice-model.tar.bz2 .

echo ::endgroup::
)

# Free up disk space so the GitHub Action runner doesn't die when collecting
# the artifacts.
echo ::group::Freeup space

df -h

for DIR in ${GITHUB_WORKSPACE}/*; do
if [ x$DIR = x"${GITHUB_WORKSPACE}/output" ]; then
continue
fi
echo
echo "Removing $DIR"
rm -rvf $DIR
done

df -h

echo ::endgroup::

# Output which files are being saved.
echo ::group::Output files
du -h ${GITHUB_WORKSPACE}/output/*
Expand Down
38 changes: 0 additions & 38 deletions .github/test.sh

This file was deleted.

24 changes: 14 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ name: CI

on:
push:
branches:
- hspice
tags:
- 1.*
pull_request:
branches:
- hspice
workflow_dispatch:


Expand All @@ -13,12 +19,6 @@ jobs:
fail-fast: false
matrix:
library:
- sky130_fd_sc_hd
- sky130_fd_sc_hdll
- sky130_fd_sc_hs
- sky130_fd_sc_ms
- sky130_fd_sc_ls
- sky130_fd_sc_hvl
- all
env:
STD_CELL_LIBRARY: ${{ matrix.library }}
Expand All @@ -35,10 +35,6 @@ jobs:
run: |
bash .github/build.sh

- name: Test
run: |
bash .github/test.sh

- name: Capture
if: ${{ always() }}
run: |
Expand All @@ -50,3 +46,11 @@ jobs:
with:
name: ${{ matrix.library }}
path: ${{ github.workspace }}/output/**
- name: Release
uses: softprops/action-gh-release@v1
id: create_release
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ github.workspace }}/output/hspice-model.tar.bz2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 26 additions & 5 deletions scripts/configure
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ XSCHEM_SKY130_PATH
SKY130_ML_XX_HD_PATH
PATCH
MAGIC
HSPICE_DISABLED
XSCHEM_DISABLED
QFLOW_DISABLED
OPENLANE_DISABLED
Expand Down Expand Up @@ -670,6 +671,7 @@ enable_irsim
enable_openlane
enable_qflow
enable_xschem
enable_hspice
enable_alpha_sky130
enable_xschem_sky130
enable_sram_sky130
Expand Down Expand Up @@ -1323,6 +1325,10 @@ Optional Features:
Enable or disable xschem setup [default=enabled]


--enable-hspice
Enable or disable hspice setup [default=enabled]


--enable-alpha-sky130[=path]
Install sky130_ml_xx_hd. If path is omitted, the repository
will be downloaded. [default=enabled]
Expand Down Expand Up @@ -1834,7 +1840,7 @@ if ${am_cv_pathless_PYTHON+:} false; then :
$as_echo_n "(cached) " >&6
else

for am_cv_pathless_PYTHON in python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
for am_cv_pathless_PYTHON in python python2 python3 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
test "$am_cv_pathless_PYTHON" = none && break
prog="import sys
# split strings by '.' and convert to numeric. Append some zeros
Expand Down Expand Up @@ -2295,8 +2301,8 @@ ALL_TECHS="sky130"
# Set variables for tool setups


{ $as_echo "$as_me:${as_lineno-$LINENO}: Found tools: klayout magic netgen irsim openlane qflow xschem" >&5
$as_echo "$as_me: Found tools: klayout magic netgen irsim openlane qflow xschem" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found tools: klayout magic netgen irsim openlane qflow xschem hspice" >&5
$as_echo "$as_me: Found tools: klayout magic netgen irsim openlane qflow xschem hspice" >&6;}



Expand Down Expand Up @@ -2407,6 +2413,21 @@ fi



HSPICE_DISABLED=0
# Check whether --enable-hspice was given.
if test "${enable_hspice+set}" = set; then :
enableval=$enable_hspice;
if test "$enableval" == "no" -o "$enableval" == "NO"; then
HSPICE_DISABLED=1
fi


fi





# Magic
# Extract the first word of "magic", so it can be a program name with args.
set dummy magic; ac_word=$2
Expand Down Expand Up @@ -2753,8 +2774,8 @@ fi



{ $as_echo "$as_me:${as_lineno-$LINENO}: Tools enabled for PDK setup installation: klayout magic netgen irsim openlane qflow xschem" >&5
$as_echo "$as_me: Tools enabled for PDK setup installation: klayout magic netgen irsim openlane qflow xschem" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: Tools enabled for PDK setup installation: klayout magic netgen irsim openlane qflow xschem hspice" >&5
$as_echo "$as_me: Tools enabled for PDK setup installation: klayout magic netgen irsim openlane qflow xschem hspice" >&6;}

# Check for "--with-ef-style"
EF_STYLE=0
Expand Down
1 change: 1 addition & 0 deletions scripts/tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ irsim
openlane
qflow
xschem
hspice
19 changes: 19 additions & 0 deletions sky130/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ ifneq (${XCIRCUIT_DISABLED}, 1)
TOOLS += xcircuit
endif


HSPICE_DISABLED=@HSPICE_DISABLED@

# These definitions depend on the setting of EF_STYLE
ifeq (${EF_STYLE}, 1)
IO_VERILOG = verilog/sky130_fd_io
Expand Down Expand Up @@ -1169,6 +1172,22 @@ primitive-%:
# Custom: Add "spinit" file
cat ./custom/models/spinit >> \
${STAGING_PATH}/${SKY130$*}/libs.tech/ngspice/spinit

ifneq (${HSPICE_DISABLED}, 1)
make hspice-build-$*;
endif

hspice-build-%:
# Convert sky130$* ngspice models files to hspice format
${STAGE} -source ${STAGING_PATH}/${SKY130$*} -target ${STAGING_PATH}/${SKY130$*} \
-hspice libs.tech/ngspice/* \
filter=custom/scripts/convert_hspice.py \
2>&1 | tee -a ${SKY130$*}_make.log
# Copy libs.ref spice to hspice
${STAGE} -source ${STAGING_PATH}/${SKY130$*}/libs.ref -target ${STAGING_PATH}/${SKY130$*} \
-hspice/spi ${PR_SPICE}/* \
filter=custom/scripts/convert_hspice.py \
2>&1 | tee -a ${SKY130$*}_make.log

io-%:
# Install custom additions to I/O pad library
Expand Down
Loading