Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Compare packet-symbol multisets

Hardware interview practice

Compare packet-symbol multisets

MediumRTL DatapathsSystemVerilog

Determine whether two bounded packet descriptors contain the same 4-bit symbols with the same multiplicities, regardless of ordering.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Reviewed example

Work through one case

Input
A length4=[1,2,1,3]; B length4=[3,1,2,1]; inactive suffixes contain unrelated data
Expected output
same_multiset=1

Both active prefixes have counts {1:2,2:1,3:1}; ordering and inactive lanes do not affect the 16-bin comparison.

What to cover

Requirements

  1. Support active lengths from zero through MAX_LEN and ignore inactive slots.
  2. Treat the 4-bit alphabet as exactly 16 possible symbols.
  3. Return false immediately in the logical result when lengths differ.
  4. Capture each request while idle and clear all per-request counting state.
asic.fyi · Learn silicon end to end.info@asic.fyi