Question: (b) Consider the following MIPS assembly code and the register assignment table: 1 2 3 4 5 6 li $4,1 li $3,15 li $2,1 li

 (b) Consider the following MIPS assembly code and the register assignment

(b) Consider the following MIPS assembly code and the register assignment table: 1 2 3 4 5 6 li $4,1 li $3,15 li $2,1 li $1,5 label: bgt $2,$1, exit sub $3,$3,$2 mul $4,$4,$3 addi $2,$2,1 7 8 9 10 j label exit: MIPS Register Java Variable $1 $2 y $3 Z $4 w (1) Describe the above MIPS code by adding brief comments on each line. [3 marks) (ii) Convert the above MIPS code into equivalent Java code. [3 marks] (iii) Write equivalent MIPS code by replacing only the bgt instruction line 5) with a different branch instruction from the table below. [3 marks] 6 Instruction Example Comments Branch on Greater Than bgt Rsrci, Src2, label Conditionally branch to the instruction at the label if the contents of register Rsrc1 are greater than Src2. Branch on Greater Than Equal bge Rsrci, Src2, label Conditionally branch to the instruction at the label if the contents of register Rsrce are greater than or equal to Src2. Branch on Less Than Branch on Less Than Equal blt Rsrci, Src2, label Conditionally branch to the instruction at the label if the contents of register Rsrc1 are less than Src2. ble Rsrci, Src2, label Conditionally branch to the instruction at the label if the contents of register Rsrc1 are less than or equal to Src2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!