Skip to content
Official PYQ · 2015

GATE CS 2015 Set 3 Q51 — Instruction Pipelining

Explain with AI
Consider the following reservation table for a pipeline having three stages S1,S2 and S3S_1, S_2 \text{ and } S_3.
Time→12345S_1XXS_2XXS_3X\begin{array}{|l|l|} \hline \textbf{Time} \rightarrow \\ \hline & \text{1}& \text{2} & \text{$3$} & \text{$4$} & \text{$5$} \\ \hline \textbf{$S \_1$} & \text{$X$} & & & & \text{$X$}\\ \hline \textbf{$S \_2$} & & \text{$X$} & & \text{$X$}\\ \hline \textbf{$S \_3$} & & & \text{$X$} & \\ \hline \end{array}
The minimum average latency (MAL) is ______
View worked solution

Answer: 3

To find the Minimum Average Latency (MAL), we first determine the forbidden latencies and construct the state transition diagram.

Step 1: Find the Forbidden Latencies
Forbidden latencies are the time differences between any two mark points (XX) in the same row of the reservation table:

  • For stage S1S_1: Mark points at times 11 and 55. Forbidden latency = ∣5−1∣=4|5 - 1| = 4.
  • For stage S2S_2: Mark points at times 22 and 44. Forbidden latency = ∣4−2∣=2|4 - 2| = 2.
  • For stage S3S_3: Only one mark point at time 33. No forbidden latency.
Thus, the set of forbidden latencies is F={2,4}F = \{2, 4\}.

Step 2: Determine the Collision Vector
The collision vector is C=(c4c3c2c1)=(1010)2C = (c_4 c_3 c_2 c_1) = (1010)_2, where ci=1c_i = 1 if i∈Fi \in F, and ci=0c_i = 0 otherwise.

Step 3: Construct the State Transition Diagram
Starting with the initial state S0=(1010)S_0 = (1010):

  • From S0=(1010)S_0 = (1010):
    • With latency 11: New state = Shift(1010,1)∨(1010)=(0101)∨(1010)=(1111)\text{Shift}(1010, 1) \lor (1010) = (0101) \lor (1010) = (1111).
    • With latency 33: New state = Shift(1010,3)∨(1010)=(0001)∨(1010)=(1011)\text{Shift}(1010, 3) \lor (1010) = (0001) \lor (1010) = (1011).
    • With latency ≥5\ge 5: Transitions back to S0S_0.
  • From state (1111)(1111):
    • No latencies <5< 5 are allowed. With latency ≥5\ge 5, it transitions back to S0S_0.
  • From state (1011)(1011):
    • With latency 33: New state = Shift(1011,3)∨(1010)=(0001)∨(1010)=(1011)\text{Shift}(1011, 3) \lor (1010) = (0001) \lor (1010) = (1011) (self-loop).
    • With latency ≥5\ge 5: Transitions back to S0S_0.

Step 4: Identify Simple Cycles and Calculate Average Latencies

  • Cycle S0→1(1111)→5S0S_0 \xrightarrow{1} (1111) \xrightarrow{5} S_0: Average latency = 1+52=3\frac{1 + 5}{2} = 3
  • Cycle (1011)→3(1011)(1011) \xrightarrow{3} (1011): Average latency = 33
  • Cycle S0→3(1011)→5S0S_0 \xrightarrow{3} (1011) \xrightarrow{5} S_0: Average latency = 3+52=4\frac{3 + 5}{2} = 4
Comparing the average latencies of all simple cycles, the Minimum Average Latency (MAL) is 3\mathbf{3}.

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

Published
Report a correction
Keep exploringMore Instruction Pipelining questions