MIPS Assembly/Memory Instructions

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search


This page will discuss the load and store instructions that deal with memory access

Contents

[edit] Load Instructions

Instruction:
lbu
type:
I Type
Instruction:
lhu
type:
I Type
Instruction:
lui
type:
I Type
Instruction:
lw
type:
I Type
Instruction:
li
type:
I Type

[edit] Store Instructions

Instruction:
sb
type:
I Type
Instruction:
sh
type:
I Type
Instruction:
sw
type:
I Type

[edit] Move Instructions

Instruction:
movz
type:
R Type
Instruction:
movn
type:
R Type
Instruction:
move
type:
R Type

[edit] 32-bit Manipulations

To manipulate 32-bit numbers, we need to break the values into 16-bit component parts, and manipulate the parts individually.

[edit] Load

To load a 32-bit number, we need to use lui to load the high 16 bits with the specified number. Then we need to use ori to shift the high 16 bits into the low 16 bits. Finally, we need to use lui again to load the upper 16 bits. The result will be the complete 32 bit number.