ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 1,823 microarchs · 16,083 chips · 105 sources
Arch:
Tier:

mireg2

T1 riscv register register
Machine Indirect Register Alias 2
SourceRISC-V Official Unified Database (riscv-unified-db) (riscv_unified_db)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeRISC-V Privileged (Smcsrind)
RV32 / RV64 (Ratified & Standard Extensions)
License & VersionApache-2.0 / CC-BY-4.0
main
Upstreamhttps://github.com/riscv/riscv-unified-db
PrivilegeM
ExtensionsSmcsrind

Summary

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.

Syntax / Encoding

CSR 0x352 (M-mode, RW)

Bitfields (1)

BitsFieldDescription
63:0VALUERegister state of the CSR selected by the current miselect value [RV32: 31:0, RV64: 63:0]

Reference Notes

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.

For RV32, if an extension defines an indirectly accessed register as 64 bits wide, it is
recommended that the lower 32 bits of the register are accessed through `mireg2`,
while the upper 32 bits are accessed through `mireg5`.