This assignment consists of two questions. The first question has multiple parts
ID: 3672352 • Letter: T
Question
This assignment consists of two questions. The first question has multiple parts.
1. Use the following program for this question.
a. If the .data section starts at 0x10010000 and the .text starts at 0x00400010, what is the value of each label? Include all labels from the program.
b. What is the addressing mode for each instruction? There are 10 unique instructions.
c. Assemble the program and give the machine code in hex.
2. The following is a MIPS program in machine code. Decode this code, converting it to the equivalent assembly language program. Your solution should have one label. Be sure to put it at the correct location.
.data num: .word 7, .globl .text 3 main . tex main: lui St0, 0x1001 top: beq $s0, $0, end jal func add Ss0, Ss0, sto addi Ss0, $s0, 1 top bne $s0, s0, top end: func: SraExplanation / Answer
Answer 1
top:
lw $t1, 0($t0) #Pull $a0
beq $s0,$0, end # if LF stop reading and go to sorting
jal func #call function
addi $s0, $s0 ,$to #move the next element
addi $s0, $s0,-1 # decrement the counter
j top # jump to top function
bne $s0, $0, top #if $t1 <> 0 go to Ordinary
end:
func:
sll $v0, $t1 ,4 # set the $v0-th bit in $t1 to 4, one element set - {$v0}
jr $ra # return
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.