The purpose of this lab is to introduce you to the layout and structure of the M
ID: 3848003 • Letter: T
Question
The purpose of this lab is to introduce you to the layout and structure of the Mars IDE development tool in addition to Decision and Loop statements. In this lab, the MIPS Assembly language is used.
Procedure:
The code:
# ----------------------------Lab 2-------------------------------------
#-----------------------Decision and Loop---------------------------
#-------------------------By: ---------------------------
#--------------------------- ------------------------------
li $s6,268500992
li $s3,3
li $s5,10
li $t0,10
sw $t0, 0($s6)
sw $t0, 4($s6)
sw $t0, 8($s6)
sw $t0, 12($s6)
sw $t0, 16($s6)
sw $t0, 20($s6)
sw $t0, 24($s6)
sw $t0, 28($s6)
li $t0,2
sw $t0, 32($s6)
loop: sll $t1,$s3,2
add $t1,$t1,$s6
lw $t0,0($t1)
bne $t0,$s5,exit
addi $s3,$s3,1
j loop
exit:
Questions:
Draw the memory and its contents starting from address 268500992.
What does the final value of $s3 represent?
After understanding the provided program, write your own program using loops to find how many times the same number (10) is stored in the memory
Explanation / Answer
2)
# ----------------------------Lab 2-------------------------------------
#-----------------------Decision and Loop---------------------------
#-------------------------By: ---------------------------
#--------------------------- ------------------------------
li $s6,268500992
li $s3,3
li $s5,10
li $t0,10
sw $t0, 0($s6)
sw $t0, 4($s6)
sw $t0, 8($s6)
sw $t0, 12($s6)
sw $t0, 16($s6)
sw $t0, 20($s6)
sw $t0, 24($s6)
sw $t0, 28($s6)
li $t0,2
sw $t0, 32($s6)
loop: sll $t1,$s3,2
add $t1,$t1,$s6
lw $t0,0($t1)
bne $t0,$s5,exit
addi $s3,$s3,1
j loop
exit:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.