Skip to content

Commit b18de4b

Browse files
authored
Bug fixes in e2e flow (#897)
* fixed spacing in makefile * sram testcase * moving sram confs to sram_wrapper confs * improved setup docs, moved sky130/openroad tools to public spot on bwrc servers * Update Hammer-Setup.md * updated sky130/openroad install docs * misc fixes, bumping bwrc tool versions * Update openroad-sky130.md * adder config and src files * small typo * RTL sim flags * added macro defines input to synthesis/power * improved joules report api * final test * removing redundant gitignore * cleaned up experiments * more small fixes * fixes * made width always a define param * cleaned up using add8/add32 * improved flow * reverting repo to remove experiment files, bumping some tool versions * adding example hammer driver to demonstrate hooks * report_stem is None bug * adding sram_wrapper_sky130 testcase to e2e dir * removing sram22_64x4m4w2 instance because its LEF is empty in sram22 files * Update README.md * Update openroad-sky130.md * reverting default tool flow to nop
1 parent 6601d54 commit b18de4b

File tree

28 files changed

+461
-204
lines changed

28 files changed

+461
-204
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ dist/
2626
/opendatabase.log
2727

2828
# e2e outputs
29+
e2e/poetry.lock
2930
e2e/obj_dir
3031
e2e/build*
3132
e2e/output.json
33+
e2e/*.log
34+
e2e/experiments/tests/

doc/Examples/openroad-sky130.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
The following directions will get a simple ``pass`` design from RTL to GDS using the [OpenROAD tools](https://theopenroadproject.org) and the [Skywater 130nm PDK](https://github.com/google/skywater-pdk). These directions are meant to provide the minimal set of steps to do so, please reference the next section, [Hammer End-to-End Integration Tests](https://hammer-vlsi.readthedocs.io/en/stable/Examples/e2e.html), for more detailed descriptions of all files and commands.
44

5-
## Instructions
5+
## Prerequisites Setup
66

7-
First, follow the [Hammer Developer Setup](https://hammer-vlsi.readthedocs.io/en/stable/Hammer-Basics/Hammer-Setup.html#developer-setup) to clone Hammer and install/activate the poetry virtual environment.
7+
First, follow the [Hammer Power User Setup](https://hammer-vlsi.readthedocs.io/en/stable/Hammer-Basics/Hammer-Setup.html#power-user-setup) to clone Hammer and install/activate the virtual environment.
88

9-
Next, run the setup script to install the OpenROAD tools using Conda, and Skywater 130nm PDK using the [Open-PDKs tool](https://github.com/RTimothyEdwards/open_pdks).
10-
This step will take a long time due to the amount and size of the required installs.
11-
You should supply a ``PREFIX`` path to a directory that will serve as the root of all PDK files and supporting tools (total size of all files is ~42GB),
9+
Next, run the setup script to install the OpenROAD tools and Skywater 130nm PDK using Conda.
10+
You should supply a ``PREFIX`` path to a directory that will serve as the root of all PDK files and supporting tools (total size of all files is ~4GB),
1211
otherwise the script will default to installing to your home directory (``~/``).
1312

1413
```shell
1514
cd hammer/e2e
1615
./scripts/setup-sky130-openroad.sh [PREFIX]
1716
```
1817

18+
## Running Hammer
19+
1920
You should now have a file ``configs-env/my-env.yml`` containing all required tool and technology paths for this tutorial.
2021
To point to your custom environment setup, set the Make variable ``env=my``.
2122
Additionally, we set the ``design``, ``pdk``, and ``tools`` Make variables to the appropriate RTL design, PDK, and tools flow, respecively.

doc/Hammer-Basics/Hammer-Setup.md

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,50 @@
22

33
Hammer depends on Python 3.9+.
44

5-
The default technology, ASAP7, has some extra requirements. See its [README](https://github.com/ucb-bar/hammer/blob/master/hammer/technology/asap7/README.md) for instructions.
5+
The Hammer setup is different based on its usecase, which are summarized as follows:
66

7-
## User Setup
7+
* [User Setup](#user-setup): Use Hammer with no modifications.
8+
* [Power User Setup](#power-user-setup): Modify Hammer and see these changes immediately reflected when calling Hammer [recommended].
9+
* [Developer Setup](#developer-setup): Developing major Hammer features, adding dependencies, running Hammer unit tests, etc.
810

9-
You can install Hammer from PyPI:
11+
Note that some tools and technologies have extra setup requirements:
12+
* [ASAP7 setup directions](https://github.com/ucb-bar/hammer/blob/master/hammer/technology/asap7/README.md)
13+
* [Sky130 & OpenROAD tools setup](https://hammer-vlsi.readthedocs.io/en/stable/Examples/openroad-sky130.html)
1014

11-
```shell
12-
pip install hammer-vlsi
13-
```
15+
## User Setup
1416

15-
If you are using ASAP7, you need to install hammer-vlsi with the asap7 extra dependency (gdspy or gdstk). By default, gdspy is installed:
17+
Install the hammer python package from PyPI.
1618

1719
```shell
18-
pip install hammer-vlsi[asap7]
19-
```
20+
pip install hammer-vlsi
2021

21-
If instead, you want to install gdstk:
22+
# if using the ASAP7 PDK you need the gdspy or gdstk dependencies
23+
pip install hammer-vlsi[asap7] # default: gdspy
24+
pip install hammer-vlsi[asap7-gdstk] # install gdstk instead
2225

23-
```shell
24-
pip install hammer-vlsi[asap7-gdstk]
26+
# verify that you can run the `hammer-vlsi` script from the command line
27+
hammer-vlsi -h
2528
```
2629

27-
After installation, verify that you can run the `hammer-vlsi` script from the command line.
30+
## Power User Setup
31+
Install Hammer as a source dependency to some target virtual environment, such as conda.
2832

2933
```shell
30-
hammer-vlsi -h
31-
```
34+
# clone Hammer somewhere on your disk
35+
git clone https://github.com/ucb-bar/hammer.git
3236

33-
Note: certain tools and technologies will have additional system requirements. For example, LVS with Netgen requires Tcl/Tk 8.6, which is not installed for CentOS7/RHEL7 and below. Refer to each respective tool and technology's documentation for those requirements.
37+
# activate your target virtual environment, e.g. Chipyard
38+
# commands vary for this based on your package/environment manager:
39+
# conda activate <env name>
40+
# source <path>/.venv/bin/activate
3441

35-
### Installing Hammer as a Source Dependency
42+
# install hammer package in editable mode to your environment
43+
cd hammer
44+
pip install -e . # run this after activating your target environment
3645

37-
In some cases, it is useful to install Hammer as a source dependency.
38-
For instance, when developing tool or PDK plugins alongside a new feature or API changes in main Hammer, installing hammer as a source dependency will allow you to make changes in main hammer and see them reflected immediately when running code for your tool/PDK plugin.
46+
```
3947

40-
(poetry_project)=
41-
#### From Another Poetry Project
48+
### Installing from Another Poetry Project
4249

4350
Hammer tool (e.g. `hammer-cadence-plugins`) and PDK plugin repositories are poetry projects (with a `pyproject.toml` in their root).
4451
To depend on Hammer as a source dependency, first clone Hammer somewhere on your disk.
@@ -54,15 +61,6 @@ Run `poetry update` and `poetry install`.
5461
Do not commit the changes to `pyproject.toml` or `poetry.lock` without first removing the source dependency.
5562
You only need to specify `extras` if you need the `asap7` optional dependency (gdstk).
5663

57-
#### From a Generic Python Project
58-
59-
Other repos, such as Chipyard, are not poetry projects, but still depend on Hammer.
60-
To use Hammer as a source dependency:
61-
62-
1. Remove the PyPI hammer-vlsi dependency from the project (e.g. by editing a conda env.yml file and rerunning dependency resolution)
63-
1. Clone Hammer somewhere on your disk
64-
1. Activate the virtualenv of the project (e.g. Chipyard)
65-
1. Run `pip install -e .` from the root of Hammer *within the project's virtualenv*
6664

6765
## Developer Setup
6866

e2e/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

e2e/Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env ?= bwrc
1111
extra ?= # extra configs
1212
args ?= # command-line args (including step flow control)
1313

14-
14+
HAMMER_DRIVER ?= ./example-driver
1515
OBJ_DIR ?= $(vlsi_dir)/build-$(pdk)-$(tools)/$(design)
1616

1717
# non-overlapping default configs
@@ -28,9 +28,10 @@ SIM_CONF ?= $(if $(findstring -rtl,$(MAKECMDGOALS)), configs-design/$
2828
POWER_CONF ?= $(if $(findstring power-rtl,$(MAKECMDGOALS)), configs-design/$(design)/power-rtl-$(pdk).yml, \
2929
$(if $(findstring power-syn,$(MAKECMDGOALS)), configs-design/$(design)/power-syn-$(pdk).yml, \
3030
$(if $(findstring power-par,$(MAKECMDGOALS)), configs-design/$(design)/power-par-$(pdk).yml, )))
31+
SRAM_CONF ?= $(OBJ_DIR)/sram_generator-output.json
3132

3233
PROJ_YMLS ?= $(PDK_CONF) $(TOOLS_CONF) $(DESIGN_CONF) $(DESIGN_PDK_CONF) $(SIM_CONF) $(POWER_CONF) $(extra)
33-
HAMMER_EXTRA_ARGS ?= $(foreach conf, $(PROJ_YMLS), -p $(conf)) $(args)
34+
HAMMER_EXTRA_ARGS ?= $(foreach conf, $(PROJ_YMLS), -p $(conf)) -p $(SRAM_CONF) $(args)
3435

3536

3637

@@ -39,10 +40,14 @@ HAMMER_D_MK = $(OBJ_DIR)/hammer.d
3940

4041
build: $(HAMMER_D_MK)
4142

42-
$(HAMMER_D_MK):
43-
hammer-vlsi --obj_dir $(OBJ_DIR) -e $(ENV_YML) $(HAMMER_EXTRA_ARGS) build
43+
$(HAMMER_D_MK): $(SRAM_CONF)
44+
$(HAMMER_DRIVER) --obj_dir $(OBJ_DIR) -e $(ENV_YML) $(HAMMER_EXTRA_ARGS) build
4445

4546
-include $(HAMMER_D_MK)
4647

48+
$(SRAM_CONF) srams:
49+
$(HAMMER_DRIVER) --obj_dir $(OBJ_DIR) -e $(ENV_YML) $(foreach conf, $(PROJ_YMLS), -p $(conf)) sram_generator
50+
cp output.json $(SRAM_CONF)
51+
4752
clean:
48-
rm -rf $(OBJ_DIR) hammer-vlsi-*.log
53+
rm -rf $(OBJ_DIR) hammer-vlsi-*.log

e2e/README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
# Hammer End-to-End Integration Tests
22

3-
This folder contains an end-to-end (RTL -> GDS) smoketest flow using Hammer, using the Cadence toolchain, and the ASAP7 or Skywater 130 PDKs.
3+
The `hammer/e2e` folder contains an end-to-end (RTL -> GDS) smoketest flow using Hammer, either the Cadence or OpenROAD toolchain, and the ASAP7 or Skywater 130 PDKs.
44

55
## Setup
66

7-
The integration tests use Hammer as a source dependency, so create the e2e poetry environment.
8-
9-
```shell
10-
poetry install
11-
poetry shell
12-
```
7+
First, follow the [Hammer Power User Setup](https://hammer-vlsi.readthedocs.io/en/stable/Hammer-Basics/Hammer-Setup.html#power-user-setup) to clone Hammer and install/activate the virtual environment.
138

149
## Overview
1510

@@ -19,7 +14,7 @@ poetry shell
1914
The following variables in the Makefile select the target flow to run:
2015

2116
- `design` - RTL name
22-
- {`pass`, `gcd`}
17+
- {`pass`, `gcd`, `sram_wrapper_sky130`}
2318
- `pdk` - PDK name
2419
- {`sky130`, `asap7`}
2520
- `tools` - CAD tool flow
@@ -86,6 +81,9 @@ make lvs
8681

8782
These actions are summarized in more detail:
8883

84+
- SRAM generation
85+
- `make srams`
86+
- Generated SRAM configs in `OBJ_DIR/sram_generator-output.json` (empty unless `vlsi.inputs.sram_parameters` is specified)
8987
- RTL simulation
9088
- `make sim-rtl`
9189
- Generated waveform in `OBJ_DIR/sim-rtl-rundir/output.fsdb`
@@ -151,3 +149,22 @@ Clone the [asap7 repo](https://github.com/The-OpenROAD-Project/asap7) somewhere
151149

152150
Refer to the [Hammer Sky130 plugin README](https://hammer-vlsi.readthedocs.io/en/stable/Technology/Sky130.html)
153151
to install the Sky130 PDK, then reference the path in your `ENV_YML` config (only the `technology.sky130.sky130A` key is required).
152+
153+
## Pipecleaning
154+
155+
We have provided several reference designs of increasing complexity to aid with pipecleaning your Hammer VLSI flow setup. These are summarized as follows, in order of complexity:
156+
157+
- `pass`: single register
158+
- `gcd`: computes greatest common denominator, good for testing more complex logic
159+
- `sram_wrapper_sky130`: example wrapper for an SRAM instance in Sky130, useful for ensuring correct SRAM integration into flow
160+
- wraps any Sky130 SRAM instance available in `hammer/hammer/technology/sky130/sram-cache.json`
161+
- SRAM instance specified via defines in `configs-design/sram_wrapper_sky130/common.yml`
162+
- all SRAM configurations are loaded via these config fragments in `configs-design/sram_wrapper_sky130/sky130.yml`:
163+
- ```yaml
164+
# Compile all srams in our cache
165+
vlsi.inputs.sram_parameters: "../../../hammer/technology/sky130/sram-cache.json"
166+
vlsi.inputs.sram_parameters_meta: ["prependlocal", "transclude", "json2list"]
167+
```
168+
169+
170+

e2e/configs-design/gcd/power-rtl-sky130.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ power.inputs:
1111
levels: 1
1212
toggle_signal: /gcd/clk
1313
num_toggles: 1
14-
report_name: levels-1
14+
report_stem: levels-1
1515
output_formats:
1616
- all
1717
# the following two should produce equivalent results:
1818
- waveform_path: "build-sky130-cm/gcd/sim-rtl-rundir/output.fsdb"
1919
inst: /gcd/GCDctrl0
2020
toggle_signal: /gcd/clk
2121
num_toggles: 1
22-
report_name: inst-GCDctrl0
22+
report_stem: inst-GCDctrl0
2323
output_formats:
2424
- all
2525
- waveform_path: "build-sky130-cm/gcd/sim-rtl-rundir/output.fsdb"
2626
module: gcd_control
2727
interval_size: 5ns
28-
report_name: module-gcd_control
28+
report_stem: module-gcd_control
2929
output_formats:
3030
- all
3131

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Generate Make include to aid in flow
2+
vlsi.core.build_system: make
3+
4+
vlsi.inputs.power_spec_type: "cpf"
5+
vlsi.inputs.power_spec_mode: "auto"
6+
7+
design.defines: &DEFINES
8+
- SRAM_NAME=sram22_64x32m4w8
9+
- DATA_WIDTH=32
10+
- ADDR_WIDTH=6
11+
- WMASK_WIDTH=4
12+
13+
synthesis.inputs:
14+
top_module: "sram_wrapper_sky130"
15+
input_files: ["src/sram_wrapper_sky130.v"]
16+
defines: *DEFINES
17+
defines_meta: append
18+
19+
sim.inputs:
20+
top_module: "sram_wrapper_sky130"
21+
tb_name: "sram_wrapper_sky130_tb"
22+
tb_dut: "sram_wrapper_sky130_dut"
23+
defines: *DEFINES
24+
defines_meta: append
25+
26+
power.inputs:
27+
top_module: "sram_wrapper_sky130"
28+
tb_name: "sram_wrapper_sky130_tb"
29+
tb_dut: "sram_wrapper_sky130_dut"
30+
defines: *DEFINES
31+
defines_meta: append
32+
33+
vlsi.inputs.delays: [
34+
{name: "we", clock: "clock", delay: "1", direction: "input"},
35+
{name: "wmask", clock: "clock", delay: "1", direction: "input"},
36+
{name: "addr", clock: "clock", delay: "1", direction: "input"},
37+
{name: "din", clock: "clock", delay: "1", direction: "input"},
38+
{name: "dout", clock: "clock", delay: "1", direction: "output"}
39+
]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Test Joules Flow
2+
3+
vlsi.core.power_tool: "hammer.power.joules"
4+
5+
power.inputs:
6+
level: "rtl"
7+
input_files: ["src/sram_wrapper_sky130.v"]
8+
waveforms: ["build-sky130-cm/sram_wrapper_sky130/sim-rtl-rundir/output.fsdb"]
9+
report_configs:
10+
- waveform_path: "build-sky130-cm/sram_wrapper_sky130/sim-rtl-rundir/output.fsdb"
11+
inst: /sram_wrapper_sky130/mem0
12+
# specify either interval_size or toggle_signal+num_toggles
13+
# interval_size: 2.5ns
14+
levels: 2
15+
report_stem: sram22_64x32m4w8-write-din_13
16+
toggle_signal: clock
17+
num_toggles: 1
18+
output_formats:
19+
- report
20+
- ppa
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# RTL Simulation
2+
3+
sim.inputs:
4+
level: "rtl"
5+
input_files: ['src/sram_wrapper_sky130.v', 'src/sram_wrapper_sky130_tb.v']
6+
options:
7+
- "-notice"
8+
- "-line"
9+
- "+lint=all,noVCDE"
10+
- "+v2k"
11+
- "-debug"
12+
- "-sverilog"
13+
- "-lca"

0 commit comments

Comments
 (0)