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-OpenROAD Chipyard Tutorial, OpenROAD plugin fixes, Key History, Tempus, Joules, FGP opt-in #1226

Merged
merged 34 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
cb64741
skeleton for sky130 commercial vs open source tutorial
nayiri-k Sep 3, 2022
1ef194e
updated Makefile
nayiri-k Sep 7, 2022
ede3a10
sky130+openroad tutorial docs, still need some work
nayiri-k Sep 14, 2022
64620e2
Merge branch 'openroad' of https://github.com/ucb-bar/chipyard into o…
nayiri-k Sep 14, 2022
9c7e5fc
tutorial tweaks
nayiri-k Sep 14, 2022
5c48d03
removing sky130_pdk key from yaml
nayiri-k Sep 14, 2022
2371465
Update Sky130-OpenROAD-Tutorial.rst
nayiri-k Sep 14, 2022
052c7a7
updates to README
nayiri-k Sep 15, 2022
4ee1acc
commenting out the sram macro placement FOR NOW
nayiri-k Sep 15, 2022
7ad7735
Merge branch 'openroad' of https://github.com/ucb-bar/chipyard into o…
nayiri-k Sep 15, 2022
205adee
new tutorial make variables for ease of use
nayiri-k Sep 16, 2022
d547132
openroad tutorial enhancements
nayiri-k Sep 27, 2022
fbd5966
refactored some yaml design files for the openroad tutorial
nayiri-k Sep 27, 2022
79772d8
Merge remote-tracking branch 'origin/main' into openroad
nayiri-k Sep 27, 2022
e61638c
Merge branch 'main' of https://github.com/ucb-bar/chipyard into openroad
nayiri-k Sep 27, 2022
7694695
updating docs
nayiri-k Sep 27, 2022
f1aa2f7
Merge branch 'openroad' of https://github.com/ucb-bar/chipyard into o…
nayiri-k Sep 27, 2022
4947975
minor tweaks
nayiri-k Sep 27, 2022
be7bf0e
changed tabs to spaces in Makefile
nayiri-k Sep 27, 2022
a45de04
Merge branch 'openroad' of https://github.com/ucb-bar/chipyard into o…
nayiri-k Sep 27, 2022
205895e
undid some makefile changes
nayiri-k Sep 27, 2022
648301c
Merge branch 'openroad' of https://github.com/ucb-bar/chipyard into o…
nayiri-k Sep 27, 2022
c314814
made relative path clearer
nayiri-k Sep 27, 2022
4330d40
bumping hammer cadence and synopsys plugins
nayiri-k Sep 27, 2022
1130d09
merged branch
nayiri-k Sep 27, 2022
ca314e7
clarifying that sky130_nda key is now optional
nayiri-k Sep 28, 2022
61b8883
removing references to nangate45 example
nayiri-k Sep 28, 2022
e4aba60
moved vlsi flow control description
nayiri-k Sep 29, 2022
ad3188b
improved example-designs override
nayiri-k Sep 29, 2022
16538ef
Merge branch 'openroad' of https://github.com/ucb-bar/chipyard into o…
nayiri-k Sep 29, 2022
6418afc
re-added macro placement
nayiri-k Sep 29, 2022
9494e84
adding basic floorplan to default sky130
nayiri-k Sep 29, 2022
35b9d27
adding drc.magic.magic_bin so it's visible to netgen lvs plugin
nayiri-k Sep 29, 2022
3ec713b
bumping hammer
nayiri-k Sep 29, 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
2 changes: 1 addition & 1 deletion docs/VLSI/ASAP7-Tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This example gives a suggested file structure and build system. The ``vlsi/`` fo

* Hammer IR for this tutorial.

* ``example-design.yml``, ``example-nangate45.yml``, ``example-tech.yml``
* ``example-design.yml``, ``example-sky130.yml``, ``example-tech.yml``

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

Expand Down
2 changes: 1 addition & 1 deletion docs/VLSI/Basic-Flow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Setting up the Hammer Configuration Files
The first configuration file that needs to be set up is the Hammer environment configuration file ``env.yml``. In this file you need to set the paths to the EDA tools and license servers you will be using. You do not have to fill all the fields in this configuration file, you only need to fill in the paths for the tools that you will be using.
If you are working within a shared server farm environment with an LSF cluster setup (for example, the Berkeley Wireless Research Center), please note the additional possible environment configuration listed in the :ref:`VLSI/Basic-Flow:Advanced Environment Setup` segment of this documentation page.

Hammer relies on YAML-based configuration files. While these configuration can be consolidated within a single files (as is the case in the ASAP7 tutorial :ref:`tutorial` and the ``nangate45``
Hammer relies on YAML-based configuration files. While these configuration can be consolidated within a single files (as is the case in the ASAP7 tutorial :ref:`tutorial` and the ``sky130``
OpenRoad example), the generally suggested way to work with an arbitrary process technology or tools plugins would be to use three configuration files, matching the three Hammer concerns - tools, tech, and design.
The ``vlsi`` directory includes three such example configuration files matching the three concerns: ``example-tools.yml``, ``example-tech.yml``, and ``example-design.yml``.

Expand Down
11 changes: 11 additions & 0 deletions docs/VLSI/Hammer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ Hooks

Hooks are modifications to steps or actions that are programmatically defined in a Hammer configuration.


VLSI Flow Control
-----------------
Sometimes we want more fine-grained control of the VLSI flow than at the action level.
The Hammer flow supports being able to start/stop before/after any of the steps in a particular action.
See the `Hammer documentation on Flow Control <https://docs.hammer-eda.org/en/latest/Hammer-Use/Flow-Control.html>`__ for a full list and description of the options.
The ``Makefile`` in the ``vlsi`` directory passes this extra information via the ``HAMMER_EXTRA_ARGS`` variable.
This variable can also be used to specify additional YAML configurations that may have
changed or been omitted from the inital build.


Configuration (Hammer IR)
=========================

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. _sky130-tutorial:
.. _sky130-commercial-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.
The ``vlsi`` folder of this repository contains an example Hammer flow with the TinyRocketConfig from Chipyard. 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
-----------------
Expand Down Expand Up @@ -30,7 +30,7 @@ This example gives a suggested file structure and build system. The ``vlsi/`` fo

* Hammer IR for this tutorial.

* ``example-design.yml``, ``example-nangate45.yml``, ``example-tech.yml``
* ``example-design.yml``, ``example-asap7.yml``, ``example-tech.yml``

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

Expand All @@ -45,7 +45,7 @@ This example gives a suggested file structure and build system. The ``vlsi/`` fo
Prerequisites
-------------

* Python 3.4+
* Python 3.6+
* numpy package
* Genus, Innovus, Voltus, VCS, and Calibre licenses
* Sky130 PDK, install using `these directions <https://github.com/ucb-bar/hammer/blob/master/src/hammer-vlsi/technology/sky130/README.md>`__
Expand Down
213 changes: 213 additions & 0 deletions docs/VLSI/Sky130-OpenROAD-Tutorial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
.. _sky130-openroad-tutorial:

Sky130 + OpenROAD Tutorial
==========================
The ``vlsi`` folder of this repository contains an example Hammer flow with the TinyRocketConfig from Chipyard. This example tutorial uses the built-in Sky130 technology plugin and OpenROAD tool plugin.

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``

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

* ``build``

* 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.

* ``example-vlsi-sky130``

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

* ``example-sky130.yml``, ``example-openroad.yml``

* Hammer IR for this tutorial.

* ``example-design.yml``, ``example-asap7.yml``, ``example-tech.yml``

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

* ``generated-src``

* All of the elaborated Chisel and FIRRTL.

* ``hammer``, ``hammer/src/hammer-vlsi/<syn-par-drc-lvs>/<tool>``, ``hammer/src/hammer-vlsi/technology/<tech>``

* Core repository, and open-source tool and technology plugins.

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

* Python 3.6+
* numpy package
* OpenROAD flow tools:

* Yosys (synthesis), install `from source <https://yosyshq.net/yosys/download.html>`__ or `using conda <https://anaconda.org/TimVideos/yosys>`__
* OpenROAD (place-and-route), install `from source <https://openroad.readthedocs.io/en/latest/main/README.html#install-dependencies>`__
* Magic (DRC), install `from source <http://www.opencircuitdesign.com/magic/install.html>`__
* NetGen (LVS), install `from source <http://www.opencircuitdesign.com/netgen/install.html>`__ or `using conda <https://anaconda.org/conda-forge/netgen>`__

* 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 openroad

to pull the Hammer submodule. Note that for technologies other than ``sky130`` or ``asap7``, the tech plugin submodule is cloned into the ``vlsi`` folder,
and for the commercial tool flow (set up by omitting the ``openroad`` argument), the tool plugin submodules are cloned into the ``vlsi`` folder.

Pull the Hammer environment into the shell:

.. code-block:: shell

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

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

For this tutorial we will be setting the Make variable ``tutorial=sky130-openroad`` to abbreviate the configuration.
The current options for this variable are defined in ``tutorial.mk``, a few of which are summarized as follows:

* ``CONFIG=TinyRocketConfig`` selects the ``TinyRocketConfig`` from the Chipyard configurations.
* ``tech_name`` sets a few more necessary paths in the ``Makefile``, such as the appropriate Hammer plugin
* ``TOOLS_CONF`` and ``TECH_CONF`` select the approproate YAML configuration files, ``example-openroad.yml`` and ``example-sky130.yml``, which are described below
* ``DESIGN_CONF`` and ``EXTRA_CONFS`` allow for additonal design-specific overrides of the Hammer IR in ``example-sky130.yml``
* ``VLSI_OBJ_DIR`` gives the build directory a unique name to allow running multiple flows in the same repo.

example-vlsi-sky130
^^^^^^^^^^^^^^^^^^^
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.


example-sky130.yml
^^^^^^^^^^^^^^^^^^
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, sky130_nda, openram_lib>`` to the absolute path of the respective directories containing the Sky130 PDK and SRAM files. See the
`Sky130 Hammer plugin README <https://github.com/ucb-bar/hammer/blob/master/src/hammer-vlsi/technology/sky130/README.md>`__
for details about the PDK setup.


example-openroad.yml
^^^^^^^^^^^^^^^^^^^^
This contains the Hammer configuration for the OpenROAD tool flow.
It selects tools for synthesis (Yosys), place and route (OpenROAD), DRC (Magic), and LVS (NetGen).
For the remaining commands, we will need to specify this file as the tool configuration to hammer via the ``TOOLS_CONF`` Makefile variable.


Generating SRAMs
^^^^^^^^^^^^^^^^
To map the generic memory macros in the generarted Verilog to the SRAMs in your technology process, run the following command:

.. code-block:: shell

make srams tutorial=sky130-openroad

Generating Verilog
^^^^^^^^^^^^^^^^^^
To elaborate the ``TinyRocketConfig`` from Chisel to Verilog, run:

.. code-block:: shell

make verilog tutorial=sky130-openroad

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. The resulting verilog is located in ``./generated-src/chipyard.TestHarness.TinyRocketConfig/chipyard.TestHarness.TinyRocketConfig.top.v``.

Note that in the generated Verilog, there are generic memory macros for the various memory components (dcache, icache, tag array, PTW).
This is the same Verilog that is generated for RTL simulations in the ``~chipyard/sims/verilator`` directory, see :ref:`Simulation/Software-RTL-Simulation:Software RTL Simulation` for directions on how to run these simulations.

Building the Design
^^^^^^^^^^^^^^^^^^^
To 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 TOOLS_CONF=example-openroad.yml CONFIG=TinyRocketConfig

The command ``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.


Synthesis
^^^^^^^^^

.. code-block:: shell

make syn tutorial=sky130-openroad

Post-synthesis logs and collateral are in ``build/syn-rundir``.

.. The raw quality of results data is available at ``build/syn-rundir/reports``, and methods to extract this information for design space exploration are a work in progress.

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

make par tutorial=sky130-openroad

After completion, the final database can be opened in an interactive OpenROAD session.

.. code-block:: shell

cd ./build/par-rundir
./generated-scripts/open_chip


Below is the post-PnR layout for the TinyRocketConfig in Sky130 generated by OpenROAD.

.. image:: ../_static/images/vlsi-openroad-par-tinyrocketconfig.png

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

.. code-block:: shell

openroad # launch OpenROAD tool
openroad> read_db pre_global_route

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

DRC & LVS
^^^^^^^^^
To run DRC & LVS:

.. code-block:: shell

make drc tutorial=sky130-openroad
make lvs tutorial=sky130-openroad

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>`__.


VLSI Flow Control
harrisonliew marked this conversation as resolved.
Show resolved Hide resolved
^^^^^^^^^^^^^^^^^
Firt, refer to the :ref:`VLSI/Hammer:VLSI Flow Control` documentation. The below examples use the ``redo-par`` Make target to re-run only place-and-route. ``redo-`` may be prepended to any of the VLSI flow actions to re-run only that action.

.. code-block:: shell

# the following two statements are equivalent because the
# extraction step immediately precedes the write_design step
make redo-par HAMMER_EXTRA_ARGS="--start_after_step extraction"
make redo-par HAMMER_EXTRA_ARGS="--start_before_step write_design"

# example of re-running only floorplanning to test out a new floorplan configuration
make redo-par HAMMER_EXTRA_ARGS="--only_step floorplan_design -p example-sky130.yml"

See the `OpenROAD tool plugin <https://github.com/ucb-bar/hammer/tree/master/src/hammer-vlsi/par/openroad>`__ for the full list of OpenROAD tool steps and their implementations.

Documentation
-------------
For more information about Hammer's underlying implementation, visit the `Hammer documentation website <https://docs.hammer-eda.org/en/latest/index.html>`__.

For details about the plugins used in this tutorial, check out the `OpenROAD tool plugin repo + README <https://github.com/ucb-bar/hammer/tree/master/src/hammer-vlsi/par/openroad>`__
and `Sky130 tech plugin repo + README <https://github.com/ucb-bar/hammer/tree/master/src/hammer-vlsi/technology/sky130>`__.
3 changes: 2 additions & 1 deletion docs/VLSI/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ In particular, we aim to support the Hammer physical design generator flow.
Hammer
Basic-Flow
ASAP7-Tutorial
Sky130-Tutorial
Sky130-Commercial-Tutorial
Sky130-OpenROAD-Tutorial
Advanced-Usage
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions scripts/init-vlsi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ set -o pipefail

# Initialize HAMMER and CAD-plugins
git submodule update --init --recursive vlsi/hammer
git submodule update --init --recursive vlsi/hammer-cadence-plugins
git submodule update --init --recursive vlsi/hammer-synopsys-plugins
git submodule update --init --recursive vlsi/hammer-mentor-plugins
if [[ $1 != *openroad* ]] && [[ $2 != *openroad* ]]; then
git submodule update --init --recursive vlsi/hammer-cadence-plugins
git submodule update --init --recursive vlsi/hammer-synopsys-plugins
git submodule update --init --recursive vlsi/hammer-mentor-plugins
fi

# Initialize HAMMER tech plugin
if [[ $1 != *asap7* ]] && [[ $1 != *sky130* ]]; then
Expand Down
13 changes: 6 additions & 7 deletions vlsi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ sim_dir=$(abspath .)
#########################################################################################
# include shared variables
#########################################################################################
include $(vlsi_dir)/tutorial.mk
include $(base_dir)/variables.mk

#########################################################################################
Expand All @@ -30,15 +31,13 @@ ifdef USE_SRAM_COMPILER
MACROCOMPILER_MODE ?= -l $(SMEMS_COMP) --use-compiler -hir $(SMEMS_HAMMER) --mode strict
else
MACROCOMPILER_MODE ?= -l $(SMEMS_CACHE) -hir $(SMEMS_HAMMER) --mode strict
endif
endif

ENV_YML ?= $(vlsi_dir)/env.yml
INPUT_CONFS ?= example-tools.yml \
$(if $(filter $(tech_name),nangate45),\
example-nangate45.yml,\
$(if $(filter $(tech_name),asap7),\
example-asap7.yml,\
example-sky130.yml))
TECH_CONF ?= $(if $(filter $(tech_name),asap7), example-asap7.yml,\
example-sky130.yml))
TOOLS_CONF ?= example-tools.yml
INPUT_CONFS ?= $(TOOLS_CONF) $(TECH_CONF)
HAMMER_EXEC ?= $(if $(filter $(tech_name),sky130),\
./example-vlsi-sky130,\
./example-vlsi)
Expand Down
Loading