sw.rl
Store Word Release
- Extension
- Zalasr
- XLEN
- RV32 and RV64
- Assembly (riscv-unified-db)
sw.rl xs2, (xs1)- Length
- 32-bit
Encoding
| 3127 | 26 | 25 | 2420 | 1915 | 1412 | 117 | 62 | 10 | |||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 00111 | aq | 1 | rs2 | rs1 | 010 | 00000 | 01011 | 11 | |||||||||||||||||||||||
Match 0x3a00202f, mask 0xfa007fff. Source: sw.rl rs1 rs2 aq 25=1 31..27=7 14..12=2 11..7=0 6..2=0x0B 1..0=3 in riscv-opcodes/extensions/rv_zalasr.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| aq | 26 | aq |
| rs2 | 24:20 | rs2 |
| rs1 | 19:15 | rs1 |
Description
Store the lowest 32 bits of register xs2 to the address in xs1.
This instruction has release semantics, which means that no previous memory operations (in program order) from this hart can be observed to occur after this store completes. Release semantics provide ordering guarantees useful for synchronization, such as writing a lock variable to release it.
The address must be naturally aligned (4-byte aligned); if not, an address-misaligned or access-fault exception will be raised.
Description from riscv-unified-db, reformatted.
Operation
XReg virtual_address = X[xs1];
if (!is_naturally_aligned(32, virtual_address)) {
raise(ExceptionCode::StoreAmoAddressMisaligned, mode(), virtual_address);
}
write_memory_aligned(32, virtual_address, X[xs2][31:0], $encoding, 1'b0, 1'b1);Pseudocode in riscv-unified-db’s IDL, quoted unchanged.