Question

Need to write a MIPS assembly program that finds the minimum and maximum and sum of...

Need to write a MIPS assembly program that finds the minimum and maximum and sum of a stored array. It also finds the locations of the minimum and maximum.

The interaction between the main program and the function is solely through the stack. The function stores $ra immediately after being called and restores $ra before returning to main.

The main program reserves a static C like array (index starts from 0) of 10 elements and initializes it. The maximum should be in locations 4 and 5 (same number) and the minimum in location 7. Locations 0, 1, 8, and 9 should contain the same value. Furthermore, the main program stores the base address of the array in $t0 and the array size in $s0 and has to use these registers after calling the function (you do not have to code the register usage).

The function receives the starting address of an array of 32-bit integers and the number of elements in the array from the main program, finds the maximum integer, the minimum integer within the array, and the average value of the elements in the array and returns the maximum, minimum, average, and the locations of the minimum and maximum values in the array to the main program. Further assume that the function uses $t0 as a pointer to array elements. Additionally, the function stores the index used to “navigate”through the array in $s0. Hence, both $t0 and $s0 are changed by the function.

After calling the function, and receiving the results, the main program prints these results to the screen and stops.

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
Need to write a MIPS assembly program that finds the minimum and maximum and sum of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Subroutines in MIPS Determines the minimum of two integers Functions within the MIPS slides describe how...

    Subroutines in MIPS Determines the minimum of two integers Functions within the MIPS slides describe how one can use subroutines (also called procedures, functions, and methods) in MIPS. Because of the importance of subroutines in modern programming, most hardware designers include mechanisms to help programmers. In a high-level language like C or Java, most of the details of subroutine calling are hidden from the programmer. MIPS has special registers to send information to and from a subroutine. The registers $a0,...

  • WRITE THE FOLLOWING CODE IN FLOATING POINT NUMBERS IN ASSEMBLY LANGUAGE USING MIPS IN MARS .data...

    WRITE THE FOLLOWING CODE IN FLOATING POINT NUMBERS IN ASSEMBLY LANGUAGE USING MIPS IN MARS .data prompt: .asciiz "\nMaximum number is : " prompt1: .asciiz "\nMinimum number is : " prompt2: .asciiz "\nRange of the array is : " size: .word 10 #load array array: .word 23, -12, 45, -32, 52, -72, 8, 13,22,876 .text #load address of array and size la $s4,array #load address of A lw $t0,size #load i to t0 jal getArrayRange li $v0, 4    la...

  • Using beq only, not bge! Translate the following C code to MIPS assembly code. Use a...

    Using beq only, not bge! Translate the following C code to MIPS assembly code. Use a minimum number of instructions. Assume that the values of a, b, i, and j are in registers $s0, $s1, $t0, and $t1, respectively. Also, assume that register $s2 holds the base address of the integer array D. Comments are required. for(i=1; i<a; i++) for(j=1; j<b; j++) D[2*j] = i + j;

  • Q-1: Write a program in Assembly language using MIPS instruction set that reads 15 integer numbers...

    Q-1: Write a program in Assembly language using MIPS instruction set that reads 15 integer numbers from user and stores all the numbers in the array intArray. Now, read another integer number N from the user, find the total number of array elements that are greater or equal to the number N, and the total number of array elements that are lower than the number N You must have two procedures: i. ReadIntegerArray: this procedure should read integer array elements...

  • Need to implement an IterativeMax function in assembly language using the MIPS calling convention. IterativeMax take...

    Need to implement an IterativeMax function in assembly language using the MIPS calling convention. IterativeMax take two arguments: The address of an array of word-long (four byte) signed integers, held in $a0. The length of the array as an unsigned integer, held in $a1. The main purpose of the function is to determine which element of the provided array is the largest (i.e., the maximum element in the array). This is achieved by going through the array one element at...

  • MIPS CODE required to write an assembly program to find the maximum of an array of integers by...

    required to write an assembly program to find the maximum of anarray of integers by doing the following:1. Prompt user to input array size n (n <= 10)2. Prompt user to input element values of array A one by one3. Display the result on the console.This program must at least include one function. The main program will read the valuesof the array (as user inputs the element values) and stores them in the memory (datasegments section) and at the end...

  • # ECE 445 Computer Organization # Homework 3, problem 9 # Write a MIPS assembly language...

    # ECE 445 Computer Organization # Homework 3, problem 9 # Write a MIPS assembly language program to count the number of positive values in an array of integers. # The array of integers and the array length are provided in the .data section below. # After running your code, the variable count (in memory) should contain the number of positive values in the array Insert your name here > Insert the date here > # Author: # Date: .text...

  • How can I convert the following C code to MIPS Assembly? +++++++++++++++++++++++++++++++++ MIPS main program ++++++++++++++++++++++++++++++++...

    How can I convert the following C code to MIPS Assembly? +++++++++++++++++++++++++++++++++ MIPS main program ++++++++++++++++++++++++++++++++ .data # Defines variable section of an assembly routine. array: .word x, x, x, x, x, x, x, x, x, x # Define a variable named array as a word (integer) array # with 10 unsorted integer numbers of your own. # After your program has run, the integers in this array # should be sorted. .text # Defines the start of the code...

  • using Mips assembly to work on Mars simulator write a program that outputs the maximum and...

    using Mips assembly to work on Mars simulator write a program that outputs the maximum and minimum values of an entered array

  • im trying to complete mips program code about a calculator program that can calculate integer addition...

    im trying to complete mips program code about a calculator program that can calculate integer addition / subtraction written using the MIPS assembler. im having hard times to debug this. The input is given to the array of Formula char (base address $ s0) in the form of a formula. The null character (\ 0, ASCII code 0) is placed at the end. The calculation result is given to the register $ s1 and the overflow is ignored. For example,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT