GATE / CS ARCHIVE

GATE CSE 2006 / QUESTION 42

Conditional-branch pipeline stalls

Computer Organization & Architecture · Pipelining & Hazards · Full GATE CSE 2006 paper

GATE 2006, Q42 2 marks · MCQ
Report issue

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