1 In the following MIPS assembly code translate all the inst
1.     In the following MIPS assembly code, translate all the instructions to their corresponding machine code in hexadecimal format. This code is stored in the memory from address 0x1fff0000.
 Loop: sw $t1, 4($s0)
        addi $t1, $t1, -1
    sll $t1, $t1, 2
        bne $t1, $s5, Exit
    addi $s0, $s0, 4
          j Loop
 Exit: …
Solution
Loop: sw $t1, 4($s0)
 The syntax is: SW rt, offset(base)
 SW - 101011
 rt - 01001
 base - 10000
 offset - 4 - 0000000000000100
 So,the binary instruction is: 101011   10000   01001   0000000000000100
 And its hex equivalent is: 0xAE090004
addi $t1, $t1, -1
 The syntax is: ADDI rt, rs, immediate
 ADDI - 001000
 rt - 01001
 rs - 01001
 immediate - 1111111111111111
 So, the binary instruction is: 001000   01001   01001   1111111111111111
 And its hex equivalent is: 0x2129FFFF
sll $t1, $t1, 2
 The syntax is: SLL rd, rt, sa
 SPECIAL - 000000
 SLL - 000000
 0 - 00000
 rd - 01001
 rt - 01001
 sa - 00010
 So, the instruction is: 000000   00000   01001   01001   00010   000000
 And its hex equivalent is: 0x00094880
bne $t1, $s5, Exit
 The syntax is: BNE rs, rt, offset
 BNE - 000101
 rs - 01001
 rt - 10101
 offset - 0000000000011000
 So, the instruction is: 000101   01001   10101   0000000000011000
 And its hex equivalent is: 0x15350018
addi $s0, $s0, 4
 The syntax is: ADDI rt, rs, immediate
 ADDI - 001000
 rt - 10000
 rs - 10000
 immediate - 0000000000000100
 So, the instruction is: 001000   10000   10000   0000000000000100
 And its hex equivalent is: 0x22100004
j Loop
 The syntax is: J target
 J - 000010
 target - 11111111110000000000000000
 So, the instruction is: 000010   11111111110000000000000000
 And its hex equivalent is: 0x0BFF0000
 Exit: …


