Encoding:

LWGP16

011001

rt

offset

6

3

7

Format:

LWGP 

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

LW16 rt, left_shifted_offset(gp)

microMIPS

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

Purpose:

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

To load a word from memory as a signed value

Description:

 GPR[rt] = memory[GPR[28] + (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 7-bit signed offset is left shifted by two bits and then added to the contents of GPR 28 to form the effective address.

Restrictions:

The 3-bit register field can only specify GPRs $2-$7, $16, $17.

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 = sign_extend(offset|| 02) + GPR[28]
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