Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ622
Page ↗
Q622ArchAMDASIC interview problem

Calculate CPI with branch and cache penalties

TechniquesArchCachePipeline
DifficultyMedium
TopicComputer Architecture
LanguageSystemVerilog
Requirements4 checkpoints
01

Problem

A five-stage pipeline completes 100 instructions. Base time is N+4 cycles. Ten mispredictions add two cycles each, five cache misses add eight cycles each, and penalties do not overlap. Write the total-cycle and CPI calculation.

Starting declarationSystemVerilog
N = 100 instructions
base cycles = N + 4
10 branch misses × 2 cycles
5 cache misses × 8 cycles
no penalty overlap

Example input and output

Use this case to check your interpretation
Input
Case 1: Base contribution
Case 2: Penalty contribution
Case 3: Final result
Output
Case 1: 100 + 4 = 104 cycles.
Case 2: 10×2 + 5×8 = 60 cycles.
Case 3: 164 cycles and CPI 1.64.
Explanation

The shown result follows by applying this rule: Pipeline fill and both penalty classes are counted once. The cases also demonstrate this requirement: Report CPI = 164 / 100 = 1.64 and state the no-overlap assumption.

02

Requirements (4)

  • Compute base time as 104 cycles.
  • Add 20 branch-penalty cycles and 40 cache-penalty cycles.
  • Report total cycles = 164.
  • Report CPI = 164 / 100 = 1.64 and state the no-overlap assumption.