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.
-
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started