Skip to content

[BUG] mstatus.SXL/UXL read as XLEN_64 when S-mode/U-mode are not implemented,which violates RISC-V Spec #3182

@oChunCai

Description

@oChunCai

Is there an existing CVA6 bug for this?

  • I have searched the existing bug issues

Bug Description

Description

The RISC-V Privileged Specification defines mstatus.SXL and mstatus.UXL as the effective XLEN for S-mode and U-mode. When the corresponding privilege mode is not implemented, these fields should be read-only zero.
In CVA6, SXL and UXL are unconditionally assigned to XLEN_64 when IS_XLEN64 is true, regardless of whether S-mode (RVS) or U-mode (RVU) are implemented.

Spec reference

RISC-V Privileged Spec:
If S-mode is not supported: SXL is read-only 0
If U-mode is not supported: UXL is read-only 0
Image

in CVA6

csr_regfile.sv
Image
This makes SXL/UXL appear non-zero in configurations where CVA6Cfg.RVS=0 and/or CVA6Cfg.RVU=0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type:BugFor bugs in the RTL, Documentation, Verification environment or Tool and Build system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions