Webcentive RISC-V Reference

sb.rl

Store Byte Release

Extension
Zalasr
XLEN
RV32 and RV64
Assembly (riscv-unified-db)
sb.rl xs2, (xs1)
Length
32-bit

Encoding

312726252420191514121176210
00111aq1rs2rs1000000000101111

Match 0x3a00002f, mask 0xfa007fff. Source: sb.rl rs1 rs2 aq 25=1 31..27=7 14..12=0 11..7=0 6..2=0x0B 1..0=3 in riscv-opcodes/extensions/rv_zalasr.

FieldBitsriscv-opcodes name
aq26aq
rs224:20rs2
rs119:15rs1

Description

Store the lowest 8 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; 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(8, virtual_address)) {
  raise(ExceptionCode::StoreAmoAddressMisaligned, mode(), virtual_address);
}

write_memory_aligned(8, virtual_address, X[xs2][7:0], $encoding, 1'b0, 1'b1);

Pseudocode in riscv-unified-db’s IDL, quoted unchanged.

Specification and related pages