S8.8.1 Size the Buffer

MediumImplement22 minIcarus Verilog · serverReview the topic

Find the smallest byte queue that survives a scheduled memory blackout and catches up before the next frame.

Hardware context: UART receive queue and DMA sink. SoC bandwidth budgeting

These are exercise values for an ap_soc capture channel. The queue starts empty. Each of eight active slots offers three bytes, followed by eight silent slots.

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

In slots 1 and 2, no bytes depart. From slot 3 onward RAM can remove up to two already queued bytes before arrivals enter. Unused service expires. Repeat the sixteen-slot frame.

EntryYour decision
FRAMESlots in a frame?
OFFERBytes offered per frame?
AFTER_TWOQueue after slot 2?
AFTER_THREEQueue after slot 3?
DEPTHMinimum byte capacity for no loss?
DRAINSilent slots needed to empty the peak?
EMPTYFirst end-of-slot with an empty queue after the burst?
LOSTBytes dropped in a frame with ten spaces, dropping newest excess bytes?
SPAREUnused service bytes per frame at the lossless depth?
FIRST_PEAKReplace the two-slot blackout with BLACKOUT active slots. Size for the first burst from empty.

Examples

Example 1

FRAME
Input
Slots in a frame?
Output
matches = 1

Eight active slots and eight silent slots make sixteen.

Example 2

OFFER
Input
Bytes offered per frame?
Output
matches = 1

Eight groups of three arrive.

Example 3

AFTER TWO
Input
Queue after slot 2?
Output
matches = 1

All six bytes wait through the blackout.

Constraints and Contract

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

Hints

Hint 1

Start from the previous backlog and subtract only bytes present.

Hint 2

Count arrivals after the grant and save the largest level.

Hint 3

Continue into the silent slots to see whether the next frame starts empty.

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

10 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

FRAME

Input
Slots in a frame?
Expected output
matches = 1

Eight active slots and eight silent slots make sixteen.

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

Icarus Verilog · server