Does rd hold the stored data when SC.D succeeds?
No. rd is the status-result register: success writes 0 and failure writes nonzero; the memory data comes from rs2.
On RV64, conditionally store a 64-bit doubleword according to reservation state; success writes rd=0, failure writes nonzero and leaves memory unchanged
SC.D uses the 64-bit doubleword in rs2 as the candidate store value. It writes that value to memory and sets rd=0 only if the current hart has a valid reservation containing the target bytes addressed by rs1; on failure it does not write memory and writes a nonzero failure code to rd. Whether it succeeds or fails, SC.D invalidates the current reservation.
Shows A-extension doubleword atomic field decode, aq/rl ordering bits, memory read, and RMW state update.
A-extension doubleword atomic instructions use a 32-bit encoding; the animation starts by splitting the fields.
This animation shows ISA-visible atomic read-modify-write, compare-and-swap, LR/SC reservation state, and ordering bits, not any specific CPU cache-coherence implementation, pipeline, or timing.
SC.D is the conditional write point of an RV64 LR/SC sequence. On success it stores the 64-bit rs2 value and writes rd=0; on failure memory keeps the old value and rd is nonzero.
Understand this scenario with real code like «sc.d.rl t0, a1, (a0) # store 64-bit a1 to *a0 if the reservation is valid; t0=0 on success».
Understand this scenario with real code like «sc.d.rl t0, a1, (a0) # store 64-bit a1 to *a0 if the reservation is valid; t0=0 on success».
No. rd is the status-result register: success writes 0 and failure writes nonzero; the memory data comes from rs2.
No. On failure, SC.D does not perform the memory write; it only writes a nonzero failure code to rd and invalidates the reservation.