Skip to content

Conversation

@AlexJones0
Copy link

This is needed to allow the I-ECALL-01 RISC-V compliance test to pass as it currently does on FPGA and silicon targets.
mtvec is WARL, and in reality will accept writes with invalid encode modes but will just tie them to vectored mode (1).

@AlexJones0 AlexJones0 changed the title ibex_csrs: Fix non-vectored mtvec write behaviour ibex_csr: Fix non-vectored mtvec write behaviour Oct 30, 2025
Copy link

@jwnrt jwnrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@rivos-eblot rivos-eblot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I would copy the comments of the PR into the code itself, as the bit manip seems a bit obsure w/o details :-)

@AlexJones0
Copy link
Author

AlexJones0 commented Oct 30, 2025

also here's the RTL reference for how this is tied off in HW: https://github.com/lowRISC/ibex/blob/1f2232a94581538f535f4bb32b2455d8c9beadf1/rtl/ibex_cs_registers.sv#L587-L588

This fixes the behaviour of mtvec writes on Ibex to allow writes in
non-vectored mtvec encode modes, but always tie the written mode to
vectored (mtvec is WARL).

This is required for the ECALL RISC-V compliance test to pass in QEMU
(as it currently does on FPGA and Silicon targets).

Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
@AlexJones0 AlexJones0 merged commit 2af1b13 into lowRISC:ot-9.2.0 Oct 30, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants