sd

Store doubleword

For RV64, store 64 bits of data from register xs2 to an address formed by adding xs1 to a signed offset. <% if ext?(:Zilsd) %> For RV32, store doubleword from even/odd register pair. <% end %>

Assembly format

sd xs2, imm(xs1)

Decode Variables

  • RV32

  • RV64

signed Bits<12> imm = sext({$encoding[31:25], $encoding[11:7]}, 12);
Bits<5> xs2 = $encoding[24:20];
Bits<5> xs1 = $encoding[19:15];
signed Bits<12> imm = sext({$encoding[31:25], $encoding[11:7]}, 12);
Bits<5> xs2 = $encoding[24:20];
Bits<5> xs1 = $encoding[19:15];

Execution

Bits<64> data;
XReg virtual_address = X[xs1] + $signed(imm);
if (xlen() == 32) {
  if (implemented?(ExtensionName::Zilsd)) {
    data = {X[xs2 + 1], X[xs2]};
  } else {
    raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
  }
} else {
  data = X[xs2];
}
write_memory(64, virtual_address, data, $encoding);

Exceptions

This instruction may result in the following synchronous exceptions:

  • IllegalInstruction

  • LoadAccessFault

  • StoreAmoAccessFault

  • StoreAmoAddressMisaligned

  • StoreAmoPageFault

Encoding

This instruction has different encodings in RV32 and RV64.
RV32
svg
RV64
svg

Defining extension

(I || Zilsd)

Access

M

Always

Containing profiles

  • Mandatory: None

  • Optional: None