Lab 3: Loops and functions Solution

$30.00 $24.00

Purpose Learn to develop assembly language programs using loops and function calls What to Hand In Completed Sum2.asm, PosRun.asm, Fib.asm Modify the MIPS program Sum.asm from Lab#2 to have a function perform the addition operation: int add2 (int num1, int num2). (Don’t have to use the stack for this problem) The file posrun.cpp contains a…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

Purpose

Learn to develop assembly language programs using loops and function calls

What to Hand In

Completed Sum2.asm, PosRun.asm, Fib.asm

  1. Modify the MIPS program Sum.asm from Lab#2 to have a function perform the addition operation: int add2 (int num1, int num2). (Don’t have to use the stack for this problem)

  1. The file posrun.cpp contains a simple C++ function that finds the length of the longest consecutive run of positive values in an array, convert the C++ program to a MIPS assembly program.

  1. Write a MIPS program with a recursive function that calculates the Fibonacci sequence. Your program should prompt the user for the starting sequence number. The high-level C code for the sequence is:

int fib (int n)

{

if(n == 0) {

return 1;

}

if (n == 1) {

return 1;

}

return (fib(n – 1) + fib(n – 2));

}

Lab 3: Loops and functions Solution
$30.00 $24.00