Problem
I. Show the machine code for the branch not equal (bne) instruction in the following program.
# MIPS assembly code
0x40 loop: add $t1, $a0, $s0 0x44 lb $t1, 0($t1) 0x48 add $t2, $a1, $s0 0x4C sb $t1, 0($t2) 0x50 addi $s0, $s0, 1 0x54 bne $t1, $0, loop 0x58 lw $s0, 0($sp)
i. What addressing type does the bne instruction use?
ii. Calculate the immediate field and write the machine code in binary and hex.
II. Convert the following I type instructions from MIPS to Machine code. (base addressing)
i. lw $s0, 12($t0)
III. Convert the following I type instructions from MIPS to Machine code. (immediate addressing).
i. addi $t0, $t1, 25
ii. addi $t0, $t1, 983040