Controlling the Execution of Load


The memory (or I-type) instruction lw, load word, operates in five steps:

  lw  $t1, offset($t2)
  # $t1=mem[[$t2]+offset]
  #  rt=mem[ [rs]+offset]
  1. An instruction is fetched and the PC is incremented.
  2. A register ($t2 or rs) value is read from the register file.
  3. The ALU computes the sum of the value read from the register file and the sign extended, lower 16 bits of the instruction (offset).
  4. The sum from the ALU is used as the address for the data memory.
  5. The data from the memory unit is written into the register file; the register destination is given by bits 20:16 of the instruction ($t1 or rt).