-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement full mtval
#712
Implement full mtval
#712
Conversation
da3d15c
to
c603db9
Compare
@@ -95,7 +95,9 @@ def elaborate(self, platform): | |||
"rl_s1": Mux(instr_decoder.rs1_v & (~exception_override), instr_decoder.rs1, 0), | |||
"rl_s2": Mux(instr_decoder.rs2_v & (~exception_override), instr_decoder.rs2, 0), | |||
}, | |||
"imm": instr_decoder.imm, | |||
"imm": Mux( | |||
~exception_override, instr_decoder.imm, Mux(raw.access_fault, raw.access_fault, raw.instr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be raw.pc
in case when raw.access_fault
is true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is correct, Exception FU uses information from access_fault
to determine correct PC. Switched to enum and documented this mux
Waiting until comments are addressed. |
Implements full
mtval
CSR.Required some tricks. This CSR is optional to fill for all exception types, so if some case becomes too problematic in the future, it can be set to 0.
Boom and XiangShan doesn't support setting it to instruction bytes in case of Illegal Instruction, but it was added to coreblocks at currently little cost. It is helpful, because it could speed up emulation of missing instructions (possibly in OpenSBI?)
XiangShan supports setting mtval to upper half of instruction address in case of fault on misaligned instruction crossing fetch blocks, hard to tell if supported in Boom.
Other cases are handled by both processors.