Question: Learning objectives The goal of this assignment is to continue learning MIPS assembly language. By the end of this assignment, you should be able to:
Learning objectives
The goal of this assignment is to continue learning MIPS assembly language. By the end of this assignment, you should be able to:
1. read a string from standard input 2. write an algorithm in pseudocode 3. translate that pseudocode into assembly 4. implement control structures for branching and looping
Description and Requirements
Write and test a friendly MIPS assembly program that calculates and prints Fibonacci numbers. Specifically, your program should be divided into the following four sections, which must perform several specific tasks.
Section 1: Introduction
-
Print an introduction that includes: your name, a title, and (optionally) a description of the program.
-
Prompt the user to enter their name and read in the string input. (You should reserve 64 bytes in data
memory for this string.)
-
Print a greeting that includes the users name.
Section 2: Get and validate n
Prompt the user to enter a number between 1 and 47 (inclusive); read in the input (well call this n). Check that n is within the range. If not, print an error message and prompt the user again. Repeat until the user enters a valid number.
Section 3: Calculate and print the first n Fibonacci numbers
-
Calculate and print each of the Fibonacci numbers up to and including the nth.
-
The first 9 numbers should be: 0, 1, 1, 2, 3, 5, 8, 13, 21, . . . (Note that you should start at 0.)
-
Numbers should be printed exactly five per line, with at least four spaces between numbers on a line.
-
Note that you do not need to store the Fibonacci numbers in memory. You may just print them as they
are computed.
Section 4: Conclusion
Print a farewell message that again refers to the users name. Use the exit system call to end your program.
-

-
Example execution Below is the output example that illustrates what your program should do. Your output will not match this output exactly. The important thing is that it must be clear and easy to tell that your program is com- puting and printing the correct values. Program output is in typewriter font while user input is in red, bold, italic font. Fibonacci Numbers by [Your Name] What is your name?: Leonardo Pisano Hi, Leonardo Pisano How many Fibonacci numbers should I display? Enter an integer in the range [1..47]: -7 That number was out of range, try again. How many Fibonacci numbers should I display? Enter an integer in the range [1..47]: 50 That number was out of range, try again. How many Fibonacci numbers should I display? Enter an integer in the range [1..47]: 22 1 8 0 5 55 610 6765 1 2 13 21 144 987 1597 10946 89 3 34 233 377 2584 4181 Goodbye, Leonardo Pisano
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
