csrrs
riscv_unified_db)RV32 / RV64 (Ratified & Standard Extensions)
main
userZicsrSummary
Atomically read and set bits in a CSR.
Syntax / Encoding
csrrs xd, csr, xs1 | xxxxxxxxxxxxxxxxx010xxxxx1110011 (mask=0x0000707f match=0x00002073)
Cross-Chip Latency & Throughput (11 cores)
| Microarchitecture | Latency (cycles) | Recip. TP | uops | Ports | Source |
|---|---|---|---|---|---|
| Andes 45-Series | 1 | 1 | 1 | Andes45CSR | llvm_sched_models |
| MIPS P8700 (RISC-V) | 1 | 1 | 1 | p8700ALQ | llvm_sched_models |
| SiFive 7-Series (U74) | 1 | 1 | 1 | PipeB | llvm_sched_models |
| SiFive P670 / P600 | 1 | 1 | 1 | SiFiveP600SYS | llvm_sched_models |
| SiFive P870 / P800 | 1 | 1 | 1 | SiFiveP800SYS | llvm_sched_models |
| SpacemiT X100 | 1 | 0.5 | 1 | SMTX100_IQ0 | llvm_sched_models |
| SpacemiT X60 (K1) | 1 | 0.5 | 1 | SMX60_IEU | llvm_sched_models |
| Syntacore SCR7 | 1 | 1 | 1 | — | llvm_sched_models |
| Tenstorrent Ascalon-X | 1 | 1 | 1 | AscalonFXA | llvm_sched_models |
| XiangShan KunMingHu | 1 | 1 | 1 | XSPipeBJU3 | llvm_sched_models |
| XiangShan NanHu | 1 | 1 | 1 | XS2MISC | llvm_sched_models |
Binary Encodings (1)
| Width | Format | Bit Pattern | Mask / Match |
|---|---|---|---|
| 32 | RV | xxxxxxxxxxxxxxxxx010xxxxx1110011 | 0x0000707f / 0x00002073 |
Operands
| Name | Description |
|---|---|
csr | bits [31:20] |
xs1 | bits [19:15] |
xd | bits [11:7] |
Reference Notes
Atomically read and set bits in a CSR. Reads the value of the CSR, zero-extends the value to `XLEN` bits, and writes it to integer register `xd`. The initial value in integer register `xs1` is treated as a bit mask that specifies bit positions to be set in the CSR. Any bit that is high in `xs1` will cause the corresponding bit to be set in the CSR, if that CSR bit is writable. Other bits in the CSR are not explicitly written.