Skip to content

Commit da6072b

Browse files
committed
WIP: Update bkdr loader and integrate into CW340
Signed-off-by: Thomas Benz <tbenz@lowrisc.org>
1 parent 3f242f5 commit da6072b

27 files changed

Lines changed: 1111 additions & 504 deletions

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 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: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ filegroup(
1414
"README.md",
1515
],
1616
) + [
17-
"//hw/ip/sram_ctrl/data:all_files",
17+
"//hw/ip/bkdr_loader/data:all_files",
1818
],
1919
)
2020

21-
filegroup(
22-
name = "doc_files",
23-
srcs = glob([
24-
"**/*.md",
25-
"**/*.svg",
26-
]) + ["//hw/ip/sram_ctrl/data:doc_files"],
27-
)
21+
#filegroup(
22+
# name = "doc_files",
23+
# srcs = glob([
24+
# "**/*.md",
25+
# "**/*.svg",
26+
# ]) + ["//hw/ip/bkdr_loader/data:doc_files"],
27+
#)

hw/ip/bkdr_loader/README.md

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1 @@
1-
# SRAM Controller Technical Specification (UPDATE ME FOR BKDR_LOADER!)
2-
3-
[`sram_ctrl/main`](https://reports.opentitan.org/hw/ip/sram_ctrl_main/dv/latest/report.html):
4-
![](https://dashboards.lowrisc.org/badges/dv/sram_ctrl/main/test.svg)
5-
![](https://dashboards.lowrisc.org/badges/dv/sram_ctrl/main/passing.svg)
6-
![](https://dashboards.lowrisc.org/badges/dv/sram_ctrl/main/functional.svg)
7-
![](https://dashboards.lowrisc.org/badges/dv/sram_ctrl/main/code.svg)
8-
9-
[`sram_ctrl/ret`](https://reports.opentitan.org/hw/ip/sram_ctrl_ret/dv/latest/report.html):
10-
![](https://dashboards.lowrisc.org/badges/dv/sram_ctrl/ret/test.svg)
11-
![](https://dashboards.lowrisc.org/badges/dv/sram_ctrl/ret/passing.svg)
12-
![](https://dashboards.lowrisc.org/badges/dv/sram_ctrl/ret/functional.svg)
13-
![](https://dashboards.lowrisc.org/badges/dv/sram_ctrl/ret/code.svg)
14-
15-
# Overview
16-
17-
This document specifies the functionality of the SRAM memory controller.
18-
The SRAM controller is a module that is a peripheral on the chip interconnect bus, and thus follows the [Comportability Specification](../../../doc/contributing/hw/comportability/README.md).
19-
20-
21-
The SRAM controller contains the SRAM data and address scrambling device and provides CSRs for requesting the scrambling keys and triggering the hardware initialization feature.
22-
23-
## Features
24-
25-
- [Lightweight scrambling mechanism](../prim/doc/prim_ram_1p_scr.md#custom-substitution-permutation-network) based on the PRINCE cipher.
26-
- Key request logic for the lightweight memory and address scrambling device.
27-
- Alert sender and checking logic for detecting bus integrity failures.
28-
- LFSR-based memory initialization feature.
29-
- Access controls to allow / disallow code execution from SRAM.
30-
- Security hardening when integrity error has been detected.
31-
- Optional memory readback mode for detecting memory integrity errors.
1+
# FPGA Backdoor Loader IP

hw/ip/bkdr_loader/bkdr_loader.core

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ filesets:
1111
- lowrisc:prim:all
1212
- lowrisc:ip:tlul
1313
files:
14+
- rtl/bkdr_loader.svh : {is_include_file : true}
1415
- rtl/bkdr_loader_reg_pkg.sv
1516
- rtl/bkdr_loader_regs_reg_top.sv
1617
- rtl/bkdr_loader_pkg.sv

hw/ip/bkdr_loader/data/BUILD

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ filegroup(
99
srcs = glob(["**"]),
1010
)
1111

12-
filegroup(
13-
name = "doc_files",
14-
srcs = glob(["*_testplan.hjson"]),
15-
)
12+
#filegroup(
13+
# name = "doc_files",
14+
# srcs = glob(["*_testplan.hjson"]),
15+
#)

hw/ip/bkdr_loader/data/bkdr_loader.hjson

Lines changed: 69 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@
4242
type: "int unsigned",
4343
default: "4",
4444
}
45-
{ name: "MaxIndexBitsDiv32",
46-
desc: "Max number of bits in the word index / word address, divided by 32",
47-
type: "int unsigned",
48-
default: "1",
49-
}
5045
]
5146

5247
features: [
@@ -72,59 +67,78 @@
7267
////////////////////////
7368
// Ctrl / Status CSRs //
7469
////////////////////////
75-
76-
{ name: "INFO",
77-
desc: "Information about this backdoor loader.",
78-
swaccess: "ro",
79-
hwaccess: "none",
80-
hwqe: "false",
70+
{ name: "Status",
71+
desc: "Status register",
72+
swaccess: "rc",
73+
hwaccess: "hwo",
74+
hwext: "true",
75+
hwqe: "true",
8176
fields: [
82-
{ bits: "2:0"
83-
name: "MAX_WORD_SIZE"
77+
{ bits: "0"
78+
name: "Error"
79+
swaccess: "ro",
80+
hwaccess: "hwo",
8481
desc: '''
85-
The maximum number of bits supported in a word, encoded as a power of 2.
82+
Whether an error happened on the last access. Clear on read.
8683
''',
87-
resval: "7" // Need templating to derive this value
88-
8984
}
90-
{ bits: "13:8"
91-
name: "MAX_INDEX_BITS"
85+
{ bits: "15:8"
86+
name: "IDX"
9287
desc: '''
93-
The maximum number of bits supported in a word index (word "address").
88+
Index of last memory access.
9489
''',
95-
resval: "32"
9690
}
9791
]
9892
}
99-
{ name: "OP",
100-
desc: "Operation control and status",
101-
swaccess: "rw",
93+
{ name: "Control",
94+
desc: "Control register",
95+
swaccess: "wo",
10296
hwaccess: "hro",
97+
hwqe: "true",
10398
fields: [
10499
{ bits: "0"
105-
name: "ISSUE_WRITE"
106-
swaccess: "rw1s",
107-
hwaccess: "hrw",
100+
name: "DONE"
101+
swaccess: "wo",
102+
hwaccess: "hro",
108103
desc: '''
109-
Issue a write transaction with the current state of the other CSRs.
104+
Switch to mission mode.
105+
''',
106+
},
107+
{ bits: "1"
108+
name: "WRITE_ENA"
109+
swaccess: "wo",
110+
hwaccess: "hro",
111+
desc: '''
112+
Whether to write or read.
110113
''',
111114
}
112-
{ bits: "15:8"
113-
name: "MEM_SELECT"
115+
]
116+
}
117+
{ name: "FPGA_INFO",
118+
desc: "FPGA info register",
119+
swaccess: "ro",
120+
hwaccess: "hwo",
121+
hwext: "true",
122+
fields: [
123+
{ bits: "31:0"
124+
name: "VAL"
125+
swaccess: "ro",
126+
hwaccess: "hwo",
114127
desc: '''
115-
Binary-encoded memory selector for issuing an operation.
128+
FGPA information.
116129
''',
117130
}
118131
]
119132
}
120133
{ skipto: "0x40" }
121134
{ multireg: {
122-
name: "DATA",
123-
desc: "Value to be written to the RAM",
135+
name: "READ_DATA",
136+
desc: "Value to be read from the RAM",
124137
count: "MaxWordWidthDiv32",
125138
cname: "VAL",
126-
swaccess: "rw",
127-
hwaccess: "hro",
139+
swaccess: "ro",
140+
hwaccess: "hwo",
141+
hwext: "true",
128142
fields: [
129143
{ bits: "31:0",
130144
name: "VAL",
@@ -134,13 +148,15 @@
134148
},
135149
]
136150
} },
151+
{ skipto: "0x80" }
137152
{ multireg: {
138-
name: "INDEX",
139-
desc: "Index of the word to be written",
140-
count: "MaxIndexBitsDiv32",
153+
name: "WRITE_DATA",
154+
desc: "Value to be written to the RAM",
155+
count: "MaxWordWidthDiv32",
141156
cname: "VAL",
142-
swaccess: "rw",
157+
swaccess: "wo",
143158
hwaccess: "hro",
159+
hwqe: "true",
144160
fields: [
145161
{ bits: "31:0",
146162
name: "VAL",
@@ -150,6 +166,21 @@
150166
},
151167
]
152168
} },
169+
{ skipto: "0x120" }
170+
{ name: "ADDRESS",
171+
desc: "Byte address of the word to be accessed",
172+
swaccess: "wo",
173+
hwaccess: "hro",
174+
hwqe: "true",
175+
fields: [
176+
{ bits: "31:0",
177+
name: "VAL",
178+
desc: '''
179+
''',
180+
resval: 0x0
181+
},
182+
]
183+
},
153184
],
154185
}
155186
}

0 commit comments

Comments
 (0)