S4.8.1 Bound the Wait

HardImplement35 minIcarus Verilog · serverReview the topic

Implement a worst-case admission budget for a CPU read behind older reads and two competing managers.

Hardware context: Three-manager SRAM arbiter. Latency budgeting for interrupt handlers

A grouped weighted arbiter visits CPU, DMA and debug in that order, wrapping to CPU. Their consecutive grant counts are wc, wd and wj. All enabled managers stay backlogged. A zero weight disables a manager.

A new CPU request enters behind older CPU requests at an arbitrary turn boundary, before the next grant starts. Return the tight worst-case time until its own grant starts. Each input is unsigned, from 0 through 7.

Signals in the Timeline

SignalWidthRole
sample10input of each check
Full specification

A CPU, DMA or debug turn consumes at most tc, td or tj cycles respectively. A zero cost means that service has no finite upper bound. Costs matter only for turns that precede this grant.

The bounds can all be attained together. Exclude the new request’s own service. Return 4095 if it might never start or its wait can be arbitrarily long. Otherwise return the exact maximum.

Examples

Example 1

Just Missed CPU
Input
wc=2; wd=1; wj=1; tc=1; td=3; tj=2; older=0
Output
cycles = 5

DMA costs three cycles and debug costs two.

Example 2

Two Older Reads
Input
wc=2; wd=1; wj=1; tc=1; td=3; tj=2; older=2
Output
cycles = 12

The two older CPU grants fill a visit. Another rival group can intervene.

Example 3

Unbounded Rival
Input
wc=1; wd=0; wj=1; tc=1; td=0; tj=0; older=0
Output
cycles = 4095

Debug is enabled and has no finite service limit.

Constraints and Contract

  • Drive cycles combinationally. The inputs describe one scheduler, with no upstream or return-path delay.

Hints

Hint 1

Try arriving just after the last CPU grant.

Hint 2

Draw one frame for older equal to wc.

Hint 3

Can an unused or future turn delay the grant?

What the grader checks: Tight bounds are independently calculated by walking every possible starting phase for each case.

241 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

Just Missed CPU

Input
wc=2; wd=1; wj=1; tc=1; td=3; tj=2; older=0
Expected output
cycles = 5

DMA costs three cycles and debug costs two.

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

Icarus Verilog · server