Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement a MIPS assembly language program that defines main , readArray and sea

ID: 3744200 • Letter: I

Question

Implement a MIPS assembly language program that defines main, readArray and searchElement procedures.
The readArray takes an array of integers as its parameter, reads in integers from a user to fill the array and also print each value as long as it is with the number of elements specified by the parameter "howMany" and "length".
The searchElement procedure takes parameters of an array of integers, and its length, and asks a user how many integers to read in and calls the readArray procedure. It also asks a user to enter an integer to search. Then it should go through the array to see if each number is same as the integer to search. If an element in the array is the same as the integer to search, double its content, by multiplying it by 2, and set the variable found to 1 so that it can print out a message to say whether it was found or not. Then it prints out the updated content of the array.
The main procedure asks a user how many times to call the searchElement procedure, and it repeats it based on the entered number.

The following shows how it looks like in a C program:

This is all the information we're given.. Can you be more specific of what more information you think I'm missing?

Explanation / Answer

The main procedure asks a user how many times to call the searchElement procedure, and it repeats it based on the entered number.thus the answer for this is

MIPS code:

$LFBO = .

main:

addiu $sp,$sp,-32

sw $fp,28($sp)

move $fp,$sp

lw $3,8($fp)

lw $2,12($fp)

nop

subu $3,$3,$2

Ii $2,-2147483648 #

Oxffffffff80000000

on $2,$2,0x3

and $2,$3,$2

bgez $2,$L2

nop

addiu $2,$2,-1

Ii $3,-4 # Oxfffffffffffffffc

or $2,$2,$3

addiu $2,$2,1

sw $2,16($fp)

move $2,$0

move $sp,$fp

lw $fp,28($sp)

addiu $sp,$sp,32

j $31

nop

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote