scause
Supervisor Cause
Reports the cause of the latest exception.
Fields
INT
- Location
-
scause[63] - Description
-
Written by hardware when a trap is taken into S-mode.
When set, the last exception was caused by an asynchronous Interrupt.
scause.INT is writable.
If scause is written with an undefined cause (combination of scause.INT and scause.CODE), an
Illegal Instructionexception occurs.If scause is written with an undefined cause (combination of scause.INT and scause.CODE), neither scause.INT nor scause.CODE are modified.
- Type
RW-RH |
Read-Write Restricted with Hardware update Field is writable by software. Only certain values are legal. Writing an illegal value into the field is ignored, such that the field retains its prior state. Hardware also updates the field without an explicit software write.) |
- Reset value
-
UNDEFINED_LEGAL
- Software write
-
This field has special behavior when written by software (e.g., through csrrw).
When software tries to write
csr_value, the field will be written with the return value of the function below.if (csr_value.INT == 1) { if (valid_interrupt_code?(csr_value.CODE)) { return 1; } return ILLEGAL_WLRL; } else { if (valid_exception_code?(csr_value.CODE)) { return 1; } return ILLEGAL_WLRL; }
CODE
- Location
-
scause[62:0] - Description
-
Written by hardware when a trap is taken into S-mode.
Holds the interrupt or exception code for the last taken trap.
scause.CODE is writable.
If scause is written with an undefined cause (combination of scause.INT and scause.CODE), an
Illegal Instructionexception occurs.If scause is written with an undefined cause (combination of scause.INT and scause.CODE), neither scause.INT nor scause.CODE are modified.
Valid interrupt codes are:
0 |
InstructionAddressMisaligned |
1 |
InstructionAccessFault |
2 |
IllegalInstruction |
3 |
Breakpoint |
4 |
LoadAddressMisaligned |
5 |
LoadAccessFault |
6 |
StoreAmoAddressMisaligned |
7 |
StoreAmoAccessFault |
8 |
Ucall |
9 |
Scall |
10 |
VScall |
11 |
Mcall |
12 |
InstructionPageFault |
13 |
LoadPageFault |
15 |
StoreAmoPageFault |
16 |
DoubleTrap |
18 |
SoftwareCheck |
19 |
HardwareError |
20 |
InstructionGuestPageFault |
21 |
LoadGuestPageFault |
22 |
VirtualInstruction |
23 |
StoreAmoGuestPageFault |
+ Valid exception codes are:
0 |
InstructionAddressMisaligned |
1 |
InstructionAccessFault |
2 |
IllegalInstruction |
3 |
Breakpoint |
4 |
LoadAddressMisaligned |
5 |
LoadAccessFault |
6 |
StoreAmoAddressMisaligned |
7 |
StoreAmoAccessFault |
8 |
Ucall |
9 |
Scall |
10 |
VScall |
11 |
Mcall |
12 |
InstructionPageFault |
13 |
LoadPageFault |
15 |
StoreAmoPageFault |
16 |
DoubleTrap |
18 |
SoftwareCheck |
19 |
HardwareError |
20 |
InstructionGuestPageFault |
21 |
LoadGuestPageFault |
22 |
VirtualInstruction |
23 |
StoreAmoGuestPageFault |
- Type
RW-RH |
Read-Write Restricted with Hardware update Field is writable by software. Only certain values are legal. Writing an illegal value into the field is ignored, such that the field retains its prior state. Hardware also updates the field without an explicit software write.) |
- Reset value
-
UNDEFINED_LEGAL
- Software write
-
This field has special behavior when written by software (e.g., through csrrw).
When software tries to write
csr_value, the field will be written with the return value of the function below.if (csr_value.INT == 1) { if (valid_interrupt_code?(csr_value.CODE)) { return csr_value.CODE; } return ILLEGAL_WLRL; } else { if (valid_exception_code?(csr_value.CODE)) { return csr_value.CODE; } return ILLEGAL_WLRL; }