CSRRSI

CSR Read and Set Immediate

CSRRSI rd, csr, uimm

Sets bits in a CSR using a 5-bit unsigned immediate.

Details

CSRRSI atomically reads CSR csr into rd, then sets bits in the CSR corresponding to set bits in the zero-extended 5-bit immediate. If the immediate is zero, no bits are modified.

Pseudocode Operation

t = CSRs[csr]; CSRs[csr] = t | zext(uimm); R[rd] = t;

Example

CSRRSI x0, sstatus, 1

Encoding

Binary Layout
csr
31:20
uimm
110
19:17
rd
16:12
1110011
11:5
 
Format I-Type
Opcode 0x73
Extension Zicsr

Operands

  • rd
    Destination register (integer)
  • csr
    CSR Address
  • uimm
    Bit Mask