-
Notifications
You must be signed in to change notification settings - Fork 228
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
RISC-V "Zicntr" and "Zihpm" extensions #192
Conversation
* `SYSINFO_CPU_HPM` => `SYSINFO_CPU_ZIHPM` * `SYSINFO_CPU_ZXNOCNT` => not `SYSINFO_CPU_ZICNTR`
Shall we update https://github.com/stnolting/neorv32/blob/master/sim/run_riscv_arch_test.sh#L50-L60 accordingly? I.e., are there specific test suites for these extensions? |
Hey!
There are no tests in the RISC-V arch-test setup for the |
This PR adds two new configuration generics to the processor top entity:
These new generics are used to explicitly control implementation of the
Zicntr
andZihpm
ISA extensions. Both extensions can still be customized using theCPU_CNT_WIDTH
(actually physical size of CPU counters) andHPM_NUM_CNTS
(acatual physical number of HPM counters) generics.Rationale: "Define the Zicntr and Zihpm extensions" - https://github.com/riscv/riscv-isa-manual/releases/tag/draft-20211029-4e4dfff
Zicntr
- Basic CPU counters ISA extensionIn order to implement the CPU base counters (which is required by the RISC-V spec), the
CPU_EXTENSION_RISCV_Zicntr
generic has to be enabled.Affected CSRs:
time[h]
System time - low/high word (from MTIME)[m]cycle[h]
Cycle counter - low/high word[m]instret[h]
Retired instructions counter - low/high wordThe SYSINFO flag
SYSINFO_CPU_ZXNOCNT
(no counters implemented) has been replaced by theSYSINFO_CPU_ZICNTR
flag, which now indicates that the counters are implemented (inversion). Furthermore, this flag now also includes thetime[h]
CSRs.Zihpm
- Hardware performance monitors ISA extensionIn order to implement the hardware performance monitors, the
CPU_EXTENSION_RISCV_Zihpm
generic has to be enabled.Affected CSRs:
mhpmevent3
...mhpmevent31
HMP event configuration CSRsmhpmcounter3[h]
...mhpmcounter31[h]
HPM counters - low/high wordThe SYSINFO flag
SYSINFO_CPU_HPM
has been renamed toSYSINFO_CPU_ZIHPM
.Backwards-Compatibility
✔️
CPU_EXTENSION_RISCV_Zicntr
is true per default - base counters are implemented by default.❌
CPU_EXTENSION_RISCV_Zihpm
has to be set true to implement the HPM CSRs.