Assign the register numbers for all the variables. You are encouraged to refer the MIPS assembly registers. (2) Select appropriate assembly instructions for arithmetic operations and if/else statements. (3) Once you have the assembly instructions for arithmetic operations and if/else statement, pair up these instructions with beq/bne and j instructions. If the condition has equality comparison, you may need to slt instruction. Using slt instruction, you can set a temporary value (t) to 1 and branch to the next instruction with beq/bne instruction. (4) Finally, add the comments for each instruction line to clarify. Assume the integer variables g and h are in registers $s2 and $s3, respectively. if (g > h) g = g + h; else g = g – h; if (g >= h) g = g + 1; else h = h – 1; if (g <= h) g = 0; else h = 0;

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter4: Processor Technology And Architecture
Section: Chapter Questions
Problem 15VE: A(n) ________________ instruction always alters the instruction execution sequence. A(n)...
icon
Related questions
Question
100%

Assign the register numbers for all the variables. You are encouraged to refer the MIPS assembly registers. (2) Select appropriate assembly instructions for arithmetic operations and if/else statements. (3) Once you have the assembly instructions for arithmetic operations and if/else statement, pair up these instructions with beq/bne and j instructions. If the condition has equality comparison, you may need to slt instruction. Using slt instruction, you can set a temporary value (t) to 1 and branch to the next instruction with beq/bne instruction. (4) Finally, add the comments for each instruction line to clarify.

Assume the integer variables g and h are in registers $s2 and $s3, respectively.

  1. if (g > h)
                   g = g + h;
    else
                   g = g – h;
  1. if (g >= h)
                   g = g + 1;
    else
                   h = h – 1;
  2. if (g <= h)
                   g = 0;
    else
                   h = 0;
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Assume the integer variables g and h are in registers $s2 and $s3, respectively.

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Fundamentals of Computer System
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Principles of Information Systems (MindTap Course…
Principles of Information Systems (MindTap Course…
Computer Science
ISBN:
9781285867168
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning