DescriptionQ235
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 interpretationInput
8-bit sequence stream near rollover: 254, 255, 0, 1Output
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.
