Skip to content

Commit c7febb3

Browse files
committed
[doc] Various misc doc updates for the new FPGA loading flow
Remove references to splicing bitstreams and update docs where relevant. Also address some smaller areas of documentation that have fallen out of date with the current practices. Where necessary, apply relevant OpenTitan Markdown styling for consistencfy (one sentence per line). Additionally, add a small note for a needed FIXUP with old CW310 references, which should be replaced with CW340 references (but is deferred to a separate commit). Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
1 parent 7a79c7d commit c7febb3

14 files changed

Lines changed: 38 additions & 41 deletions

File tree

.github/workflows/bitstream.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
bitstream_archive=$(./bazelisk.sh outquery "${cached_archive}")
5757
cp -Lv ${bitstream_archive} build-bin.tar
5858
59-
- name: Build and splice bitstream with Vivado
59+
- name: Build base bitstream with Vivado
6060
if: steps.strategy.outputs.bitstreamStrategy != 'cached'
6161
run: |
6262
bazel_package=//hw/bitstream/vivado

.github/workflows/monthly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
cp -rLvt "$OBJ_DIR/$SUB_PATH/" \
5050
$(./bazelisk.sh outquery-all ${bitstream_target}) || true
5151
52-
# TODO: Splice ROM into the bitstream?
52+
# TODO: upload the ROM to be spliced as a separate artefact?
5353
cp -Lv ${bitstream_archive} build-bin.tar
5454
}
5555

ci/scripts/run-fpga-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export BITSTREAM="--offline --list ci_bitstreams"
3131
# Note that the hyperdebug backend does not have the reset-sam3x command so this will fail but not trigger an error.
3232
trap './bazelisk.sh run //sw/host/opentitantool -- --rcfile= --interface=${fpga} fpga reset-sam3x || true' EXIT
3333

34-
# In case tests update OTP or otherwise leave state on the FPGA we should start
35-
# by clearing the bitstream.
34+
# Running tests will clear all non-volatile memory on the FPGA, but we start by
35+
# clearing the bitstream to be cautious in case tests leave behind some state.
3636
# FIXME: #16543 The following step sometimes has trouble reading the I2C we'll
3737
# log it better and continue even if it fails (the pll is mostly correctly set
3838
# anyway).

doc/contributing/bazel_notes.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ bazel run //quality:license_check --test_output=streamed
245245
Note, to run (software) tests on these OpenTitan hardware platforms **does not** require these Bazel commands be invoked before the test commands above.
246246
Bazel is aware of all dependency relationships, and knows what prerequisites to build to run a test.
247247

248-
- Build FPGA bitstream with (test) ROM, see [here](../getting_started/setup_fpga.md#build-an-fpga-bitstream).
249-
- Build FPGA bitstream with (production) ROM, see [here](../getting_started/setup_fpga.md#build-an-fpga-bitstream).
250-
- Build Verilator simulation binary:
248+
- Build a base FPGA bitstream with a (test) ROM, see [here](../getting_started/setup_fpga.md#build-an-fpga-bitstream).
249+
- Build a production ROM and OTP image for the FPGA, see [here](../getting_started/setup_fpga.md#programming-the-fpga-with-rom--otp-images).
250+
- Build a Verilator simulation binary:
251251
```sh
252252
bazel build //hw:verilator
253253
```

doc/contributing/fpga/debugging_with_ila.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,10 @@ In practice, we have not seen problems (e.g., due to missing constraints) yet, a
234234
So you can ignore this warning, but it's worth keeping in mind *if* you should see any problems (e.g., due to timing violations).
235235

236236

237-
## Building and splicing bitstreams that include an ILA
237+
## Building bitstreams that include an ILA
238238

239239
With the steps above complete, building a first bitstream that includes the defined ILAs is as simple as following the [corresponding guide](../../getting_started/setup_fpga.md#build-an-fpga-bitstream).
240-
The generated and spliced bitstream will include the defined ILAs.
240+
The generated bitstream will include the defined ILAs.
241241

242242

243243
## Programming the FPGA, controlling the ILA, and running a test

doc/getting_started/build_sw.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,12 @@ We maintain or use the following tags to support this:
119119
* `broken` is used to tag tests that are committed but should not be expected by CI or others to pass.
120120
* `cw340`, `cw340_test_rom`, and `cw340_rom_with_fake_keys` are used to tag tests that depend on a correctly setup cw340 "Luna Board" to emulate OpenTitan.
121121
The `cw340` tag may be used in `--test_tag_filters` to enable concise filtering to select tests that run on this board and include or exclude them.
122-
Loading the bitstream is the slowest part of the test, so these tags can group tests with common bitstreams to accelerate the tests tagged `cw340_test_rom`.
122+
Historically these tests were grouped by execution environment, because this corresponded to a new "spliced" bitstream in the old FPGA testing flow.
123+
Loading the bitstream is the slowest part of the test, but this should only need to be done once for the FPGA.
124+
These tags are currently retained as a convenient mechanism for grouping tests, but are somewhat arbitrary.
123125
* `verilator` is used to tag tests that depend on a verilated model of OpenTitan that can take a significant time to build.
124126
Verilated tests can still be built with `--define DISABLE_VERILATOR_BUILD`, but they will skip the invocation of Verilator and cannot be run.
125127
* `vivado` is used to tag tests that critically depend on Vivado.
126-
* `jtag` is used to tag tests that rely on a USB JTAG adapter connected like we have in CI.
127128
* `manual` is a Bazel builtin that prevents targets from matching wildcards.
128129
Test suites are typically tagged manual so their contents match, but test suites don't get built or run unless they're intentionally invoked.
129130
Intermediate build artifacts may also be tagged with manual to prevent them from being unintentionally built if they cause other problems.
Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# Install Vivado
22

3-
Generating a bitstream for Xilinx devices requires a
4-
[Vivado](https://www.xilinx.com/products/design-tools/vivado.html) installation.
5-
Please note that the "WebPACK" edition __does not__ support the Xilinx Kintex
6-
UltraScale XCKU095 used on the CW341 board.
3+
Generating a bitstream for Xilinx devices requires a [Vivado](https://www.xilinx.com/products/design-tools/vivado.html) installation.
4+
Please note that the "WebPACK" edition __does not__ support the Xilinx Kintex UltraScale XCKU095 used on the CW341 board.
75

8-
For software development, Vivado is still necessary for most workflows.
9-
However, the (free) Lab Edition is sufficient, and it has a significantly smaller installation footprint.
10-
For example, Vivado's `updatemem` tool is used to splice ROM images into the bitstream, and this is included in the Lab Edition.
6+
For software development, Vivado is *not* necessary for most workflows.
7+
We previously used Vivado's `updatemem` to splice ROM & OTP images into the bitstream, which required the (free) Lab edition of Vivado.
8+
This has since been migrated to instead use an FPGA-specific IP to program memories over JTAG, and thus is no longer necessary.
119

1210
## Install Xilinx Vivado
1311

@@ -16,17 +14,12 @@ _**Vivado Version:** The recommendation is to use Vivado {{#tool-version vivado
1614
Following the arrival of Vivado ML Edition, you will need to follow the links for that, eg. Products -> Hardware Development -> Vivado ML.
1715
Then click on 'Vivado Archive' in the Version list and locate version {{#tool-version vivado }} of Vivado Design Suite.
1816

19-
See [Download and
20-
Installation](https://docs.xilinx.com/r/{{#tool-version vivado }}-English/ug973-vivado-release-notes-install-license/Download-and-Installation)
21-
for installation instructions.
17+
See [Download and Installation](https://docs.xilinx.com/r/{{#tool-version vivado }}-English/ug973-vivado-release-notes-install-license/Download-and-Installation) for installation instructions.
2218

2319
When asked what edition to install, choose "Vivado HL Design Edition".
24-
_Note: If you are only developing software, you may select the "Lab Edition" instead._
2520
On the feature selection screen, select at least the following features:
2621

2722
![Vivado features selection screen](features.png)
2823

29-
After installing Vivado, you will need to add Vivado's paths to your shell
30-
environment. See [Launching the Vivado IDE from the Command Line on Windows or
31-
Linux](https://docs.xilinx.com/r/{{#tool-version vivado }}-English/ug892-vivado-design-flows-overview/Launching-the-Vivado-IDE-from-the-Command-Line-on-Windows-or-Linux)
32-
for instructions.
24+
After installing Vivado, you will need to add Vivado's paths to your shell environment.
25+
See [Launching the Vivado IDE from the Command Line on Windows or Linux](https://docs.xilinx.com/r/{{#tool-version vivado }}-English/ug892-vivado-design-flows-overview/Launching-the-Vivado-IDE-from-the-Command-Line-on-Windows-or-Linux) for instructions.

sw/device/silicon_creator/rom/doc/e2e_tests.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,24 @@ This guide will help you to setup an environment to run the ROM E2E tests in an
55
The [ROM](../README.md) is the first boot stage of secure boot flow and by nature, it cannot be updated after manufacturing.
66
The ROM E2E (End-to-End) tests validates the ROM features and can be used for regression tests.
77
Each test is divided into components:
8-
- **ROM Image**, a C program built by `bazel` and spliced with the bitstream. The ROM is the DUT (Device Under Test) of the ROM E2E tests.
8+
- **ROM Image**, a C program built by `bazel` and loaded onto the FPGA. The ROM is the DUT (Device Under Test) of the ROM E2E tests.
99
- **OTP image**, contains HW and SW configurations, some of which control execution paths in the ROM, such as the lifecycle stage.
1010
As a result, we run some tests with several different OTP images to increase coverage of ROM execution paths.
1111
There is more information in the documentation for the OTP layout.
1212
That documentation is specialised for the different tops.
1313
For an example, see earlgrey's [OTP memory map](../../../../../hw/top_earlgrey/ip_autogen/otp_ctrl/README.md#direct-access-memory-map).
1414
- **FPGA bitstream**, Opentitan Hardware implementation synthesized for the FPGA built by `bazel` and `vivado`.
1515
- **Device test firmware**, a C program (built by bazel to run on an OpenTitan device) that is loaded into flash, and booted by the ROM stage. It checks the HW registers and/or memory configurations performed by the ROM and relays information to the Host test software.
16-
- **opentitantool**, a Rust program that provides a common interface to interact with an OpenTitan device. `opentitantool` uses `opentitanlib` which provides the abstractions to communicate with an OpenTitan device.
16+
- **opentitantool**, a Rust program that provides a common interface to interact with an OpenTitan device.
17+
`opentitantool` uses `opentitanlib` which provides the abstractions to communicate with an OpenTitan device.
1718
- **Host test software**, any Rust program (built by `bazel` to run on the host platform , e.g. a x86 binary, and linked with `opentitanlib`) that actively interacts with an OpenTitan device over any hardware interface (e.x., UART, SPI or JTAG) to perform the test functions and check their results.
1819

1920
![Architecture](ROM_E2E_Tests.svg)
2021

2122
All the existing tests are documented in the [ROM E2E Testplan](https://github.com/lowRISC/OpenTitan/blob/master/sw/device/silicon_creator/rom/data/rom_e2e_testplan.hjson).
2223
## Hardware setup
2324
### FPGA
25+
<!--FIXME: The below docs should be updated to reference the CW340, since the CW310 is no longer supported.-->
2426
The E2E ROM tests run on the CW310 FPGA board with the following configuration:
2527
- The power supply connected to the J11 connector.
2628
- A USB cable connecting the Host PC to the USB-C Data (J8) connector which is connected to the SAM3U microcontroller on the CW310 FPGA board.
@@ -37,7 +39,6 @@ Some tests will use the JTAG interface to interact with OpenTitan, as the CW310
3739
The software dependencies are covered by other guides in this book and are linked below.
3840
- Clone the OpenTitan repository and install the software dependencies: [Get started](../../../../../doc/getting_started/README.md).
3941
- Setup the FPGA: [FPGA guide](../../../../../doc/getting_started/setup_fpga.md).
40-
- Install Vivado to be able to splice bitstreams: [Installing Vivado](../../../../../doc/getting_started/install_vivado).
4142

4243
**Note**: Make sure that you added the udev rules for the [FPGA](../../../../../doc/getting_started/install_vivado#device-permissions-udev-rules) board and the [JTAG](../../../../../doc/getting_started/setup_fpga.md#device-permissions-udev-rules) adapter.
4344

@@ -51,6 +52,7 @@ Once the hardware setup is done and the FPGA is connected to the USB, the full s
5152
cd ${REPO_TOP}
5253
bazel test --define DISABLE_VERILATOR_BUILD=true --define bitstream=gcp --test_tag_filters=-verilator,-dv,-broken --build_tests_only //sw/device/silicon_creator/rom/e2e/...
5354
```
54-
This bazel command will download a bitstream associated with the HEAD commit of the repository, splice it with the different OTP configurations (RMA, DEV, PROD*, TEST*), load the FPGA and run all the tests suites under `sw/device/silicon_creator/rom/e2e`.
55+
This bazel command will download a bitstream associated with the HEAD commit of the repository, load the FPGA with the bitstream and program it with various different OTP configurations (RMA, DEV, PROD*, TEST*), and run all the tests suites under `sw/device/silicon_creator/rom/e2e`.
5556

56-
**Note**: If you have hardware changes then you can build the bitstream locally by changing the tag `bitstream=` from `gcp` to `vivado`. Although this will take much longer.
57+
**Note**: If you have hardware changes then you can build the bitstream locally by changing the tag `bitstream=` from `gcp` to `vivado`.
58+
Although this will take much longer.

sw/device/silicon_creator/rom/e2e/bootstrap/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ opentitan_test(
9595
"//hw/top_earlgrey:fpga_cw340_rom_with_fake_keys": None,
9696
},
9797
fpga = fpga_params(
98-
# Since the bitstream disables bootstrap, there is no firmware to
98+
# Since the OTP configuration disables bootstrap, there is no firmware to
9999
# load into the chip. However, opentitan_test wants to build a
100100
# binary target. We'll build an unsigned do-nothing binary.
101101
binaries = {

sw/device/silicon_creator/rom/e2e/jtag_inject/BUILD

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ package(default_visibility = ["//visibility:public"])
3232
]
3333

3434
[
35-
# We are using a bitstream with disabled execution so the content of the flash
36-
# does not matter but opentitan_test() is unhappy if we don't provide one.
35+
# We are using an OTP configuration with disabled execution so the content of the
36+
# flash does not matter, but opentitan_test() is unhappy if we don't provide one.
3737
# Since execution in the ROM is disabled, bootstrap is not possible so we need
38-
# to make sure that the test does not try to bootstrap
38+
# to make sure that the test does not try to bootstrap.
3939
opentitan_test(
4040
name = "sram_program_test_otp_{}".format(lc_state),
4141
srcs = ["//sw/device/silicon_creator/rom/e2e:empty_test"],

0 commit comments

Comments
 (0)