assemblymipscpu-architecture

Understanding LW in MIPS


What is the value in $t2?

LUI $t1, 0
ORI $t1, $t1, 16
LW  $t2, 8($t1)

Firstly, I think that the equation is rs = offset + base address, 8 + 16 = 24.

However, my professor said it is wrong.

I think I do not fully understand LW. Could you help me to solve the problem and extra concept of LW?


Solution

  • $t1 = 0x10
    $t2 = (0x18)
    

    That is, the value stored at 0x18 will be loaded into $t2.

    LW means Load Word. It loads a word into a register from the specified address. 0x18 is the address, not the value that will be stored into $t2.