For this problem you will consider the following assembly fragment: data word X
ID: 2085111 • Letter: F
Question
For this problem you will consider the following assembly fragment: data word X word 0 times 0 text start li $t0, 0 times 0 li $t1, 0 times 2 li $t2, X li $t5, 0 times F loop: and $t4, $t1, $t0 beq $t4, $t0, skip addi $t0, $t0, 0 times 1 # (branch delay slot) lw $t3, 0($t2) addi $t3, $t3, 0 times 3 sw $t3, 0($t2) Skip: bne $t0, $t5, loop noop #(branch delay slot) (A) What is the final value stored in X? (B) How many times does line #11 execute? Line #13? (C) On the code above mark the true (read-after-write) dependencies between instructions.Explanation / Answer
Answer-A:- Final value stored in X is 0x0 since X never has been changed.
Answer-B:- Line #11 is never executed because the "loop" and "skip" labels are calling each other with condition that is always true. i.e after bit-wise and operation $t4 has value zero, and that is compared with register $0 which has value always zero. Similarly at line 13, $t0 has value 0x0 and $t5 has value 0xF and they are never equal so here condition is again true.
Line #13 is executing infinitely, with line #7 and line #8.
Answer-C:- Data dependancy means, an instruction is using a data modified or changed by other preceding instruction. Here in given code following lines are data dependent-
line:- 7, 8, 9, 10, 11, 12, and 13 as these lines are using previously changed or updated data.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.