scause
Supervisor Cause
Reports the cause of the latest exception.
Attributes
Defining Extension |
|
---|---|
CSR Address |
0x142 |
Length |
32 when CSR[mstatus].SXL == 0 64 when CSR[mstatus].SXL == 1 |
Privilege Mode |
S |
Format
This CSR format changes dynamically.
Figure 1. scause Format when CSR[mstatus].SXL == 0
Figure 2. scause Format when CSR[mstatus].SXL == 1
Field Summary
Name | Location | Type | Reset Value |
---|---|---|---|
* 31 when CSR[mstatus].SXL == 0 * 63 when CSR[mstatus].SXL == 1 |
RW-RH |
UNDEFINED_LEGAL |
|
* 30:0 when CSR[mstatus].SXL == 0 * 62:0 when CSR[mstatus].SXL == 1 |
RW-RH |
UNDEFINED_LEGAL |
Software write
This CSR may store a value that is different from what software attempts to write.
When a software write occurs (e.g., through csrrw), the following determines the written value:
INT = # the write only holds if the INT/CODE combination is valid # otherwise, the old value is retained 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 = # the write only holds if the INT/CODE combination is valid # otherwise, the old value is retained 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; }