Skip to content

Commit 4a3b22a

Browse files
a-willthommythomaso
authored andcommitted
[rtl,fpga] Add and integrate FPGA-only memory backdoor loader IP
The `bkdr_loader` IP is used to preload different ROM and OTP contents when running FPGA tests. It poses a technology-independent replacement for the currently used bitstream splicing flow. Co-authored-by: Alex Williams <awill@opentitan.org> Signed-off-by: Alex Williams <awill@opentitan.org> Signed-off-by: Thomas Benz <tbenz@lowrisc.org>
1 parent f3ee88d commit 4a3b22a

32 files changed

Lines changed: 4006 additions & 196 deletions

hw/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ endif
2222
IPS ?= aes \
2323
adc_ctrl \
2424
aon_timer \
25+
bkdr_loader \
2526
csrng \
2627
dma \
2728
edn \

hw/ip/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ filegroup(
1717
"//hw/ip/adc_ctrl:rtl_files",
1818
"//hw/ip/aes:rtl_files",
1919
"//hw/ip/aon_timer:rtl_files",
20+
"//hw/ip/bkdr_loader:rtl_files",
2021
"//hw/ip/csrng:rtl_files",
2122
"//hw/ip/dma:rtl_files",
2223
"//hw/ip/edn:rtl_files",

hw/ip/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
| [`aes`] | AES encryption and decryption engine with SCA and FI countermeasures |
99
| [`aon_timer`] | Wakeup and watchdog timers running on a low-power, always-on clock |
1010
| [`ascon`] | Ascon authenticated encryption and decryption engine |
11+
| [`bkdr_loader`] | Provides FPGA-only indirect programming to RAMs |
1112
| [`csrng`] | Takes entropy bits to produce cryptographically secure random numbers for consumption by hardware blocks and by software |
1213
| [`dma`] | DMA Controller for the integrated OpenTitan. |
1314
| [`edn`] | Distributes random numbers produced by CSRNG to hardware blocks |
@@ -40,6 +41,7 @@
4041
[`aes`]: ./aes/README.md
4142
[`aon_timer`]: ./aon_timer/README.md
4243
[`ascon`]: ./ascon/README.md
44+
[`bkdr_loader`]: ./bkdr_loader/README.md
4345
[`csrng`]: ./csrng/README.md
4446
[`dma`]: ./dma/README.md
4547
[`edn`]: ./edn/README.md

hw/ip/bkdr_loader/BUILD

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright lowRISC contributors (OpenTitan project).
2+
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
package(default_visibility = ["//visibility:public"])
6+
7+
filegroup(
8+
name = "rtl_files",
9+
srcs = glob(
10+
["**"],
11+
exclude = [
12+
"dv/**",
13+
"doc/**",
14+
"README.md",
15+
],
16+
) + [
17+
"//hw/ip/bkdr_loader/data:all_files",
18+
],
19+
)

hw/ip/bkdr_loader/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# BKDR_LOADER Technical Specification
2+
<!-- BEGIN CMDGEN util/mdbook_regression_links.py --hjson hw/ip/bkdr_loader/data/bkdr_loader.hjson --top earlgrey -->
3+
| Regression | Version | [Stages](https://opentitan.org/book/doc/project_governance/development_stages.html) | Results |
4+
|-|-|-|-|
5+
[`bkdr_loader`](https://dashboard.reports.lowrisc.org/opentitan/earlgrey/dashboard.html) | 0.1.0 | D1, V0 | ![](https://dashboard.reports.lowrisc.org/opentitan/earlgrey/badge/bkdr_loader/test.svg) ![](https://dashboard.reports.lowrisc.org/opentitan/earlgrey/badge/bkdr_loader/passing.svg) ![](https://dashboard.reports.lowrisc.org/opentitan/earlgrey/badge/bkdr_loader/functional.svg) ![](https://dashboard.reports.lowrisc.org/opentitan/earlgrey/badge/bkdr_loader/code.svg) |
6+
7+
<!-- END CMDGEN -->
8+
9+
# Overview
10+
11+
This document specifies the FPGA-only memory Backdoor Loader which is used to preload non-volatile
12+
and volatile memories on FPGA targets.
13+
14+
15+
## Features
16+
17+
- No impact on ASIC implementation: loader RTL only in FPGA-specific files
18+
- Exposes FPGA-only registers such as the `USR_TIMESTAMP`
19+
- Up to 64 memory r/w targets supported
20+
- Automatic discovery of available targets by presenting a 32-bit target ID as well as width and depth
21+
- Access to raw BRAM data allowing to set both data and ECC arbitrarily for each target
22+
23+
## Description
24+
25+
The BKDR_LOADER intercepts the reset and JTAG signals between the FPGA pad array and the top-level
26+
OpenTitan instance. On reset, the IP samples the tap strap pins and becomes active if both strap
27+
signals are high (DFT mode on the ASIC).
28+
29+
When active, the module keeps the reset to both the AST and OpenTitan asserted to prevent any access
30+
to non-initialized memory regions. It presents an internal RISC-V DTM over which the loader's internal
31+
[registers](doc/registers.md) can be accessed. The BKDR_LOADER presents both the number of targets and key target
32+
information through its register space.
33+
34+
After completing preloading and data validation, the loader is deactivated until the next
35+
button reset via the control register. In this case, the JTAG signals are forwarded to OpenTitan
36+
and the reset to the AST and OpenTitan is de-asserted.

hw/ip/bkdr_loader/bkdr_loader.core

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
CAPI=2:
2+
# Copyright lowRISC contributors (OpenTitan project).
3+
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
4+
# SPDX-License-Identifier: Apache-2.0
5+
name: "lowrisc:ip:bkdr_loader:0.1"
6+
description: "Backdoor Memory Loader intended for FPGAs"
7+
8+
filesets:
9+
files_rtl:
10+
depend:
11+
- lowrisc:prim:all
12+
- lowrisc:ip:tlul
13+
files:
14+
- rtl/bkdr_loader.svh : {is_include_file : true}
15+
- rtl/bkdr_loader_reg_pkg.sv
16+
- rtl/bkdr_loader_regs_reg_top.sv
17+
- rtl/bkdr_loader_pkg.sv
18+
- rtl/bkdr_loader.sv
19+
file_type: systemVerilogSource
20+
21+
files_verilator_waiver:
22+
depend:
23+
# common waivers
24+
- lowrisc:lint:common
25+
- lowrisc:lint:comportable
26+
file_type: vlt
27+
28+
files_ascentlint_waiver:
29+
depend:
30+
# common waivers
31+
- lowrisc:lint:common
32+
- lowrisc:lint:comportable
33+
file_type: waiver
34+
35+
files_veriblelint_waiver:
36+
depend:
37+
# common waivers
38+
- lowrisc:lint:common
39+
- lowrisc:lint:comportable
40+
file_type: veribleLintWaiver
41+
42+
parameters:
43+
SYNTHESIS:
44+
datatype: bool
45+
paramtype: vlogdefine
46+
47+
48+
targets:
49+
default: &default_target
50+
filesets:
51+
- tool_verilator ? (files_verilator_waiver)
52+
- tool_ascentlint ? (files_ascentlint_waiver)
53+
- tool_veriblelint ? (files_veriblelint_waiver)
54+
- files_rtl
55+
toplevel: bkdr_loader
56+
57+
lint:
58+
<<: *default_target
59+
default_tool: verilator
60+
parameters:
61+
- SYNTHESIS=true
62+
tools:
63+
verilator:
64+
mode: lint-only
65+
verilator_options:
66+
- "-Wall"
67+
68+
syn:
69+
<<: *default_target
70+
# TODO: set default to DC once
71+
# this option is available
72+
# olofk/edalize#89
73+
default_tool: icarus
74+
parameters:
75+
- SYNTHESIS=true

hw/ip/bkdr_loader/data/BUILD

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright lowRISC contributors (OpenTitan project).
2+
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
package(default_visibility = ["//visibility:public"])
6+
7+
filegroup(
8+
name = "all_files",
9+
srcs = glob(["**"]),
10+
)

0 commit comments

Comments
 (0)