Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ502
Page ↗
Q502DVASIC interview problem

Enforce a rolling bandwidth limit

TechniquesPythonSliding windowBandwidthDeque
DifficultyMedium
TopicReference Models
LanguagePython
Requirements4 checkpoints
01

Problem

Implement a checker allowing at most five accepted packets in any rolling ten-cycle window.

Example input and output

Use this case to check your interpretation
Input
accepted packet cycles=[0,1,2,3,4]; attempt at cycle 9; attempt at cycle 10
Output
cycle 9 packet rejected as sixth in the rolling window; cycle 10 packet accepted after cycle 0 expires
Explanation

Before checking cycle 10, events at or before 0 leave the ten-cycle window; the rejected cycle-9 event never pollutes legal state.

02

Requirements (4)

  • Accept monotonically nondecreasing cycle numbers.
  • Before checking a new packet at cycle c, remove events at or before c - 10.
  • Reject a sixth in-window packet without adding the illegal event to legal model state.
  • Use cycle counts rather than simulator time units.