Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your assignment is to write a MIPS program that successfully executes on the QtSpim simulator that determines if numbers input by a user are perfect
Your assignment is to write a MIPS program that successfully executes on the QtSpim simulator that determines if numbers input by a user are perfect or prime. Your program should prompt the user, read an integer value, show the sum of the factors of the value that was read, and indicate whether or not the number is perfect. If it is not perfect, then you should also indicate whether or not it is prime. You should continue until a number less than is entered.
You are required to write a separate function to determine if one integer value is a factor of another integer value.
Call this function isafactor. This function will accept two integer arguments, where the first is the larger value received through $ and the second is the potential factor received through $a It returns a value through $
of one if the second value is a factor of the first value, and otherwise returns a value of zero.
You are also required to write a separate function that prints the factors of a integer value, where a separates each preceding factor and the next factor. The factor list should be followed by an and the sum of the factors. Call this function printsumoffactors. It accepts an integer argument through $ and return the sum of the factors of the argument through $
The isafactor, printsumoffactors, and main functions should follow the MIPS calling conventions described in the lecture slides and videos in the module FP Instructions and Functions". Note you should only use a syscall instruction to perform IO and should not use it to exit the program.
Be sure to provide a comment before each block of MIPS assembly code so others can understand your program.
This code must be a new and unique code
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