SW16 111010 |
rt |
base |
offset |
6 |
3 |
3 |
4 |
SW16 rt, left_shifted_offset(base) |
microMIPS |
Store Word (16-bit instr size) |
Store Word (16-bit instr size)
To store a word to memory
memory[GPR[base] + (offset <= 4)] = GPR[rt]
The least-significant 32-bit word of GPR rt is stored in memory at the location specified by the aligned effective address. The 4-bit unsigned offset is left-shifted by two bits and then added to the contents of GPR base to form the effective address.
The 3-bit base register field can only specify GPRs $2-$7, $16, $17.
The 3-bit rt register field can only specify GPRs $0, $2-$7, $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, STORE) pAddr = pAddrPSIZE-1..3 || (pAddr2..0 xor (ReverseEndian || 02)) bytesel = vAddr2..0 xor (BigEndianCPU || 02) datadoubleword = GPR[rt]63-8*bytesel..0 || 08*bytesel StoreMemory (CCA, WORD, datadoubleword, pAddr, vAddr, DATA)
TLB Refill, TLB Invalid, TLB Modified, Address Error, Watch