Skip to content
Official PYQ · 2014

GATE CS 2014 Set 3 Q43 — Instruction Pipelining

Explain with AI
An instruction pipeline has five stages, namely, instruction fetch (IF), instruction decode and register fetch (ID/RF), instruction execution (EX), memory access (MEM), and register writeback (WB) with stage latencies 11 ns, 2.22.2 ns, 22 ns, 11 ns, and 0.750.75 ns, respectively (ns stands for nanoseconds). To gain in terms of frequency, the designers have decided to split the ID/RF stage into three stages (ID, RF1, RF2) each of latency 2.2/32.2/3 ns. Also, the EX stage is split into two stages (EX1, EX2) each of latency 11 ns. The new design has a total of eight pipeline stages. A program has 20%20\% branch instructions which execute in the EX stage and produce the next instruction pointer at the end of the EX stage in the old design and at the end of the EX2 stage in the new design. The IF stage stalls after fetching a branch instruction until the next instruction pointer is computed. All instructions other than the branch instruction have an average CPI of one in both the designs. The execution times of this program on the old and the new design are PP and QQ nanoseconds, respectively. The value of P/QP/Q is __________.
View worked solution

Answer: 1.50 : 1.60

To find the ratio of the execution times P/QP/Q, we first determine the clock cycle times and average CPIs for both pipeline designs.

1. Clock Cycle Times (toldt_{\text{old}} and tnewt_{\text{new}})
  • Old Design: The clock cycle time is determined by the slowest stage latency: told=max⁡(1,2.2,2,1,0.75)=2.2 nst_{\text{old}} = \max(1, 2.2, 2, 1, 0.75) = 2.2 \text{ ns}
  • New Design: The ID/RF stage is split into three stages (each 2.2/3≈0.7332.2/3 \approx 0.733 ns) and the EX stage into two stages (each 11 ns). The clock cycle time is: tnew=max⁡(1,2.23,1,1,1,0.75)=1 nst_{\text{new}} = \max\left(1, \frac{2.2}{3}, 1, 1, 1, 0.75\right) = 1 \text{ ns}
2. Average CPI Calculation
  • For non-branch instructions (80%80\% of the program), average CPI=1\text{CPI} = 1 in both designs.
  • For branch instructions (20%20\% of the program):
    • Old Design: The target address is available at the end of the EX stage (3rd stage: IF, ID/RF, EX). This causes 22 stall cycles, so CPIbranch=1+2=3\text{CPI}_{\text{branch}} = 1 + 2 = 3.
    • New Design: The target address is available at the end of the EX2 stage (6th stage: IF, ID, RF1, RF2, EX1, EX2). This causes 55 stall cycles, so CPIbranch=1+5=6\text{CPI}_{\text{branch}} = 1 + 5 = 6.

Now, we compute the average CPI for both designs:

CPIavg, old=(0.8×1)+(0.2×3)=1.4\text{CPI}_{\text{avg, old}} = (0.8 \times 1) + (0.2 \times 3) = 1.4 CPIavg, new=(0.8×1)+(0.2×6)=2.0\text{CPI}_{\text{avg, new}} = (0.8 \times 1) + (0.2 \times 6) = 2.0 3. Execution Time Ratio (P/QP/Q)

Let NN be the total number of instructions:

P=N×CPIavg, old×told=N×1.4×2.2=3.08NP = N \times \text{CPI}_{\text{avg, old}} \times t_{\text{old}} = N \times 1.4 \times 2.2 = 3.08 N Q=N×CPIavg, new×tnew=N×2.0×1=2.0NQ = N \times \text{CPI}_{\text{avg, new}} \times t_{\text{new}} = N \times 2.0 \times 1 = 2.0 N PQ=3.08N2.0N=1.54\frac{P}{Q} = \frac{3.08 N}{2.0 N} = 1.54

The value 1.541.54 lies within the range of 1.50 : 1.60.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Instruction Pipelining questions