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

Sky130 Tutorial #1115

Merged
merged 21 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0f49423
skywater tutorial doc files
nayiri-k Feb 7, 2022
f54f785
sky130 tutorial initial modifications
nayiri-k Feb 9, 2022
ee46508
updating skywater tutorial docs
nayiri-k Feb 12, 2022
9aa7d7e
cleaned up file
nayiri-k Feb 12, 2022
9eb1a04
Merge branch 'dev-sky130' of https://github.com/ucb-bar/chipyard into…
nayiri-k Feb 12, 2022
ab9b084
fixing small bug
nayiri-k Feb 12, 2022
1945ca8
fixed name of entry script to example-vlsi-sky130
nayiri-k Feb 15, 2022
743865d
Merge branch 'dev-sky130' of https://github.com/ucb-bar/chipyard into…
nayiri-k Feb 15, 2022
7442eda
minor formatting fixes, changing name from Tutorial to ASAP7-Tutorial
nayiri-k Feb 16, 2022
4956a93
changing clock to clock_clock [skip ci]
nayiri-k Feb 16, 2022
e9b1c48
removing extra space [skip ci]
nayiri-k Feb 16, 2022
dc17b85
bumping hammer cadence plugin to lastest master commit [skip ci]
nayiri-k Feb 16, 2022
488e25c
modified power straps and floorplan to improve PnR results [skip ci]
nayiri-k Feb 16, 2022
cbf5f9f
adding FSDB note
nayiri-k Feb 16, 2022
c076b74
Merge branch 'dev-sky130' of https://github.com/ucb-bar/chipyard into…
nayiri-k Feb 16, 2022
82d151c
adding layer explanation [skip ci]
nayiri-k Feb 16, 2022
30db79a
bumping synopsys plugins submodule [skip ci]
nayiri-k Feb 16, 2022
cc777d1
bumping hammer submodule to include sky130 changes [skip ci]
nayiri-k Feb 16, 2022
fbca9ee
attempting to fix hammer conflict [skip ci]
nayiri-k Feb 16, 2022
98e62b4
attempting to fix hammer conflict [skip ci]
nayiri-k Feb 16, 2022
70be8ac
Merge remote-tracking branch 'origin/dev' into dev-sky130 [ci skip]
abejgonzalez Feb 16, 2022
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
157 changes: 157 additions & 0 deletions docs/VLSI/Sky130-Tutorial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
.. _sky130-tutorial:

Sky130 Tutorial
===============
The ``vlsi`` folder of this repository contains an example Hammer flow with the SHA-3 accelerator and a dummy hard macro. This example tutorial uses the built-in Sky130 technology plugin and requires access to the included Cadence and Mentor tool plugin submodules. Cadence is necessary for synthesis & place-and-route, while Mentor is needed for DRC & LVS.

Project Structure
-----------------

This example gives a suggested file structure and build system. The ``vlsi/`` folder will eventually contain the following files and folders:

* Makefile, sim.mk, power.mk
nayiri-k marked this conversation as resolved.
Show resolved Hide resolved

* Integration of Hammer's build system into Chipyard and abstracts away some Hammer commands.

* build
nayiri-k marked this conversation as resolved.
Show resolved Hide resolved

* Hammer output directory. Can be changed with the ``OBJ_DIR`` variable.
* Will contain subdirectories such as ``syn-rundir`` and ``par-rundir`` and the ``inputs.yml`` denoting the top module and input Verilog files.

* env.yml
nayiri-k marked this conversation as resolved.
Show resolved Hide resolved

* A template file for tool environment configuration. Fill in the install and license server paths for your environment.

* example-vlsi

* Entry point to Hammer. Contains example placeholders for hooks.

* example-sky130.yml, example-tools.yml
nayiri-k marked this conversation as resolved.
Show resolved Hide resolved

* Hammer IR for this tutorial.

* example-design.yml, example-nangate45.yml, example-tech.yml
harrisonliew marked this conversation as resolved.
Show resolved Hide resolved

* Hammer IR not used for this tutorial but provided as templates.

* generated-src
nayiri-k marked this conversation as resolved.
Show resolved Hide resolved

* All of the elaborated Chisel and FIRRTL.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also mention that this contains other collateral emitted from the generators.


* hammer, hammer-<vendor>-plugins, hammer-<tech>-plugin
nayiri-k marked this conversation as resolved.
Show resolved Hide resolved

* Core, tool, tech repositories.

Prerequisites
-------------

* Python 3.4+
* numpy package
* Genus, Innovus, and Calibre licenses
* Sky130 PDK, install using `these directions <https://github.com/ucb-bar/hammer/blob/master/src/hammer-vlsi/technology/sky130/README.md>`__

Initial Setup
-------------
In the Chipyard root, run:

.. code-block:: shell

./scripts/init-vlsi.sh sky130

to pull the Hammer & plugin submodules. Note that for technologies other than ``sky130`` or ``asap7``, the tech submodule must be added in the ``vlsi`` folder first.

Pull the Hammer environment into the shell:

.. code-block:: shell

cd vlsi
export HAMMER_HOME=$PWD/hammer
source $HAMMER_HOME/sourceme.sh

Building the Design
--------------------
To elaborate the ``TinyRocketConfig`` and set up all prerequisites for the build system to push the design and SRAM macros through the flow:

.. code-block:: shell

make buildfile tech_name=sky130 CONFIG=TinyRocketConfig

The ``CONFIG=TinyRocketConfig`` selects the target generator config in the same manner as the rest of the Chipyard framework. This elaborates a stripped-down Rocket Chip in the interest of minimizing tool runtime.

For the curious, ``make buildfile`` generates a set of Make targets in ``build/hammer.d``. It needs to be re-run if environment variables are changed. It is recommended that you edit these variables directly in the Makefile rather than exporting them to your shell environment.

Running the VLSI Flow
---------------------

example-vlsi
nayiri-k marked this conversation as resolved.
Show resolved Hide resolved
^^^^^^^^^^^^
This is the entry script with placeholders for hooks. In the ``ExampleDriver`` class, a list of hooks is passed in the ``get_extra_par_hooks``. Hooks are additional snippets of python and TCL (via ``x.append()``) to extend the Hammer APIs. Hooks can be inserted using the ``make_pre/post/replacement_hook`` methods as shown in this example. Refer to the Hammer documentation on hooks for a detailed description of how these are injected into the VLSI flow.
nayiri-k marked this conversation as resolved.
Show resolved Hide resolved


example-sky130.yml
nayiri-k marked this conversation as resolved.
Show resolved Hide resolved
^^^^^^^^^^^^^^^^^^
This contains the Hammer configuration for this example project. Example clock constraints, power straps definitions, placement constraints, and pin constraints are given. Additional configuration for the extra libraries and tools are at the bottom.

First, set ``technology.sky130.sky130A`` to the absolute path to the ``sky130A`` directory containing the Sky130 PDK files. See the
`Sky130 Hammer plugin README <https://github.com/ucb-bar/hammer/blob/sky130sram/src/hammer-vlsi/technology/sky130/README.md>`__
for details about the PDK setup.


Synthesis
^^^^^^^^^
.. code-block:: shell

make syn tech_name=sky130 CONFIG=TinyRocketConfig

Post-synthesis logs and collateral are in ``build/syn-rundir``. The raw QoR data is available at ``build/syn-rundir/reports``, and methods to extract this information for design space exploration are a WIP.
nayiri-k marked this conversation as resolved.
Show resolved Hide resolved

Place-and-Route
^^^^^^^^^^^^^^^
.. code-block:: shell

make par tech_name=sky130 CONFIG=TinyRocketConfig

After completion, the final database can be opened in an interactive Innovus session via ``./build/par-rundir/generated-scripts/open_chip``.

Intermediate database are written in ``build/par-rundir`` between each step of the ``par`` action, and can be restored in an interactive Innovus session as desired for debugging purposes.

Timing reports are found in ``build/par-rundir/timingReports``. They are gzipped text files.

DRC & LVS
^^^^^^^^^
To run DRC & LVS, and view the results in Calibre:

.. code-block:: shell

make drc tech_name=sky130 CONFIG=TinyRocketConfig
./build/chipyard.TestHarness.TinyRocketConfig-ChipTop/drc-rundir/generated-scripts/view_drc
make lvs tech_name=sky130 CONFIG=TinyRocketConfig
./build/chipyard.TestHarness.TinyRocketConfig-ChipTop/lvs-rundir/generated-scripts/view_lvs

Some DRC errors are expected from this PDK, especially with regards to the SRAMs, as explained in the
`Sky130 Hammer plugin README <https://github.com/ucb-bar/hammer/blob/master/src/hammer-vlsi/technology/sky130/README.md>`__.
For this reason, the ``example-vlsi`` script black-boxes the SRAMs for DRC/LVS analysis.

Simulation
^^^^^^^^^^
Simulation with VCS is supported, and can be run at the RTL- or gate-level (post-synthesis and post-P&R). The simulation infrastructure as included here is intended for running RISC-V binaries on a Chipyard config. For example, for an RTL-level simulation:

.. code-block:: shell

make sim-rtl CONFIG=TinyRocketConfig BINARY=$RISCV/riscv64-unknown-elf/share/riscv-tests/isa/rv64ui-p-simple

Post-synthesis and post-P&R simulations use the ``sim-syn`` and ``sim-par`` make targets, respectively.

Appending ``-debug`` and ``-debug-timing`` to these make targets will instruct VCS to write a SAIF + VPD and do timing-annotated simulations, respectively. See the ``sim.mk`` file for all available targets.
harrisonliew marked this conversation as resolved.
Show resolved Hide resolved

Power/Rail Analysis
^^^^^^^^^^^^^^^^^^^
Post-P&R power and rail (IR drop) analysis is supported with Voltus:

.. code-block:: shell

make power-par tech_name=sky130 CONFIG=TinyRocketConfig

If you append the ``BINARY`` variable to the command, it will use the activity file generated from a ``sim-<syn/par>-debug`` run and report dynamic power & IR drop from the toggles encoded in the waveform.

To bypass gate-level simulation, you will need to run the power tool manually (see the generated commands in the generated ``hammer.d`` buildfile). Static and active (vectorless) power & IR drop will be reported.
1 change: 1 addition & 0 deletions docs/VLSI/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ In particular, we aim to support the Hammer physical design generator flow.
Hammer
Basic-Flow
Tutorial
Sky130-Tutorial
Advanced-Usage
2 changes: 1 addition & 1 deletion scripts/init-vlsi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ git submodule update --init --recursive vlsi/hammer-synopsys-plugins
git submodule update --init --recursive vlsi/hammer-mentor-plugins

# Initialize HAMMER tech plugin
if [[ $1 != *asap7* ]]; then
if [[ $1 != *asap7* ]] && [[ $1 != *sky130* ]]; then
git submodule update --init --recursive vlsi/hammer-$1-plugin
fi
10 changes: 7 additions & 3 deletions vlsi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include $(base_dir)/variables.mk
#########################################################################################
sim_name ?= vcs # needed for GenerateSimFiles, but is unused
tech_name ?= asap7
tech_dir ?= $(if $(filter $(tech_name),asap7 nangate45),\
tech_dir ?= $(if $(filter $(tech_name),sky130 asap7 nangate45),\
$(vlsi_dir)/hammer/src/hammer-vlsi/technology/$(tech_name), \
$(vlsi_dir)/hammer-$(tech_name)-plugin/$(tech_name))
SMEMS_COMP ?= $(tech_dir)/sram-compiler.json
Expand All @@ -36,8 +36,12 @@ ENV_YML ?= $(vlsi_dir)/env.yml
INPUT_CONFS ?= example-tools.yml \
$(if $(filter $(tech_name),nangate45),\
example-nangate45.yml,\
example-asap7.yml)
HAMMER_EXEC ?= ./example-vlsi
$(if $(filter $(tech_name),asap7),\
example-asap7.yml,\
example-sky130.yml))
HAMMER_EXEC ?= $(if $(filter $(tech_name),sky130),\
./example-vlsi-sky130,\
./example-vlsi)
VLSI_TOP ?= $(TOP)
VLSI_HARNESS_DUT_NAME ?= chiptop
# If overriding, this should be relative to $(vlsi_dir)
Expand Down
191 changes: 191 additions & 0 deletions vlsi/example-sky130.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
# Technology Setup
# Technology used is Sky130
vlsi.core.technology: sky130

vlsi.core.max_threads: 12

# Technology paths
technology.sky130:
sky130_pdk: "path-to-skywater-pdk/"
sky130_nda: "path-to-skywater-src-nda/"
sky130A: "path-to-sky130A/"
openram_lib: "path-to-sky130_sram_macros/"

# Mentor environment variables
mentor.extra_env_vars:
- PDK_HOME: "path-to-skywater-src-nda/s8/V2.0.1"
nayiri-k marked this conversation as resolved.
Show resolved Hide resolved

# General Hammer Inputs

# Hammer will auto-generate a CPF for simple power designs; see hammer/src/hammer-vlsi/defaults.yml for more info
vlsi.inputs.power_spec_mode: "auto"
vlsi.inputs.power_spec_type: "cpf"

# Specify clock signals
vlsi.inputs.clocks: [
{name: "clock_clock", period: "200ns", uncertainty: "10ns"}
nayiri-k marked this conversation as resolved.
Show resolved Hide resolved
]

# Generate Make include to aid in flow
vlsi.core.build_system: make

# Power Straps
par.power_straps_mode: generate
par.generate_power_straps_method: by_tracks
par.blockage_spacing: 2.0
par.generate_power_straps_options:
by_tracks:
strap_layers:
- met2
- met3
- met4
- met5
pin_layers:
- met5
track_width: 6
track_width_met5: 2
track_spacing: 1
track_start: 10
power_utilization: 0.2
power_utilization_met5: 1

# Placement Constraints
vlsi.inputs.placement_constraints:
- path: "ChipTop"
type: toplevel
x: 0
y: 0
width: 4000
height: 3000
margins:
left: 0
right: 0
top: 0
bottom: 0

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/dcache/data/data_arrays_0/data_arrays_0_ext/mem_0_0"
type: hardmacro
x: 30
y: 2190
orientation: r0
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/dcache/data/data_arrays_0/data_arrays_0_ext/mem_1_0"
type: hardmacro
x: 30
y: 1530
orientation: mx
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/dcache/data/data_arrays_0/data_arrays_0_ext/mem_2_0"
type: hardmacro
x: 30
y: 1030
orientation: mx
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/dcache/data/data_arrays_0/data_arrays_0_ext/mem_3_0"
type: hardmacro
x: 30
y: 530
orientation: mx
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/dcache/data/data_arrays_0/data_arrays_0_ext/mem_4_0"
type: hardmacro
x: 30
y: 30
orientation: mx
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/dcache/data/data_arrays_0/data_arrays_0_ext/mem_5_0"
type: hardmacro
x: 1110
y: 30
orientation: mx
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/dcache/data/data_arrays_0/data_arrays_0_ext/mem_6_0"
type: hardmacro
x: 2150
y: 30
orientation: mx
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/dcache/data/data_arrays_0/data_arrays_0_ext/mem_7_0"
type: hardmacro
x: 2150
y: 530
orientation: mx
top_layer: "met4"



- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/frontend/icache/data_arrays_0/data_arrays_0_0_ext/mem_0_0"
type: hardmacro
x: 2150
y: 1550
orientation: mx
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/frontend/icache/data_arrays_0/data_arrays_0_0_ext/mem_1_0"
type: hardmacro
x: 2150
y: 1030
orientation: r0
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/frontend/icache/tag_array/tag_array_ext/mem_0_0"
type: hardmacro
x: 2350
y: 2200
orientation: r0
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/ptw/l2_tlb_ram/l2_tlb_ram_ext/mem_0_0"
type: hardmacro
x: 3100
y: 30
orientation: "r0"
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/ptw/l2_tlb_ram/l2_tlb_ram_ext/mem_0_1"
type: hardmacro
x: 3100
y: 530
orientation: "r0"
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/ptw/l2_tlb_ram/l2_tlb_ram_ext/mem_0_2"
type: hardmacro
x: 3100
y: 1030
orientation: "r0"
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/ptw/l2_tlb_ram/l2_tlb_ram_ext/mem_0_3"
type: hardmacro
x: 3100
y: 1530
orientation: "r0"
top_layer: "met4"

- path: "ChipTop/system/tile_prci_domain/tile_reset_domain/tile/ptw/l2_tlb_ram/l2_tlb_ram_ext/mem_0_4"
type: hardmacro
x: 3100
y: 2190
orientation: "r0"
top_layer: "met4"

# Pin placement constraints
vlsi.inputs.pin_mode: generated
vlsi.inputs.pin.generate_mode: semi_auto
vlsi.inputs.pin.assignments: [
{pins: "*", layers: ["met2", "met4"], side: "bottom"}
]

# SRAM Compiler compiler options
vlsi.core.sram_generator_tool: "sram_compiler"
# You should specify a location for the SRAM generator in the tech plugin
vlsi.core.sram_generator_tool_path: ["hammer/src/hammer-vlsi/technology/sky130"]
vlsi.core.sram_generator_tool_path_meta: "append"
Loading