Encoding:

LWSP16

010010

rt

offset

6

5

5

Format:

LWSP 

Load Word from Stack Pointer (16-bit instr size)

LW16 rt, left_shifted_offset(sp)

microMIPS

Load Word from Stack Pointer (16-bit instr size)

Purpose:

Load Word from Stack Pointer (16-bit instr size)

To load a word from memory as a signed value

Description:

 GPR[rt] = memory[GPR[29] + (offset <= 4)]

The contents of the 32-bit word at the memory location specified by the aligned effective address are fetched, signextended to the GPR register length if necessary, and placed in GPR rt. The 5-bit signed offset is left shifted by two bits, zero-extended and then is added to the contents of GPR 29 to form the effective address.

Restrictions:

The effective address must be naturally-aligned. If either of the 2 least-significant bits of the address is non-zero, an

Address Error exception occurs.

Providing misaligned support for Release 6 is not a requirement for this instruction.

Operation:

vAddr = zero_extend(offset|| 02) + GPR[29]
if vAddr1..0 != 02 then
   SignalException(AddressError)
endif
(pAddr, CCA) = AddressTranslation (vAddr, DATA, LOAD)
pAddr = pAddrPSIZE-1..3 || (pAddr2..0 xor (ReverseEndian || 02))
memdoubleword = LoadMemory (CCA, WORD, pAddr, vAddr, DATA)
byte = vAddr2..0 xor (BigEndianCPU || 02)
GPR[rt] = sign_extend(memdoubleword31+8*byte..8*byte)

Exceptions:

TLB Refill, TLB Invalid, Bus Error, Address Error, Watch