Unprivileged Hardware Performance Counter 12
Alias for M-mode CSR `mhpmcounter12`.
See `mhpmcounter12` for information on privilege mode access control.
| 63:56 | 55:48 | 47:40 | 39:32 | 31:24 | 23:16 | 15:8 | 7:0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| COUNT | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Bits | Field | Alias | Description | Type | Reset |
|---|---|---|---|---|---|
| [63:0] | COUNT | mhpmcounter12.COUNT | Alias of `mhpmcounter12.COUNT`. | RO-H | UNDEFINED_LEGAL |
# access is determined by *counteren CSRs
if (mode() == PrivilegeMode::S) {
# S-mode is present ->
# mcounteren determines access in S-mode
if (CSR[mcounteren].HPM12 == 1'b0) {
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
} else if (mode() == PrivilegeMode::U) {
if (CSR[misa].S == 1'b1) {
# S-mode is present ->
# mcounteren and scounteren together determine access in U-mode
if ((CSR[mcounteren].HPM12 & CSR[scounteren].HPM12) == 1'b0) {
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
} else if (CSR[mcounteren].HPM12 == 1'b0) {
# S-mode is not present ->
# mcounteren determines access in U-mode
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
} else if (mode() == PrivilegeMode::VS) {
# access in VS mode
if (CSR[hcounteren].HPM12 == 1'b0 && CSR[mcounteren].HPM12 == 1'b1) {
raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
} else if (CSR[mcounteren].HPM12 == 1'b0) {
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
} else if (mode() == PrivilegeMode::VU) {
# access in VU mode
if (((CSR[hcounteren].HPM12 & CSR[scounteren].HPM12) == 1'b0) && (CSR[mcounteren].HPM12 == 1'b1)) {
raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
} else if (CSR[mcounteren].HPM12 == 1'b0) {
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
}
return read_hpm_counter(12);Version af3eaf9+cheriot.f635218
Data from the RISC-V Unified Database, copyright RISC-V International and contributors.
CHERIoT extensions from the CHERIoT specification and Sail model, copyright Microsoft and the CHERIoT Platform contributors.
This site is provided as a community resource and is NOT affiliated with nor endorsed by RISC-V International.