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 8 for more details about the
mcause
register. Refer to Table 9 for a list of synchronous exception codes.
Machine Cause Register
CSR
mcause
Bits
Field Name
Attr.
Description
[30:0]
Exception Code
WLRL
A code identifying the last exception.
31
Interrupt
WARL
1 if the trap was caused by an interrupt; 0
otherwise.
Table 8:
mcause
Register
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–15
Reserved
1
16
Local Interrupt 0
1
17
Local Interrupt 1
1
18–30
…
1
31
Local Interrupt 15
1
≥ 32
Reserved
0
0
Instruction address misaligned
0
1
Instruction access fault
0
2
Illegal instruction
0
3
Breakpoint
0
4
Load address misaligned
0
5
Load access fault
0
6
Store/AMO address misaligned
0
7
Store/AMO access fault
0
8
Environment call from U-mode
0
9–10
Reserved
0
11
Environment call from M-mode
0
≥ 12
Reserved
Table 9:
mcause
Exception Codes
Copyright © 2017–2018, SiFive Inc. All rights reserved.
19