Machine Indirect Register Alias 4
The `mireg4` machine indirect alias CSR is used to access register state indirectly upon a read or write, as determined by the value of `miselect`.
The behavior upon accessing `mireg4` from M-mode, while `miselect` holds a value that is not implemented, is UNSPECIFIED.
It is expected that implementations will typically raise an illegal instruction exception for such accesses, so that, for example, they can be identified as software bugs. Platform specs, profile specs, and/or the Privileged ISA spec may place more restrictions on behavior for such accesses.
Attempts to access `mireg4` while `miselect` holds a number in an allocated and implemented range results in a specific behavior that, for each combination of `miselect` and `mireg4`, is defined by the extension to which the `miselect` value is allocated.
Ordinarily, `mireg4` will access register state, access read-only 0 state, or raise an illegal instruction exception.
For RV32, if an extension defines an indirectly accessed register as 64 bits wide, it is recommended that the upper 32 bits of the register are accessed through `mireg4`, while the lower 32 bits are accessed through `mireg`, `mireg2`, or `mireg3`.
| 31:24 | 23:16 | 15:8 | 7:0 | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| VALUE | |||||||||||||||||||||||||||||||
| 63:56 | 55:48 | 47:40 | 39:32 | 31:24 | 23:16 | 15:8 | 7:0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| VALUE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Bits | Field | Alias | Description | Type | Reset |
|---|---|---|---|---|---|
| RV32 [31:0] RV64 [63:0] | VALUE | Register state of the CSR selected by the current `miselect` value | RW | UNDEFINED_LEGAL |
Csr handle = indirect_csr_lookup(PrivilegeMode::M, CSR[miselect].VALUE, 4);
if (!handle.valid) {
unimplemented_csr($encoding);
}
return csr_sw_read(handle);Version af3eaf9+cheriot.f635218
Data from the RISC-V Unified Database, copyright RISC-V International and contributors.
CHERIoT extensions from the CHERIoT specification and Sail model, copyright Microsoft and the CHERIoT Platform contributors.
This site is provided as a community resource and is NOT affiliated with nor endorsed by RISC-V International.