Skip to content
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

Reduce mtvec alignment requirement #427

Closed
wants to merge 1 commit into from
Closed

Conversation

towoe
Copy link
Contributor

@towoe towoe commented Oct 25, 2019

RISC-V Privileged Spec v1.11 allows BASE filed of mtvec to be 4-byte
aligned.

Update the assignment and usage of mtvec to use 4-byte aligned
addresses.

This fixes I-EBREAK and I-ECALL tests of RISC-V compliance failures
reported in #100.

@towoe towoe requested review from imphil and vogelpi October 25, 2019 11:43
@@ -378,6 +378,7 @@ module ibex_cs_registers #(
mepc_d = mepc_q;
mcause_d = mcause_q;
mtval_d = mtval_q;
// TODO Should this assignment use boot_addr_i[31:1]? [7:2] always 6'b0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggestions?

RISC-V Privileged Spec v1.11 allows BASE filed of mtvec to be 4-byte
aligned.

Update the assignment and usage of mtvec to use 4-byte aligned
addresses.

This fixes `I-EBREAK` and `I-ECALL` tests of RISC-V compliance failures
reported in lowRISC#100.
Copy link
Contributor

@vogelpi vogelpi left a comment

Choose a reason for hiding this comment

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

Thanks @towoe for your PR.

It is correct that the RISC-V Privileged Spec allows for 4-byte aligned mtvec but it does not require it.

I do not agree with the proposed changes, and I don't think we should allow 4-byte aligned values in mtvec. Either it requires the instantiation of an adder in the IF stage to compute the correct address for interrupts. Or, if the core ignores the LSBs of mtvec for interrupts (as you are suggesting with this PR), the LSBs of mtvec are ignored for interrupts but not for exceptions which is not programmer friendly.

IMO this must be solved upstream in the compliance suite.

@towoe
Copy link
Contributor Author

towoe commented Oct 25, 2019

Thanks @vogelpi for the feedback.
I agree that the changes from this PR are not the correct fix as it will mess up the interrupts, thanks for pointing that out!
Will create an issue to track this.

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.

2 participants