Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Detect nonoverlapping 10110 sequences

Hardware interview practice

Detect nonoverlapping 10110 sequences

MediumSequential RTLSystemVerilog

Design a serial sequence detector that accepts one bit per clock and emits a one-cycle pulse when 10110 completes. Bits consumed by a match cannot begin the next match.

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 →
Starting point

Question code

input  logic clk, rst_n, bit_in;
output logic detected;
Reviewed example

Work through one case

Input
bit_in at successive rising edges = 1, 0, 1, 1, 0
Expected output
detected = 0, 0, 0, 0, 1

The fifth sampled bit completes 10110, so the registered output pulses for the following cycle and the FSM returns to its no-prefix state.

What to cover

Requirements

  1. Recognize the exact five-bit pattern 10110 without overlap.
  2. Pulse detected for exactly one destination clock cycle.
  3. Clear all partial-match state on reset.
  4. Retain the longest useful suffix after every mismatch, but return to the start state after a full match.
Continue practicing

Related questions

FSMsDetect overlapping 1011 sequences→
asic.fyi · Learn silicon end to end.info@asic.fyi