Zookal
Zookal

We’d love to hear any feedback or comment from you!

© 2011-2021 Zookal Pty Ltd

View question and answer

From our collection of questions and answers
Engineering · Computer Science
Question details

# Procedure: sumarray # This procedure will surn the values in an array and return the sum of all of the numebrs added together. # Parameters: a0 This is a pointer to the start of the array that is to be printed Şal This is the number of numbers that are to be read in # Return Value: $v0 This will be the sum of all of the numbers sumArray: # start the prologue by moving the stack around and adding to the stack frame. addi Şsp, $sp,-64 sw Sra, 48 (Ssp) sw $SO, 44 (Şsp) sw şs1, 40 (Ssp) sw $s2, 36 (Şsp) sw $S3, 32 (Şsp) sw $S4, 28 (Şsp) sw $S5, 24 (Şsp) sw $s6, 20 (Ssp) sw $s7, 16 (Şsp) sw a0, 12 (Şsp) sw $a2, 4 ($sp)s umArrayLoop: # Exit the loop If there are no more numbers to be summed based on the value in $a1 # Load $t0 with the number that is to be summed. # Add the value into the sum # Move the address by 4 bytes (1 word) # Decrease the count of remaining items to be summed by 1 j sumArrayLoop

ends umArray: # Restore the stack to its initial status lw Şra, 48 (Şsp) lw SSO, 44 (Şsp) lw $sl, 40 (Şsp) lw $S2, 36 (Şsp) lw $S3, 32 (Şsp) lw $S4, 28 (Şsp) lw $S5, 24 (Şsp) lw $s6, 20 (Şsp) lw $s7, 16 (Şsp) lw $a2, 4 (Şsp) lw $a3, 0 (Şsp) addi $sp, $sp, 64 Sra # Return from the procedure

For this assignment, you are to complete the implementation of a function which sums an array of numbers and returns the sum back to the user. The function is to be called from a main program.

MIPS

comments in green is the "to-do"

Answer
Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.

Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.