Skip to content
Official PYQ · 2026

GATE CS 2026 Set 1 Q50 — Pipeline Hazards

Explain with AI
The EX stage of a pipelined processor performs the memory read operations for LOAD instructions, and the operations for the arithmetic and logic instructions. Let tEXt_{E X} denote the time taken by the EX stage to perform the operation for an instruction. For each instruction type, the values of tEXt_{E X} and MM (the number of instructions of that type in a sequence of 100100 instructions for a program P ), are given in the table below.

The duration of the pipeline clock cycle is 11 nanosecond. Assume that the latch time for the interstage buffers in the pipeline is negligible.

InstructiontEX innanosecondsMLOAD1.815IMUL1.510IDIV2.55FADD1.710FSUB1.75FMUL2.815FDIV3.25All otherinstructionsLess than1.035\begin{array}{|l|c|c|} \hline \text{Instruction} & \begin{array}{c} t_{EX}\ \text{in} \\ \text{nanoseconds} \end{array} & M \\ \hline \text{LOAD} & 1.8 & 15 \\ \hline \text{IMUL} & 1.5 & 10 \\ \hline \text{IDIV} & 2.5 & 5 \\ \hline \text{FADD} & 1.7 & 10 \\ \hline \text{FSUB} & 1.7 & 5 \\ \hline \text{FMUL} & 2.8 & 15 \\ \hline \text{FDIV} & 3.2 & 5 \\ \hline \begin{array}{l} \text{All other} \\ \text{instructions} \end{array} & \begin{array}{c} \text{Less than} \\ 1.0 \end{array} & 35 \\ \hline \end{array}
When program P\text{P} is executed, the number of clock cycles for which the pipeline is stalled due to structural hazards in the EX stage is ____\_\_\_\_. (answer in integer)
View worked solution

Answer: 95 : 95

The pipeline clock cycle is 1 ns1\text{ ns}. Since the EX stage is not pipelined internally, an instruction with execution time tEXt_{EX} will occupy the EX stage for ⌈tEX⌉\lceil t_{EX} \rceil clock cycles.

In a standard pipeline, each instruction is expected to spend 11 clock cycle in the EX stage. Any additional cycles spent by an instruction in the EX stage prevent subsequent instructions from entering, thereby causing structural hazard stalls. Thus, the number of stall cycles introduced by a single instruction is:

Stall cycles per instruction=⌈tEX⌉−1\text{Stall cycles per instruction} = \lceil t_{EX} \rceil - 1

We calculate the total stall cycles for each instruction type as follows:

  • LOAD: tEX=1.8 ns  ⟹  ⌈1.8⌉=2t_{EX} = 1.8\text{ ns} \implies \lceil 1.8 \rceil = 2 cycles. Stall =2−1=1= 2 - 1 = 1 cycle.
    Total stalls =15×1=15= 15 \times 1 = 15
  • IMUL: tEX=1.5 ns  ⟹  ⌈1.5⌉=2t_{EX} = 1.5\text{ ns} \implies \lceil 1.5 \rceil = 2 cycles. Stall =2−1=1= 2 - 1 = 1 cycle.
    Total stalls =10×1=10= 10 \times 1 = 10
  • IDIV: tEX=2.5 ns  ⟹  ⌈2.5⌉=3t_{EX} = 2.5\text{ ns} \implies \lceil 2.5 \rceil = 3 cycles. Stall =3−1=2= 3 - 1 = 2 cycles.
    Total stalls =5×2=10= 5 \times 2 = 10
  • FADD: tEX=1.7 ns  ⟹  ⌈1.7⌉=2t_{EX} = 1.7\text{ ns} \implies \lceil 1.7 \rceil = 2 cycles. Stall =2−1=1= 2 - 1 = 1 cycle.
    Total stalls =10×1=10= 10 \times 1 = 10
  • FSUB: tEX=1.7 ns  ⟹  ⌈1.7⌉=2t_{EX} = 1.7\text{ ns} \implies \lceil 1.7 \rceil = 2 cycles. Stall =2−1=1= 2 - 1 = 1 cycle.
    Total stalls =5×1=5= 5 \times 1 = 5
  • FMUL: tEX=2.8 ns  ⟹  ⌈2.8⌉=3t_{EX} = 2.8\text{ ns} \implies \lceil 2.8 \rceil = 3 cycles. Stall =3−1=2= 3 - 1 = 2 cycles.
    Total stalls =15×2=30= 15 \times 2 = 30
  • FDIV: tEX=3.2 ns  ⟹  ⌈3.2⌉=4t_{EX} = 3.2\text{ ns} \implies \lceil 3.2 \rceil = 4 cycles. Stall =4−1=3= 4 - 1 = 3 cycles.
    Total stalls =5×3=15= 5 \times 3 = 15
  • Others: tEX<1.0 ns  ⟹  1t_{EX} < 1.0\text{ ns} \implies 1 cycle. Stall =1−1=0= 1 - 1 = 0 cycles.
    Total stalls =35×0=0= 35 \times 0 = 0

Summing these values gives the total number of stall cycles:

Total Stalls=15+10+10+10+5+30+15+0=95\text{Total Stalls} = 15 + 10 + 10 + 10 + 5 + 30 + 15 + 0 = 95

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

Published
Report a correction
Keep exploringMore Pipeline Hazards questions