
8.3.5
Machine Cause (
mcause
)
When a trap is taken in machine mode,
mcause
is written with a code indicating the event that
caused the trap. When the event that caused the trap is an interrupt, the most-significant bit of
mcause
is set to 1, and the least-significant bits indicate the interrupt number, using the same
encoding as the bit positions in
mip
. For example, a Machine Timer Interrupt causes
mcause
to
be set to
0x8000_0007
.
mcause
is also used to indicate the cause of synchronous exceptions, in
which case the most-significant bit of
mcause
is set to 0.
See Table 17 for more details about the
mcause
register. Refer to Table 18 for a list of synchro-
nous exception codes.
Table 17:
mcause
Register
Machine Cause Register
CSR
mcause
Bits
Field Name
Attr.
Description
[9:0]
Exception Code
WLRL
A code identifying the last exception.
[30:10]
Reserved
WLRL
31
Interrupt
WARL
1, if the trap was caused by an interrupt; 0
otherwise.
Table 18:
mcause
Exception Codes
Interrupt Exception Codes
Interrupt
Exception Code
Description
1
0–2
Reserved
1
3
Machine software interrupt
1
4–6
Reserved
1
7
Machine timer interrupt
1
8–10
Reserved
1
11
Machine external interrupt
1
≥ 12
Reserved
0
0
Instruction address misaligned
0
1
Instruction access fault
0
2
Illegal instruction
Chapter 8 Interrupts
SiFive FE310-G000 Manual: v3p2
© SiFive, Inc.
Page 38
Содержание FE310-G000
Страница 1: ...SiFive FE310 G000 Manual v3p2 SiFive Inc ...