mireg2
Machine Indirect Register Alias 2
The mireg2 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 mireg2 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 mireg2 while miselect holds a number in an allocated and implemented range results in a specific behavior that, for each combination of miselect and mireg2, is defined by the extension to which the miselect value is allocated.
Ordinarily, mireg2 will access register state, access read-only 0 state, or raise an illegal instruction exception.
Attributes
Defining Extension |
|
---|---|
CSR Address |
0x352 |
Length |
32 when CSR[misa].MXL == 0 64 when CSR[misa].MXL == 1 |
Privilege Mode |
M |
Format
This CSR format changes dynamically.
Field Summary
Name | Location | Type | Reset Value |
---|---|---|---|
* 31:0 when CSR[misa].MXL == 0 * 63:0 when CSR[misa].MXL == 1 |
RW |
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:
VALUE = Csr handle = indirect_csr_lookup(CSR[miselect].VALUE, 2); if (!handle.valid) { unimplemented_csr($encoding); } if (!handle.writable) { raise (ExceptionCode::IllegalInstruction, mode(), $encoding); } csr_sw_write(handle, csr_value.VALUE); return csr_hw_read(handle);
Software read
This CSR may return a value that is different from what is stored in hardware.
Csr handle = indirect_csr_lookup(miselect.VALUE, 2);
if (!handle.valid) {
unimplemented_csr($encoding);
}
return csr_sw_read(handle);