This project implements a Finite State Machine (FSM) in Verilog to detect the sequence "11" in a serial input stream of bits.
The FSM is modeled as a Mealy machine, where the output depends on both the current state and the input.
- Input Stream:
1 0 1 1 0 1 1 1
- Output:
0 0 0 1 0 0 1 1
Whenever two consecutive 1
s are detected, the output detected
goes high.
- S0 → No
1
detected yet - S1 → Last input was
1
- S2 → Sequence
11
detected (output asserted)
S0 --(1)--> S1 S1 --(1)--> S2 (detected=1) S1 --(0)--> S0 S2 --(1)--> S2 (detected=1, allows overlapping) S2 --(0)--> S0
find_pattern.v
→ Verilog source code for the FSMfind_pattern_tb.v
→ Testbench to simulate the design
- Compile the design and testbench using your Verilog simulator (e.g., Icarus Verilog, ModelSim, or Vivado).
- Run the simulation and generate a waveform (
.vcd
) file. - Open the waveform in GTKWave (or another viewer) to visualize inputs and outputs.