Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started