Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

below is the minmax.asm , In which, you can treat the array as a fixed sequence of numbers (signed). This could include a 0. Question

image text in transcribedbelow is the minmax.asm , In which, you can treat the array as a fixed sequence of numbers (signed). This could include a 0.

image text in transcribed

Question 2: Minimum and maximum value (30 marks) 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 minmax.asm file to work with. * This program illustrates the exercise of finding the maximum and minimum values in an array. # The array in this example has hardcoded initial values. # The subroutine 'minmax' should return the minimum and maximum values # in the array, using appropriate registers. # The 'main' program should test the subroutine and should print the results using syscalls for printing. # Feel free to add additional entries as you need them in the text or .data segments. # Make sure that your 'main' program terminates gracefully. # Be sure to comment your code. Use proper register conventions ! .data # An array, with hard-coded values, to use for testing array1: .word 23, 45, -2, 4, 6, 42, 7, 35, 10, 2, -332, 101, 2, 3, 110, -1 size: 16 .text .globl main main: jal minmax minmax: Question 2: Minimum and maximum value (30 marks) 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 minmax.asm file to work with. * This program illustrates the exercise of finding the maximum and minimum values in an array. # The array in this example has hardcoded initial values. # The subroutine 'minmax' should return the minimum and maximum values # in the array, using appropriate registers. # The 'main' program should test the subroutine and should print the results using syscalls for printing. # Feel free to add additional entries as you need them in the text or .data segments. # Make sure that your 'main' program terminates gracefully. # Be sure to comment your code. Use proper register conventions ! .data # An array, with hard-coded values, to use for testing array1: .word 23, 45, -2, 4, 6, 42, 7, 35, 10, 2, -332, 101, 2, 3, 110, -1 size: 16 .text .globl main main: jal minmax minmax

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions