mireg5

Machine Indirect Register Alias 5

The mireg5 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 mireg5 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 mireg5 while miselect holds a number in an allocated and implemented range results in a specific behavior that, for each combination of miselect and mireg5, is defined by the extension to which the miselect value is allocated.

Ordinarily, mireg5 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 mireg5, while the lower 32 bits are accessed through mireg2.

Attributes

CSR Address

0x356

Defining extension

Length

64-bit

Privilege Mode

M

Format

mireg5 format
Figure 1. mireg5 format

Field Summary

Name Location Type Reset Value

VALUE

63:0

RW

UNDEFINED_LEGAL

Fields

VALUE

Location

mireg5[63:0]

Description

Register state of the CSR selected by the current miselect value

Type

RW

Read-Write

Field is writable by software. Any value that fits in the field is acceptable and shall be retained for subsequent reads.

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.

Csr handle = indirect_csr_lookup(PrivilegeMode::M, CSR[miselect].VALUE, 5);
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.

  • Pruned

  • Original

Csr handle = indirect_csr_lookup(PrivilegeMode::M, CSR[miselect].VALUE, 5);
if (!handle.valid) {
  unimplemented_csr($encoding);
}
return csr_sw_read(handle);
Csr handle = indirect_csr_lookup(PrivilegeMode::M, CSR[miselect].VALUE, 5);
if (!handle.valid) {
  unimplemented_csr($encoding);
}
return csr_sw_read(handle);