This assignment consists of two questions. The first question has multiple parts
ID: 3728044 • Letter: T
Question
This assignment consists of two questions. The first question has multiple parts. Create a single file with your answers to the questions and submit your work using the link on Blackboard. Your answer must be in one of the following formats: .txt, .pdf, .doc 1. Use the following program for this question. .data .half 7, 3 num: .word 9 .glob .text main: main lui sto, 0x1001 top: lw St1, -4 ($t0) beq $s0, $s2, end jal func add $s0, s1, $t0 andi $80, $0, 0xFFFF top bne $s0, $0, top end: func: s11 Svo, $t1, 4 jr 2 Sra a. There are 5 labels in this code. If the .data section starts at 0x 10010000 and the .text starts at 0x00400400, what is the value of each label? Include all labels from the program. 2.5 pointsExplanation / Answer
1) Use the program to answer
a) The above program has five labels :- num,main,top,end and func
Values of label:-
num=0x10010004
main=0x00400400
top=0x00400404
end=0x00400420
func=0x00400420
explanation: labels always replaced with the memory address .
----------------------------------------------------------------------------------------------------------------------
b) Addressing modes:-
lui $t0,0x1001 --> Immediate addressing mode.
lw $t1,-4($t0) --> Base addressing mode
beq $s0,$s2,end --> PC relative addressing mode
jal func --> pseudo direct addressing mode
add $s0,$s1,$t0 --> Register addressing mode
andi $s0,$0,0xFFFF -- >Immediate adressing model
j top --> pseudo direct addressing mode
bne $s0,$0,top--> PC relative addressing mode
sll 4v0,$t1,4 --> Immediate adressing model
jr $ra --> Register direct addressing mode
----------------------------------------------------------------------------------------------------------
c) machine code in hex
lui $t0,0x1001 --> 0x3c081001
lw $t1,-4($t0) --> 0x8d09fffc
beq $s0,$s2,end --> 0x12120005
jal func --> 0x0c100008
add $s0,$s1,$t0 --> 0x02288020
andi $s0,$0,0xFFFF -- >0x3010ffff
j top --> 0x081000001
bne $s0,$0,top--> 0x1600fff9
sll 4v0,$t1,4 --> 0x00091100
jr $ra --> 0x03e00008
----------------------------------------------------------------------------------------------------------
2) Decode the given code
addi $t1,$0,14
and $t2,$0,$0
add $t2,$t2,$t1
sll $t1,$t1,2
bne $t1,$0,label
lui $t0,0x1001
sw $t1,0($t0)
label:
Explanation:-
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.