← Back to Pull requests

Rename ENABLE_L8 and L8 to ENABLE_MSB and MSB #1283

Closed
arichardson closed this pull request without merging on Oct 12, 2026 13:33 UTC
View on GitHub
arichardson arichardson commented on Oct 09, 2026 00:08 UTC
Author

Addresses the following ARC review comments on v0.9.10:

  • "Why is this parameter not in CAPS like the others?"

  • "Does enableL8 need to be an option? Why not always mandate it?"

  • "Where is L8 stored? Where does it come from? It's not shown in the

  • capability metadata and doesn't appear to be calculated."
  • "Don't use subscripts in variable name. Suggest should be "L8" to

  • match other variables and the pseudo-code."

    Signed-off-by: Alex Richardson <alexrichardson@google.com>

    Diff: 71 lines (+39 / -32) across 5 files Reviewer: tariqkurd-repo Review duration: 5125m
    All Vouch review confidence checks passed
    Residual risk 0.07 = Change Risk (0.34) × (1 − Review Confidence (0.80)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.34 · 71 lines diff across 5 files
    0.34
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.73 · 5 substantive comment(s)
    0.73
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    80%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.256
    Real PR Conversation Timeline
    37 items
    tariqkurd-repo tariqkurd-repo commented on code on Oct 09, 2026 14:27 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -189,13 +189,14 @@ The variables related to the bounds decoding are shown in <<rvy64_uni_base_name_
     | B         | Value substituted into the capability's address to decode the _base_ bound address.
     | BE        | Value either substituted into the exponent or the _base_ bound address depending on EF.
     | E         | Exponent that determines the position at which T and B are substituted into the capability's address.
    -| L~8~^1^   | Value used to form either the MSB of the exponent or the MSB of the _top_ bound address.
    +| L8^1^     | Value used to form either the MSB of the exponent or the MSB of the _top_ bound address.
     | EF        | Exponent format flag indicating the encoding for T, B, and E: +
    -EF=0: The exponent is calculated from TE and BE, and conditionally L~8~, so it is 'internal'. +
    -EF=1: The exponent is zero; TE, BE, and L~8~ form part of the address bounds.
    +EF=0: The exponent is calculated from TE and BE, and conditionally L8, so it is 'internal'. +
    +EF=1: The exponent is zero; TE, BE, and L8 form part of the address bounds.
     |==============================================================================
     
    -^1^ Only valid if `enableL8=1`.
    +^1^ Only present in capability-encoding formats where `ENABLE_L8=1` (see <<sec_cap_encoding_formats>>), in which case `L8` is stored as a 1-bit field in the capability metadata.
    +In {rv64y_uni_base_name}, `EW=6` is even (`TE` and `BE` are 3 bits each) so a separate `L8` metadata bit is not used (`ENABLE_L8=0`); the bounds decoding equations are parameterized by `ENABLE_L8` so that they also apply to {cheri_base32_ext_name} capability-encoding formats that include an `L8` metadata bit for an odd exponent width (`EW`) and an extra bit of bounds precision when `EF=1`.

    In {rv64y_uni_base_name}, `EW=6` is even (`TE` and `BE` are 3 bits each).
    For {cheri_base32_ext_name} capability-encoding formats only a 5-bit exponent is needed, and exponent bits are shared equally between the base and top bound meaning that another exponent bit needs to be stored separately in the L8 bit.
    Additionally, L8 gives and an extra bit of bounds precision when `EF=1`.
    

    I find this easier to understand, but I don't think it gives the full picture yet.

    tariqkurd-repo tariqkurd-repo commented on Oct 09, 2026 14:34 UTC
    Contributor

    L8 needs renaming.
    It's the MSB of the exponent if EF=1 and also gives an extra bit of mantissa precision.
    Right now it's added into bit 8 of the top as MW=10
    It's bit 8 of the length as it's added to the base upper bits to form the top upper bits.

    T[MW - 1:MW - 2] = B[MW - 1:MW - 2] + LCout + LMSB

    I'm wondering if it should simply be MSB as it's for the exponent and length MSB?!

    tariqkurd-repo tariqkurd-repo commented on Oct 09, 2026 14:55 UTC
    Contributor

    Following discussion with @PeterRugg I've renamed L8 to MSB and improved the description of the field.

    arichardson arichardson commented on Oct 09, 2026 15:35 UTC
    Author

    Following discussion with PeterRugg I've renamed L8 to MSB and improved the description of the field.

    Yeah I also thought we should really rename it. This pr was the minimal fix but I think we should do it properly

    tariqkurd-repo tariqkurd-repo approved these changes on Oct 09, 2026 15:43 UTC
    Approved Reviewer

    it's much better with the rename, I never knew why it was called L8 until today

    arichardson arichardson commented on code on Oct 09, 2026 15:45 UTC
    Code Review
    src/cheri/rvy32-encoding.adoc:1
    @@ -46,7 +46,7 @@ NOTE: T[9:8], T[1:0] and B[1:0] are not specified by the metadata fields and are
     | MW          | {cap_rv32_mw_width} | Mantissa width
     | EW          | {cap_rv32_exp_width}| Exponent width
     | CAP_MAX_E   | {cap_rv32_exp_max}  | Maximum exponent value
    -| enableL8    | 1                   | Whether the encoding format includes the L~8~ bit
    +| ENABLE_MSB  | 1                   | Whether the encoding format includes the <<rvy64_uni_base_name_bndsenc_param_summary,MSB>> bit

    Actually now I wonder if we even need this flag, isn't it really just EW is odd/even?

    tariqkurd-repo tariqkurd-repo commented on code on Oct 09, 2026 15:55 UTC
    Code Review
    src/cheri/rvy32-encoding.adoc:1
    @@ -46,7 +46,7 @@ NOTE: T[9:8], T[1:0] and B[1:0] are not specified by the metadata fields and are
     | MW          | {cap_rv32_mw_width} | Mantissa width
     | EW          | {cap_rv32_exp_width}| Exponent width
     | CAP_MAX_E   | {cap_rv32_exp_max}  | Maximum exponent value
    -| enableL8    | 1                   | Whether the encoding format includes the L~8~ bit
    +| ENABLE_MSB  | 1                   | Whether the encoding format includes the <<rvy64_uni_base_name_bndsenc_param_summary,MSB>> bit

    no - because it has a dual purpose and also increases the length - it get's added into top[MW-2]
    EF=0 -> exponent, EF=1 -> increase length of small cap

    tariqkurd-repo tariqkurd-repo commented on code on Oct 09, 2026 15:56 UTC
    Code Review
    src/cheri/rvy32-encoding.adoc:1
    @@ -46,7 +46,7 @@ NOTE: T[9:8], T[1:0] and B[1:0] are not specified by the metadata fields and are
     | MW          | {cap_rv32_mw_width} | Mantissa width
     | EW          | {cap_rv32_exp_width}| Exponent width
     | CAP_MAX_E   | {cap_rv32_exp_max}  | Maximum exponent value
    -| enableL8    | 1                   | Whether the encoding format includes the L~8~ bit
    +| ENABLE_MSB  | 1                   | Whether the encoding format includes the <<rvy64_uni_base_name_bndsenc_param_summary,MSB>> bit

    they could be controlled by a separate parameters... could be cleaner

    tariqkurd-repo tariqkurd-repo commented on code on Oct 09, 2026 16:03 UTC
    Code Review
    src/cheri/rvy32-encoding.adoc:1
    @@ -46,7 +46,7 @@ NOTE: T[9:8], T[1:0] and B[1:0] are not specified by the metadata fields and are
     | MW          | {cap_rv32_mw_width} | Mantissa width
     | EW          | {cap_rv32_exp_width}| Exponent width
     | CAP_MAX_E   | {cap_rv32_exp_max}  | Maximum exponent value
    -| enableL8    | 1                   | Whether the encoding format includes the L~8~ bit
    +| ENABLE_MSB  | 1                   | Whether the encoding format includes the <<rvy64_uni_base_name_bndsenc_param_summary,MSB>> bit

    or just an enable for the extra bit on the length - the exponent is just even, odd certainly.

    marnovandermaas marnovandermaas approved these changes on Oct 09, 2026 16:13 UTC
    Approved Reviewer

    Looks like a reasonable change to me.

    tariqkurd-repo tariqkurd-repo commented on Oct 12, 2026 09:44 UTC
    Contributor

    I've gone further, 2 more commits.
    The first one tidies up the wording.
    The second one is more extensive:

    1. remove ENABLE_L8 (renamed to ENABLE_LMSB) completely
    2. Have MSB (formerly L8) as read-only-zero for RV64Y, inly encoded for RV32Y
    3. Simplify the pseudo-code as the new MSB is the same as the old (ENABLE_MSB && MSB)
    4. Simplify the malformed bounds check inthe same way as (3)

    This is a simpler and hopefully acceptable alternative to #1287 (which I suggested to Alex)

    PeterRugg PeterRugg commented on code on Oct 12, 2026 11:07 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -428,18 +434,19 @@ equivalent to _base_=0 and _top_{ge}2^XLEN^.
     
     A capability is _malformed_ if its bounds cannot be correctly decoded.
     The following check indicates whether a capability is malformed.
    -If `enableL8=1`, the L~8~ bit is available in the capability-encoding format for extra precision when `EF=1`.
     
     [source]
     ----
     malformedMSB =  (E == CAP_MAX_E     && B         != 0)
                  || (E == CAP_MAX_E - 1 && B[MW - 1] != 0)
    -malformedLSB =  (E  < 0) || (E == 0 && enableL8)
    +malformedLSB =  (E  < 0) || (E == 0 && MSB)

    I don't think this is right. Claude's tried to have a go at this in a similar way before. I don't think it understands it (or maybe I don't, who knows...)
    The point is if you have enableL8 (using the old terminology), then you can reach all these encodings with EF=1, MSB=1, and still have your lower bits of precision in your mantissa.

    PeterRugg PeterRugg commented on code on Oct 12, 2026 11:09 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -428,18 +434,19 @@ equivalent to _base_=0 and _top_{ge}2^XLEN^.
     
     A capability is _malformed_ if its bounds cannot be correctly decoded.
     The following check indicates whether a capability is malformed.
    -If `enableL8=1`, the L~8~ bit is available in the capability-encoding format for extra precision when `EF=1`.
     
     [source]
     ----
     malformedMSB =  (E == CAP_MAX_E     && B         != 0)
                  || (E == CAP_MAX_E - 1 && B[MW - 1] != 0)
    -malformedLSB =  (E  < 0) || (E == 0 && enableL8)
    +malformedLSB =  (E  < 0) || (E == 0 && MSB)

    This is a bit of an issue for the whole approach of removing enableL8. We need to know if these encodings can be reached using L8 with EF=1 to decide if we ban them when EF=0, so it's a "global" property of the format we need to check. I think what we used to have here is E == 0 && XLEN==32 or similar, but it's a bit harder to understand what's going on.

    tariqkurd-repo tariqkurd-repo commented on code on Oct 12, 2026 11:13 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -428,18 +434,19 @@ equivalent to _base_=0 and _top_{ge}2^XLEN^.
     
     A capability is _malformed_ if its bounds cannot be correctly decoded.
     The following check indicates whether a capability is malformed.
    -If `enableL8=1`, the L~8~ bit is available in the capability-encoding format for extra precision when `EF=1`.
     
     [source]
     ----
     malformedMSB =  (E == CAP_MAX_E     && B         != 0)
                  || (E == CAP_MAX_E - 1 && B[MW - 1] != 0)
    -malformedLSB =  (E  < 0) || (E == 0 && enableL8)
    +malformedLSB =  (E  < 0) || (E == 0 && MSB)

    this was a manual change by me - not by Claude - and that previous line has been there since at least 0.9.3, but I see your point. You only need the line if that case is possible which is currently gated by enableL8=1.

    tariqkurd-repo tariqkurd-repo commented on code on Oct 12, 2026 12:29 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -428,18 +434,19 @@ equivalent to _base_=0 and _top_{ge}2^XLEN^.
     
     A capability is _malformed_ if its bounds cannot be correctly decoded.
     The following check indicates whether a capability is malformed.
    -If `enableL8=1`, the L~8~ bit is available in the capability-encoding format for extra precision when `EF=1`.
     
     [source]
     ----
     malformedMSB =  (E == CAP_MAX_E     && B         != 0)
                  || (E == CAP_MAX_E - 1 && B[MW - 1] != 0)
    -malformedLSB =  (E  < 0) || (E == 0 && enableL8)
    +malformedLSB =  (E  < 0) || (E == 0 && MSB)

    I'm now convinced it's still correct (and not just because Claude hasn't complained).
    The reason is that enablel8 has _no_ effect if the encoded L8 (MSB) bit is zero, so the only way that the malformed bounds check is different is if the encoded bit is actually set.
    Therefore testing L8 (MSB) directly gives the same end result without the enable.

    PeterRugg PeterRugg commented on code on Oct 12, 2026 12:31 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -428,18 +434,19 @@ equivalent to _base_=0 and _top_{ge}2^XLEN^.
     
     A capability is _malformed_ if its bounds cannot be correctly decoded.
     The following check indicates whether a capability is malformed.
    -If `enableL8=1`, the L~8~ bit is available in the capability-encoding format for extra precision when `EF=1`.
     
     [source]
     ----
     malformedMSB =  (E == CAP_MAX_E     && B         != 0)
                  || (E == CAP_MAX_E - 1 && B[MW - 1] != 0)
    -malformedLSB =  (E  < 0) || (E == 0 && enableL8)
    +malformedLSB =  (E  < 0) || (E == 0 && MSB)

    Sorry, didn't mean to imply that Claude had made the change, just that it hadn't noticed the inconsistency.

    PeterRugg PeterRugg commented on code on Oct 12, 2026 12:31 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -428,18 +434,19 @@ equivalent to _base_=0 and _top_{ge}2^XLEN^.
     
     A capability is _malformed_ if its bounds cannot be correctly decoded.
     The following check indicates whether a capability is malformed.
    -If `enableL8=1`, the L~8~ bit is available in the capability-encoding format for extra precision when `EF=1`.
     
     [source]
     ----
     malformedMSB =  (E == CAP_MAX_E     && B         != 0)
                  || (E == CAP_MAX_E - 1 && B[MW - 1] != 0)
    -malformedLSB =  (E  < 0) || (E == 0 && enableL8)
    +malformedLSB =  (E  < 0) || (E == 0 && MSB)

    But I'm afraid I still disagree.

    tariqkurd-repo tariqkurd-repo commented on code on Oct 12, 2026 12:32 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -428,18 +434,19 @@ equivalent to _base_=0 and _top_{ge}2^XLEN^.
     
     A capability is _malformed_ if its bounds cannot be correctly decoded.
     The following check indicates whether a capability is malformed.
    -If `enableL8=1`, the L~8~ bit is available in the capability-encoding format for extra precision when `EF=1`.
     
     [source]
     ----
     malformedMSB =  (E == CAP_MAX_E     && B         != 0)
                  || (E == CAP_MAX_E - 1 && B[MW - 1] != 0)
    -malformedLSB =  (E  < 0) || (E == 0 && enableL8)
    +malformedLSB =  (E  < 0) || (E == 0 && MSB)

    ah ok!

    PeterRugg PeterRugg commented on code on Oct 12, 2026 12:32 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -428,18 +434,19 @@ equivalent to _base_=0 and _top_{ge}2^XLEN^.
     
     A capability is _malformed_ if its bounds cannot be correctly decoded.
     The following check indicates whether a capability is malformed.
    -If `enableL8=1`, the L~8~ bit is available in the capability-encoding format for extra precision when `EF=1`.
     
     [source]
     ----
     malformedMSB =  (E == CAP_MAX_E     && B         != 0)
                  || (E == CAP_MAX_E - 1 && B[MW - 1] != 0)
    -malformedLSB =  (E  < 0) || (E == 0 && enableL8)
    +malformedLSB =  (E  < 0) || (E == 0 && MSB)

    The reason is that enablel8 has no effect if the encoded L8 (MSB) bit is zero

    Yes: but the point is that the encodings that _are_ enabled by MSB=1 make _these_ encodings redundant.

    PeterRugg PeterRugg commented on code on Oct 12, 2026 12:54 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -428,18 +434,19 @@ equivalent to _base_=0 and _top_{ge}2^XLEN^.
     
     A capability is _malformed_ if its bounds cannot be correctly decoded.
     The following check indicates whether a capability is malformed.
    -If `enableL8=1`, the L~8~ bit is available in the capability-encoding format for extra precision when `EF=1`.
     
     [source]
     ----
     malformedMSB =  (E == CAP_MAX_E     && B         != 0)
                  || (E == CAP_MAX_E - 1 && B[MW - 1] != 0)
    -malformedLSB =  (E  < 0) || (E == 0 && enableL8)
    +malformedLSB =  (E  < 0) || (E == 0 && MSB)

    From discussing offline, I've realised this does _technically_ work, and is explained by the non-normative note from below that I'd missed:

    This relies on MSB being set whenever E=0 and EF=0, which holds for any format with an MSB bit where CAP_MAX_E >= 16, because then { MSB, TE, BE } = CAP_MAX_E has MSB=1.

    Capability-encoding formats with an MSB bit must satisfy this constraint, or must define the redundant E=0 encodings as malformed differently.

    This is very strange though: effectively sneaking in an XLEN dependency by relying on something that happens to always be true when XLEN=32 and is defined away as false when XLEN=64...

    tariqkurd-repo tariqkurd-repo commented on code on Oct 12, 2026 13:00 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -428,18 +434,19 @@ equivalent to _base_=0 and _top_{ge}2^XLEN^.
     
     A capability is _malformed_ if its bounds cannot be correctly decoded.
     The following check indicates whether a capability is malformed.
    -If `enableL8=1`, the L~8~ bit is available in the capability-encoding format for extra precision when `EF=1`.
     
     [source]
     ----
     malformedMSB =  (E == CAP_MAX_E     && B         != 0)
                  || (E == CAP_MAX_E - 1 && B[MW - 1] != 0)
    -malformedLSB =  (E  < 0) || (E == 0 && enableL8)
    +malformedLSB =  (E  < 0) || (E == 0 && MSB)

    yeah - we've agreed that this isn't the way forwards

    tariqkurd-repo tariqkurd-repo commented on code on Oct 12, 2026 13:05 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -428,18 +434,19 @@ equivalent to _base_=0 and _top_{ge}2^XLEN^.
     
     A capability is _malformed_ if its bounds cannot be correctly decoded.
     The following check indicates whether a capability is malformed.
    -If `enableL8=1`, the L~8~ bit is available in the capability-encoding format for extra precision when `EF=1`.
     
     [source]
     ----
     malformedMSB =  (E == CAP_MAX_E     && B         != 0)
                  || (E == CAP_MAX_E - 1 && B[MW - 1] != 0)
    -malformedLSB =  (E  < 0) || (E == 0 && enableL8)
    +malformedLSB =  (E  < 0) || (E == 0 && MSB)

    I've reverted that commit

    PeterRugg PeterRugg commented on code on Oct 12, 2026 13:08 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -232,7 +239,7 @@ inverted to ensure that the <<null-cap>> capability is encoded as zero without t
     need for CHERI v9's in-memory format. +
     When EF=1, the exponent E=0, so the address bits a[MW - 1:0] are replaced
     with T and B to form the top and base bound addresses respectively. +
    -When EF=0, the exponent `E=CAP_MAX_E - ( enableL8 ? { L8, TE, BE } : { TE, BE } )`,
    +When EF=0, the exponent `E=CAP_MAX_E - { MSB, TE, BE }`,

    By not conditioning here, the RHS of the subtract becomes 7 bits for RV64, which is a bit odd, but I don't think it matters

    PeterRugg PeterRugg approved these changes on Oct 12, 2026 13:09 UTC
    Approved Reviewer

    Approved these changes.

    tariqkurd-repo tariqkurd-repo commented on code on Oct 12, 2026 13:11 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -232,7 +239,7 @@ inverted to ensure that the <<null-cap>> capability is encoded as zero without t
     need for CHERI v9's in-memory format. +
     When EF=1, the exponent E=0, so the address bits a[MW - 1:0] are replaced
     with T and B to form the top and base bound addresses respectively. +
    -When EF=0, the exponent `E=CAP_MAX_E - ( enableL8 ? { L8, TE, BE } : { TE, BE } )`,
    +When EF=0, the exponent `E=CAP_MAX_E - { MSB, TE, BE }`,

    I'll revert it

    arichardson arichardson commented on Oct 12, 2026 13:13 UTC
    Author

    I don't really mind which way we do this but there is also #1287

    arichardson arichardson commented on Oct 12, 2026 13:15 UTC
    Reviewer

    I'm not convinced MSB is a good name for this field, how about LE like I did in #1287 ?

    arichardson arichardson commented on code on Oct 12, 2026 13:16 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -186,13 +186,20 @@ The variables related to the bounds decoding are shown in <<rvy64_uni_base_name_
     | B         | Value substituted into the capability's address to decode the _base_ bound address.
     | BE        | Value either substituted into the exponent or the _base_ bound address depending on EF.
     | E         | Exponent that determines the position at which T and B are substituted into the capability's address.
    -| L~8~^1^   | Value used to form either the MSB of the exponent or the MSB of the _top_ bound address.
    +| MSB^1^    | Value used to form either the MSB of the exponent or the MSB of the _top_ bound address.
     | EF        | Exponent format flag indicating the encoding for T, B, and E: +
    -EF=0: The exponent is calculated from TE and BE, and conditionally L~8~, so it is 'internal'. +
    -EF=1: The exponent is zero; TE, BE, and L~8~ form part of the address bounds.
    +EF=0: The exponent is calculated from TE and BE, and conditionally MSB, so it is 'internal'. +
    +EF=1: The exponent is zero; TE, BE, and MSB form part of the address bounds.
     |==============================================================================
     
    -^1^ Only valid if `enableL8=1`.
    +^1^ This bit is not encoded in the metadata for {rv64y_uni_base_name}, and so is always zero.
    +It will be encoded in future {cheri_base32_ext_name} capability-encoding formats which set `ENABLE_MSB=1` and which have an odd number of bits in the exponent field (E) and also limited encoding space.
    +The bounds decoding equations in this section include `MSB` so that they also apply to future {cheri_base32_ext_name} capability-encoding formats.
    +
    +NOTE: In {rv64y_uni_base_name}, `EW=6` is even (`TE` and `BE` are 3 bits each) and the exponent is fully encoded in the least significant bits of `TE` and `BE` when `EF=0`. +

    These two paragraphs are basically the same information

    arichardson arichardson commented on code on Oct 12, 2026 13:17 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -255,16 +262,16 @@ If EF = 1:
         T[EW / 2 - 1:0] = TE
         B[EW / 2 - 1:0] = BE
         LCout           = (T[MW - 3:0] < B[MW - 3:0]) ? 1 : 0
    -    LMSB            = enableL8 ? L8 : 0
    +    LMSB            = MSB

    This one is a bit weird now since we say the field does not exist?

    arichardson arichardson commented on code on Oct 12, 2026 13:19 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -275,8 +282,8 @@ T and B are both MW bits wide, and are formed of different bit ranges:
     The design rationale for the two `EF` cases is as follows:
     
     * `EF = 1`: The exponent is 0.
    -When `enableL8=1`, L~8~ encodes the MSB of the length, which can be used to derive `T[MW-1:MW-2]`, forming a full MW-bit `T` field.
    -* `EF = 0`: The exponent is _internal_ with `E` stored in the lower bits of `T` and `B`, with L~8~ used for the MSB of `E` when `enableL8=1`.
    +When `ENABLE_MSB=1`, `MSB` encodes the MSB of the length, which can be used to derive `T[MW-1:MW-2]`, forming a full `MW`-bit `T` field.
    +* `EF = 0`: The exponent is _internal_ with `E` stored in the lower bits of `T` and `B`, with `MSB` used for the MSB of `E` when `ENABLE_MSB=1`.

    I think this sentence is weird with the two MSB meaning different things, would be easier if we used a different name like LE for the field

    tariqkurd-repo tariqkurd-repo commented on code on Oct 12, 2026 13:19 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -255,16 +262,16 @@ If EF = 1:
         T[EW / 2 - 1:0] = TE
         B[EW / 2 - 1:0] = BE
         LCout           = (T[MW - 3:0] < B[MW - 3:0]) ? 1 : 0
    -    LMSB            = enableL8 ? L8 : 0
    +    LMSB            = MSB

    it's read-only-zero or encoded.
    But either way it needs to move to RV32

    tariqkurd-repo tariqkurd-repo commented on code on Oct 12, 2026 13:22 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -275,8 +282,8 @@ T and B are both MW bits wide, and are formed of different bit ranges:
     The design rationale for the two `EF` cases is as follows:
     
     * `EF = 1`: The exponent is 0.
    -When `enableL8=1`, L~8~ encodes the MSB of the length, which can be used to derive `T[MW-1:MW-2]`, forming a full MW-bit `T` field.
    -* `EF = 0`: The exponent is _internal_ with `E` stored in the lower bits of `T` and `B`, with L~8~ used for the MSB of `E` when `enableL8=1`.
    +When `ENABLE_MSB=1`, `MSB` encodes the MSB of the length, which can be used to derive `T[MW-1:MW-2]`, forming a full `MW`-bit `T` field.
    +* `EF = 0`: The exponent is _internal_ with `E` stored in the lower bits of `T` and `B`, with `MSB` used for the MSB of `E` when `ENABLE_MSB=1`.

    yes - the double use of MSB is a bit odd

    arichardson arichardson commented on code on Oct 12, 2026 13:22 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -255,16 +262,16 @@ If EF = 1:
         T[EW / 2 - 1:0] = TE
         B[EW / 2 - 1:0] = BE
         LCout           = (T[MW - 3:0] < B[MW - 3:0]) ? 1 : 0
    -    LMSB            = enableL8 ? L8 : 0
    +    LMSB            = MSB

    Well if it's always zero then isn't the bit concatenation below a size mismatch? But ok having it as always zero works

    arichardson arichardson commented on code on Oct 12, 2026 13:23 UTC
    Code Review
    src/cheri/rvy64-encoding.adoc:1
    @@ -255,16 +262,16 @@ If EF = 1:
         T[EW / 2 - 1:0] = TE
         B[EW / 2 - 1:0] = BE
         LCout           = (T[MW - 3:0] < B[MW - 3:0]) ? 1 : 0
    -    LMSB            = enableL8 ? L8 : 0
    +    LMSB            = MSB

    Oh I see that's fixed now

    arichardson arichardson commented on code on Oct 12, 2026 13:27 UTC
    Code Review
    src/cheri/riscv-unpriv-integration.adoc:1
    @@ -628,7 +628,7 @@ NOTE: The default settings all match <<rv64y_cap_description>>.
     | MW          | integer values       | {cap_rv64_mw_width}  | Mantissa width for the bounds encoding
     | EW          | integer values       | {cap_rv64_exp_width} | Exponent width for the bounds encoding
     | CAP_MAX_E   | integer values       | {cap_rv64_exp_max}   | Maximum exponent value
    -| enableL8    | 0/1                  | 0                    | Whether the encoding format includes the L~8~ bit
    +| ENABLE_MSB  | 0/1                  | 0                    | Whether the encoding format includes the <<rvy64_uni_base_name_bndsenc_param_summary,MSB>> bit

    Looking at this again the enable_ prefix is a bit odd. Maybe we should have used something like HAVE_LE / HAS_LE / NEED_LE?

    tariqkurd-repo tariqkurd-repo commented on Oct 12, 2026 13:33 UTC
    Contributor

    closed in favour of #1287

    Assignees
    arichardson arichardson
    Labels
    risk: low confidence: 80.4% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 34.4% (LOW) · Higher = larger blast radius
    34.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 80.4% · Lower = rushed or shallow review
    80.4%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 6.8% · Safe to merge
    6.8%