'FSM for long bit sequence

Currently, I'm working on a mealy fsm that detects a 17 bit sequence 10100001010000001. Due to the length of the sequence, I'm having difficulty figuring out which state to return to when the input doesn't allow me to move on to the next state. Any suggestions ??



Solution 1:[1]

Think about what previous pattern is satisfied when the expected pattern is not met. The FSM for a 10100001010000001 Mealy machine is shown below, in ASCII art (not sure how it will render here...)

s0-1->s1-0->s2-1->s3-0->s4-0->s5-0->s6-0->s7-1->s8-0->s9-1->s10-0->s11-0->s12-0->s13-0->s14-0->s15-0->s16-1->s17-0->s2
 |    |     |     |     |     |     |     |     |     |     |      |      |      |      |      |      |      |
 0    1     0     1     1     1     1     0     1     0     1      1      1      1      1      1      0      1
 |    |     |     |     |     |     |     |     |     |     |      |      |      |      |      |      |      |
s0    s1    s0    s1    s3    s1    s1    s0    s1    s0    s1     s3     s1     s1     s8     s1     s0     s1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andrew