go to previous page   go to home page   go to next page hear noise

Answer:

0x00400060 --- address of data
0x00400000 --- address in $10
$8         --- destination register

The instruction is:

lw $8,0x60($10)

Machine Instruction for Load Word

Here is the machine code version of the instruction. It specifies the base register, the destination register, and the offset. It does not directly contain the memory address.

100011  01010 01000 0000 0000 0110 0000 -- fields of the instruction

lw      $10   $8     0    0    6    0
opcode  base  dest        offset        -- meaning of the fields

lw      $8, 0x60($10)                   -- assembly language

Here is how this instruction is executed:

  1. The 32-bit address in $10 is:   0x00400000
  2. The offset is sign-extended to 32 bits:   0x00000060
  3. The memory address is the 32-bit sum of the above:   0x00400060
  4. Main memory is asked for data from that address.
  5. After a one machine cycle delay the data reaches $8.   $8 = The 4 bytes.

There is a one machine cycle delay before the data from memory is available. Reaching outside of the processor chip into main memory takes time. But the processor does not wait and executes one more instruction while the load is going on. This is the load delay slot. The instruction immediately after a lw instruction should not use the register that is being loaded. Sometimes the instruction after the lw is a no-operation instruction.


QUESTION 7:

Picture of the Problem

Look at registers $12 and $13 and memory (at right). Write the instruction that puts the value 0x00000004 into register $12.

  • Register $12 contains 0xFFFFFFFF
  • Register $13 contains 0x00040000
lw $,  ($ )