4. Assume that perfect branch prediction is used that there are no delay slots,
ID: 3806867 • Letter: 4
Question
4. Assume that perfect branch prediction is used that there are no delay slots, and that the pipeline has full forwarding support. Also assume that many instructions of this loop are executed before the loop exits. For the given code below, show a pipeline execution diagram for the third iteration of this loop, from the cycle in which we fetch the first instruction of that iteration up to (but not including) the cycle in which we can fetch the first instruction of the next iteration.
Loop:
ADD R1, R2, R1
LW R2, 0 (R1)
LW R2, 16 (R2)
SLT R1, R2, R4
BEQ R1, R9, Loop
Explanation / Answer
Ans:: pipeline execution diagram::
egin{table}[hp]
caption{Third Iteration}label{tab:iteration}
egin{center}
egin{tabular}{cccccccccccccc}
oprule
extbf{Iter} & extbf{1} & extbf{2} & extbf{3} & extbf{4} & extbf{5}
& extbf{6} & extbf{7} & extbf{8} & extbf{9} & extbf{10} & extbf{11}
& extbf{12} & extbf{13} \
midrule
lw3 & WB \
beq & ID & EX & MEM & WB \
lw1 & IF & ID & EX & MEM & WB \
and & & & IF & ID & EX & MEM & WB \
lw2 & & & & IF & ID & EX & MEM & WB \
lw3 & & & & & & IF & ID & EX & MEM & WB \
beq & & & & & & & & & IF & ID & EX & MEM & WB \
lw1 & & & & & & & & & & IF & ID & EX & MEM \
and & & & & & & & & & & & & IF & ID \
lw2 & & & & & & & & & & & & & IF \
ottomrule
end{tabular}
end{center}
end{table}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.