S8.6.2 CPI from the Counters

EasyImplement12 minIcarus Verilog · serverReview the topic

Recover the cost of a short routine from paired snapshots, including a counter that crosses zero.

Hardware context: ap_soc performance monitoring. Core and peripheral performance analysis

These exercise snapshots use eight-bit wrapping counters. During each interval both increments total less than 256. Each pair reads cycles first and retired instructions second.

This worksheet uses named constants. The first three entries show how to record your decisions.

Signals in the Timeline

SignalWidthRole
question8input of each check
Full specification

Report CPI in tenths, truncating only the final result. Enter 255 when no instruction retires.

EntryYour decision
CLOCKSStart (12,4), stop (30,10). How many cycles elapsed?
WORKSame interval. How many instructions retired?
COSTSame interval. What is CPI in tenths?
WRAPStart (250,20), stop (10,24). CPI in tenths?
BOTHStart (252,254), stop (3,2). CPI in tenths?
IDLEStart (60,13), stop (81,13). CPI in tenths?
COMBINEDTwo successive windows use 6 and 18 cycles for 3 and 3 retirements. Combined CPI in tenths?
MISSThree fetches miss. One waits four extra cycles. How many miss starts does the selected event count?
REDIRECTFour branches retire. Two redirect fetch after a wrong prediction. Count mispredictions.
WRITESAPB write trace: one setup, three selected access edges with ready low, one with ready high. Count writes.
RETRYHigh, low, high again reads give 5, 0, 6. Enter 1 to retry or 0 to use the sample.
WEIGHTEDTwo successive windows use 8 and 9 cycles for 2 and 9 retirements. Combined CPI in tenths?
REPLAYA replay takes 11 + WAIT cycles for four retirements. CPI in tenths?

Examples

Example 1

CLOCKS
Input
Start (12,4), stop (30,10). How many cycles elapsed?
Output
value = 18

The clock advanced from 12 to 30.

Example 2

WORK
Input
Same interval. How many instructions retired?
Output
value = 6

Six instructions retired between the snapshots.

Example 3

COST
Input
Same interval. What is CPI in tenths?
Output
value = 30

Eighteen cycles shared by six instructions gives 3.0 cycles each.

Constraints and Contract

  • Keep the parameter and named constants. Use the numeric codes and units on this page.
  • For REPLAY, enter a constant expression using WAIT. Only this entry changes with the parameter. The supported integer range is 0 through 7, inclusive.

Hints

Hint 1

Pair snapshots from the same workload.

Hint 2

Use modular differences for each counter.

Hint 3

Divide elapsed cycles by completed instructions.

What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.

16 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.

See all 2 problems on this path

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

CLOCKS

Input
Start (12,4), stop (30,10). How many cycles elapsed?
Expected output
value = 18

The clock advanced from 12 to 30.

Run samples executes all 3 public checks. Check all tests runs 16 checks on the server.

Icarus Verilog · server