Problem Set 2

Intro to Computer Architecture
Spring, 2018
Due:  March 2 (class time)

You may write your answers on paper or submit them electronically through handin.

Consider the following MIPS assembly code.  Translate the 6 MIPS assembly language statements below (the la, lw, sub, addi, add, and bne instructions) into machine code.  Express your answers in hex.  Show how your answers are derived (field by field).  (Note:  Some of the statements will need to be translated into more than one machine code instruction.)

0x00c10400    a:   .word   0
0x00c10404    b:   .word   0

0x00001244         la      $s1, a
0x00001248         lw      $s2, b
0x0000124c         sub     $s3, $s1, $s2
0x00001250         addi    $s3, $s5, 50
0x00001254         add     $s4, $0, $s3
0x00001258         bne     $s2, $s2, L5

0x000020bc    L5: