mcause
Machine trap cause
- Address
0x342- Group
- Machine-level CSRs
- Privilege
MRW(privileged spec CSR listing, Machine Trap Handling)- Access
- read/write; lowest privilege M (machine)
- Address range
- Standard read/write
- Name in riscv-unified-db
- Machine Cause
Privileged spec: Machine trap cause
Description
Reports the cause of the latest exception.
From riscv-unified-db, reformatted.
Fields
| Field | Bits | Type | Description |
|---|---|---|---|
INT | RV32 31 / RV64 63 | RW-RH | Written by hardware when a trap is taken into M-mode. When set, the last exception was caused by an asynchronous Interrupt.
If If |
CODE | RV32 30-0 / RV64 62-0 | RW-RH |
Fields from riscv-unified-db; field types computed by IDL functions there are not shown.
Specification and related pages
- The RISC-V Instruction Set Manual, Volume II: CSR listing (src/priv/csrs.adoc)
- riscv-opcodes csrs.csv
- riscv-unified-db: spec/std/isa/csr/mcause.yaml
- csrrw, csrrs, csrrc (Zicsr instructions that access CSRs)