GATE / CS ARCHIVE

SIMILAR QUESTIONS / COMPUTER ORGANIZATION & ARCHITECTURE

Sum structural stalls from multicycle execution occupancy

2 questions solved the same way, newest first. Back to Computer Organization & Architecture

How these are solved

For each instruction class, determine how many cycles the shared execution stage is occupied, subtract its ideal one-cycle service, and weight the excess by the class count.

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 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