LW16 011010 |
rt |
base |
offset |
6 |
3 |
3 |
4 |
LW16 rt, left_shifted_offset(base) |
microMIPS |
Load Word (16-bit instr size) |
Load Word (16-bit instr size)
To load a word from memory as a signed value
GPR[rt] = memory[GPR[base] + (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 4-bit unsigned offset is left shifted by two bits and then is added to the contents of GPR base to form the effective address.
The 3-bit register fields can only specify GPRs $2-$7, $16, $17.
Pre-Release 6: 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.
Release 6 allows hardware to provide address misalignment support in lieu of requiring natural alignment.
Note: The pseudocode is not completely adapted for Release 6 misalignment support as the handling is implementation dependent.
vAddr = zero_extend(offset|| 02) + GPR[base] (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)
TLB Refill, TLB Invalid, Bus Error, Address Error, Watch