54
docs/VLSI/Advanced-Usage.rst
Normal file
54
docs/VLSI/Advanced-Usage.rst
Normal file
@@ -0,0 +1,54 @@
|
||||
.. _advanced-usage:
|
||||
|
||||
Advanced Usage
|
||||
==============
|
||||
|
||||
Alternative RTL Flows
|
||||
---------------------
|
||||
The Make-based build system provided supports using Hammer without using RTL generated by Chipyard. To push a custom verilog module through, one only needs to append the following environment variables to the ``make buildfile`` command (or edit them directly in the Makefile).
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
CUSTOM_VLOG=<your verilog files>
|
||||
VLSI_TOP=<your top module>
|
||||
|
||||
``CUSTOM_VLOG`` breaks the dependency on the rest of the Chipyard infrastructure and does not start any Chisel/FIRRTL elaboration. ``VLSI_TOP`` selects the top module from your custom Verilog files.
|
||||
|
||||
Under the Hood
|
||||
--------------
|
||||
To uncover what is happening under the hood, here are the commands that are executed:
|
||||
|
||||
For ``make syn``:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
./example-vlsi -e /path/to/env.yml -p /path/to/example.yml -p /path/to/inputs.yml --obj_dir /path/to/build syn
|
||||
|
||||
``example-vlsi`` is the entry script as explained before, ``-e`` provides the environment yml, ``-p`` points to configuration yml/jsons, ``--obj_dir`` speficies the destination directory, and ``syn`` is the action.
|
||||
|
||||
For ``make par``:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
./example-vlsi -e /path/to/env.yml -p /path/to/syn-output-full.json -o /path/to/par-input.json --obj_dir /path/to/build syn-to-par
|
||||
./example-vlsi -e /path/to/env.yml -p /path/to/par-input.json --obj_dir /path/to/build par
|
||||
|
||||
A ``syn-to-par`` action translates the synthesis output configuration into an input configuration given by ``-o``. Then, this is passed to the ``par`` action.
|
||||
|
||||
For more information about all the options that can be passed to the Hammer command-line driver, please see the Hammer documentation.
|
||||
|
||||
Manual Step Execution & Dependency Tracking
|
||||
-------------------------------------------
|
||||
It is invariably necessary to debug certain steps of the flow, e.g. if the power strap settings need to be updated. The underlying Hammer commands support options such as ``--to_step``, ``--from_step``, and ``--only_step``. These allow you to control which steps of a particular action are executed.
|
||||
|
||||
Make's dependency tracking can sometimes result in re-starting the entire flow when the user only wants to re-run a certain action. Hammer's build system has "redo" targets such as ``redo-syn`` and ``redo-par`` to run certain actions without typing out the entire Hammer command.
|
||||
|
||||
Say you need to update some power straps settings in ``example.yml`` and want to try out the new settings:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
make redo-par HAMMER_REDO_ARGS='-p example.yml --only_step power_straps'
|
||||
|
||||
Simulation
|
||||
----------
|
||||
With the Synopsys plugin, RTL and gate-level simulation is supported using VCS. While this example does not implement any simulation, refer to Hammer's documentation for how to set it up for your design.
|
||||
@@ -1,58 +0,0 @@
|
||||
Core HAMMER
|
||||
================================
|
||||
|
||||
`HAMMER <https://github.com/ucb-bar/hammer>`__ is a physical design generator that wraps around vendor specific technologies and tools to provide a single API to create ASICs.
|
||||
HAMMER allows for reusability in ASIC design while still providing the designers leeway to make their own modifications.
|
||||
|
||||
For more information, read the `HAMMER paper <https://people.eecs.berkeley.edu/~edwardw/pubs/hammer-woset-2018.pdf>`__ and see the `GitHub repository <https://github.com/ucb-bar/hammer>`__.
|
||||
|
||||
Actions
|
||||
-------
|
||||
|
||||
Actions are the top-level tasks Hammer is capable of executing (e.g. synthesis, place-and-route, etc.)
|
||||
|
||||
Steps
|
||||
-------
|
||||
|
||||
Steps are the sub-components of actions that individually addressable in Hammer (e.g. placement in the place-and-route action).
|
||||
|
||||
Hooks
|
||||
-------
|
||||
|
||||
Hooks are modifications to steps or actions that are programmatically defined in a Hammer configuration.
|
||||
|
||||
Tool Plugins
|
||||
============
|
||||
|
||||
Hammer supports separately managed plugins for different CAD tool vendors.
|
||||
The types of tools (in there hammer names) supported currently include:
|
||||
|
||||
* synthesis
|
||||
* par
|
||||
* drc
|
||||
* lvs
|
||||
* sram_generator
|
||||
* pcb
|
||||
|
||||
In order to configure your tool plugin of choice, you will need to set several configuration variables.
|
||||
First, you should select which specific tool you want to use by setting ``vlsi.core.<tool_type>_tool`` to the name of your tool.
|
||||
For example ``vlsi.core.par_tool: "innovus"``.
|
||||
You will also need to point hammer to the folder that contains your tool plugin by setting ``vlsi.core.<tool_type>_tool_path``.
|
||||
This directory should include a folder with the name of the tool as specified previously, which itself includes a python file ``__init__.py`` and a yaml file ``defaults.yml`` specifying the default values for any tool specific variables.
|
||||
In addition you can also customize the version of the tools you use by setting ``<tool_type>.<tool_name>.version`` to a tool specific string.
|
||||
Looking at the tools ``defaults.yml`` will inform you if there are other variables you would like to set for your use of this tool.
|
||||
|
||||
The ``__init__.py`` file should contain a variable, ``tool``, that points to the class implementing this tools Hammer support.
|
||||
This class should be a subclass of ``Hammer<tool_type>Tool``, which will be a subclass of ``HammerTool``.
|
||||
|
||||
Technology Plugins
|
||||
==================
|
||||
|
||||
Hammer supports separately managed plugins for different technologies.
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
To configure a hammer flow the user needs to supply a yaml or json configuration file the chooses the tool and technology plugins and versions as well as any design specific configuration APIs.
|
||||
|
||||
You can see the current set of all available Hammer APIs `here <https://github.com/ucb-bar/hammer/blob/master/src/hammer-vlsi/defaults.yml>`__.
|
||||
71
docs/VLSI/Hammer.rst
Normal file
71
docs/VLSI/Hammer.rst
Normal file
@@ -0,0 +1,71 @@
|
||||
.. _hammer:
|
||||
|
||||
Core Hammer
|
||||
================================
|
||||
|
||||
`Hammer <https://github.com/ucb-bar/hammer>`__ is a physical design generator that wraps around vendor specific technologies and tools to provide a single API to create ASICs.
|
||||
Hammer allows for reusability in ASIC design while still providing the designers leeway to make their own modifications.
|
||||
|
||||
For more information, read the `Hammer paper <https://people.eecs.berkeley.edu/~edwardw/pubs/hammer-woset-2018.pdf>`__ and see the `GitHub repository <https://github.com/ucb-bar/hammer>`__ and associated documentation.
|
||||
|
||||
Hammer implements a VLSI flow using the following high-level constructs:
|
||||
|
||||
Actions
|
||||
-------
|
||||
|
||||
Actions are the top-level tasks Hammer is capable of executing (e.g. synthesis, place-and-route, etc.)
|
||||
|
||||
Steps
|
||||
-------
|
||||
|
||||
Steps are the sub-components of actions that individually addressable in Hammer (e.g. placement in the place-and-route action).
|
||||
|
||||
Hooks
|
||||
-------
|
||||
|
||||
Hooks are modifications to steps or actions that are programmatically defined in a Hammer configuration.
|
||||
|
||||
Configuration (Hammer IR)
|
||||
=========================
|
||||
|
||||
To configure a Hammer flow, supply a set ``yaml`` or ``json`` configuration files that chooses the tool and technology plugins and versions as well as any design specific configuration options. Collectively, this configuration API is referred to as Hammer IR and can be generated from higher-level abstractions.
|
||||
|
||||
The current set of all available Hammer APIs is codified `here <https://github.com/ucb-bar/hammer/blob/master/src/hammer-vlsi/defaults.yml>`__.
|
||||
|
||||
Tool Plugins
|
||||
============
|
||||
|
||||
Hammer supports separately managed plugins for different CAD tool vendors. You may be able to acquire access to the included Cadence, Synopsys, and Mentor plugins repositories with permission from the respective CAD tool vendor.
|
||||
The types of tools (by Hammer names) supported currently include:
|
||||
|
||||
* synthesis
|
||||
* par
|
||||
* drc
|
||||
* lvs
|
||||
* sram_generator
|
||||
* pcb
|
||||
|
||||
Several configuration variables are needed to configure your tool plugin of choice.
|
||||
|
||||
First, select which tool to use for each action by setting ``vlsi.core.<tool_type>_tool`` to the name of your tool, e.g. ``vlsi.core.par_tool: "innovus"``.
|
||||
|
||||
Then, point Hammer to the folder that contains your tool plugin by setting ``vlsi.core.<tool_type>_tool_path``.
|
||||
This directory should include a folder with the name of the tool, which itself includes a python file ``__init__.py`` and a yaml file ``defaults.yml``. Customize the version of the tool by setting ``<tool_type>.<tool_name>.version`` to a tool specific string.
|
||||
|
||||
The ``__init__.py`` file should contain a variable, ``tool``, that points to the class implementing this tool.
|
||||
This class should be a subclass of ``Hammer<tool_type>Tool``, which will be a subclass of ``HammerTool``. The class should implement methods for all the tool's steps.
|
||||
|
||||
The ``defaults.yml`` file contains tool-specific configuration variables. The defaults may be overridden as necessary.
|
||||
|
||||
Technology Plugins
|
||||
==================
|
||||
|
||||
Hammer supports separately managed technology plugins to satisfy NDAs. You may be able to acquire access to certain pre-built technology plugins with permission from the technology vendor. Or, to build your own tech plugin, you need at least a ``<tech_name>.tech.json`` and ``defaults.yml``. An ``__init__.py`` is optional if there are any technology-specific methods or hooks to run.
|
||||
|
||||
The `ASAP7 plugin <https://github.com/ucb-bar/hammer/tree/master/src/hammer-vlsi/technology/asap7>`__ is a good starting point for setting up a technology plugin because it is an open-source example that is not suitable for taping out a chip. Refer to Hammer's documentation for the schema and detailed setup instructions.
|
||||
|
||||
Several configuration variables are needed to configure your technology of choice.
|
||||
|
||||
First, choose the technology, e.g. ``vlsi.core.technology: asap7``, then point to the location with the PDK tarball with ``technology.<tech_name>.tarball_dir`` or pre-installed directory with ``technology.<tech_name>.install_dir`` and (if applicable) the plugin repository with ``vlsi.core.technology_path``.
|
||||
|
||||
Technology-specific options such as supplies, MMMC corners, etc. are defined in their respective ``vlsi.inputs...`` configurations. Options for the most common use case are already defined in the technology's ``defaults.yml`` and can be overridden by the user.
|
||||
140
docs/VLSI/Tutorial.rst
Normal file
140
docs/VLSI/Tutorial.rst
Normal file
@@ -0,0 +1,140 @@
|
||||
.. _tutorial:
|
||||
|
||||
ASAP7 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 ASAP7 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
|
||||
|
||||
* 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.
|
||||
|
||||
* env.yml
|
||||
|
||||
* 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.v
|
||||
|
||||
* Verilog wrapper around the accelerator and dummy hard macro.
|
||||
|
||||
* example.yml
|
||||
|
||||
* Hammer IR for this tutorial.
|
||||
|
||||
* extra_libraries
|
||||
|
||||
* Contains collateral for the dummy hard macro.
|
||||
|
||||
* generated-src
|
||||
|
||||
* All of the elaborated Chisel and FIRRTL.
|
||||
|
||||
* hammer, hammer-<vendor>-plugins, hammer-<tech>-plugin
|
||||
|
||||
* Core, tool, tech repositories.
|
||||
|
||||
Prerequisites
|
||||
-------------
|
||||
|
||||
* Python 3.4+
|
||||
* numpy and gdspy packages
|
||||
* Genus, Innovus, and Calibre licenses
|
||||
* For ASAP7 specifically:
|
||||
|
||||
* Download the `ASAP7 PDK <http://asap.asu.edu/asap/>`__ tarball to a directory of choice but do not extract it
|
||||
* If you have additional ASAP7 hard macros, their LEF & GDS need to be 4x upscaled @ 4000 DBU precision. They may live outside ``extra_libraries`` at your discretion.
|
||||
|
||||
Initial Setup
|
||||
-------------
|
||||
In the Chipyard root, run:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
``./scripts/init-vlsi.sh asap7``
|
||||
|
||||
to pull the Hammer & plugin submodules. Note that for technologies other than ``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 ``Sha3RocketConfig`` (Rocket Chip w/ the accelerator) and set up all prerequisites for the build system to push just the accelerator + hard macro through the flow:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
make buildfile MACROCOMPILER_MODE='--mode synflops' CONFIG=Sha3RocketConfig VLSI_TOP=Sha3AccelwBB
|
||||
|
||||
The ``MACROCOMPILER_MODE='--mode synflops'`` is needed because the ASAP7 process does not yet have a memory compiler. Therefore, flip-flop arrays are used instead.
|
||||
|
||||
The ``CONFIG=Sha3RocketConfig`` selects the target generator config in the same manner as the rest of the Chipyard framework. This elaborates a Rocket Chip with the Sha3Accel module.
|
||||
|
||||
The ``VLSI_TOP=Sha3AccelwBB`` indicates that we are only interested in physical design of the accelerator block. If this variable is not set, the entire SoC will be pushed through physical design. Note that you should not set the ``TOP`` variable because it is used during Chisel elaboration.
|
||||
|
||||
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
|
||||
^^^^^^^^^^^^
|
||||
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.
|
||||
|
||||
The ``scale_final_gds`` hook is a particularly powerful hook. It dumps a Python script provided by the ASAP7 tech plugin, an executes it within the Innovus TCL interpreter. This hook is run after ``write_design`` because the ASAP7 PDK requires post-par GDSs to be scaled down by a factor of 4.
|
||||
|
||||
example.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.asap7.tarball_dir`` to the absolute path of where the downloaded the ASAP7 PDK tarball lives.
|
||||
|
||||
Synthesis
|
||||
^^^^^^^^^
|
||||
.. code-block:: shell
|
||||
|
||||
``make syn``
|
||||
|
||||
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.
|
||||
|
||||
Place-and-Route
|
||||
^^^^^^^^^^^^^^^
|
||||
.. code-block:: shell
|
||||
|
||||
``make par``
|
||||
|
||||
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
|
||||
./build/drc-rundir/generated-scripts/view-drc
|
||||
make lvs
|
||||
./build/lvs-rundir/generated-scripts/view-lvs
|
||||
|
||||
Some DRC errors are expected from this PDK, as explained in the `ASAP7 plugin readme <https://github.com/ucb-bar/hammer/tree/master/src/hammer-vlsi/technology/asap7>`__.
|
||||
@@ -2,11 +2,13 @@ VLSI Flow
|
||||
================================
|
||||
|
||||
The Chipyard framework aims to provide wrappers for a general VLSI flow.
|
||||
In particular, we aim to support the HAMMER physical design generator flow.
|
||||
In particular, we aim to support the Hammer physical design generator flow.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: VLSI Flow:
|
||||
|
||||
Building-A-Chip
|
||||
HAMMER
|
||||
Hammer
|
||||
Tutorial
|
||||
Advanced-Usage
|
||||
|
||||
Reference in New Issue
Block a user