ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 913 microarchs · 15,555 chips · 105 sources
Arch:
Tier:

lr.d.aqrl

T1 riscv alu insn
Load Reserved Doubleword
SourceRISC-V Official Unified Database (riscv-unified-db) (riscv_unified_db)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeRV32/RV64 Zalrsc
RV32 / RV64 (Ratified & Standard Extensions)
License & VersionApache-2.0 / CC-BY-4.0
main
Upstreamhttps://github.com/riscv/riscv-unified-db
Privilegeuser
ExtensionsZalrsc

Summary

Loads a doubleword from the address in xs1, places the value in xd, and registers a _reservation set_ -- a set of bytes that subsumes the bytes in the addressed doubleword.

Syntax / Encoding

lr.d.aqrl xd, (xs1) | 00010xx00000xxxxx011xxxxx0101111 (mask=0xf9f0707f match=0x1000302f)

Binary Encodings (1)

WidthFormatBit PatternMask / Match
32RV00010xx00000xxxxx011xxxxx01011110xf9f0707f / 0x1000302f

Operands

NameDescription
aqbits [26], not 0
rlbits [25], not 0
xs1bits [19:15]
xdbits [11:7]

Reference Notes

Loads a doubleword from the address in xs1, places the value in xd,
and registers a _reservation set_  -- a set of bytes that subsumes the bytes in the
addressed doubleword.

The address in xs1 must be 8-byte aligned.

If the address is not naturally aligned, a `LoadAddressMisaligned` exception or an
`LoadAccessFault` exception will be generated. The access-fault exception can be generated
for a memory access that would otherwise be able to complete except for the misalignment,
if the misaligned access should not be emulated.

An implementation can register an arbitrarily large reservation set on each LR, provided the
reservation set includes all bytes of the addressed data word or doubleword.
An SC can only pair with the most recent LR in program order.
An SC may succeed only if no store from another hart to the reservation set can be
observed to have occurred between the LR and the SC, and if there is no other SC between the
LR and itself in program order.
An SC may succeed only if no write from a device other than a hart to the bytes accessed by
the LR instruction can be observed to have occurred between the LR and SC. Note this LR
might have had a different effective address and data size, but reserved the SC's
address as part of the reservation set.

[NOTE]
----
Following this model, in systems with memory translation, an SC is allowed to succeed if the
earlier LR reserved the same location using an alias with a different virtual address, but is
also allowed to fail if the virtual address is different.

To accommodate legacy devices and buses, writes from devices other than RISC-V harts are only
required to invalidate reservations when they overlap the bytes accessed by the LR.
These writes are not required to invalidate the reservation when they access other bytes in
the reservation set.
----

Software should not set the _rl_ bit on an LR instruction unless the _aq_ bit is also set.
LR.rl and SC.aq instructions are not guaranteed to provide any stronger ordering than those
with both bits clear, but may result in lower performance.