Sm Extension
Versions
| Version 1.11.0 | |
|---|---|
State |
ratified |
Ratification date |
2019-12 |
Changes |
|
| Version 1.12.0 | |
|---|---|
State |
ratified |
Ratification date |
2021-12 |
Changes |
|
| Version 1.13.0 | |
|---|---|
State |
frozen |
Changes |
|
Synopsis
This chapter describes the machine-level operations available in machine-mode (M-mode), which is the highest privilege mode in a RISC-V hart. M-mode is used for low-level access to a hardware platform and is the first mode entered at reset. M-mode can also be used to implement features that are too difficult or expensive to implement in hardware directly. The RISC-V machine-level ISA contains a common core that is extended depending on which other privilege levels are supported and other details of the hardware implementation. This chapter describes the RISC-V machine-level architecture, which contains a common core that is used with various supervisor-level address translation and protection schemes.
Parameters
This extension has the following implementation options (AKA parameters):
- COUNTINHIBIT_EN
-
Type
array
Valid Values
32-element array where:
[0] is boolean
[1] is false
[2] is boolean
additional items are:
booleanDescription
Indicates which hardware performance monitor counters can be disabled from mcountinhibit.
An unimplemented counter cannot be specified, i.e., if HPM_COUNTER_EN[3] is false, it would be illegal to set COUNTINHIBIT_EN[3] to true.
COUNTINHIBIT_EN[1] can never be true, since it corresponds to mcountinhibit, which is always read-only-0.
COUNTINHIBIT_EN[3:31] must all be false if Zihpm is not implemented.
- MARCHID_IMPLEMENTED
- MIMPID_IMPLEMENTED
- MISALIGNED_LDST
-
Type
boolean
Valid Values
boolean
Description
Does the implementation perform non-atomic misaligned loads and stores to main memory (does not affect misaligned support to device memory)? If not, the implementation always throws a misaligned exception.
- MISALIGNED_LDST_EXCEPTION_PRIORITY
-
Type
string
Valid Values
[low, high]
Description
The relative priority of a load/store/AMO exception vs. load/store/AMO page-fault or access-fault exceptions.
May be one of:
low
Misaligned load/store/AMO exceptions are always lower priority than load/store/AMO page-fault and access-fault exceptions.
high
Misaligned load/store/AMO exceptions are always higher priority than load/store/AMO page-fault and access-fault exceptions.
MISALIGNED_LDST_EXCEPTION_PRIORITY cannot be "high" when MISALIGNED_MAX_ATOMICITY_GRANULE_SIZE is non-zero, since the atomicity of an access cannot be determined in that case until after address translation.
- MISA_CSR_IMPLEMENTED
- MTVAL_WIDTH
-
Type
integer when
MXLEN== 32 integer whenMXLEN== 64Valid Values
0 to 32 when
MXLEN== 32 0 to 64 whenMXLEN== 64Description
The number of implemented bits in the mtval CSR. This is the CSR that may be written when a trap is taken into M-mode with exception-specific information to assist software in handling the trap (e.g., address associated with exception).
Must be greater than or equal to max(
PHYS_ADDR_WIDTH,VA_SIZE)
- MTVEC_ACCESS
- MTVEC_ILLEGAL_WRITE_BEHAVIOR
-
Type
string
Valid Values
[retain, custom]
Description
Options:
- retain
-
When either mtvec.MODE or mtvec.BASE is illegal, mtvec will retain its curent value
- custom
-
When either mtvec.MODE or mtvec.BASE is illegal, mtvec will obtain an unpredictable value
Other values may be added over time once other common behaviors are identified.
- MTVEC_MODES
-
Type
array
Valid Values
1-element to 2-element array of [0, 1]
Description
Options:
- 0
-
Direct; All traps set
pcto mtvec.BASE - 1
-
Vectored; Asynchronous interrupts set
pcto mtvec.BASE + 4 x cause.
If only one mode is given, mtvec.MODE is assumed to be read-only with that value. Otherwise, mtvec.MODE is read-write.
- MXLEN
-
Type
integer
Valid Values
[32, 64]
Description
XLEN in machine mode, specified in bits
- M_MODE_ENDIANNESS
-
Type
string
Valid Values
[little, big, dynamic]
Description
Options:
little
M-mode data is always little endian
big
M-mode data is always big endian
dynamic
M-mode data can be either little or big endian, depending on the CSR field mstatus.MBE
- PHYS_ADDR_WIDTH
-
Type
integer when
MXLEN== 32 integer whenMXLEN== 64Valid Values
1 to 34 when
MXLEN== 32 1 to 64 whenMXLEN== 64Description
Implementation-defined size of the physical address space.
- PMA_GRANULARITY
-
Type
integer
Valid Values
2 to 66
Description
Generally, for systems with an MMU, should not be smaller than 12, as that would preclude caching PMA results in the TLB along with virtual memory translations
- PRECISE_SYNCHRONOUS_EXCEPTIONS
-
Type
boolean
Valid Values
boolean
Description
If false, any exception not otherwise mandated to precise (e.g., PMP violation) will cause execution to enter an unpredictable state.
- REPORT_ENCODING_IN_MTVAL_ON_ILLEGAL_INSTRUCTION
- REPORT_VA_IN_MTVAL_ON_BREAKPOINT
-
Type
boolean
Valid Values
boolean
Description
- REPORT_VA_IN_MTVAL_ON_INSTRUCTION_ACCESS_FAULT
- REPORT_VA_IN_MTVAL_ON_INSTRUCTION_MISALIGNED
- REPORT_VA_IN_MTVAL_ON_LOAD_ACCESS_FAULT
- REPORT_VA_IN_MTVAL_ON_LOAD_MISALIGNED
- REPORT_VA_IN_MTVAL_ON_STORE_AMO_ACCESS_FAULT
- REPORT_VA_IN_MTVAL_ON_STORE_AMO_MISALIGNED
- TRAP_ON_EBREAK
-
Type
boolean
Valid Values
boolean
Description
The spec states that implementations may handle EBREAKs transparently without raising a trap, in which case the EEI must provide a builtin.
- TRAP_ON_ECALL_FROM_M
-
Type
boolean
Valid Values
boolean
Description
The spec states that implementations may handle ECALLs transparently without raising a trap, in which case the EEI must provide a builtin.
- TRAP_ON_ILLEGAL_WLRL
-
Type
boolean
Valid Values
boolean
Description
Options:
-
true: Writing an illegal value to a WLRL CSR field will cause an IllegalInstruction exception.
-
false: Writing an illegal value to a WLRL CSR field causes unpredictable behavior.
-
- TRAP_ON_RESERVED_INSTRUCTION
-
Type
boolean
Valid Values
boolean
Description
Options:
-
true: Fetching an unimplemented and/or undefined instruction from the standard/reserved opcode space will cause an IllegalInstruction exception.
-
false: Fetching an unimplemented and/or undefined instruction from the standard/reserved opcose space causes unpredictable behavior.
TRAP_ON_RESERVED_INSTRUCTION may be false while TRAP_ON_UNIMPLEMENTED_INSTRUCTION is true when a custom instruction is implemented in the standard/reserved opcode space.
-
- TRAP_ON_UNIMPLEMENTED_CSR
- TRAP_ON_UNIMPLEMENTED_INSTRUCTION
-
Type
boolean
Valid Values
boolean
Description
Options:
-
true: Fetching an unimplemented instruction will cause an IllegalInstruction exception.
-
false: Fetching an unimplemented instruction causes unpredictable behavior.
An unimplemented instruction is any instruction encoding that is not defined by the implementation. Custom instructions are considered implemented.
-
- VENDOR_ID_BANK
-
Type
integer
Valid Values
25-bit integer
Description
Encodes the number of one-byte continuation codes in the Bank field of mvendorid.
iN JEDEC’s parlance, the bank number is one greater than the number of continuation codes; hence, the mvendorid Bank field encodes a value that is one less than the JEDEC bank number.
- VENDOR_ID_OFFSET
-
Type
integer
Valid Values
7-bit integer
Description
Encodes the final byte of a JEDEC manufactor ID, discarding the parity bit.