Theory of Operation

Block Diagram

CHERIoT memory subsystem block diagram

PortDirectionPeerPurpose
cored_tl_ddevicerv_core_ibexCore data accesses with the capability tag support.
cored_tl_hhostxbar_mainThe data half of the access, forwarded to SRAM, NVM and peripherals.
corerevbm_tldevicerv_core_ibexRevocation bitmap reads from the core’s TRVK filter.
revbm_tl_ddevicexbar_mainMemory window through which software reads and writes the revocation bitmap.
regs_tl_ddevicexbar_mainCSR interface.
meta_sram_tlhostsram_ctrl_metaThe single port into the unified meta SRAM.

cheriot_ena_i selects the execution mode. It is a mubi4_t driven by the write-once mode switch in rv_core_ibex.

Metadata Encoding

Two kinds of metadata are stored, both at bit granularity, both packed into 32-bit words:

MetadataCovered by one bitCovered by one 32-bit word
Capability tagone 8-byte capability256 bytes of data
Revocation bit8 heap bytes256 heap bytes

Meta SRAM Address Map

The map is derived from the address-map parameters, so it changes with the covered region sizes. For Earl Grey - 192 KiB main SRAM at 0x1000_0000, 2 MiB NVM at 0x3000_0000, meta SRAM at 0x1100_0000 - it is:

OffsetSizeRegionReachable from
0x00003 KiBMain SRAM revocation bitmaprevbm_tl_d, corerevbm_tl
0x0C0032 KiBNVM capability tagsRMW filter
0x8C003 KiBMain SRAM capability tagsRMW filter
0x9800-top-

The revocation bitmap is situated at the base of the meta SRAM. The revbm window and the meta SRAM’s own RAM interface consequently share a base address; the window is the software-visible view of the first region, the RAM interface is only reachable from meta_sram_tl.

In the revbm window, bit b of word w covers the eight heap bytes starting at MainSramBaseAddr + (w * 32 + b) * 8, setting it marks that granule as revoked. Accesses must be full 32-bit words, and the window returns a TL-UL error while the system is in ePMP mode.

Datapath

Tag Filter

The tag filter forks each core data access into up to three streams, the host port, the meta port, and a small metadata FIFO that carries information from the request to the response channel. After receiving the responses, the streams are joined together and the data response is returned to the core.

A meta lookup is needed when CHERIoT mode is enabled, the access targets memory capable of holding capabilities, and either:

  • the access is a 64-bit-aligned read that the core hints as a capability load.
  • the access is a write, of any kind.

Writes always look up because a non-capability store must clear the tag of the location it overwrites.

The returned tag is sticky across the two words of a capability: on a response whose FIFO entry was marked aligned, the tag read from the meta SRAM is presented and captured; on the following unaligned response the captured value is presented again and then cleared. This is what lets a 65-bit capability arrive over two 32-bit responses with one combined validity tag bit.

The FIFO depth sets the number of outstanding transactions the subsystem supports; it is fixed to two, matching Ibex’s LSU, which never issues more than two outstanding split-access halves. Error responses from either the host or the meta path are merged into d_error towards the core.

RMW Filter

Because tags are bit-granular, a tag write cannot be a plain TL-UL write. The RMW filter turns each access into meta SRAM traffic with a four-state FSM:

StateBehaviour
PassthroughA read is forwarded and the tag bit is picked out of the response word. A write is turned into a Get of the meta word and the FSM advances to Fill.
FillThe meta word arrives. If the stored tag bit already equals the tag to be written, the read response is converted into an AccessAck towards the core and the FSM returns to Passthrough. Otherwise the word is captured, the bit is modified, and the FSM advances.
WriteBackReqThe modified word is written back with PutFullData and freshly computed command and data integrity.
WriteBackAckThe write response is forwarded to the core and the FSM returns to Passthrough.

Skipping the write-back is the common case and keeps pressure off the shared meta SRAM: it costs one meta SRAM read per 32-bit store, and a read plus a write only when the tag actually changes.

The filter checks the response integrity and response data integrity of every meta SRAM response and separately reports d_error.

Access Checkers

Each of the three requesters passes an access checker parameterized with the region it owns. An access is forwarded only if all of the following hold:

  • cheriot_ena_i is MuBi4True.
  • The address is inside the allowable region for the requester.
  • The opcode is Get or PutFullData.

Everything else is steered to a tlul_err_resp instance and answered with a TL-UL error. In particular, any cheriot_ena_i value other than a strict MuBi4True - including a strict MuBi4False - makes the entire meta SRAM inaccessible from all three ports.

Arbitration

A tlul_socket_m1 arbitrates the three checked streams onto meta_sram_tl. Arbitration sits behind the checkers, on transactions that are already integrity-protected end to end.

System Bus Access

The debug module’s system bus access (SBA) port is a crossbar host of its own and does not pass through the tag filter, so none of the datapath above applies to it. SBA remains available in CHERIoT mode if the life cycle state allows debug, but:

  • reads and writes go straight to memory without any CHERIoT checks.
  • writes do not clear the capability tag of the location they overwrite.

Debug accesses in CHERIoT-mode MUST therefore be performed through Ibex and not through SBA.

Error Handling

The subsystem distinguishes a denied access from a fault:

CauseResult
Any meta SRAM access while in ePMP modeTL-UL error response, merged into d_error towards the core
Access outside the region owned by the requesting portTL-UL error response
PutPartialData to the meta SRAMTL-UL error response
Device error on the tag pathRead-modify-write aborted, d_error towards the core, and fatal_fault alert
Integrity fault on a meta SRAM response (rsp_intg or data_intg)fatal_fault alert
Integrity fault on the CSR interfacefatal_fault alert
Pointer error in the tag filter’s hardened FIFOfatal_fault alert

The first three are reachable by software and surface as a bus fault in the core, so they must not raise an alert. The last four latch the fatal alert until reset. There is no interrupt.

Timing

All internal sockets and the socket towards the meta SRAM are instantiated with zero-depth FIFOs, so a request propagates combinationally from cored_tl_d through the tag filter, RMW filter, access checker and arbiter to meta_sram_tl, and the response propagates back the same way. This keeps the latency overhead of CHERIoT mode at zero cycles for reads, but places the meta SRAM path on the critical path.

The design provisions optional pipeline cuts in front of the access checkers to break that path, at the cost of two extra cycles per meta SRAM access. They are not implemented yet.