Question: Write a MIPS subroutine, minmax', that has two input arguments: a pointer to a 1D array (i.e., the address of its first element), and the

 Write a MIPS subroutine, minmax', that has two input arguments: a

pointer to a 1D array (i.e., the address of its first element),

Write a MIPS subroutine, minmax', that has two input arguments: a pointer to a 1D array (i.e., the address of its first element), and the length of the array. Each element of the array is a 32 bit word representing a signed integer. The subroutine should traverse the array and should return the value of both the largest and the smallest numbers in the array. Include a main' procedure to test this subroutine. For this, you can create an array of a fixed length, and initialize it as you wish, using hard-coded values. Print the minimum and maximum values using the appropriate syscalls. You are given a template minmaz. asm file to work with. TIPS1.asi 1 # This program illustrates the exercise of finding the maximum and minimum values in an array. 2 # The array in this example has hardcoded initial values. 3 # The subroutine 'minmax' should return the minimum and maximum values 4 # in the array, using appropriate registers. 5 # The 'main' program should test the subroutine and should print the results using syscalls for printing. 6 # Feel free to add additional entries as you need them in the text or .data segments. 7 # Make sure that your 'main' program terminates gracefully. 8 # Be sure to comment your code. Use proper register conventions! 10 .data 11 12 13 14 # An array, with hard-coded values, to use for testing arrayl: .word 23, 45, -2, 4, 6, 42, 7, 35, 10, 2, -332, 101, 2, 3, 110, -1 size: .word 16 .text .globl main 20 main: 21 22 jal minmax 23 24 minmax: Line: 24 Column: 8 Show Line Numbers Write a MIPS subroutine, minmax', that has two input arguments: a pointer to a 1D array (i.e., the address of its first element), and the length of the array. Each element of the array is a 32 bit word representing a signed integer. The subroutine should traverse the array and should return the value of both the largest and the smallest numbers in the array. Include a main' procedure to test this subroutine. For this, you can create an array of a fixed length, and initialize it as you wish, using hard-coded values. Print the minimum and maximum values using the appropriate syscalls. You are given a template minmaz. asm file to work with. TIPS1.asi 1 # This program illustrates the exercise of finding the maximum and minimum values in an array. 2 # The array in this example has hardcoded initial values. 3 # The subroutine 'minmax' should return the minimum and maximum values 4 # in the array, using appropriate registers. 5 # The 'main' program should test the subroutine and should print the results using syscalls for printing. 6 # Feel free to add additional entries as you need them in the text or .data segments. 7 # Make sure that your 'main' program terminates gracefully. 8 # Be sure to comment your code. Use proper register conventions! 10 .data 11 12 13 14 # An array, with hard-coded values, to use for testing arrayl: .word 23, 45, -2, 4, 6, 42, 7, 35, 10, 2, -332, 101, 2, 3, 110, -1 size: .word 16 .text .globl main 20 main: 21 22 jal minmax 23 24 minmax: Line: 24 Column: 8 Show Line Numbers

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!