Convert the following MIPS instructions into Machine Code in

Convert the following MIPS instructions into Machine Code instructions. Assume the first instruction starts at memory address 20000

slt $t1, $s1, $s0

beq $s1, $s2, L1

beq $t1, $zer0, L2

j Exit

L1: add $s1, $s1, $s1

j Exit

L2: addi $s1, $s1, 1

Exit:

Solution

Line 1: 0x00020000 [slt $t1 $s1 $s0 => R(op:0(slt) rs:17(s1) rt:16(s0) rd:9(t1) sh:0 func:42)]
Line 2: 0x00020004 [beq $s1 $s2 L1 => I(op:4(beq) rs:17(s1) rt:18(s2) immed:0x00000002)]
Line 3: 0x00020008 [beq $t1 $zer0 L2 => I(op:4(beq) rs:9(t1) rt:zer0(zer0) immed:0x00000003)]
Line 4: 0x0002000c [j Exit => JFormat(op:2(j) target:0x0000001c >> 2 = 0x00000007)]
Line 5: 0x00020010 [L1: add $s1 $s1 $s1 => R(op:0(add) rs:17(s1) rt:17(s1) rd:17(s1) sh:0 func:32)]
Line 6: 0x00020014 [j Exit => JFormat(op:2(j) target:0x0000001c >> 2 = 0x00000007)]
Line 7: 0x00020018 [L2: addi $s1 $s1 1 => I(op:8(addi) rs:17(s1) rt:17(s1) immed:0x00000001)]

Output

Hex           Binary
0230482a       0000 0010 0011 0000 0100 1000 0010 1010
12320002       0001 0010 0011 0010 0000 0000 0000 0010
11200003       0001 0001 0010 0000 0000 0000 0000 0011
08000007       0000 1000 0000 0000 0000 0000 0000 0111
02318820       0000 0010 0011 0001 1000 1000 0010 0000
08000007       0000 1000 0000 0000 0000 0000 0000 0111
22310001       0010 0010 0011 0001 0000 0000 0000 0001

Convert the following MIPS instructions into Machine Code instructions. Assume the first instruction starts at memory address 20000 slt $t1, $s1, $s0 beq $s1, $

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site