Question: Write the close 1 0 ( int a , int b ) function from CodingBat in MIPS assembly. This problem focuses on writing assembly code

Write the close10(int a, int b) function from CodingBat in MIPS assembly.
This problem focuses on writing assembly code with branches. In order for your solution to be graded, it must work with my MUnit tests. Follow these rules:
Give your procedures the exact names indicated here.
Your procedures must be declared .globl.
The method parameters will be placed in registers a0, a1, and a2.
The method return value must be placed in register v0.
Any method must end with the instruction jr $ra.
Use the literal value 1 for true and 0 for false.
The Help menu in MARS has a list of instructions, or you may find it helpful to find a set on Google, such as this MIPS instruction reference.
You may use this class, as a starting point for your MUnit tests. this class is down below import org.junit.*; import static edu.gvsu.mipsunit.munit.MUnit.Register.*; import static edu.gvsu.mipsunit.munit.MUnit.*; public class Close10Test {/******************************************************************** Test close10******************************************************************/ @Test public void close10_aClosest(){ run("close10",8,13); Assert.assertEquals(8, get(v0)); }// Write more tests! }// end class
branches-close10.asm ??

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 Programming Questions!