Write in MIPS Assembly language a well-documented program consisting of the two following functions. ● Write a function that accepts two parameters of type half in $a0 and $a1 registers and returns in $a3 register the value calculated as shown below. (16* $a0 - 8 * $a1 if $a0 == $a1 $a3 = $a0* $a1 if $a0 != $a1 Write a function with a minimum number of instructions that: 1) defines four variables p1 and p2 of type half and initializes them with any values; 2) calls the above-defined function and prints three values: p1, p2 and the returned value separated by tabs.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section: Chapter Questions
Problem 7PP: (Numerical) Heron’s formula for the area, A, of a triangle with sides of length a, b, and c is...
icon
Related questions
Question
Write in MIPS Assembly language a well-documented program consisting of the two
following functions.
●
Write a function that accepts two parameters of type half in $a0 and $a1 registers and returns
in $a3 register the value calculated as shown below.
(16 * $a0 − 8 * $a1 if $a0
== $a1
$a3 =
$a0* $a1
if $a0 != $a1
Write a function with a minimum number of instructions that:
1) defines four variables p1 and p2 of type half and initializes them with any
values;
2) calls the above-defined function and prints three values: p1, p2 and the returned
value separated by tabs.
3) To ensure the correctness of your program, run it twice:
a) When p1 and p2 are equal
b) When p1 and p2 are NOT equal
Transcribed Image Text:Write in MIPS Assembly language a well-documented program consisting of the two following functions. ● Write a function that accepts two parameters of type half in $a0 and $a1 registers and returns in $a3 register the value calculated as shown below. (16 * $a0 − 8 * $a1 if $a0 == $a1 $a3 = $a0* $a1 if $a0 != $a1 Write a function with a minimum number of instructions that: 1) defines four variables p1 and p2 of type half and initializes them with any values; 2) calls the above-defined function and prints three values: p1, p2 and the returned value separated by tabs. 3) To ensure the correctness of your program, run it twice: a) When p1 and p2 are equal b) When p1 and p2 are NOT equal
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Returning value from Function
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning