Skip to the selected question
ASIC.FYI

ASIC Interview Question Bank

1,000+ hardware interview questions.Curated and reviewed by industry engineers.1,000+ hardware questions1,000+ questionsEngineer-reviewed
DescriptionQ235
Page ↗
Q235DesignFollow-up to Q560ASIC interview problem

Handle wrapping 8-bit sequence numbers

TechniquesSequence numbersWraparoundModular arithmetic
DifficultyMedium
TopicReliable RTL
LanguageSystemVerilog
Requirements4 checkpoints
01

Problem

Adapt window membership and advancement to 8-bit sequence numbers that wrap from 255 to 0.

Function headerSystemVerilog
function bit in_window(byte unsigned seq);
function void advance_base();

Example input and output

Use this case to check your interpretation
Input
8-bit sequence stream near rollover: 254, 255, 0, 1
Output
All four values are classified as consecutive; next expected sequence is 2.
Explanation

Modulo-256 distance treats 0 as the successor of 255 rather than as an old packet.

02

Requirements (4)

  • Compute forward distance modulo 256.
  • Treat seq equal to base as distance zero.
  • Restrict the window to at most 128 entries so old and future values are unambiguous.
  • Wrap base modulo 256 after retirement.