Does AMOADD.D place the added result in rd?
No. AMOADD.D places the old 64-bit memory value before the add in rd; the low 64-bit added result is written back to memory.
RV64 atomic 64-bit doubleword add: rd returns the old memory value, while memory receives the low 64-bit result of old value plus rs2
AMOADD.D performs an atomic read-modify-write on the 64-bit doubleword addressed by rs1: it reads the old memory value into rd, adds that old value to the 64-bit value from rs2, and writes the low 64-bit result back to the same address. The addition wraps as a 64-bit doubleword; aq/rl bits affect memory ordering and do not change the arithmetic result.
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.
AMOADD.D uses full 64-bit doubleword addition and writes the low 64-bit result to memory; this view avoids per-bit equations that would hide the carry chain.
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.
AMOADD.D is commonly used for RV64 64-bit atomic counter updates. rd returns the old doubleword before the add, while memory receives the low 64-bit result of old value plus rs2; do not mistake rd for the new sum.
Understand this scenario with real code like «amoadd.d a0, a1, (a2) # a0 = old 64-bit *a2; *a2 = old + a1».
Understand this scenario with real code like «amoadd.d a0, a1, (a2) # a0 = old 64-bit *a2; *a2 = old + a1».
No. AMOADD.D places the old 64-bit memory value before the add in rd; the low 64-bit added result is written back to memory.
No. The doubleword addition wraps at 64 bits, and the low 64-bit result is written back.