MIPS Memory Instructions

Read this article to learn about memory instructions for the MIPS processor.

Load and store instructions use a special syntax:

 instr rt, imm(rs)

The memory address used for the load or store is rs + imm. The immediate is sign-extended.


Load Instructions

Instruction:
lbu
type:
I Type

Loads a byte and does not sign-extend the value.

Instruction:
lhu
type:
I Type

Loads a halfword, or two bytes, and does not sign-extend the value. The halfword must be aligned (i.e., it must start at an even address).

Instruction:
lw
type:
I Type

Loads a word (four-bytes) from memory. The word must be aligned (i.e., the last two bits of the address must be zero).


Store Instructions

Instruction:
sb
type:
I Type

Stores the least significant (rightmost) byte of rt to memory.

Instruction:
sh
type:
I Type

Stores the least significant (rightmost) halfword of rt to memory.

Instruction:
sw
type:
I Type

Stores the contents of rt in memory.



Source: Wikibooks, https://en.wikibooks.org/wiki/MIPS_Assembly/Memory_Instructions
Creative Commons License This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.

Last modified: Thursday, July 23, 2020, 6:03 PM