SC.W
Store Conditional Word
SC.W rd, rs2, (rs1)
Conditionally stores a word to memory if the reservation (from LR) is still valid.
Details
SC.W conditionally stores the word in rs2 to the address in rs1, only if the reservation set by LR.W is still valid. It writes 0 to rd on success and a non-zero value on failure.
Pseudocode Operation
if (ReservationValid) { M[R[rs1]] = R[rs2]; R[rd] = 0; } else { R[rd] = 1; }
Example
SC.W x10, x11, (x12)
Encoding
Binary Layout
00011
31:27
aq
26
rl
25
rs2
24:20
rs1
19:15
010
14:12
rd
11:7
0101111
6:0
Operands
-
rd
Dest (Success/Fail) -
rs2
Source Value -
rs1
Address