S4.8.2 Weights for a Latency Target

HardOptimize30 minIcarus Verilog · serverReview the topic

Choose the fastest DMA allocation that still gives an interrupt handler a deadline and debug a minimum share.

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

Fill in a parameterized planning worksheet. One circular frame serves one CPU word, then D DMA words, then J debug words. Every word takes one cycle. All three queues stay full.

Both D and J are integers from 1 through 7. The head CPU word must start within LIMIT lost slots, even if it just missed CPU. The entire frame must fit within FRAME slots. Debug must receive at least one word per SHARE slots on average.

Signals in the Timeline

SignalWidthRole
sample11input of each check
Full specification

Maximize the fraction of slots given to DMA. Among equal fractions choose the shortest frame. Encode the answer as 16 times D plus J. Return zero when no legal allocation exists.

LIMIT ranges from 1 to 15, FRAME from 3 to 16 and SHARE from 2 to 7. All parameters are integers. Count the slot containing the grant only as service.

Examples

Example 1

CPU Deadline Binds
Input
LIMIT=3, FRAME=6, SHARE=4
Output
dma_weight = 2, debug_weight = 1

A four-slot frame can serve two DMA words and one debug word.

Example 2

Debug Needs a Third
Input
LIMIT=6, FRAME=6, SHARE=3
Output
dma_weight = 3, debug_weight = 2

In six slots, debug needs two turns.

Example 3

No Room
Input
LIMIT=1, FRAME=5, SHARE=2
Output
dma_weight = 0, debug_weight = 0

Two active rivals already need two slots.

Constraints and Contract

  • Submit module answer with the three integer parameters and elaboration constant WEIGHTS. Use constant arithmetic or a constant function.

Hints

Hint 1

Draw a full round starting just after CPU service.

Hint 2

Compare two fractions without rounding them.

Hint 3

Keep the best legal pair until you finish the search.

What the grader checks: The private model enumerates legal allocations and walks the CPU wait around each circular schedule.

1264 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

CPU Deadline Binds

Input
LIMIT=3, FRAME=6, SHARE=4
Expected output
dma_weight = 2, debug_weight = 1

A four-slot frame can serve two DMA words and one debug word.

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

Icarus Verilog · server