Abstract


  • Each word in MIPS is 4 bytes, and MIPS uses byte addressing, so consecutive words’ addresses differ by . Thus, the offset to the next word is always a multiple of 4

Can I load or store one byte?

Yes, we can use lb and sb. The consecutive byte’s addresses differ by .

Important

MIPS disallows loading/storing unaligned word using lw and sw.

Important

Using pointers will often result in less MIPS code when looping through array elements. This is because we can use the memory address directly as the loop termination condition, rather than having to calculate the offset.

lw

sw