GATE / CS ARCHIVE

SUBJECT COLLECTION

Computer Organization & Architecture · Pipelining & Hazards

47 questions, newest first

GATE CSE has asked 47 questions on Pipelining & Hazards (Computer Organization & Architecture) from 1992 to 2026, in 35 of the 46 papers; the most recent is in GATE CSE 2026 Set 2. In the last five years it carried 1.8 marks per 100-mark paper on average, against 1.8 since 2003. Since 2014 the questions have been 19 NAT, 3 MCQ and 2 MSQ. 9 groups of questions here are solved the same way; “One per method” keeps the newest of each.

Browse topics
1 mark · MCQ
Report issue

Pipeline dependencies and model assumptions

Pipelining & Hazards

Question 16, GATE 2026: Which register dependence can cause a data hazard in a pipelined processor? A read-after-read, B read-after-write, C write-after-read, D write-after-write. The source does not explicitly constrain instruction issue or completion order.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Our answer: B in the classic in-order fixed-stage model; WAR/WAW can also be hazards in broader pipeline models.

Givens and goal

Which register dependence can cause a data hazard in a pipelined processor? A read-after-read, B read-after-write, C write-after-read, D write-after-write. The source does not explicitly constrain instruction issue or completion order.

Approach

Explain the true producer-consumer hazard, then state the narrower pipeline model needed to make the official MCQ selection unique.

Step-by-step solution

1. Suppose instruction I1 computes R1=R2+R3 and the following instruction I2 computes R4=R1+1. I2 must read the value produced by I1, so this is a read-after-write (RAW) dependence on R1.
2. If I2 reaches its register-read/use stage before I1’s result is available, it can read the old R1. That is a data hazard. Forwarding or a stall may be needed to preserve the intended computation. Thus B is a genuine hazard category.
3. In the conventional single-issue, in-order, fixed-stage pipeline, reads occur in an earlier fixed stage than writes. A later instruction cannot overtake an earlier read or write. Under those assumptions, WAR and WAW dependencies do not cause hazards, and B is the intended unique answer. RAR is not a hazard because neither instruction changes the shared register.
4. The unrestricted wording is broader. A write-after-read (WAR) hazard can arise if an earlier instruction is delayed before reading R1 and a later instruction overwrites R1 first. A write-after-write (WAW) hazard can arise if a slow earlier instruction and a fast later instruction both write R1, but the earlier write completes last, leaving the wrong final value.
5. Therefore preserve official B for scoring, with the qualification that C and D can also be hazard categories in pipelines permitting the relevant reordering. Register renaming and ordering mechanisms may prevent them, but are not specified.

CS-2026-S1-Q16-PIPELINE-MODEL. This is a model-dependent uniqueness issue, not an official key correction. The published single-answer selection requires the narrower pipeline convention described above.

Original paper, page 13 · Answer key

2 marks · NAT
Report issue

Structural stalls from a multicycle EX stage

Pipelining & Hazards

Question 60, GATE 2026: A pipeline clock is 1 ns, with negligible latch overhead. The shared EX stage performs both arithmetic and LOAD memory reads. A 100-instruction sequence contains (EX time in ns, count): LOAD (1.8,15), IMUL (1.5,10), IDIV (2.5,5), FADD (1.7,10), FSUB (1.7,5), FMUL (2.8,15), FDIV (3.2,5), and other instructions (<1.0,35). Count EX structural-stall cycles.
Tap to enlarge
Answer & solution

Official answer: 95

Givens and goal

A pipeline clock is 1 ns, with negligible latch overhead. The shared EX stage performs both arithmetic and LOAD memory reads. A 100-instruction sequence contains (EX time in ns, count): LOAD (1.8,15), IMUL (1.5,10), IDIV (2.5,5), FADD (1.7,10), FSUB (1.7,5), FMUL (2.8,15), FDIV (3.2,5), and other instructions (<1.0,35). Count EX structural-stall cycles.

Approach

Round each EX occupancy up to whole clock cycles, subtract the one cycle already included in normal pipeline operation, and multiply by instruction counts.

Step-by-step solution

1. Clock boundaries occur every 1 ns. An operation taking t_EX ns occupies the exercise’s single EX resource for ceil(t_EX/1 ns) cycles. A normal instruction already has one EX cycle, so additional blocked cycles per instruction are ceil(t_EX)−1.
2. The instruction-by-instruction contributions are:

    Type    Time   Occupied cycles   Extra cycles   Count   Stalls
    LOAD    1.8          2                1           15      15
    IMUL    1.5          2                1           10      10
    IDIV    2.5          3                2            5      10
    FADD    1.7          2                1           10      10
    FSUB    1.7          2                1            5       5
    FMUL    2.8          3                2           15      30
    FDIV    3.2          4                3            5      15
    Other   <1.0         1                0           35       0

3. Sum the final column: 15+10+10+10+5+30+15=95 stalled cycles.
4. This is a stall count, not total program execution time. Do not add the 100 baseline instruction slots or pipeline fill/drain cycles, which are not requested.

The calculation uses the stated exercise’s shared, non-overlapped EX-stage occupancy model: while a multicycle operation holds EX, a subsequent instruction cannot enter it. A separately pipelined or replicated functional unit could have a different initiation interval; its behavior cannot be inferred solely from these operation latencies.

Original paper, page 44 · Answer key

2 marks · NAT
Report issue

Pipeline speedup with stalls and a slower clock

Pipelining & Hazards

Question 57, GATE 2026: A nonpipelined processor averages 5 cycles/instruction at 1.6 GHz. Its pipeline has ideal CPI 1 but runs at 1.2 GHz; 30% of instructions incur an additional 2-cycle stall. Compute long-program speedup to two decimals. The published accepted range is 2.30–2.40.
Tap to enlarge
Answer & solution

Official answer: 2.30 to 2.40

Our answer: 2.34375 (2.34 rounded)

Givens and goal

A nonpipelined processor averages 5 cycles/instruction at 1.6 GHz. Its pipeline has ideal CPI 1 but runs at 1.2 GHz; 30% of instructions incur an additional 2-cycle stall. Compute long-program speedup to two decimals. The published accepted range is 2.30–2.40.

Approach

Compare actual seconds per instruction, not CPI alone.

Step-by-step solution

1. The nonpipelined average instruction time is CPI/frequency=5/(1.6×10⁹) seconds=3.125 ns.
2. Each pipelined instruction contributes one base cycle on average. The expected added stall cost is 0.30×2=0.60 cycles per instruction, so effective CPI is 1.60.
3. The pipelined instruction time is 1.60/(1.2×10⁹) seconds=4/3 ns≈1.33333 ns. Its clock is slower, so a CPI reduction by itself would overstate the improvement.
4. Speedup is old time/new time=3.125/(4/3)=2.34375, which rounds to 2.34. Equivalently use (5/1.6)/(1.6/1.2).
5. The full official accepted interval 2.30–2.40 is preserved, rather than replaced with a single exact scoring value. The calculation assumes long-program throughput, negligible pipeline fill/drain cost, and additive two-cycle stalls as stated; a short program or overlapping penalties would need more details.

Original paper, page 39 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 56, GATE 2025: A five-stage pipeline has stage delays 180,250,150,170,250 ns. Each inter-stage latch adds 10 ns. With no stalls, how long does execution of 1000 instructions take, in microseconds to two decimal places?
Tap to enlarge
Answer & solution

Official answer: 260.20 to 261.20

Our answer: 261.04

A synchronous pipeline clock must allow its slowest stage plus the latch overhead to complete. Thus T_clock=max(180,250,150,170,250)+10=260 ns. Adding all five stage delays would instead describe an unpipelined or differently timed design; faster stages must still wait for this common clock.

The first instruction completes after five cycles. Once the pipeline is full, one further instruction completes per cycle, so 999 additional instructions take 999 more cycles. Total cycles=k+n−1=5+1000−1=1004.

Execution time is 1004·260=261040 ns. Dividing by 1000 ns per microsecond gives 261.04 μs. The fill/drain accounting is already included in k+n−1; adding separate extra fill and drain terms would double-count. The value lies within the published acceptable range 260.20 to 261.20 μs. Answer: 261.04.

Original paper, page 43 · Answer key

1 mark · MSQ
Report issue

What forwarding solves and what it does not

Pipelining & Hazards

Question 30, GATE 2024: A processor has IF, ID, EX, MEM and WB pipeline stages. Which forwarding claims are correct? A An earlier instruction's result is passed from a source stage to a later instruction's destination stage. B MEM output can feed the next instruction's EX input. C Forwarding does not prevent every pipeline stall. D Forwarding needs no extra hardware.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, B, C

Approach: Forwarding supplies a computed value before the normal register-file writeback/read sequence has completed.
1. A later instruction may need a value that an earlier instruction has produced but has not yet written to the architectural register file. A bypass path sends that result directly to the consumer's appropriate stage. This is A.
2. A result available at the output of MEM can be routed to an EX input in a following cycle through pipeline registers and bypass selection. Thus B describes a valid forwarding path.
3. Availability still matters: in the usual five-stage pipeline, a load's value arrives too late for the immediately following instruction's EX stage without a load-use bubble. Control hazards and resource conflicts are not universally removed either. Therefore C is true.
4. Forwarding requires extra wires, multiplexers, register-number comparators and control logic to choose the correct source. D is false.
Answer: A, B and C. Forwarding reduces some data-hazard stalls; it does not eliminate timing constraints.

Original paper, page 19 · Answer key

1 mark · MSQ
Report issue

Classify register dependencies by read and write sets

Pipelining & Hazards

Question 31, GATE 2024: Instructions have destination first: I1 DIV R3,R1,R2; I2 SUB R5,R3,R4; I3 ADD R3,R5,R6; I4 MUL R7,R3,R8. Which are true? A I1→I2 RAW on R3; B I1→I3 WAR on R3; C I2→I3 RAW on R3; D I3→I4 WAW on R3.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A

Approach: Write down which instruction produces a register and which consumes it; retain the stated register name.

1. Derivation. I1 writes R3 and I2 reads R3, a read-after-write dependency, so A is true. I1 and I3 both write R3, making their relation WAW rather than WAR. I2 reads R3 and I3 writes it, giving WAR on R3 (they also have RAW on R5). I3 writes R3 and I4 reads it, giving RAW rather than WAW. Only A.

2. Explanation and checks. On R3 the four operations are write, read, write, read. A later read after an earlier write is RAW, two writes give WAW, and a write after an earlier read gives WAR. This sequence directly classifies each proposed pair. Although I2→I3 does have a RAW dependency on R5, option C explicitly says R3 and is therefore false. A dependency is a program-order relationship; whether it produces an actual stall depends on the implementation.

Original paper, page 21 · Answer key

2 marks · NAT
Report issue

Compute speedup from effective CPI

Pipelining & Hazards

Question 58, GATE 2024: A nonpipelined 2 GHz unit averages 6 cycles/instruction. A 5-stage redesign at the same frequency ideally achieves 1 instruction/cycle. In program P, 20% of instructions incur 2 stall cycles for data hazards and 20% incur 3 stall cycles for control hazards. Find steady-state speedup to one decimal.
Tap to enlarge
Answer & solution

Official answer: 2.9 to 3.1

Our answer: 3.0

Approach: Add average stall cycles per instruction to ideal CPI and compare elapsed time at equal clock rate.

1. Derivation. The pipelined average CPI is 1+0.20×2+0.20×3=2. Both designs have the same 2GHz frequency, so their steady-state speedup is 6/2=3.0. The5-stage fill/drain overhead is ignored in this throughput model; instruction count is not supplied. Hazard penalties are treated as additive non-overlapped stalls.

2. Explanation and checks. For a conceptual batch of 100 instructions, ideal execution costs 100 cycles, data stalls add 20×2=40, and control stalls add 20×3=60, totaling 200. The old design costs 600 cycles, so the ratio is three. Pipeline depth alone is not the speedup: it affects overlap, while actual CPI includes stalls. No program length is supplied for computing fill/drain effects, and the conventional average calculation treats the stated penalties additively.

Original paper, page 38 · Answer key

1 mark · NAT
Report issue

Pipelining & Hazards

Question 33, GATE 2023: A hazard-free 3-stage pipeline has stage delays 10,20,14 ns, no other delay, and fetches one instruction per cycle. Find total time in ns for 100 instructions, starting with an empty pipeline.
Tap to enlarge
Answer & solution

Official answer: 2040

The pipeline clock must accommodate the slowest stage, 20 ns. Three stages take 3 cycles for the first instruction, followed by one cycle per additional instruction. Thus100 instructions require 100+3−1=102 cycles and 102×20=2040 ns. There are no extra latch delays or hazard stalls by premise.

Teaching detail. A synchronous pipeline cannot clock each stage at its own independent duration: its common cycle length is bounded by the slowest stage. The first instruction leaves stage 3 after three 20 ns cycles. The remaining 99 instructions then finish one per cycle, so the elapsed time is (3+99)·20. Summing delays to get 44 ns per instruction would describe a different, unpipelined calculation. Multiplying only 100·20 overlooks the two extra fill/drain cycles in the finite batch.

Original paper, page 31 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 61, GATE 2022: X1 runs at 2 GHz, base CPI 1, with 30% branches and two stall cycles per branch. X2 has the same frequency and base CPI, but predicts 80% of branches correctly, eliminating stalls for those; mispredictions keep the same two-cycle penalty. No other hazards occur. Find speedup rounded to two decimals.
Tap to enlarge
Answer & solution

Official answer: 1.42 to 1.45

Our answer: 1.43

Without prediction, CPI1=1+0.30*2=1.6. With 80 percent correct predictions, only 20 percent of branches still pay the two-cycle penalty, so CPI2=1+0.30*0.20*2=1.12. Both processors have the same frequency and execute the same program, giving speedup 1.6/1.12=10/7, or 1.43 to two decimal places. This uses the stated steady-state CPI model, without separately charging pipeline fill/drain.

Speedup is old execution time/new execution time, not new CPI/old CPI. For N instructions at frequency F, times are N·1.6/F and N·1.12/F, so N and F cancel. The branch predictor saves 0.30×0.80×2=0.48 cycles per instruction, reducing CPI from 1.60 to 1.12.

Original paper, page 39 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 53, GATE 2021: A five-stage pipeline has stage delays 150,120,150,160,140 ns, and its interstage registers each have 5 ns delay. With no stalls, find the total execution time of 100 independent instructions in ns.
Tap to enlarge
Answer & solution

Official answer: 17160

The clock period is the slowest combinational stage delay plus the pipeline-register delay: 160+5=165 ns. Five stages take five clocks for the first instruction and one clock for each of the remaining 99. Total cycles=5+99=104, so execution time is 104*165=17160 ns under the standard synchronous-pipeline timing convention.

The clock cannot use the average stage delay: every stage must finish before the next common edge, so the 160 ns stage controls. Add 5 ns register overhead once per clock interval to obtain 165 ns, rather than summing all register delays into one stage. The first instruction completes after five clocks and the hundredth after 99 additional clocks. This separates pipeline latency from steady-state throughput and avoids the error 100×5×165.

Original paper, page 40 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 53, GATE 2021: Five-stage IF,ID,EX,MEM,WB pipeline; stages each one cycle except MUL EX needs two; ADD EX needs one. ID only decodes; register read happens in EX. Eight instructions alternate ADD,MUL starting ADD, each dependent on previous. Ignore pipeline register delays. Find execution time without forwarding divided by time with forwarding, rounded to two decimals.
Tap to enlarge
Answer & solution

Official answer: 1.87 to 1.88

Our answer: 1.88

With forwarding, dependent instructions enter EX immediately after the previous EX result is ready. EX occupies cycles 3; 4–5; 6; 7–8; 9; 10–11; 12; 13–14. The last WB is cycle 16. Without forwarding, register operands must wait for the previous instruction to finish WB: EX intervals 3; 6–7; 10; 13–14; 17; 20–21; 24; 27–28, and final WB30. Thus speedup=30/16=1.875, rounding to 1.88, inside official 1.87–1.88. This uses the intended cycle-boundary model: a WB result becomes available to an EX register read in the following cycle. Allowing same-cycle WB-to-EX visibility would require a different timing convention; the prompt does not explicitly specify subcycle register timing.

For any instruction with EX finishing in cycle c, MEM occurs c+1 and WB c+2. Forwarding allows the dependent EX to start c+1, whereas the adopted no-forwarding convention requires c+3. Initial IF,ID place first EX in cycle 3; the last instruction then needs two drain cycles after EX. Counting only EX work or omitting pipeline fill/drain produces an incorrect speedup.

Original paper, page 87 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 43, GATE 2020: A nonpipelined 2.5 GHz processor takes 5 cycles/instruction. Its five-stage pipeline runs at 2 GHz. Program mix: 30% memory,60% ALU,10% branch. Of memory instructions,5% cause 50-cycle stalls. Of branches,50% cause 2-cycle stalls. ALU instructions cause none. Find steady-state speedup to two decimals.
Tap to enlarge
Answer & solution

Official answer: 2.15 to 2.18

Our answer: 2.16

Worked explanation

Use time per instruction, since the two designs have different clocks. For 1000 representative instructions, 300 are memory, of which 15 stall for 750 cycles total; 100 are branches, of which 50 stall for 100 cycles total. Add the ideal 1000 pipeline cycles to obtain 1850, or CPI=1.85. Nonpipelined cycle time is 1/2.5 GHz=0.4 ns, so an instruction takes 2 ns. Pipeline cycle time is 0.5 ns, making average time 0.925 ns. Speedup is old time/new time=2/0.925=2.162162…, rounded 2.16. Counting 5% of all instructions as cache misses would overstate the penalty because that rate is conditional on memory instructions.

Derivation and answer

The non-pipelined time per instruction is 5/(2.5GHz)=2 ns. The pipeline average CPI is 1+0.30*0.05*50+0.10*0.50*2=1.85. At2GHz its average time is 1.85*0.5=0.925 ns per instruction. Speedup=2/0.925=2.162162..., or 2.16, within the official 2.15–2.18 range. This is the long-program steady-state calculation; the fixed pipeline fill/drain cost is neglected because program length is not supplied.

Original paper, page 14 · Answer key

2 marks · NAT
Report issue

Pipeline with a variable-duration stage

Pipelining & Hazards

Question 50, GATE 2018: A pipeline is IF,ID,OF,PO,WB. Every stage except PO takes one cycle. Among 100 instructions PO takes 3 cycles for 40, 2 for 35, and 1 for 25. No data/control hazards. Find total cycles under single-occupancy PO operation.
Tap to enlarge
Answer & solution

Official answer: 219

Method

Start with the ideal five-stage baseline: 100+5−1=104 cycles if every PO takes one cycle. The 40 three-cycle operations add 40·2=80 stall cycles; the 35 two-cycle operations add 35·1=35. Total is 104+80+35=219. This agrees with adding three fill cycles, all PO occupancies, and one final writeback cycle. It would be wrong to charge every instruction five separate nonoverlapped stages; most stage work overlaps.

Solution

The single PO stage is occupied for 40*3+35*2+25*1=215 clocks. The first instruction needs 3 clocks to reach PO through IF, ID, OF, and the final instruction needs 1 WB clock afterward. With no data/control hazards, earlier stages can supply the next instruction whenever PO becomes free, so total=3+215+1=219. This uses the intended non-overlapped PO-stage model; a separately internally pipelined execution unit would need an initiation-interval specification.

Original paper, page 21 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 50, GATE 2017: Five pipeline stages IF,ID,OF,EX,WB take 5,4,20,10,3 ns; interstage buffer overhead is 2 ns. NP uses these five stages. EP splits OF into OF1=12 ns,OF2=8 ns. Find EP speedup over NP for 20 independent hazard-free instructions, to two decimals.
Tap to enlarge
Answer & solution

Official answer: 1.49 to 1.52

Our answer: 1.51

1. The clock period is the slowest stage plus buffer overhead. NP therefore has period max(5,4,20,10,3)+2=22 ns. Its five-stage pipeline needs 5+(20−1)=24 cycles, or 528 ns.

2. EP has stages 5,4,12,8,10,3 ns, so its period is 12+2=14 ns. Six stages need 6+19=25 cycles for the same twenty instructions, or 350 ns.

3. Speedup is old time/new time=528/350=1.508571..., rounding to 1.51. Using only the clock ratio 22/14 neglects the extra fill cycle.

Original paper, page 22 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 32, GATE 2016: A4-stage pipeline has delays 800,500,400,300 ps. Replace its 800 ps stage by two equivalent stages of 600 ps and 350 ps. Ignoring unspecified register overhead, find the percentage increase in steady-state throughput.
Tap to enlarge
Answer & solution

Official answer: 33.0 : 34.0

Our answer: 33.33%

Ignoring unstated register overhead, the old steady-state clock is 800 ps and the new bottleneck 600 ps. Throughput rises from 1/800 to 1/600 instructions/ps. Relative increase=(800/600−1)·100%=33.333...%, rather than the 25% decrease in clock period.

A pipeline clock must accommodate its slowest stage, so the new clock is max(600,350,500,400,300)=600 ps. After filling, an ideal pipeline completes one item each clock; the number of stages affects latency but not this rate. The ratio of rates is (1/600)/(1/800)=4/3. Subtracting 1 and converting to percent gives 33⅓%. Computing(800−600)/800 instead measures a 25% period reduction, a different requested quantity.

Original paper, page 13 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 30, GATE 2016: Functional units UF and UG compute F and G in 5 ns and 3 ns. Two instances of each are available. Find the minimum completion time for ten computations F(G(Xi)), i=1,…,10, ignoring other delays.
Tap to enlarge
Answer & solution

Official answer: 28.0 : 28.0

Our answer: 28

Each of the two F units must perform at least five 5 ns operations to finish ten jobs. No F can begin before the first G output at 3 ns, so makespan≥3+25=28 ns. Two G units produce pairs at 3, 6, 9, 12, 15 ns. Feed the F units continuously in paired intervals 3–8, 8–13, 13–18, 18–23, 23–28. This attains 28 ns.

Think in five two-job batches. The G stage finishes each batch every 3 ns, whereas F needs 5 ns, so F is the bottleneck after startup. Waiting buffers hold early G outputs while F is busy. Multiplying ten jobs by 8 ns ignores parallelism; using just 25 ns forgets the unavoidable initial G latency.

Original paper, page 33 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 33, GATE 2016: A three-stage 3 GHz pipeline has τ1=3τ2/4=2τ3. Split the longest stage into two equal stages. Ignoring pipeline-register delay, find the new frequency in GHz.
Tap to enlarge
Answer & solution

Official answer: 3.9 : 4.1

Our answer: 4 GHz

The relation gives tau2=4tau1/3 and tau3=tau1/2; tau2 is originally longest. A3GHz clock therefore has tau2=1/3 ns and tau1=1/4 ns. Splitting tau2 creates two 1/6 ns stages; the new bottleneck is tau1=1/4 ns, giving 4GHz.

The original stage times are τ1=1/4 ns, τ2=1/3 ns, τ3=1/8 ns. After splitting, the four stages are 1/4,1/6,1/6,1/8 ns. The clock period is their maximum, not their average or sum. Adding one stage does not automatically multiply the frequency by four-thirds; it does so here because of these particular delays.

Original paper, page 34 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 55, GATE 2015: A nonpipelined CPU runs at 2.5 GHz with average CPI=4. A five-stage pipelined version runs at 2 GHz due to pipeline delay, with no stalls. Find speedup.
Tap to enlarge
Answer & solution

Official answer: 3.2

Compare time per instruction, not stage count alone. Initially an instruction costs four 0.4-ns cycles, or 1.6 ns. A full stall-free pipeline produces one result per 0.5-ns cycle. Throughput speedup is 1.6/0.5=3.2. Five stages affect latency and initial fill; they do not make the improvement automatically fivefold. This is the steady-state limit for a sufficiently long stream.

Solution: Nonpipelined throughput is 2.5GHz/4=0.625 billion instructions/s. A stall-free full pipeline at 2GHz completes one instruction per cycle, giving 2 billion/s. The steady-state speedup is 2/0.625=3.2. This ignores fill/drain overhead for a finite short instruction sequence, whose length is not supplied.

Original paper, page 21 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 53, GATE 2015: Instructions are MUL R5, R0, R1; DIV R6, R2, R3; ADD R7, R5, R6; SUB R8, R7, R4. Pipeline stages IF, OF and WB take one cycle; PO takes 3 for MUL, 5 for DIV and 1 for ADD/SUB. PO output can forward to OF. Find total cycles under the stated single occupied PO-stage interpretation.
Tap to enlarge
Answer & solution

Official answer: 13

Step through it (6 steps)

With a single occupied PO stage and the stated forwarding, MUL uses IF1, OF2, PO3–5, WB6. DIV uses PO6–10, ADD uses PO11 and SUB uses PO12; SUB writes back in cycle 13. The dependent ADD/SUB operand fetches use the forwarded results at the end of the preceding producer PO cycle. Thus total 13 cycles. This is the conventional in-order, non-internally-pipelined PO-stage model; independent or internally pipelined functional units would require more scheduling details.

Count occupied execution cycles rather than adding all independent instruction latencies. MUL starts PO in cycle 3 and occupies cycles 3–5. DIV cannot use the same PO stage until cycle 6, then occupies 6–10. ADD depends on both results and uses PO in cycle 11 after forwarding; SUB follows in cycle 12. Its WB is cycle 13. The explicit resource model matters: a separately pipelined multiplier/divider would permit a different schedule, and a non-forwarding design would add dependency stalls.

Original paper, page 47 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 48, GATE 2015: A three-stage pipeline has a five-column reservation table. Stage S1 is used at time slots 1 and 5, S2 at slots 2 and 4, and S3 only at slot 3; all other cells are blank. Determine the minimum average initiation latency (MAL). Initiation times may vary, but no two active operations may use the same stage simultaneously.
Tap to enlarge
Answer & solution

Official answer: 3

1. The forbidden separations come from differences between occupied columns in the same row, not from differences across different stages. Thus the initial forbidden-latency set is exactly {2,4}. To attain average 3, start operations at times 0,3,6,9,...; every pairwise separation is a positive multiple of 3 and therefore safe.

2. Repeated use in S1 forbids initiation separation 4; S2 forbids 2. Therefore allowed positive gaps include 1, 3, 5. Constant gap 3 is collision-free because no multiple of 3 is 2 or 4, achieving average 3. If any gap is 1, its next gap cannot 1 or 3 (the two-gap total would be 2 or 4) and must be at least 5. Pair each such 1 with its following≥5 gap; every pair averages≥3, while unpaired gaps are≥3. Thus no lower long-run average is possible.

Original paper, page 70 · Answer key

2 marks · MCQ
Report issue

Pipelining & Hazards

Question 49, GATE 2015: Instructions have form OP Ri,Rj,Rk, which reads Rj,Rk and writes Ri. The sequence is I1: ADD R1,R2,R3; I2: MUL R7,R1,R3; I3: SUB R4,R1,R5; I4: ADD R3,R2,R4; I5: MUL R7,R8,R9. Consider S1: I2 and I5 have an anti-dependence; S2: I2 and I4 have an anti-dependence; S3: in a pipeline, an anti-dependence always causes at least one stall. Options: (A) S1 only; (B) S2 only; (C) S1 and S3 only; (D) S2 and S3 only.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. I2 reads R3 and I4 later writes R3, a write-after-read anti-dependence, so S2 holds.

2. I2 and I5 both write R7, an output dependence rather than anti-dependence. In-order reads/writes or register renaming can avoid stalls for anti-dependences, so S3 is false. Thus only S2, B.

Original paper, page 70 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 43, GATE 2014: A perfectly balanced six-stage instruction pipeline has no cycle-time overhead. While an application runs, 25% of its instructions incur two stall cycles each. Find the speedup relative to nonpipelined execution.
Tap to enlarge
Answer & solution

Official answer: 4

1. Method and setup. Measure time in units of one pipeline stage. Without pipelining an instruction consumes six such units; in steady state the pipeline completes one instruction per cycle plus stalls. Weight the stall penalty by the fraction of affected instructions rather than adding two cycles to every instruction.

2. Work through the result and its assumptions. The average cycles per instruction is 1+0.25·2=1.5. A nonpipelined instruction takes six balanced stage times, so steady-state speedup is 6/1.5=4. This ignores fill/drain effects; for a finite N-instruction run with exactly N/2 stall cycles, the usual timing is 6N/(1.5N+5), approaching4.

Original paper, page 18 · Answer key

1 mark · MCQ
Report issue

Pipelining & Hazards

Question 9, GATE 2014: Pipeline-register latency is zero. Four processors have stage delays in ns: P1=(1,2,2,1); P2=(1,1.5,1.5,1.5); P3=(0.5,1,1,0.6,1); P4=(0.5,0.5,1,1,1.1). Which has the highest peak clock frequency? A P1; B P2; C P3; D P4.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step 1: A synchronous pipeline must allow its slowest stage to finish during one clock period. With zero register overhead, the minimum period is the maximum stage latency, not the sum or average. Step 2: The four maxima are 2, 1.5, 1 and 1.1 ns respectively. Step 3: Frequency is the reciprocal of period, so P3 is fastest at 1/(1 ns)=1 GHz, C. Its greater number of stages does not itself determine this ranking.

Original paper, page 54 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 43, GATE 2014: An old pipeline has IF,ID/RF,EX,MEM,WB with delays 1,2.2,2,1,0.75 ns. A new eight-stage pipeline splits ID/RF into ID,RF1,RF2 of 2.2/3 ns each, and EX into EX1,EX2 of 1 ns each. Branches are 20% of instructions and resolve at the end of EX (old) or EX2 (new); after fetching a branch, IF stalls until its next PC is known. Other instructions have average CPI 1. For old/new program times P,Q, find P/Q.
Tap to enlarge
Answer & solution

Official answer: 1.50 to 1.60

Our answer: 1.54

Step 1: Ignoring latch overhead, the old period is max(1,2.2,2,1,0.75)=2.2 ns. The new longest stage is 1 ns. Step 2: In the old design, a branch fetched in cycle 1 resolves at the end of stage 3, so it blocks two following fetch slots. Average CPI is 1+0.2×2=1.4. Step 3: In the new design, EX2 is stage 6: IF,ID,RF1,RF2,EX1,EX2. A branch blocks five following fetch slots, yielding CPI 1+0.2×5=2. Step 4: In the steady-state model, time per instruction is CPI×period. Therefore P/Q=(1.4×2.2)/(2×1)=1.54. Pipeline fill/drain and register overhead are omitted; without program length an exact finite-program ratio is not specified.

Original paper, page 63 · Answer key

2 marks · MCQ
Report issue

Taken branch in a five-stage pipeline

Pipelining & Hazards

Question 45, GATE 2013: Five pipeline stages FI, DI, FO, EI, WO take 5, 7, 10, 8, 6 ns, with 1 ns buffer delay. Program I1… I12 has only branch I4, taken to I9. Without branch prediction, under end-of-EI resolution, time to complete is A132, B165, C176, D328 ns.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

The pipeline clock period is max(5, 7, 10, 8, 6)+1=11 ns. Because I4 branches to I9, the useful executed instructions are I1, I2, I3, I4, I9, I10, I11, I12: eight instructions. Using the standard model in which the branch is resolved at the end of EI, I4 occupies FI in cycle 4, DI in cycle 5, FO in cycle 6 and EI in cycle 7. Without prediction, target fetch starts in cycle 8. Then I9 finishes WO in cycle 12 and I12 finishes WO in cycle 15. Equivalently, eight useful instructions need 8+5−1=12 cycles without a control hazard, plus three branch-wait cycles. The total is 15×11=165 ns, option B. The answer relies on branch resolution in EI and target fetch in the following cycle; the prompt does not separately specify an earlier branch-resolution mechanism.

A common clock must accommodate the slowest stage plus its buffer:10+1=11 ns. Branch I4 enters EI in cycle 7, after FI4, DI5, FO6. Its target can enter FI in cycle 8, then DI9, FO10, EI11, WO12. The next target-path instructions finish in cycles 13, 14, 15. Thus the total is 165 ns. Counting all 12 source instructions would incorrectly include the skipped I5–I8. The branch resolution convention is stated because a different resolution stage would change the stall count.

Original paper, page 10 · Answer key

1 mark · MCQ
Report issue

Purpose of register renaming

Pipelining & Hazards

Question 20, GATE 2012: Register renaming is done in pipelined processors
        (A) as an alternative to register allocation at compile time
        (B) for efficient access to function parameters and local variables
        (C) to handle certain kinds of hazards
        (D) as part of address translation
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Renaming assigns different physical registers to distinct logical-register definitions. This removes false dependencies due to reusing a register name, specifically WAR and WAW hazards, allowing more overlapping execution. It cannot remove a genuine RAW data dependency. Thus it handles certain pipeline hazards, C.

Check: For example, an older instruction reading logical R1 and a newer instruction writing logical R1 need not share a physical register. Giving the newer result a new physical destination avoids a write-after-read name hazard while preserving the old value for its reader.

Original paper, page 4 · Answer key

2 marks · MCQ
Report issue

Pipeline throughput with unequal stage delays

Pipelining & Hazards

Question 41, GATE 2011: An ideal four-stage instruction pipeline has combinational delays S1=5 ns, S2=6 ns, S3=11 ns, S4=8 ns. A 1 ns pipeline register follows every stage, including the last. Approximately what is its steady-state speedup over the corresponding non-pipelined implementation?

(A) 4.0
(B) 2.5
(C) 1.1
(D) 3.0
Tap to enlarge
Your answer
Answer & solution

Official answer: B

The non-pipelined combinational delay is 5+6+11+8=30 ns. The pipelined clock period is determined by the slowest stage plus its pipeline-register delay: 11+1=12 ns. In ideal steady state one instruction completes every 12 ns, so the conventional throughput speedup is 30/12=2.5, option B. If the non-pipelined implementation also counts a final 1 ns output register, the ratio is 31/12≈2.58, still the same approximate option. This is steady-state throughput, not the latency speedup of one instruction.

After filling, different instructions occupy the four stages concurrently. The clock cannot advance every average-stage delay; the slowest stage must finish before its register captures the result. That sets 12 ns per output instruction despite three faster stages. One instruction still traverses four pipeline cycles, but the question asks steady-state throughput. Using the ideal stage-count speedup of four would require balanced stages with negligible register overhead, neither of which holds here.

Original paper, page 11 · Answer key

2 marks · MCQ
Report issue

Variable-latency pipeline execution

Pipelining & Hazards

Question 33, GATE 2010: A five-stage pipeline has IF, ID, OF, PO and WO stages. IF, ID, OF and WO each take one cycle. PO takes one cycle for ADD/SUB, three for MUL and six for DIV. Operand forwarding is used. How many cycles execute this instruction sequence?
I₀: MUL R₂,R₀,R₁   (R₂←R₀×R₁)
I₁: DIV R₅,R₃,R₄   (R₅←R₃/R₄)
I₂: ADD R₂,R₅,R₂   (R₂←R₅+R₂)
I₃: SUB R₅,R₂,R₆   (R₅←R₂−R₆)
Options: (A) 13; (B) 15; (C) 17; (D) 19.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Step through it (6 steps)

With the single shared PO stage, the first MUL occupies PO in cycles 4–6 after IF,ID,OF in cycles 1–3. DIV occupies PO in cycles 7–12; the dependent ADD then uses the forwarded DIV result in PO cycle 13, and SUB uses PO cycle 14. The last WO is cycle 15. Earlier stages stall as necessary while PO is occupied, but forwarding avoids waiting for an extra writeback before dependent execution. Total 15, B. This assumes the ordinary unpipelined multi-cycle PO unit implicit in this question, not separate independently pipelined arithmetic units.

A compact timing schedule is MUL: PO 4–6, WO 7; DIV: PO 7–12, WO 13; ADD: PO 13, WO 14; SUB: PO 14, WO 15. PO is the bottleneck and its occupied cycles sum to 3+6+1+1=11. Three initial stages plus eleven PO cycles plus the final writeback give 3+11+1=15. Forwarding handles the DIV→ADD and ADD→SUB true dependencies.

Original paper, page 8

2 marks · MCQ
Report issue

Variable-stage pipeline schedule

Pipelining & Hazards

Question 28, GATE 2009: Four pipeline stages S1–S4 require cycles per instruction: I1=(2, 1, 1, 1), I2=(1, 3, 2, 2), I3=(2, 1, 1, 3), I4=(1, 2, 2, 2). Execute two iterations of I1, I2, I3, I4. Find total cycles under overlapping buffered-stage execution, ignoring loop-control overhead: A 16; B 23; C 28; D 30.
Tap to enlarge
Your answer
Answer & solution

Answer: B under continuous overlapped execution (no official key was published)

Ignoring loop-control overhead and allowing the eight instructions from two iterations to overlap, each stage starts after both its instruction’s previous stage and the previous instruction’s same stage finish. The four stage-completion times are(2, 3, 4, 5), (3, 6, 8, 10), (5, 7, 9, 13), (6, 9, 11, 15), (8, 10, 12, 16), (9, 13, 15, 18), (11, 14, 16, 21), (12, 16, 18, 23). Thus completion is at cycle 23, B. This recurrence uses buffered stage outputs; it does not charge an additional loop branch or force a pipeline drain between iterations. Such implementation choices are not explicitly specified by the prompt.

Construct a completion-time grid. A cell cannot start until the same instruction finishes its prior stage and the previous instruction releases this stage. Thus completion(i, j)=max(completion(i−1, j), completion(i, j−1))+duration(i, j). Applying it to the eight instruction rows yields final completion 23; the full row table is given above. Simply summing durations would ignore overlap, while assuming every stage takes one cycle ignores the supplied table. Pipeline draining or stage blocking without buffers changes the model, so those assumptions remain explicit.

Original paper, page 6

2 marks · MCQ
Report issue

False pipeline-hazard claims

Pipelining & Hazards

Question 36, GATE 2008: Which are NOT true in a pipelined processor? I: bypassing handles all RAW hazards. II: register renaming eliminates all register-carried WAR hazards. III: dynamic branch prediction eliminates control-hazard penalties.

(A) I and II only
(B) I and III only
(C) II and III only
(D) I,II,III
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. RAW is a real data dependency. Forwarding helps only once the producer’s value exists; a load-use consumer can still require a stall. I is false.
2. WAR is a false name dependency. Assigning distinct physical registers removes register-carried WAR hazards, so II is true.
3. Dynamic prediction can still choose the wrong branch direction, requiring recovery. III is false. The NOT-true statements are I and III, B.

Original paper, page 7

2 marks · MCQ
Report issue

Semantics of an unconditional delay slot

Pipelining & Hazards

Question 76, GATE 2008: Delayed branching handles control hazards. For a delayed conditional branch, regardless of whether the condition is true or false, which statement holds?

(A) The instruction immediately following the branch in memory is executed
(B) The first instruction in the fall-through path is executed
(C) The first instruction in the taken path is executed
(D) The branch takes longer than any other instruction
Question 76, GATE 2008: Delayed branching handles control hazards. For a delayed conditional branch, regardless of whether the condition is true or false, which statement holds?

(A) The instruction immediately following the branch in memory is executed
(B) The first instruction in the fall-through path is executed
(C) The first instruction in the taken path is executed
(D) The branch takes longer than any other instruction
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. In the ordinary non-annulling delayed-branch model, the instruction immediately following the branch in memory executes before control transfers, regardless of whether the branch is taken. That is the delay-slot instruction, option A.
2. Instructions beyond the delay slot on the fall-through or target paths are not both guaranteed to execute. Some ISAs offer annulled slots, but those are outside the simple delayed-branch model used by this linked pair.

Original paper, page 16

2 marks · MCQ
Report issue

Safe instruction for a branch delay slot

Pipelining & Hazards

Question 77, GATE 2008: A processor has one branch delay slot. Which instruction can be moved into it without other program changes?
I1: ADD R2←R7+R8
I2: SUB R4←R5−R6
I3: ADD R1←R2+R3
I4: STORE Memory[R4]←R1
BRANCH to Label if R1==0

(A) I1
(B) I2
(C) I3
(D) I4
Question 77, GATE 2008: A processor has one branch delay slot. Which instruction can be moved into it without other program changes?
I1: ADD R2←R7+R8
I2: SUB R4←R5−R6
I3: ADD R1←R2+R3
I4: STORE Memory[R4]←R1
BRANCH to Label if R1==0

(A) I1
(B) I2
(C) I3
(D) I4
Question 77, GATE 2008: A processor has one branch delay slot. Which instruction can be moved into it without other program changes?
I1: ADD R2←R7+R8
I2: SUB R4←R5−R6
I3: ADD R1←R2+R3
I4: STORE Memory[R4]←R1
BRANCH to Label if R1==0

(A) I1
(B) I2
(C) I3
(D) I4
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. I4 stores R1 through address R4 but changes neither register used by the branch condition. Moving it from immediately before the branch to the single delay slot preserves its unconditional execution and lets the branch still test the R1 computed by I3.
2. I1 cannot move because I3 needs R2; I2 cannot move because I4 needs R4; I3 cannot move because I4 and the branch need R1. Thus I4, option D, is the legal choice in the stated dependency model.

Original paper, page 17

2 marks · MCQ
Report issue

Forwarded multicycle pipeline timing

Pipelining & Hazards

Question 37, GATE 2007: A pipeline has IF, ID (decode/operand fetch), EX, WB. IF, ID and WB each take one cycle; EX takes one cycle for ADD/SUB and three for MUL. Operand forwarding is available. How many cycles complete this sequence?
ADD R2,R1,R0   (R2←R1+R0)
MUL R4,R3,R2   (R4←R3×R2)
SUB R6,R5,R4   (R6←R5−R4)
Options:
(A) 7
(B) 8
(C) 10
(D) 14
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Step through it (5 steps)

1. Approach. Draw one timeline per instruction. Forwarding removes waiting for register writeback, but it cannot make the three-cycle multiply result available before its EX stage finishes.

2. Derivation and interpretation. ADD uses IF1,ID2,EX3,WB4. Its result is forwarded to MUL, which uses IF2,ID3,EX4–6,WB7. SUB uses IF3,ID4 and waits for the EX unit/result, then executes EX7 and WB8. Therefore completion requires 8 cycles, B, assuming the stated forwarding permits consuming an EX result in the next cycle and no additional structural conflicts.

Original paper, page 9

2 marks · MCQ
Report issue

Conditional-branch pipeline stalls

Pipelining & Hazards

Question 42, GATE 2006: A 1 GHz CPU has five pipeline stages; fetch is stage 1. Conditional branches compute their target and condition in stage 3. After fetching a branch, no further instruction is fetched until the outcome is known. A program has 10⁹ instructions, 20% conditional branches. With base CPI 1 before branch stalls, what approximate execution time results?
Options:
(A) 1.0 s
(B) 1.2 s
(C) 1.4 s
(D) 1.6 s
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. A branch fetched in stage 1 resolves at the end of stage 3, so two subsequent fetch slots are lost. The ideal CPI is 1 and branch frequency is 0.2, giving CPI=1+2(0.2)=1.4.

2. At 1 GHz, 109 instructions take approximately 1.4 seconds (C); constant pipeline fill/drain time is ignored as in the options. The statement that instructions take one cycle on average must mean the base CPI before these stalls.

3. Teaching check: The two idle fetch slots are the cycles while the branch passes stages 2 and 3. Since one fifth of instructions causes this penalty, average overhead is 0.4 cycles per instruction. The five-stage depth does not mean five cycles of throughput cost for every ordinary instruction.

Original paper, page 6

2 marks · MCQ
Report issue

Load-use dependencies in a five-stage pipeline

Pipelining & Hazards

Question 68, GATE 2005: Five one-cycle stages IF instruction fetch, RD decode/register read, EX ALU/address, MA data memory (stores use data read in RD), WB register write. Instructions I1:R0←M[loc1], I2:R0←R0+R0, I3:R2←R2−R0. Total cycles from first fetch through final completion? A8; B10; C12; D15. The source does not explicitly state forwarding.
Tap to enlarge
Your answer
Answer & solution

Answer: A, conditional on forwarding (no official key was published)

With ordinary EX forwarding, the load-use dependency requires one bubble: I1 follows IF1, RD2, EX3, MA4, WB5; I2 follows IF2, RD3 (held through cycle 4), EX5, MA6, WB7; I3 follows IF3 (held), RD5, EX6, MA7, WB8. The add result forwards to the subtract without another bubble. Total 5+2+1=8 cycles, option A. Forwarding is not explicitly stated in the paper, so 8 is conditional, not a uniquely established result from the written stage definitions alone. Without forwarding, with register write/read in opposite halves of one cycle, the two RAW dependencies instead add four bubbles, producing 11 cycles, absent from the choices.

With forwarding, the memory-loaded value appears only after I1’s MA stage, so I2 cannot consume it in EX at cycle 4; stall one cycle. Its ALU result can then forward directly to I3’s EX, adding no second bubble. An unstalled three-instruction/five-stage pipeline would take 7 cycles, so the one bubble makes 8. If forwarding is absent, register availability imposes further waits; the question’s stage list alone does not justify treating 8 as universal.

Original paper, page 9

2 marks · MCQ
Report issue

Four-stage pipeline completion time

Pipelining & Hazards

Question 69, GATE 2004: A four-stage pipeline has stage delays 150,120,160,140 ns and interstage-register delay 5 ns. With a constant clock period, how long does it take to process 1000 items?
Options:
(A) 120.4 μs
(B) 160.5 μs
(C) 165.5 μs
(D) 590.0 μs
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. The common clock period is the slowest stage plus register delay: max(150,120,160,140)+5=165 ns. A four-stage pipeline needs 4 cycles for its first item and 999 more for the remaining items.

2. Total time is (1000+4−1)×165=165495 ns=165.495 microseconds, rounded to 165.5 microseconds, C. This is the standard balanced-clock pipeline timing model.

3. Teaching check: Pipeline throughput is set by the slowest stage, not the sum of stage delays. The sum matters for an unpipelined path; the pipelined batch takes a fill of four cycles plus one cycle for each subsequent item. Include the register delay in every clock period.

Original paper, page 10

1 mark · MCQ
Report issue

Three pipeline hazard classes

Pipelining & Hazards

Question 10, GATE 2003: For a pipelined CPU with one ALU, consider I. Instruction j+1 uses instruction j’s result; II. A conditional jump executes; III. Instructions j and j+1 need the ALU simultaneously. Which can cause a hazard? A. I and II only; B. II and III only; C. III only; D. All three.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. A data hazard concerns operand availability, a control hazard concerns which instruction address to fetch, and a structural hazard concerns resource availability. These are separate reasons a pipeline may need a stall or other mitigation. A single ALU does not eliminate the data or control cases.

2. Using a preceding result can cause a data hazard; a conditional branch causes a control hazard; simultaneous demand for the single ALU causes a structural hazard. Therefore all three can cause hazards, D. The question asks possibility, not that every instance necessarily stalls.

Original paper, page 2

2 marks · MCQ
Report issue

Pipeline performance hazards

Pipelining & Hazards

Question 2.6, GATE 2002: Which condition harms pipelined-processor performance?
(A) Unequal stage delays; (B) Dependencies between consecutive instructions; (C) Shared hardware resources among stages; (D) All of these.
Question 2.6, GATE 2002: Which condition harms pipelined-processor performance?
(A) Unequal stage delays; (B) Dependencies between consecutive instructions; (C) Shared hardware resources among stages; (D) All of these.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step 1: Separate three causes of lost pipeline throughput.

Step 2: Stage imbalance makes the clock period depend on the slowest stage. A dependence can make an instruction wait until its operand is available. A structural conflict occurs when two stages need one shared resource simultaneously. These are independent mechanisms, so an answer listing only one omits other valid possibilities.

Conclusion: Unequal stage delays leave faster stages waiting for the slowest. Data dependence can require stalls, and shared hardware can create structural conflicts. Each can reduce performance, so D. Suitable forwarding, scheduling or duplicated resources may mitigate particular cases, rather than making the hazards impossible.

Original paper, page 4

Descriptive
Report issue

Trace the registered three-bit adder

Pipelining & Hazards

Question 8(a), GATE 2002: The circuit takes three-bit inputs A=a₂a₁a₀ and B=b₂b₁b₀ and produces Z=z₃z₂z₁z₀. All registers load simultaneously on falling CLOCK edges; the clock period exceeds every circuit’s settling time. The diagram has R0 (6 bits) holding b₂,a₂,b₁,a₁,b₀,a₀. A full adder takes R0’s b₀,a₀ with carry-in 0. R1 (6 bits) holds the forwarded b₂,a₂,b₁,a₁ and this adder’s carry and sum. A second full adder takes R1’s b₁,a₁ and that stored carry. R2 (5 bits) holds the forwarded b₂,a₂, the second adder’s carry and sum, and the forwarded least-significant sum. A third, unregistered full adder takes R2’s b₂,a₂ and stored carry; its carry and sum are z₃,z₂, while R2’s stored sums directly provide z₁,z₀. Initially R0, R1, R2 are all zero. For clock numbers 1 through 8, A is [110,011,111,101,000,000,000,000] and B is [101,101,011,110,000,000,000,000]. Determine the sequence of eight four-bit output values Z.
Question 8(a), GATE 2002: The circuit takes three-bit inputs A=a₂a₁a₀ and B=b₂b₁b₀ and produces Z=z₃z₂z₁z₀. All registers load simultaneously on falling CLOCK edges; the clock period exceeds every circuit’s settling time. The diagram has R0 (6 bits) holding b₂,a₂,b₁,a₁,b₀,a₀. A full adder takes R0’s b₀,a₀ with carry-in 0. R1 (6 bits) holds the forwarded b₂,a₂,b₁,a₁ and this adder’s carry and sum. A second full adder takes R1’s b₁,a₁ and that stored carry. R2 (5 bits) holds the forwarded b₂,a₂, the second adder’s carry and sum, and the forwarded least-significant sum. A third, unregistered full adder takes R2’s b₂,a₂ and stored carry; its carry and sum are z₃,z₂, while R2’s stored sums directly provide z₁,z₀. Initially R0, R1, R2 are all zero. For clock numbers 1 through 8, A is [110,011,111,101,000,000,000,000] and B is [101,101,011,110,000,000,000,000]. Determine the sequence of eight four-bit output values Z.
Question 8(a), GATE 2002: The circuit takes three-bit inputs A=a₂a₁a₀ and B=b₂b₁b₀ and produces Z=z₃z₂z₁z₀. All registers load simultaneously on falling CLOCK edges; the clock period exceeds every circuit’s settling time. The diagram has R0 (6 bits) holding b₂,a₂,b₁,a₁,b₀,a₀. A full adder takes R0’s b₀,a₀ with carry-in 0. R1 (6 bits) holds the forwarded b₂,a₂,b₁,a₁ and this adder’s carry and sum. A second full adder takes R1’s b₁,a₁ and that stored carry. R2 (5 bits) holds the forwarded b₂,a₂, the second adder’s carry and sum, and the forwarded least-significant sum. A third, unregistered full adder takes R2’s b₂,a₂ and stored carry; its carry and sum are z₃,z₂, while R2’s stored sums directly provide z₁,z₀. Initially R0, R1, R2 are all zero. For clock numbers 1 through 8, A is [110,011,111,101,000,000,000,000] and B is [101,101,011,110,000,000,000,000]. Determine the sequence of eight four-bit output values Z.
Tap to enlarge
Shared context

A and B are unsigned three-bit operands. All three registers R0, R1, R2 load on the same falling clock edge. The source circuit stages three full adders and delays higher input bits and lower result bits to keep each operand pair aligned. All registers initially contain zero.

Answer & solution

Answer: 0000, 0000, 1011, 1000, 1010, 1011, 0000, 0000 (no official key was published)

1. Read the timing rule before doing arithmetic. R0, R1, and R2 load simultaneously on every falling edge. A downstream register therefore samples the old contents of the register before it, not the new value arriving during that same edge. Read Z after the final full adder has settled.

2. Follow one input pair through the circuit. Pair t enters R0 at edge t. Its low-bit sum and carry enter R1 at edge t+1. Its middle-bit sum and carry enter R2 at edge t+2, after which the last full adder produces the high sum bit and final carry. The delayed low bits complete the four-bit output. Thus the input captured at edge 1 first appears as a complete sum after edge 3.

3. Compute the first four operand sums, preserving the carry bit:

Input pair    A     B     Decimal sum     Four-bit sum
    1        110   101       6+5=11            1011
    2        011   101       3+5=8             1000
    3        111   011       7+3=10            1010
    4        101   110       5+6=11            1011
    5–8      000   000       0+0=0             0000

4. Check the first sum at bit level. For 110 + 101, bit 0 gives 0+1+0 = 1, so s0=1,c1=0. Bit 1 gives 1+0+0 = 1, so s1=1,c2=0. Bit 2 gives 1+1+0 = 2, so s2=0,c3=1. The result c3s2s1s0 is 1011.

5. Apply the two-edge delay and the all-zero initial register contents. The requested sequence is:

Clock edge       1     2     3     4     5     6     7     8
Z after settling 0000  0000  1011  1000  1010  1011  0000  0000
Source input     init  init   1     2     3     4     5     6

The initial two outputs come from the zero-filled pipeline. Input pairs 7 and 8 have not yet reached the output at edge 8. Register-by-register synchronous simulation verifies all eight reported outputs.

Original paper, page 7

Descriptive
Report issue

Dependencies among four pipeline instructions

Pipelining & Hazards

Question 12(a), GATE 2001: Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.

Task: Show all data dependencies among the four instructions.
Question 12(a), GATE 2001: Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.

Task: Show all data dependencies among the four instructions.
Tap to enlarge
Shared context

Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.

Answer & solution

Answer: RAW: I1→I2(r2), I1→I3(r2), I1→I4(r2), I2→I4(r4). WAR: I1→I2(r4), I1→I4(r3), I2→I4(r3). No WAW. (no official key was published)

1. List register accesses first: I1 reads r3,r4 and writes r2; I2 reads r2,r3 and writes r4; I3 reads r1,r2 and writes memory; I4 reads r4,r2 and writes r3.

2. A true (RAW) dependence connects an earlier writer to a later reader of that value. I1 supplies r2 to I2, I3 and I4. I2 supplies r4 to I4. These are the four true data dependencies.

3. For completeness, anti-dependencies (WAR) constrain later overwriting of earlier inputs: I1 reads r4 before I2 writes it; I1 and I2 read r3 before I4 writes it. These are I1→I2 on r4, I1→I4 on r3, and I2→I4 on r3.

4. No two instructions write the same register, so there are no output (WAW) dependencies. Only I3 accesses memory, so there is no inter-instruction memory dependence. WAR relations do not become hazards in this in-order five-stage pipeline, where reads precede later writes.

Original paper, page 8

Descriptive
Report issue

Identify pipeline data hazards

Pipelining & Hazards

Question 12(b), GATE 2001: Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.

Task: Identify the data hazards.
Question 12(b), GATE 2001: Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.

Task: Identify the data hazards.
Tap to enlarge
Shared context

Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.

Answer & solution

Answer: Without forwarding, RAW hazards: I1→I2 on r2, I1→I3 on r2, I2→I4 on r4. I1→I4 is not a timing hazard. (no official key was published)

Step through it (6 steps)

1. Write the unstalled stage schedule. I1: IF1 ID2 EX3 MEM4 WB5; I2: IF2 ID3 EX4 MEM5 WB6; I3: IF3 ID4 EX5 MEM6 WB7 (store has no register write); I4: IF4 ID5 EX6 MEM7 WB8.

2. I1 writes r2 in cycle 5. I2 tries to read it in cycle 3 and I3 in cycle 4, both too early without forwarding. These two true dependencies create RAW hazards.

3. I2 writes r4 in cycle 6, while I4 reads r4 in cycle 5, producing the third RAW hazard.

4. I4 also depends on I1 for r2, but reads in the second half of cycle 5 after I1 writes in its first half. Therefore this dependency is safe under the explicit half-cycle timing.

5. WAR and WAW hazards do not arise in the given ordered pipeline. This list describes the original unstalled timing; adding stalls can incidentally eliminate later conflicts, so dependency and hazard should not be conflated.

Original paper, page 8

Descriptive
Report issue

Forwarding to avoid pipeline hazards

Pipelining & Hazards

Question 12(c), GATE 2001: Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.

Task: Determine whether forwarding can avoid all the hazards in this sequence.
Question 12(c), GATE 2001: Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.

Task: Determine whether forwarding can avoid all the hazards in this sequence.
Tap to enlarge
Shared context

Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.

Answer & solution

Answer: Yes, with normal ALU forwarding and a forwarding path for the store data; no load-use stall is present. (no official key was published)

1. I1 computes its r2 result at the end of EX in cycle 3. I2 needs that value at EX in cycle 4, so forwarding from I1’s EX/MEM register to I2’s ALU input resolves the nearest RAW hazard.

2. I3 may have read a stale r2 during ID4, but its store value can be corrected by forwarding the I1 result from MEM/WB during I3’s EX5 into the store-data path. That corrected value is carried to MEM6 for the write. An equivalent appropriately staged store-data bypass also works.

3. I2 computes r4 at the end of EX4. I4 needs it during EX6; the value can be forwarded from I2’s MEM/WB register to I4’s ALU input. I4’s r2 operand is already correct from the same-cycle WB5/ID5 timing.

4. All producer results are available before their consumer execution or memory-use stages, so no bubble is required with these bypasses. None of the instructions is a load producing a value too late for an immediately following EX stage.

5. The qualification matters: an implementation forwarding only ALU inputs but not correcting the store-data path would not resolve I3’s stale store value. The yes answer assumes forwarding includes the needed store-data path, not an unspecified restricted implementation.

Original paper, page 8

1 mark · MCQ
Report issue

Single-instruction pipeline latency

Pipelining & Hazards

Question 1.8, GATE 2000: Compare latency T1 for one instruction on a pipelined CPU with T2 on an otherwise identical nonpipelined CPU. Options: T1≤T2,T1≥T2,T1<T2,or T1=T2 plus one fetch cycle.
Tap to enlarge
Your answer
Answer & solution

Answer: B under the standard same-work comparison (no official key was published)

Step 1: Pipelining overlaps different instructions; one instruction still passes through all of its stages. If stage delays are d1,…,dk, the unpipelined combinational work is their sum.

Step 2: A clocked pipeline needs roughly k·max(di), plus register overhead, which is at least sum(di). Perfectly balanced ideal stages can match the unpipelined latency; real pipeline registers usually increase it.

Thus T1≥T2, B, in this standard comparison. Throughput improvement across many instructions must not be confused with reducing one instruction’s latency; no universal extra-fetch-cycle formula follows.

Original paper, page 1

Descriptive
Report issue

Pipeline average with serialized branches

Pipelining & Hazards

Question 12(a), GATE 2000: An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead.

Task: Find average instruction execution time when every branch prevents overlap.
Question 12(a), GATE 2000: An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead.

Task: Find average instruction execution time when every branch prevents overlap.
Tap to enlarge
Shared context

An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead.

Answer & solution

Answer: 3.6 ns per instruction (CPI 1.8 at a 2 ns clock). (no official key was published)

1. Without branches, the pipeline accepts a new instruction every cycle, hence steady-state throughput time is 2 ns per instruction, not the individual instruction latency of 10 ns.

2. A branch fetched in cycle t completes at the end of t+4. The successor can be fetched in t+5, whereas normal overlap would fetch it in t+1. Thus each such branch adds four idle fetch cycles, or 8 ns.

3. The expected cycles per instruction are 1+0.20×4=1.8. Multiplying by 2 ns gives 3.6 ns per instruction.

4. Equivalently, 80% of inter-fetch intervals are 2 ns and 20% are 10 ns, so 0.8×2+0.2×10=3.6 ns. Finite programs have fill/drain effects; the question’s average uses the usual long-run idealization.

Original paper, page 8

Descriptive
Report issue

Pipeline average with conditional branches

Pipelining & Hazards

Question 12(b), GATE 2000: An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead. Of the branch instructions, 80% are conditional; half of those are taken. For a not-taken conditional branch the following instructions may overlap.

Task: Find the revised average instruction execution time.
Question 12(b), GATE 2000: An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead. Of the branch instructions, 80% are conditional; half of those are taken. For a not-taken conditional branch the following instructions may overlap.

Task: Find the revised average instruction execution time.
Question 12(b), GATE 2000: An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead. Of the branch instructions, 80% are conditional; half of those are taken. For a not-taken conditional branch the following instructions may overlap.

Task: Find the revised average instruction execution time.
Question 12(b), GATE 2000: An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead. Of the branch instructions, 80% are conditional; half of those are taken. For a not-taken conditional branch the following instructions may overlap.

Task: Find the revised average instruction execution time.
Tap to enlarge
Shared context

An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead. Of the branch instructions, 80% are conditional; half of those are taken. For a not-taken conditional branch the following instructions may overlap.

Answer & solution

Answer: 2.96 ns per instruction (CPI 1.48). (no official key was published)

1. Within the branch population, 20% are unconditional and always impose the no-overlap rule. Another 80%×50%=40% are taken conditional branches. Thus 60% of branches impose the four-cycle penalty.

2. As branches are 20% of all instructions, the fraction of all instructions causing the penalty is 0.20×0.60=0.12. The remaining 0.88 do not interrupt ideal overlap under the stated model.

3. Average CPI is 1+0.12×4=1.48, giving 1.48×2=2.96 ns. Equivalently 0.88×2+0.12×10=2.96 ns.

4. The 50% figure applies only to conditional branches, not to every branch. Ignoring the unconditional 20% of branches would incorrectly reduce the answer to 2.64 ns. No branch prediction or extra recovery penalty is introduced beyond the assumptions given.

Original paper, page 8

5 marks · Descriptive
Report issue

Schedule variable-duration pipeline stages

Pipelining & Hazards

Question 13, GATE 1999: Five instructions pass in order through F, D, E, W. Their respective cycle requirements are I1=(1,2,1,1), I2=(1,2,2,1), I3=(2,1,3,2), I4=(1,3,2,1), I5=(1,2,1,2). Find the completion time.
Tap to enlarge
Answer & solution

Answer: 15 clock cycles (no official key was published)

Step through it (7 steps)

Assume one instruction can occupy each stage at a time, in-order processing and no unmentioned data hazards. A completed instruction may wait for the next stage. A feasible schedule, using inclusive cycle ranges, is:

Instruction   F     D      E      W
I1            1     2–3    4      5
I2            2     4–5    6–7    8
I3            4–5   6      8–10   11–12
I4            6     8–10   11–12  13
I5            8     11–12  13     14–15

Waiting is not additional useful stage work: I2 stays at F through cycle 3; I3 stays at D during cycle 7; I4 stays at F during cycle 7; I5 stays at F through cycle 10. Thus the schedule is also feasible with ordinary backpressure rather than unbounded interstage queues. For a lower bound, even with unrestricted waiting buffers the earliest completion recurrence is C(i,j)=max(C(i−1,j),C(i,j−1))+duration(i,j), with zero boundary values. Its rows are (1,3,4,5), (2,5,7,8), (4,6,10,12), (5,9,12,13), (6,11,13,15). No legal schedule can finish before cycle 15, and the displayed schedule attains it. Summing all stage times would incorrectly remove pipeline overlap.

Original paper, page 7

Report issue

Why instruction prefetch can speed execution

Pipelining & Hazards

Question 1(iv), GATE 1992: Why does prefetching instructions into a buffer improve processing speed?
Question 1(iv), GATE 1992: Why does prefetching instructions into a buffer improve processing speed?
Tap to enlarge
Answer & solution

Answer: It overlaps instruction fetch with execution and reduces fetch waiting (no official key was published)

While the execution unit works on one instruction, a fetch unit can use available bus cycles to obtain later instructions into a queue. When execution needs the next instruction, it may already be present, hiding some memory latency rather than performing fetch and execution strictly serially. The gain is conditional on resources and a sufficiently predictable instruction stream. Branches can invalidate prefetched instructions, and a saturated shared memory bus can limit overlap, so prefetch is not a guarantee of speedup for every program.

Original paper, page 1