GateAI
Instruction Pipelining

GATE CSE 2021 Set 2 · Q53

NAT2 marksMedium

Time

Consider a pipelined processor with 5 stages, Instruction Fetch (IF), Instruction Decode (ID), Execute (EX), Memory Access (MEM), and Write Back (WB). Each stage of the pipeline, except the EX stage, takes one cycle. Assume that the ID stage merely decodes the instruction and the register read is performed in the EX stage. The EX stage takes one cycle for ADD instruction and two cycles for MUL instruction. Ignore pipeline register latencies. Consider the following sequence of 8 instructions: ADD, MUL, ADD, MUL, ADD, MUL, ADD, MUL\text{ADD, MUL, ADD, MUL, ADD, MUL, ADD, MUL} Assume that every MUL instruction is data-dependent on the ADD instruction just before it and every ADD instruction (except the first ADD) is data-dependent on the MUL instruction just before it. The Speedup\textit{Speedup} is defined as follows: Speedup=Execution time without operand forwardingExecution time with operand forwarding\text{Speedup} = \frac{\text{Execution time without operand forwarding}}{\text{Execution time with operand forwarding}} The Speedup\textit{Speedup} achieved in executing the given instruction sequence on the pipelined processor (rounded to 2 decimal places) is \underline{\hspace{1.5cm}}.

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 1.88 (±0.01) (±0.01)

Instruction Pipelining

Let the 8 instructions be labeled as I1I_1 (ADD), I2I_2 (MUL), I3I_3 (ADD), I4I_4 (MUL), I5I_5 (ADD), I6I_6 (MUL), I7I_7 (ADD), and I8I_8 (MUL).

Since register read occurs in the EX stage:

### 1. Without Operand Forwarding A dependent instruction must wait until the producing instruction writes its result back in the WB stage. Thus, the dependent instruction's EX stage can only start in the cycle after the preceding instruction completes WB.

  • I1I_1 (ADD): EX=3\text{EX} = 3, MEM=4\text{MEM} = 4, WB=5\text{WB} = 5 (completes at cycle 5)

  • I2I_2 (MUL): EX1=6,EX2=7\text{EX}_1 = 6, \text{EX}_2 = 7, MEM=8\text{MEM} = 8, WB=9\text{WB} = 9 (completes at cycle 9)

  • I3I_3 (ADD): EX=10\text{EX} = 10, MEM=11\text{MEM} = 11, WB=12\text{WB} = 12 (completes at cycle 12)

  • I4I_4 (MUL): EX1=13,EX2=14\text{EX}_1 = 13, \text{EX}_2 = 14, MEM=15\text{MEM} = 15, WB=16\text{WB} = 16 (completes at cycle 16)

  • I5I_5 (ADD): EX=17\text{EX} = 17, MEM=18\text{MEM} = 18, WB=19\text{WB} = 19 (completes at cycle 19)

  • I6I_6 (MUL): EX1=20,EX2=21\text{EX}_1 = 20, \text{EX}_2 = 21, MEM=22\text{MEM} = 22, WB=23\text{WB} = 23 (completes at cycle 23)

  • I7I_7 (ADD): EX=24\text{EX} = 24, MEM=25\text{MEM} = 25, WB=26\text{WB} = 26 (completes at cycle 26)

  • I8I_8 (MUL): EX1=27,EX2=28\text{EX}_1 = 27, \text{EX}_2 = 28, MEM=29\text{MEM} = 29, WB=30\text{WB} = 30 (completes at cycle 30)

Execution time without operand forwarding=30 cycles\text{Execution time without operand forwarding} = 30\text{ cycles}

### 2. With Operand Forwarding With operand forwarding, the result is available directly at the end of the EX stage to the EX stage of the next instruction:

  • I1I_1 (ADD): EX=3\text{EX} = 3 (result ready at end of cycle 3)

  • I2I_2 (MUL): EX1=4,EX2=5\text{EX}_1 = 4, \text{EX}_2 = 5 (result ready at end of cycle 5)

  • I3I_3 (ADD): EX=6\text{EX} = 6 (result ready at end of cycle 6)

  • I4I_4 (MUL): EX1=7,EX2=8\text{EX}_1 = 7, \text{EX}_2 = 8 (result ready at end of cycle 8)

  • I5I_5 (ADD): EX=9\text{EX} = 9 (result ready at end of cycle 9)

  • I6I_6 (MUL): EX1=10,EX2=11\text{EX}_1 = 10, \text{EX}_2 = 11 (result ready at end of cycle 11)

  • I7I_7 (ADD): EX=12\text{EX} = 12 (result ready at end of cycle 12)

  • I8I_8 (MUL): EX1=13,EX2=14\text{EX}_1 = 13, \text{EX}_2 = 14, MEM=15\text{MEM} = 15, WB=16\text{WB} = 16 (completes at cycle 16)

Execution time with operand forwarding=16 cycles\text{Execution time with operand forwarding} = 16\text{ cycles}

### 3. Speedup Calculation

Speedup=3016=1.875≈1.88\text{Speedup} = \frac{30}{16} = 1.875 \approx 1.88

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Instruction Pipelining previous year question is Q53 of the GATE CSE 2021 Set 2 paper. Find more GATE CSE PYQs on Instruction Pipelining in Computer Organization and Architecture, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Instruction Pipelining PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Instruction Pipelining in GATE CSE

Instruction Pipelining has 25 GATE CSE PYQs across 20 papers from 2011 to 2026. 16 of them are 2-mark NAT questions like this one, and it is the only one in GATE CSE 2021 Set 2.

How GATE tests Instruction Pipelining

More from GATE CSE 2021 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2021 Set 2 · Q53 · NAT

Consider a pipelined processor with 5 stages, Instruction Fetch (IF), Instruction Decode (ID), Execute (EX), Memory Access (MEM), and Write Back (WB). Each stage of the pipeline, except the EX stage, takes one cycle. Assume that the ID stage merely decodes the instruction and the register read is performed in the EX stage. The EX stage takes one cycle for ADD instruction and two cycles for MUL instruction. Ignore pipeline register latencies. Consider the following sequence of 8 instructions: ADD, MUL, ADD, MUL, ADD, MUL, ADD, MUL Assume that every MUL instruction is data-dependent on the ADD instruction just before it and every ADD instruction (except the first ADD) is data-dependent on the MUL instruction just before it. The Speedup is defined as follows: Speedup = Execution time without operand forwardingExecution time with operand forwarding The Speedup achieved in executing the given instruction sequence on the pipelined processor (rounded to 2 decimal places) is 1.5cm.

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.