From 29898bb677581f79a0ff8c94c7539cd4f63f7f76 Mon Sep 17 00:00:00 2001 From: Harrison Liew Date: Mon, 23 Sep 2019 10:20:42 -0700 Subject: [PATCH] move documentation to docs/ and new Makefile plumbing --- docs/VLSI/HAMMER.rst | 70 ++++++++++++++++++++++++++++++++++++++++-- vlsi/Makefile | 21 ++++++++++--- vlsi/README.md | 72 -------------------------------------------- vlsi/example.yml | 10 +++--- vlsi/hammer | 2 +- 5 files changed, 88 insertions(+), 87 deletions(-) delete mode 100644 vlsi/README.md diff --git a/docs/VLSI/HAMMER.rst b/docs/VLSI/HAMMER.rst index c0c77824..c472b167 100644 --- a/docs/VLSI/HAMMER.rst +++ b/docs/VLSI/HAMMER.rst @@ -24,8 +24,8 @@ Hooks are modifications to steps or actions that are programmatically defined in Tool Plugins ============ -Hammer supports separately managed plugins for different CAD tool vendors. -The types of tools (in there hammer names) supported currently include: +Hammer supports separately managed plugins for different CAD tool vendors. You may be able to acquire access to the included Cadence, Synopsys, and Mentor Graphics plugins with permission from the respective CAD tool vendor. +The types of tools (by HAMMER names) supported currently include: * synthesis * par @@ -48,7 +48,11 @@ This class should be a subclass of ``HammerTool``, which will be a su Technology Plugins ================== -Hammer supports separately managed plugins for different technologies. +Hammer supports separately managed plugins for different technologies. 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.json`` and ``defaults.yml``. An ``__init__.py`` is optional if there are any technology-specific methods or hooks to run. Refer to the ASAP7 plugin and associated documentation for more information. + +In order to configure your technology of choice, you will need to set several configuration variables. +First, you need to choose the technology, for example ``vlsi.core.technology: asap7`` and point to the location with the PDK tarball with ``technology..tarball_dir`` or pre-installed directory with ``technology..install_dir``. +Technology-specific options such as supplies, MMMC corners, metal layers, etc. will need to be matched to the technology in their respective ``vlsi.inputs...`` configurations. Configuration ============= @@ -56,3 +60,63 @@ 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 `__. + +ASAP7 Tutorial +============== +The ``vlsi`` folder of this repository contains an example HAMMER flow with the SHA-3 accelerator and a dummy hard macro in the ASAP7 PDK. It is tested with the Cadence and Mentor tool plugins. + +Initial Setup +------------- +Run ``./scripts/init-vlsi.sh TECH_HAME`` to pull the HAMMER & plugin submodules. Note that for technologies other than ASAP7, the tech submodule must be added in the ``vlsi`` folder first. + +An example of tool environment configuration for BWRC affiliates is given in ``bwrc-env.yml``. Replace paths as necessary for your build environment. + +Pull the HAMMER environment into the shell: + +:: + export HAMMER_HOME=$PWD/hammer + source $HAMMER_HOME/sourceme.sh + +Building the Design +------------------- +To elaborate the Sha3RocketConfig (Rocketchip w/ the accelerator) and set up all prerequisites for the build system to push just the accelerator + hard macro through the flow: + +:: + export MACROCOMPILER_MODE=' --mode synflops' + export CONFIG=Sha3RocketConfig + export VLSI_TOP=Sha3AccelwBB + make buildfile + +Note that because the ASAP7 process does not yet have a memory compiler, synflops are elaborated instead. + +Running the VLSI Flow +--------------------- +The configuration for this example is contained in ``example.yml`` and the entry script with placeholders for hooks is contained in ``example-vlsi``. Before continuing, ensure you have the `ASAP7 PDK `__ tarball downloaded (but not extracted) and point the ``technology.asap7.tarball_dir`` to the tarball directory. + +To synthesize, type ``make syn``. + +Post-synthesis results are in ``build/syn-rundir``. Raw QoR data is available at ``build/syn-rundir/reports``, and methods to extract this information for design space exploration are a WIP. + +To place and route, type ``make par``. + +If successful, the resulting chip can be opened 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. Compressed timing reports are found in ``build/par-rundir/timingReports``. + +To run DRC & LVS, and view the results: + +:: + 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 `__ + +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 export the following environment variables before ``make buildfile``. + +:: + export CUSTOM_VLOG= + export VLSI_TOP= diff --git a/vlsi/Makefile b/vlsi/Makefile index d3f3d45f..3f493c6e 100644 --- a/vlsi/Makefile +++ b/vlsi/Makefile @@ -28,12 +28,20 @@ OBJ_DIR ?= $(vlsi_dir)/build ENV_YML ?= $(vlsi_dir)/bwrc-env.yml INPUT_CONFS ?= example.yml HAMMER_EXEC ?= ./example-vlsi +VLSI_TOP ?= $(TOP) ######################################################################################### # general rules ######################################################################################### -ALL_RTL = $(TOP_FILE) $(TOP_SMEMS_FILE) $(extra_v_includes) +ALL_RTL = $(TOP_FILE) $(TOP_SMEMS_FILE) extra_v_includes = $(build_dir)/EICG_wrapper.v $(vlsi_dir)/example.v +ifneq ($(CUSTOM_VLOG), ) + VLSI_RTL = $(CUSTOM_VLOG) + VLSI_BB = /dev/null +else + VLSI_RTL = $(ALL_RTL) $(extra_v_includes) + VLSI_BB = $(sim_top_blackboxes) +endif .PHONY: default verilog default: all @@ -74,14 +82,17 @@ $(SRAM_CONF): $(SRAM_GENERATOR_CONF) # synthesis input configuration ######################################################################################### SYN_CONF = $(OBJ_DIR)/inputs.yml -GENERATED_CONFS = $(SYN_CONF) $(if $(filter $(tech_name), asap7), , $(SRAM_CONF)) +GENERATED_CONFS = $(SYN_CONF) +ifeq ($(CUSTOM_VLOG), ) + GENERATED_CONFS += $(if $(filter $(tech_name), asap7), , $(SRAM_CONF)) +endif -$(SYN_CONF): $(ALL_RTL) $(extra_v_includes) $(sim_top_blackboxes) +$(SYN_CONF): $(VLSI_RTL) $(VLSI_BB) mkdir -p $(dir $@) echo "synthesis.inputs:" > $@ - echo " top_module: $(TOP)" >> $@ + echo " top_module: $(VLSI_TOP)" >> $@ echo " input_files:" >> $@ - for x in $(ALL_RTL) $(extra_v_includes) `cat $(sim_top_blackboxes)`; do \ + for x in $(VLSI_RTL) `cat $(VLSI_BB)`; do \ echo ' - "'$$x'"' >> $@; \ done diff --git a/vlsi/README.md b/vlsi/README.md deleted file mode 100644 index 29fd2bc7..00000000 --- a/vlsi/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# HAMMER VLSI flow -This is the starting point for a vlsi flow from this repository. - -This flow will not work without the necessary CAD and technology plugins for HAMMER. - -If you are a UCB-affiliate, you may be able to acquire access to the tool & tech plugins. - -# Initial Setup Instructions (For all technologies) -Run the `init-vlsi.sh` script to pull correct versions of hammer, hammer-TOOL\_VENDOR-plugins, and the hammer-TECH\_NAME-plugins. Note the technologies `asap7` and `saed32` are already included and will not submodule a tech plugin. -```shell -./scripts/init-vlsi.sh TECH_NAME -``` - -An example of tool environment configuration for BWRC affiliates is given in `bwrc-env.yml`. Replace as necessary for your environment. - -# Example design -## Building the design -In this example, you will be running a SHA-3 accelerator with a dummy hard macro through the VLSI flow in the ASAP7 process. To elaborate the Sha3RocketConfig (Rocketchip w/ the accelerator) and set up all prerequisites for the build system: -```shell -export MACROCOMPILER_MODE=' --mode synflops' -export CONFIG=Sha3RocketConfig -make buildfile -``` -Note that because the ASAP7 process does not yet have a memory compiler, synflops are elaborated instead. - -## Using HAMMER -HAMMER's configuration is driven by a JSON/YAML format. For HAMMER, JSON and YAML files are equivalent - you can use either one since HAMMER will convert them to the same representation for itself. - -We start by pulling the HAMMER environment into the shell: - -```shell -export HAMMER_HOME=$PWD/hammer -source $HAMMER_HOME/sourceme.sh -``` - -The configuration for the example design is contained in `example.yml` and the entry script with hooks is contained in `example-vlsi`. You may go through Hammer's readme to learn about the supported configuration options and how to write hooks. - -In order to install the process, download (and optionally extract) the ASAP7 PDK tarball. Then, edit the key `vlsi.technology.asap7.tarball_dir` if you want Hammer to extract for you or `vlsi.technology.asap7.install_dir` if you have already extracted it. - -To synthesize the just the SHA-3 accelerator with the hard macro we have to change the physical top module (this step is not necessary if you are pushing the entire Rocket-chip through the VLSI flow): -```shell -export TOP=Sha3AccelwBB -rm build/inputs.yml -``` - -Then, to run synthesis: -```shell -make syn -``` - -The outputs are written to a log file with a timestamp and the post-synthesis results are in `build/syn-rundir`. - -Raw QoR data is available at `build/syn-rundir/reports`, and work is planned to extract this information in a more programmatic manner. - -To run place and route: -```shell -make par -``` - -If successful, the resulting chip can be opened via `./build/par-rundir/generated-scripts/open_chip`. - -To run DRC and view violations: -```shell -make drc -./build/drc-rundir/generated-scripts/view-drc -``` - -To run LVS and view violations: -```shell -make lvs -./build/lvs-rundir/generated-scripts/view-lvs -``` diff --git a/vlsi/example.yml b/vlsi/example.yml index bf6d135d..f68bbd12 100644 --- a/vlsi/example.yml +++ b/vlsi/example.yml @@ -43,8 +43,6 @@ par.generate_power_straps_options: - M8 - M9 track_width: 5 - track_width_M8: 6 - track_width_M9: 6 track_spacing: 0 track_start: 10 power_utilization: 0.05 @@ -60,10 +58,10 @@ vlsi.inputs.placement_constraints: width: 300 height: 300 margins: - left: 10 - right: 10 - top: 10 - bottom: 10 + left: 0 + right: 0 + top: 0 + bottom: 1.08 #must be at least this number - path: "Sha3AccelwBB/dco" type: "hardmacro" x: 100 diff --git a/vlsi/hammer b/vlsi/hammer index 4f06ceef..b837b3fa 160000 --- a/vlsi/hammer +++ b/vlsi/hammer @@ -1 +1 @@ -Subproject commit 4f06ceef41c0e3d4a9a5f000cf5a120729edc85d +Subproject commit b837b3fa321cce78998811d3bc842463e58e5745