lw
, load word, operates in five steps:
lw $t1, offset($t2) # $t1=mem[[$t2]+offset] # rt=mem[ [rs]+offset] |
$t2
or rs
) value is read from the register file.
offset
).
$t1
or rt
).
ExtOp=“sign”
sign-extends the 16-bit immediate to 32 bits.
ALUSrc=‘1’
selects the extended immediate as the second ALU input.
ALUCtrl=“ADD”
calculates data memory address as [rs]+sign-extended(imm16)
MemRead=‘1’
reads data memory.
RegDst=‘0’
selects rt
as the destination register.
MemtoReg=‘1’
places the data read from memory on BusW
.
RegWrite=‘1’
writes the memory data on BusW
to register rt
.