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

[rtl] CPU code clean-up; add RISC-V mstatus.TW CSR bit #285

Merged
merged 11 commits into from
Mar 6, 2022

Conversation

stnolting
Copy link
Owner

@stnolting stnolting commented Mar 5, 2022

This PR is another clean-up and optimization of the CPU's control unit.

✨ Additionally, this PR adds support for the RISC-V mstatus.TW flag. This flag is is used to control the execution of the wfi (wait for interrupt / sleep) instruction in less-privileged user-mode. When set, executing wfi in user-mode will raise an illegal instruction exception. When cleared, user-mode is allowed to execute wfi. If user-mode is not implemented the mstatus.TW flag is hardwired to zero.

ℹ️ The user-level hardware performance monitor CSRs are added to the hardware in order to simplifiy CSR address decoding. However, the user-level HPM CSRs hpmcounter*[h] are NOT implemented. Any access from any operation mode will raise an exception. Only machine-mode is allowed to use the HPMs via the dedicated mhpmcounter*[h] CSRs.

@stnolting stnolting added risc-v compliance Modification to comply with official RISC-V specs. HW hardware-related labels Mar 5, 2022
@stnolting stnolting self-assigned this Mar 5, 2022
add user-mode HPM CSR addresses - these are not implemented and are added just for information
- VHDL CPU code clean-ups
- add RISC-V mstatus.TW bit
@stnolting stnolting changed the title [rtl] CPU code clean-up; add mstatus.TW bit [rtl] CPU code clean-up; add RISC-V mstatus.TW CSR bit Mar 5, 2022
@stnolting stnolting marked this pull request as ready for review March 5, 2022 18:04
@stnolting stnolting merged commit 86f0c9d into main Mar 6, 2022
@stnolting stnolting deleted the cleanup_and_add_mstatusTW branch March 6, 2022 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HW hardware-related risc-v compliance Modification to comply with official RISC-V specs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant