High-half timer for RDTIME Instruction
This CSR does not exist, and access will cause an IllegalInstruction exception.
-- Shadow of the memory-mapped M-mode CSR `mtimeh`.
Privilege mode access is controlled with `mcounteren.TM`, `scounteren.TM`, and `hcounteren.TM` as follows:
.2+h![.rotate]#`mcounteren.TM`# .2+h! [.rotate]#`scounteren.TM`# .2+h! [.rotate]#`scounteren.TM`# 4+^.>h! `time` behavior .^h! S-mode .^h! U-mode .^h! VS-mode .^h! VU-mode
! 0 ! - ! - ! `Illegal Instruction` ! `Illegal Instruction` ! `Illegal Instruction` ! `Illegal Instruction` ! 1 ! 0 ! 0 ! read-only ! `Illegal Instruction` ! `Illegal Instruction` ! `Illegal Instruction` ! 1 ! 1 ! 0 ! read-only ! read-only ! `Illegal Instruction` ! `Illegal Instruction` ! 1 ! 0 ! 1 ! read-only ! `Illegal Instruction` ! read-only ! `Illegal Instruction` ! 1 ! 1 ! 1 ! read-only ! read-only ! read-only ! read-only --
| 31:24 | 23:16 | 15:8 | 7:0 | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| COUNT | |||||||||||||||||||||||||||||||
| Bits | Field | Alias | Description | Type | Reset |
|---|---|---|---|---|---|
| [31:0] | COUNT | time.COUNT[63:32] | Reports the most significant 32 bits of the current wall-clock time from the timer device. | RO-H | UNDEFINED_LEGAL |
if (!TIME_CSR_IMPLEMENTED) {
unimplemented_csr($encoding);
}
# access is determined by *counteren CSRs
if (mode() == PrivilegeMode::S) {
# S-mode is present ->
# mcounteren determines access in S-mode
if (CSR[mcounteren].TM == 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].TM & CSR[scounteren].TM) == 1'b0) {
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
} else if (CSR[mcounteren].TM == 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].TM == 1'b0 && CSR[mcounteren].TM == 1'b1) {
raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
} else if (CSR[mcounteren].TM == 1'b0) {
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
} else if (mode() == PrivilegeMode::VU) {
# access in VU mode
if (((CSR[hcounteren].TM & CSR[scounteren].TM) == 1'b0) && (CSR[mcounteren].TM == 1'b1)) {
raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
} else if (CSR[mcounteren].TM == 1'b0) {
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
}
return read_mtime()[63:32];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.