Does atomic here mean a memory atomic?
No. In Zicsr, atomic means the CSR read and write are performed by one CSR instruction, not an AMO to a memory address.
Atomically read the old CSR value into rd and write rs1 to the same CSR; rd=x0 suppresses the CSR read
CSRRW is the Zicsr atomic CSR read/write instruction: in one instruction it writes the old CSR value, zero-extended to XLEN, to rd and writes rs1 to the same CSR. If rd=x0, the instruction does not read the CSR and causes no CSR read side effects, but the write still occurs from rs1. The CSR address field is 12 bits; absent CSRs, insufficient privilege, or illegal writes to read-only CSRs raise illegal-instruction.
Shows the Zicsr CSR read-modify-write flow: decode the SYSTEM encoding, read the CSR, compute write/set/clear semantics, then update rd and the CSR.
The CSR name/address is part of the instruction syntax; the old CSR value and rs1 example value are execution context. The animation gives the example CSR no platform-specific field meaning.
CSRRW is a Zicsr I-type SYSTEM instruction; the CSR address occupies bits 31..20.
The bit view shows the CSR value computation at the selected XLEN.
This animation shows only Zicsr ISA-visible CSR reads/writes, side-effect suppression, and bit-mask semantics; it does not model concrete CSR field meanings, trap handlers, pipelines, or timing.
CSRRW sends the old CSR value to rd while writing rs1 into the CSR. rd=x0 is a write-only CSR operation: no CSR read or read side effects, but the CSR write still occurs.
Understand this scenario with real code like «csrrw x5, mepc, x6 # x5 = old mepc; mepc = x6».
Understand this scenario with real code like «csrrw x5, mepc, x6 # x5 = old mepc; mepc = x6».
No. In Zicsr, atomic means the CSR read and write are performed by one CSR instruction, not an AMO to a memory address.
No. rd=x0 suppresses the CSR read only for CSRRW/CSRRWI; rs1=x0 or uimm=0 suppresses the CSR write only for CSRRS/CSRRC and their immediate forms.