Sequence Detector "1011" (Moore, Non-Overlapping)
advanced · state_machine · 200 XP
Sign in to write your solution, run it in the simulator and submit it for grading.
Sign in or create a free account →Problem
Sequence Detector "1011" — Moore FSM, Non-Overlapping
Detect the 4-bit pattern **1011** in a continuous serial bit stream. Output `y` asserts for **exactly one clock cycle** after the complete pattern is detected, then the FSM returns to the initial idle state (non-overlapping).
**Interface**
| Port | Direction | Description |
|------|-----------|-------------------------------------|
| `clk` | input | Clock |
| `rst` | input | Async reset (active-high) |
| `x` | input | Serial input bit (1 bit per cycle) |
| `y` | output | Detection pulse (Moore, registered) |
**State Diagram:** minimum 4 states required:
- `IDLE`: no pattern bits seen
- `S1`: first `1` matched
- `S10`: `10` matched (when second bit is `0`)
- `S101`: `101` matched (when third bit is `1`)
- On the fourth bit, if it's `1`, fire output; else restart.
**Key insight (Moore vs Mealy):** Output `y` depends **only on the state**, not on the current input. `y=1` only when in the "detection state" (which appears only briefly as an intermediate state). After output asserts, FSM returns to IDLE (non-overlapping).
**Example trace:**
```
Input stream: 1_1011_0_1011_...
y pulses: 0_0001_0_0001_...
```
The second "1011" is detected independently; partial matches like "101" followed by "0" reset the sequence.
Constraints
- Use a 3-block FSM design: State Register (Block 1), Next-State Logic (Block 2), Output Logic (Block 3).
- Output y is a registered Moore output (depends only on state).
- Async reset returns to IDLE state.
- Non-overlapping: after detecting 1011, FSM returns to IDLE, not to a state that could reuse the last bit.
- y is high for exactly 1 cycle; then immediately goes low.
Examples
Input: x stream: 1, 1, 0, 1, 1
Output: y pulses on 5th bit (detect pattern)
Pattern matched
Input: x stream: 1, 0, 1, 1, 1
Output: y pulses on 5th bit; pattern wraps
Partial reset then match
Input: x stream: 1, 1, 1, 0, 1, 0, 1, 1
Output: y stays low; then pulses on 8th bit
First three 1s reset; then partial match rebuilds
Common questions
- What does the Sequence Detector "1011" (Moore, Non-Overlapping) problem ask you to build?
- Sequence Detector "1011" — Moore FSM, Non-Overlapping Detect the 4-bit pattern **1011** in a continuous serial bit stream. Output `y` asserts for **exactly one clock cycle** after the complete pattern is detected, then the FSM returns to the initial idle state (non-overlapping).
- What constraints does Sequence Detector "1011" (Moore, Non-Overlapping) have?
- Use a 3-block FSM design: State Register (Block 1), Next-State Logic (Block 2), Output Logic (Block 3).; Output y is a registered Moore output (depends only on state).; Async reset returns to IDLE state.; Non-overlapping: after detecting 1011, FSM returns to IDLE, not to a state that could reuse the last bit.; y is high for exactly 1 cycle; then immediately goes low.
- What is an example input and output for Sequence Detector "1011" (Moore, Non-Overlapping)?
- Input x stream: 1, 1, 0, 1, 1 gives output y pulses on 5th bit (detect pattern). Pattern matched
- Which Verilog concepts does Sequence Detector "1011" (Moore, Non-Overlapping) practise?
- state_machine, FSM, Moore, sequence-detect, interview.