Structural stalls from a multicycle EX stage
Pipelining & Hazards

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