-
Notifications
You must be signed in to change notification settings - Fork 652
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
How should design process unimplemented pmp csr and performance counter? #1011
Comments
"Implemented", when it comes to CSRs, means that they do not take an illegal instruction exception. Read-only 0 counts as "implemented". For PMP, when the spec says "Implementations may implement zero, 16, or 64 PMP entries" that refers only to which ones take an illegal instruction exception. You can make any number of the implemented PMP CSRs read-only 0. For your specific question about pmpaddr16-63, you can do either illegal instruction or read-only 0, but they must all have the same behavior. (For example, having pmpaddr16-31 read-only 0 and pmpaddr32-64 take an illegal instruction exception would not be a legal implementation.) For performance counters, the spec says, "All counters should be implemented, but a legal implementation is to make both the counter and its corresponding event selector be read-only 0." Which means you must not take an illegal instruction exception on any of the 29 event counters, but mhpmcounter23-31 and mhpmevent23-31 can be read-only 0. |
Adding emphasis:
I think that you should not take an illegal instruction exception on any of the counters, though that is technically allowed. (I encourage you to not make an implementation that tests the limits of the architecture. I'm just being pedantic.) |
Thank you! |
If 16 PMP CSRs are implemeted, how should design process csr instructions to pmpaddr16~63? Illegal instruction or read-only 0?
And if 20 performance counter(mhpmcounter3-22) are implemented, how should design process csr instructions to mhpmcounter23-31? Illegal instruction or read-only 0?
The text was updated successfully, but these errors were encountered: