Description
Loads a word (32 bits) from the word aligned memory location that results from adding the contents of registers rA and rB. The data is placed in register rD, and the reservation bit is set. If an AXI4 interconnect with exclusive access enabled is used, and the interconnect response is not EXOKAY, the carry flag (MSR[C]) is set; otherwise the carry flag is cleared.
A data TLB miss exception occurs if virtual protected mode is enabled, and a valid translation entry corresponding to the address is not found in the TLB.
A data storage exception occurs if access is prevented by a no-access-allowed zone protection. This only applies to accesses with user mode and virtual protected mode enabled.
An unaligned data access exception will not occur, even if the two least significant bits in the address are not zero.
A data bus exception can occur when an AXI4 interconnect with exclusive access enabled is used, and the interconnect response is not EXOKAY, which means that an exclusive access cannot be handled.
Enabling AXI exclusive access ensures that the operation is protected from
other bus masters, but requires that the addressed slave supports exclusive access.
When exclusive access is not enabled, only the internal reservation bit is used.
Exclusive access is enabled using the two parameters
C_M_AXI_DP_EXCLUSIVE_ACCESS
and
C_M_AXI_DC_EXCLUSIVE_ACCESS
for the peripheral and cache
interconnect, respectively.
Pseudocode
Addr ← (rA) + (rB)
if TLB_Miss(Addr) and MSR[VM] = 1 then
ESR[EC] ← 10010; ESR[S] ← 0
MSR[UMS] ← MSR[UM]; MSR[VMS] ← MSR[VM]; MSR[UM] ← 0; MSR[VM] ← 0
else if Access_Protected(Addr) and MSR[UM] = 1 and MSR[VM] = 1 then
ESR[EC] ← 10000; ESR[S] ← 0 ; ESR[DIZ] ← 1
MSR[UMS] ← MSR[UM]; MSR[VMS] ← MSR[VM]; MSR[UM] ← 0; MSR[VM] ← 0
else if AXI_Exclusive(Addr) and AXI_Response ¹ EXOKAY and MSR[EE] then
ESR[EC] ← 00100; ESR[ECC] ← 0 ;
MSR[UMS] ← MSR[UM]; MSR[VMS] ← MSR[VM]; MSR[UM] ← 0; MSR[VM] ← 0
else
(rD) ← Mem(Addr); Reservation ← 1;
if AXI_Exclusive(Addr) and AXI_Response ≠ EXOKAY then
MSR[C] ← 1
else
MSR[C] ← 0
Registers Altered
- rD and MSR[C], unless an exception is generated, in which case they are unchanged
- MSR[UM], MSR[VM], MSR[UMS], MSR[VMS], if a TLB miss exception or a data storage exception is generated
- ESR[EC], ESR[S], if an exception is generated
- ESR[DIZ], if a data storage exception is generated
Latency
- 1 cycle with
C_AREA_OPTIMIZED
=0 or 2 - 2 cycles with
C_AREA_OPTIMIZED
=1
Notes
- This instruction is used together with SWX to implement exclusive access, such as semaphores and spinlocks.
- The carry flag (MSR[C]) might not be set immediately (dependent on pipeline stall behavior). The LWX instruction should not be immediately followed by an MSRCLR, MSRSET, MTS, or SRC instruction, to ensure the correct value of the carry flag is obtained.