Twelve bits of CSR address space eventually run out — AIA alone wants register files bigger than the map allows. Indirect access indirect csr access Smcsrind/Sscsrind: a select CSR (m/s/vsiselect) routes six alias CSRs (m/s/vsireg1-6) onto extension register files - multiplying the 12-bit CSR space. Select values are their own address space (MSB = custom); siselect must hold 0..0xFFF for emulation headroom; widths follow current XLEN; unimplemented selects should trap illegal-instruction; stateen0 bit 60 gates it. defined in ch. II·5 — open in glossary multiplies the space: a select register picks a target, and six alias CSRs become windows onto it.
One select, six windows. On RV32 the convention pairs sireg1-3 (low halves) with sireg4-6 (high halves) — 3 register arrays per select value either way.
| Addresses | Key rules | |
|---|---|---|
| miselect + mireg1-6 | 0x350-0x357 (0x354 skipped — it’s miph) | May be read-only zero with no client extensions |
| siselect + sireg1-6 | 0x150-0x157 | Required with S-mode; select range 0..0xFFF minimum |
| vsiselect + vsireg1-6 | 0x250-0x257 | Required with H; substitute for the s-versions in VS/VU-mode. Width should match siselect (else a detectable virtualization hole) |
| Common | — | Select-value space is SEPARATE from CSR numbers and tselect; MSB set = custom (MSB tracks XLEN changes); widths are CURRENT XLEN, not SXLEN/VSXLEN |
Exception matrix: unimplemented select value → UNSPECIFIED, with
illegal-instruction recommended (that’s what makes firmware emulation
work). Under H: VS/VU touching vsiselect/vsireg* directly →
virtual-instruction; VU touching siselect/sireg* →
virtual-instruction; VS touching sireg* transparently operates on
vsireg*. And Smstateen’s bit 60 (CSRIND) gates the whole
mechanism below M — with hstateen0[60]=0 ∧ mstateen0[60]=1, VS/VU
attempts raise virtual-instruction regardless of select values.
Hardware Designer Notes
Implementation is a second-level CSR decode: iselect latches a value, and the six alias addresses index a router table into whatever register files your extensions expose. For the Linux-boot core in this book’s scope (no AIA), the whole chapter is a stub: RO-0 miselect, absent s-set — and one more line in your documented-choices list.
Minimal Linux-boot hart MUST
- Trap unimplemented select values (the recommended UNSPECIFIED resolution) — emulators depend on it
- Make select/alias widths follow the CURRENT XLEN
- Wire the VS substitution and the virtual-instruction cases exactly if you implement H
MAY simplify / trap-and-emulate
- Ship miselect read-only zero and omit s/vs sets entirely until AIA or counter delegation arrives — Linux without AIA never touches this
- Implement the router as a small decode table in the CSR unit — no datapath cost
Check yourself — indirect CSR access
1.Why six alias registers (sireg through sireg6) instead of one?
2.Why must siselect support the range 0..0xFFF even on a hart implementing none of those values?
3.VS-mode code reads sireg while the H extension is active. Which register does it actually touch?