ld
Load doubleword
This instruction is defined by:
Synopsis
For RV64, load 64 bits of data into register xd
from an
address formed by adding xs1
to a signed offset.
<% if ext?(:Zilsd) %>
For RV32, Loads a 64-bit value into registers xd and xd+1.
The effective address is obtained by adding
register xs1 to the sign-extended 12-bit offset.
<% end %>
Decode Variables
Bits<12> imm = $encoding[31:20];
Bits<5> xs1 = $encoding[19:15];
Bits<5> xd = $encoding[11:7];
Execution
-
Pruned, XLEN == 64
-
Original
XReg virtual_address = X[xs1] + $signed(imm);
X[xd] = read_memory<64>(virtual_address, $encoding);
XReg virtual_address = X[xs1] + $signed(imm);
if (xlen() == 32) {
if (implemented?(ExtensionName::Zilsd)) {
Bits<64> data = read_memory<64>(virtual_address, $encoding);
X[xd] = data[31:0];
X[xd + 1] = data[63:32];
} else {
raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
} else {
X[xd] = read_memory<64>(virtual_address, $encoding);
}