Consider a $5$-stage instruction pipeline. The stages and the corresponding stage delays are given below.
$$\begin{array}{|l|l|}\hline \textbf{Instruction}&\textbf{Stage delay}\\\hline \hline \text{Fetch instruction (FI)}&\text{3 ns}\\\hline \hline \text{Decode instruction (DI)}&\text{4 ns}\\\hline \hline \text{Fetch operand (FO)}&\text{7 ns}\\\hline \hline \text{Execute instruction (EI)}&\text{10 ns}\\\hline \hline \text{Write result (WR)}&\text{7 ns}\\\hline \end{array}$$
Assume that there is no delay between two consecutive stages. Consider a processor with a branch prediction mechanism by which it is always able to correctly predict the direction of the branch at the $FI$ stage itself, without executing the branch instruction.A program consisting of a sequence of $10$ instructions $I1, I2, . . . , I10$, is executed in the pipeline, where the $5^{th}$ instruction $(I5)$ is the only branch instruction and its branch target is the $8^{th}$ instruction $(I8)$.
- Draw the pipeline diagram over time showing how the instructions $I1, I2, . . . , I10$ flow through the pipeline stages in this processor.
- Calculate the time $\text{(in ns)}$ needed to execute the program.