Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Convert the following code into MIPS Assembly language: # You write code here to implement the following C code. # This will find the MIN

Convert the following code into MIPS Assembly language:

# You write code here to implement the following C code. # This will find the MIN ($s6) and MAX ($s7) # in the array from A[0] through A[i]. # Note that you need to use lw to load A[j]. # while (j<=i) # { # if A[j]MAX # MAX=A[j]; # j=j+1; # }

***************************************************************************************

THIS CODE IS ALREADY GIVEN SO PLEASE USE IT!!!!:

.data baseadd: .word 34, 5, 11, -12, 60, -2, 14, 71, 13, -27

string1: .asciiz "Index i [0~9]: " string2: .asciiz " MIN=" string3: .asciiz " MAX="

.text main: # Input i to $s1 addi $v0, $zero, 4 # code for printing string is 4 la $a0, string1 # load address of string to be printed into $a0 syscall # call operating system addi $v0, $zero, 5 # code for reading integer is 5 syscall # call operating system add $s1, $v0, $zero # i in $s1 #baseadd of the array to $s5 la $s5, baseadd #Load A[0] to initialize MIN ($s6) and MAX ($s7) lw $s6, ($s5) lw $s7, ($s5) # initialize j=0 (j in $t1) add $t1, $zero, $zero

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

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

=+Are the contracts enforceable?

Answered: 1 week ago