Skip to content

Commit 6a94e11

Browse files
Merge pull request #97 from andresag01/cap-encoding-v9-clarification
Clarify difference in IE between current spec and CHERI v9
2 parents 3dc7efc + 30c521c commit 6a94e11

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

Diff for: src/cap-description.adoc

+17-4
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,7 @@ NOTE: Reserved bits must be 0 in valid capabilities.
289289

290290
ifdef::cheri_v9_annotations[]
291291
NOTE: *CHERI v9 Note:* The encoding changes eliminate the concept of the
292-
in-memory format, and also increase precision for RV32. When EF=0, T and B
293-
are now shifted right rather than left within the address. Also, the bounds
294-
decoding for XLENMAX=32 uses a trick (see bit T8) to save one bit when encoding
295-
the exponent.
292+
in-memory format, and also increase precision for RV32.
296293
endif::[]
297294

298295
The components of a capability are encoded as shown in
@@ -323,6 +320,22 @@ simply a place-holder while the Sail implementation is available. In this
323320
notation, / means "integer division", [] are the bit-select operators, and
324321
arithmetic is signed.#
325322

323+
ifdef::cheri_v9_annotations[]
324+
NOTE: *CHERI v9 Note:* The IE bit from CHERI v9 is renamed EF and its value is
325+
inverted to ensure that the <<NULL>> capability is encoded as zero without the
326+
need for CHERI v9's in-memory format. +
327+
When EF=1, the exponent E=0, so the address bits a[MW - 1:0] are replaced
328+
with T and B to form the top and base addresses respectively. +
329+
When EF=0, the exponent `E=CAP_MAX_E - ( (XLENMAX == 32) ? { T8, TE, BE } : { TE, BE } )`,
330+
so the address bits a[E + MW - 1:E] are replaced with T and B to form the top
331+
and base addresses respectively. E is computed by subtracting from the maximum
332+
possible exponent CAP_MAX_E which can be efficiently implemented in hardware
333+
assuming that T and B are at bit CAP_MAX_E and performing a logical bitwise
334+
shift right by E. In contrast, CHERI v9 implementations computed the top and
335+
base addresses by assumming that T and B are at bit 0 and performing a logical
336+
bitwise shift left by E.
337+
endif::[]
338+
326339
```
327340
EW = (XLENMAX == 32) ? 5 : 6
328341
CAP_MAX_E = XLENMAX - MW + 2

0 commit comments

Comments
 (0)