CSRRW
Control Status Register Read/Write
CSRRW rd, csr, rs1
Atomically swaps values in the CSRs. Reads the old value of the CSR into rd, then writes rs1 to the CSR.
Details
CSRRW atomically reads the value of CSR csr into rd, then writes the value from rs1 into the CSR. If rd is x0, the read is skipped and no side-effects from reading occur.