Consider the following assembly language program: add $5, $0, $0 lw $1, 40($6) /
ID: 3784047 • Letter: C
Question
Consider the following assembly language program:
add $5, $0, $0
lw $1, 40($6) /* assume Mem[40 + R[$6] == 5 */
loop: addi $1, $1, -1
add $5, $5, $1
add $6, $5, $0
sw $1, 20($6)
bne $1, $0, <loop>
nop
nop
A) Assume that the code is executed in a non pipelined CPU, with each instruction taking 5 clock cycles. What is the total execution time in clock cycles?
B) Assume that the code is executed in our 5 stage pipeline with no forwarding. You will have to stall or insert nops to resolve dependencies. What is the total execution time in clock cycles?
C) Assume that the code is executed in our 5 stage pipeline with forwarding. What is the total execution time in clock cycles?
Explanation / Answer
The procedure to calculate the execution time (ET) for a piece of AVR assembly code containing single loops require a bit more. You still will need the following information:
Once you have the above information follow the steps below to calculate the execution time:
Steps to calculate ET
Period (T) = 1/Frequency(f)
ET = T * C
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.