Skip to content

Commit

Permalink
Tiny Tapeout 04
Browse files Browse the repository at this point in the history
  • Loading branch information
urish committed Jun 15, 2023
0 parents commit fa85e1d
Show file tree
Hide file tree
Showing 47 changed files with 4,062 additions and 0 deletions.
141 changes: 141 additions & 0 deletions .github/workflows/gds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: gds
# either manually started, or on a schedule
on: [ push, workflow_dispatch ]
jobs:
gds:
env:
OPENLANE_TAG: 4a4de6ab426c8e53ae9534fdba2366a863a5af7e
SKY130_PDK_VERSION: 12df12e2e74145e31c5a13de02f9a1e176b56e67
PYTHONIOENCODING: utf-8

# ubuntu
runs-on: ubuntu-latest
steps:
# need the repo checked out
- name: checkout repo
uses: actions/checkout@v3
with:
submodules: recursive

- name: checkout tt-multiplexer repo
uses: actions/checkout@v3
with:
repository: tinytapeout/tt-multiplexer
path: tt-multiplexer
ref: tt03p5-openlane2

- name: Patch tt-multiplexer
working-directory: tt-multiplexer
run: |
git apply ../patches/tt_top_no_xor.patch
git apply ../patches/tt_top_power.patch
- name: checkout tt-support-tools repo
uses: actions/checkout@v3
with:
repository: tinytapeout/tt-support-tools
path: tt
ref: tt03p5

- name: checkout openlane2 repo
uses: actions/checkout@v3
with:
repository: efabless/openlane2
path: openlane2
ref: ${{ env.OPENLANE_TAG }}

- name: patch OpenLane 2
working-directory: openlane2
run: |
git apply ../patches/openlane2.patch
git apply ../patches/openlane2_power.patch
# Set Python up
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install -r tt-multiplexer/py/requirements.txt -r tt/requirements.txt

# Install yosys (required for tt/configure.py)
- name: install oss-cad-suite
uses: YosysHQ/setup-oss-cad-suite@v2
with:
version: '2023-05-27'
github-token: ${{ secrets.GITHUB_TOKEN }}

#- name: Fetch user project, update caravel configuration
# run: python ./tt/configure.py --clone-all --fetch-gds --update-caravel
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: cachix/install-nix-action@v20

- uses: cachix/cachix-action@v12
with:
name: openlane
extraPullNames: openlane

- name: Install Sky130 PDK
run: |
pip3 install volare
volare enable --pdk sky130 ${{ env.SKY130_PDK_VERSION }}
- name: uncompress gds files
run: gunzip -v gds/*.gds.gz

- name: Generate sources from user macro configuration
run: make gen-module-placement

# run OpenLane to build the GDS
- name: Harden tt_ctrl
working-directory: tt-multiplexer/ol2/tt_ctrl
run: nix-shell $GITHUB_WORKSPACE/openlane2/shell.nix --run "python build.py"

- name: Harden tt_mux
working-directory: tt-multiplexer/ol2/tt_mux
run: nix-shell $GITHUB_WORKSPACE/openlane2/shell.nix --run "python build.py"

- name: Copy macros
run: |
make copy-macros
cp verilog/rtl/tt_um_*.v tt-multiplexer/ol2/tt_top/verilog
- name: Harden tt_top
working-directory: tt-multiplexer/ol2/tt_top
run: nix-shell $GITHUB_WORKSPACE/openlane2/shell.nix --run "python build.py"

- name: Copy final results
working-directory: tt-multiplexer
run: |
cp ol2/tt_ctrl/runs/RUN_*/final/gds/tt_ctrl.magic.gds ../gds/tt_ctrl.gds
cp ol2/tt_ctrl/runs/RUN_*/final/lef/tt_ctrl.lef ../lef/tt_ctrl.lef
cp ol2/tt_ctrl/runs/RUN_*/final/pnl/tt_ctrl.pnl.v ../verilog/gl/tt_ctrl.v
cp ol2/tt_ctrl/runs/RUN_*/final/nl/tt_ctrl.nl.v ../verilog/gl/tt_ctrl.nl.v
cp -r ol2/tt_ctrl/runs/RUN_*/final/spef/* ../spef/
cp ol2/tt_mux/runs/RUN_*/final/gds/tt_mux.magic.gds ../gds/tt_mux.gds
cp ol2/tt_mux/runs/RUN_*/final/lef/tt_mux.lef ../lef/tt_mux.lef
cp ol2/tt_mux/runs/RUN_*/final/pnl/tt_mux.pnl.v ../verilog/gl/tt_mux.v
cp ol2/tt_mux/runs/RUN_*/final/nl/tt_mux.nl.v ../verilog/gl/tt_mux.nl.v
cp -r ol2/tt_mux/runs/RUN_*/final/spef/* ../spef/
cp ol2/tt_top/runs/RUN_*/final/gds/user_project_wrapper.magic.gds ../gds/user_project_wrapper.gds
cp ol2/tt_top/runs/RUN_*/final/lef/user_project_wrapper.lef ../lef/user_project_wrapper.lef
cp ol2/tt_top/runs/RUN_*/final/pnl/user_project_wrapper.pnl.v ../verilog/gl/user_project_wrapper.v
cp ol2/tt_top/runs/RUN_*/final/nl/user_project_wrapper.nl.v ../verilog/gl/user_project_wrapper.nl.v
cp -r ol2/tt_top/runs/RUN_*/final/spef/* ../spef/
- name: upload GDS artifact
uses: actions/upload-artifact@v3
with:
name: GDS
path: tt-multiplexer/ol2/tt_top/runs/RUN_*/*

- name: upload macros artifact
uses: actions/upload-artifact@v3
with:
name: macros
path: |
gds/*
lef/*
spef/*
verilog/gl/*
97 changes: 97 additions & 0 deletions .github/workflows/gl_verification.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: gl_verification
# either manually started, or on a schedule
on: [ push, workflow_dispatch, pull_request ]
jobs:
gl_verification:
env:
OPENLANE_TAG: 2023.02.14
OPENLANE_IMAGE_NAME: efabless/openlane:2023.05.19
OPENLANE_ROOT: /home/runner/openlane
PDK_ROOT: /home/runner/pdk
PDK: sky130A
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_USERNAME: ${{ secrets.GH_USERNAME }}
DESIGNS: /home/runner/work/tinytapeout-03p5/tinytapeout-03p5
TARGET_PATH: /home/runner/work/tinytapeout-03p5/tinytapeout-03p5
MGMT_AREA_ROOT: /home/runner/work/tinytapeout-03p5/tinytapeout-03p5/mgmt_core_wrapper
MCW_ROOT: /home/runner/work/tinytapeout-03p5/tinytapeout-03p5/mgmt_core_wrapper
CARAVEL_ROOT: /home/runner/work/tinytapeout-03p5/tinytapeout-03p5/caravel
CORE_VERILOG_PATH: /home/runner/work/tinytapeout-03p5/tinytapeout-03p5/mgmt_core_wrapper/verilog
GCC_PATH: /home/runner/riscv64-unknown-elf-gcc-8.3.0-2020.04.1-x86_64-linux-ubuntu14/bin/
GCC_PREFIX: riscv64-unknown-elf

# ubuntu
runs-on: ubuntu-latest
steps:
# need the repo checked out
- name: checkout repo
uses: actions/checkout@v3

# install the tt tools
- name: checkout tt tools repo
uses: actions/checkout@v3
with:
repository: tinytapeout/tt-support-tools
ref: tt03p5
path: tt

# install the tt mux
- name: checkout tt mux repo
uses: actions/checkout@v3
with:
repository: tinytapeout/tt-multiplexer
path: tt-multiplexer
ref: tt03p5-openlane2

# build pdk - have to move this back above to get caravel makefile
- name: pdk & openlane & precheck
run: |
make setup
# uncompress any gds commited to the repo
- name: uncompress gds
run: |
make uncompress
# need python
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- run: pip install -r tt/requirements.txt -r tt-multiplexer/proto/requirements.txt

# install oss fpga tools to get iverilog etc
- name: install oss-cad-suite
uses: YosysHQ/setup-oss-cad-suite@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: '2022-09-03' # pin the version, latest one fails to work with caravel

# fetch the repos,
- name: Fetch user project, update caravel configuration
run: python ./tt/configure.py --test --clone-all --fetch-gds --update-caravel

# generate the tt mux verilog that instantiates all the modules - use the test version
- name: module config
run: |
cp tt_test_module.yaml tt_user_module.yaml
make gen-user-module
# need the modules lef & gds
- name: ttmux GDS
run: make tt_ctrl tt_mux

# macro config, depends on the ttmux build artifacts being present
- name: macro config
run: python gen_macro_cfg.py

# user project wrapper
- name: user project wrapper GDS
run: make user_project_wrapper

# run GL test
- name: GL simulation
run: |
cd verilog/dv/mux
make clean test_mux_gl
70 changes: 70 additions & 0 deletions .github/workflows/verification.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: verification
# either manually started, or on a schedule
on: [ push, workflow_dispatch, pull_request ]
jobs:
verification:
env:
OPENLANE_ROOT: /home/runner/openlane
PDK_ROOT: /home/runner/pdk
PDK: sky130A

# ubuntu
runs-on: ubuntu-latest
steps:
# need the repo checked out
- name: checkout repo
uses: actions/checkout@v3

# install the tt tools
- name: checkout tt tools repo
uses: actions/checkout@v3
with:
repository: tinytapeout/tt-support-tools
ref: tt03p5
path: tt

# install the tt mux
- name: checkout tt mux repo
uses: actions/checkout@v3
with:
repository: tinytapeout/tt-multiplexer
path: tt-multiplexer
ref: tt03p5-openlane2

# install oss fpga tools for cocotb and iverilog
- name: install oss-cad-suite
uses: YosysHQ/setup-oss-cad-suite@v2
with:
version: '2022-09-03' # pin the version, latest one fails to work with caravel
github-token: ${{ secrets.GITHUB_TOKEN }}

# Set Python up
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install -r tt-multiplexer/py/requirements.txt
- run: pip install -r tt/requirements.txt

# fetch the repos - test mode
- name: fetch all
run: python ./tt/configure.py --clone-all --fetch-gds --debug --test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# install projects
- name: configure for test
run: python ./tt/configure.py --update-caravel --test

# generate the tt mux verilog that instantiates all the modules - use the test version
- name: module config
working-directory: tt-multiplexer
run: |
cp ../test_modules.yaml cfg/modules.yaml
make gensrc
# run first set of tests
- name: basic simulations
run: |
cd verilog/dv/mux
make clean test_mux
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
precheck_results/
venv/
48 changes: 48 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Build Tiny Tapeout 03p5 with Open Lane 2

## Environment setup

```bash
export OPENLANE2_ROOT=~/openlane
export SKY130_PDK_VERSION=12df12e2e74145e31c5a13de02f9a1e176b56e67

pip3 install volare
volare enable --pdk sky130 ${{ env.SKY130_PDK_VERSION }}

git clone https://github.com/TinyTapeout/tt-multiplexer/
pip install -r tt-multiplexer/py/requirements.txt
```

Then install OpenLane 2 with Nix, as explained [here](https://openlane2.readthedocs.io/en/latest/getting_started/nix_installation/index.html).

Clone OpenLane 2 to ~/openlane (or change the value of the OPENLANE2_ROOT environment variable).

## Fetching the projects

Set `GH_USERNAME` and `GH_TOKEN` environment variables with your GitHub username and a personal access token, respectively.
To generate your GH_TOKEN go to https://github.com/settings/tokens/new . Set the checkboxes for repo and workflow.

Then clone the tt03p5 branch from the tt-support-tools repo and install the required packages:

```bash
git clone -b tt03p5 https://github.com/tinytapeout/tt-support-tools tt
```

Finally, run the following commands to fetch the user projects and generate the configuration for the user_project_wrapper:

```bash
pip install -r tt/requirements.txt
python tt/configure.py --clone-all --fetch-gds --update-caravel
```

## Harden

```bash
cd tt-multiplexer/ol2/tt_ctrl && nix-shell ${OPENLANE2_ROOT}/shell.nix --run "python build.py"
cd tt-multiplexer/ol2/tt_mux && nix-shell ${OPENLANE2_ROOT}/shell.nix --run "python build.py"
make copy-macros
make gen-module-placement
cd tt-multiplexer/ol2/tt_top && nix-shell ${OPENLANE2_ROOT}/shell.nix --run "python build.py"
```

You'll find the final GDS in `ol2/tt_top/runs/RUN_*/final/gds/user_project_wrapper.magic.gds`.
Loading

0 comments on commit fa85e1d

Please sign in to comment.