24 May MIPS Program
Copyright 2018 D.Calliss Arizona State University All rights reserved.
CSE/EEE 230 Assignment 3 Spring 2018 Due February 27 (11:59PM) No late assignments are accepted. Get your work done early. In this assignment, you are to complete a MIPS program so it will perform the required tasks. The main function of the code is provided. You are to complete the program by writing four functions. Pay particular attention to the purpose of each function and how the parameters and stack are to be used. NO pseudo code/extended formats. Turn off the option on MARS under settings that allows the use of these instructions,
1. print $a0 – integer value to print $a1 – address of string to print This function must first print the string and then print the integer. Both outputs must be on the same line. End the output with a newline
2. multiplication $a0 – first integer $a1 – second integer $v0 – first integer * second integer This function is to calculate and return the result of multiplying the first argument by the second argument. Assume that both arguments are greater than zero. You must calculate the result using a loop. Using any version of the mult instruction is NOT ACCEPTABLE.
3. getpos $v0 – positive integer input This function must prompt the user to input a positive integer and then get input from the user. The process of printing a prompt and then reading input must be repeated until a value greater than zero is input. The input value is then returned in $v0. The prompt string will need to be added to the .data segment.
4. getinput $a0 – address to store the first value $a1 – address to store the second value This function will call the getpos function (above) two times. The result of the first call should be stored into memory at the location given in $a0 and the result of the second call should be stored into memory at the location given in $a1. As this function calls another function, the $ra must be stored on the stack at the beginning of the function. Also, the $ra and $sp must be restored at the end of the function.
Copyright 2018 D.Calliss Arizona State University All rights reserved.
General:
Comment the beginning of your programs with your name, class ID, and assignment number.
Comment every instruction.
Comment each function. Describe which registers are used in the function and how they are used.
Submit your file with the complete program. .data num1: .word 0 num2: .word 0 answer: .asciiz “The product is “ # add other strings at this point as needed .text .globl main main: jal getpos # get a positive number for the loop addi $s0, $v0, 0 # save input value repeat: beq $s0, $0, end # while there are more repeats lui $a0, 0x1001 # get address of first word addiu $a1, $a0, 4 # get address of second word jal getinput # call function to get input, store into addresses lui $t0, 0x1001 # get address of first word lw $a0, 0($t0) # get the first value from memory lw $a1, 4($t0) # get the second value from memory jal multiply # multiply the values, result in $v0 addi $a0, $v0, 0 # get value to print from $v0 lui $a1, 0x1001 # get start of data section addi $a1, $a1, 8 # get start of the product output string jal print # print results addi $s0, $s0, -1 # decrement counter j repeat # do it again end: ori $v0, $0, 10 # set command to stop program, syscall # end program
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
About Writedemy
We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.
How It Works
To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Are there Discounts?
All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.
