Repository navigation
Fix XLEN classification of Smrnmi and odd pmpcfg CSRs - #448
Merged
Andrew Waterman (aswaterman) merged 1 commit intoNov 25, 2026
Merged
Conversation
mnscratch, mnepc, mncause and mnstatus are MXLEN-bit CSRs that exist on RV64 too, so they belong in csrs.csv rather than csrs32.csv. pmpcfg1, pmpcfg3, ..., pmpcfg15 are illegal on RV64, so they belong in csrs32.csv rather than csrs.csv. Signed-off-by: Emanuele Lovato <bineurale@gmail.com>
Andrew Waterman (aswaterman)
merged commit Nov 25, 2026
5e641d2
into
riscv:master
1 of 11 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mnscratch, mnepc, mncause and mnstatus are in csrs32.csv, but they are MXLEN-bit registers (smrnmi.adoc) and exist on RV64. The odd pmpcfg registers have the opposite problem: they are in csrs.csv, but machine.adoc says "For RV64, the odd-numbered configuration registers, pmpcfg1, pmpcfg3, ..., pmpcfg15, are illegal."
This PR moves the 12 lines between the two files. Nothing else changes.
Where it shows: the Go generator reads only csrs.csv, so Go's riscv64 assembler (go1.27.4) accepts PMPCFG1 and rejects MNSCRATCH ("illegal or missing addressing mode for symbol MNSCRATCH"). Chisel CSRs.all / CSRs.all32 are off the same way. The C, Rust and SystemVerilog outputs merge both files, so encoding.out.h has the same set of CSR_* defines before and after (checked), only the order changes.
binutils (CSR_CLASS_I_32 for odd pmpcfg, CSR_CLASS_SMRNMI for mn*) and llvm-mc ("system register 'pmpcfg1' is RV32 only", mnscratch accepted on riscv64 with +smrnmi) already classify them this way.
Tests pass (17/17). Note that #422 moves these files into csrs/; happy to rebase onto it if that lands first.