a) Fill in the blanks. .data A: .word 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 i: .word 7 B: .word 40 45 50 55 60 65 k: .word 1 m: .word 5 # how many f: .word 15 #size of A g: .word 6 #size of B .text .globl main main:  # load registers for array A la $s0, A # load address of A lw $s2, i # load word i into s2 # load registers for array B la $s1, B # load address of B lw $s3, k # load word k into s3 #how many to overwrite lw $s4, m # load word g (how many) into s4 # initialize registers to get A[i] sll $s6, $s2, 2 add $s6, $s6, ____ # address of A[i] (new base) # initialize registers to get B[k] sll $s7, $s3, 2 add $s7, $s7, ____ # address of B (new base) #what is the A index to stop? Let's put it into s5 ______________________________ #Loop through A and B Loop: # use slt to compare $s5 and $s2, place the result in t0 ___________________________ beq $t0, $zero, end   # load A[i] and store into B[k] lw $t0, 0($s6) sw $t0, 0($s7) #update of the indices addi $s3, $s3, ____ addi $s2, $s2, ____ #update the address addi $s7, $s7, ____ addi $s6, $s6, ____ j Loop end: ori $v0, $zero, 10 #exit syscall  b)  What would have happened if m=6? What would have happened if m=10? What kind of tests should be performed in the loop to address the cases such as m=6 and m=10? Describe in words.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

a)
Fill in the blanks.
.data

A: .word 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
i: .word 7
B: .word 40 45 50 55 60 65
k: .word 1
m: .word 5 # how many
f: .word 15 #size of A
g: .word 6 #size of B

.text
.globl main

main: 
# load registers for array A

la $s0, A # load address of A
lw $s2, i # load word i into s2

# load registers for array B
la $s1, B # load address of B
lw $s3, k # load word k into s3

#how many to overwrite
lw $s4, m # load word g (how many) into s4

# initialize registers to get A[i]
sll $s6, $s2, 2
add $s6, $s6, ____ # address of A[i] (new base)

# initialize registers to get B[k]
sll $s7, $s3, 2
add $s7, $s7, ____ # address of B (new base)

#what is the A index to stop? Let's put it into s5
______________________________

#Loop through A and B

Loop:
# use slt to compare $s5 and $s2, place the result in t0
___________________________
beq $t0, $zero, end  


# load A[i] and store into B[k]
lw $t0, 0($s6)
sw $t0, 0($s7)
#update of the indices
addi $s3, $s3, ____
addi $s2, $s2, ____
#update the address
addi $s7, $s7, ____
addi $s6, $s6, ____
j Loop

end:
ori $v0, $zero, 10 #exit
syscall 

b) 
What would have happened if m=6?
What would have happened if m=10?
What kind of tests should be performed in the loop to address the cases such as m=6 and m=10?
Describe in words. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education