2. Answer the following questions. (S0 is always zero; i.e., it cannot be writte
ID: 3880312 • Letter: 2
Question
2. Answer the following questions. (S0 is always zero; i.e., it cannot be written.) (a) After executing "add S5, S5, S6", what is S5? (b) What is the content of [100]? (c) After executing "lw $1, 100(so)", what is S1? (d) After executing the following, what is [100]? Register Register ddress content 1 104 lw S1, 100(S0) lw S2, 104(S0) add S3, S1, S2 sw S3, 100 (S0) (4 bytes or 32 bits) Memory ddress Memory content (e) What is the instruction that reads the memory content at address 104 and stores to $5? 100 104 1100 25 (4 bytes or 32 bits)Explanation / Answer
a) On executing "add $5,$5,$6"the contents of the register address 6 are added to register address 5 and stored in $5 , hence the value of $5 will be now 204.
b) The memory content of the memory address [100] is 1100.
c) On executing "lw $1, 100($0) " the word from the memory [100] is loaded into the register $1 , since the value of memory [100] is 1100 it is loaded into $1 and the value at the register $1 will be 1100.
d) The execution of the given code is explained by comments below.
lw $1, 100($0) # the value of memory 100 is loaded into $1 , it becomes 1100
lw $2, 104($0) # the value of memory 104 is loaded into $2 , it becomes 25
add $3,$1,$2 # the values of register $1 and $2 are added stored in $3 , hence $3 has value 1125
sw $3, 100($0) # Memory[$0 + 100] = $3 =1125
Hence the value after execution of above code is 1125
e) The instruction which reads the memory content at address 104 and stores it in $5 is given by ,
lw $5,104($0)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.