CSR Bit Fields

RISC-V medelegh CSR Register

Address 0x312Privilege MachineAccess RW / RV32 high-half / 32-bitMachine delegation, environment-configuration, and state-enable CSRs

medelegh is the RV32 high-half companion for machine exception delegation state.

Field Map

Understand medelegh By Bit Fields

1 key fields
31:0

VALUE

RW

Full register value of medelegh; bits not split out here follow the relevant extension or privileged specification, and reserved or WPRI fields should be preserved when writing other fields and ignored on reads.

VALUE (bits 31:0) — Full register value of medelegh; bits not split out here follow the relevant extension or privileged specification, and reserved or WPRI fields should be preserved when writing other fields and ignored on reads.

What This Field Controls

  • - Full register value of medelegh; bits not split out here follow the relevant extension or privileged specification, and reserved or WPRI fields should be preserved when writing other fields and ignored on reads.

Common Values

0Not delegated

The high-half corresponding exception code is handled in M-mode or remains on the current higher-privilege path.

1Delegated to S-mode

The high-half corresponding exception code is delegated to S-mode when it occurs below M-mode.

Official Basis & Search Notes

medelegh is a RW CSR in machine delegation, environment-configuration, and state-enable csrs at 0x312. Check privilege and implemented extensions before interpreting its bit fields.

medelegh address, lowest access privilege, and access class are checked against the official CSR table: 0x312, Machine, RW.
Read it as part of machine delegation, environment-configuration, and state-enable csrs before interpreting the bit-field table on this page.
Modify only target fields and preserve unchanged bits; interpret WPRI and reserved fields only as the official specification and implementation define them.

What To Check First When Reading This CSR

  • - First confirm that the current hart implements medelegh; unimplemented or insufficiently privileged accesses raise an illegal-instruction exception.
  • - Use address 0x312 and the lowest access privilege (Machine) to decide whether software may read it directly.
  • - Do not assume fixed values for reserved, WARL, or WLRL bits; interpret the value according to the specification and implementation.

Risk Checks Before Writing

  • - Preserve bits that are not being changed so reserved or implementation-defined fields are not written with invalid values.
  • - Prefer CSRRS/CSRRC for local set/clear operations to avoid CSRRW overwriting concurrently updated status bits.

Put It Back Into A Real Flow

1

During initialization or the relevant privileged flow, software reads medelegh to observe the current state.

2

Modify only the target fields while preserving all other bits.

3

Read back the CSR or validate through later trap, interrupt, or context-switch behavior that the setting took effect.

FAQ

Can medelegh be accessed from any privilege level?

Do not decide from the CSR name alone. The official CSR address encoding and tables define the lowest access privilege; this entry records medelegh as Machine. Access with insufficient privilege or to an unimplemented CSR raises an illegal-instruction exception.

What is easiest to miss when writing medelegh?

Do not overwrite the whole CSR as if it were an ordinary integer. Modify only target fields, preserve unchanged bits, and follow the specification for WARL, WLRL, WPRI, or reserved fields.