Question
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]
***************************************************************************************
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started