Skip to main content

Sequence detector 1101 using SR flip-flops

Short answer

Use a Mealy machine with overlap and 2 SR flip-flops. Encode the four states as A=00, B=01, C=10, D=11. The flip-flop equations are S1 = Q1' Q0 X, R1 = Q1 Q0; S0 = Q1 Q0' X' + Q1' Q0' X, R0 = Q1' Q0 + Q0 X'; output Z = Q1 Q0 X.

Design a sequential machine that consists of a single input, X and the single output, Z. The machine is required to give output high when input contains serial message 1101 sequence. Use SR flip-flops only.

The machine has one serial input X and one output Z. Z = 1 when the last four bits received are 1, 1, 0, 1. Only SR flip-flops are used.

A Mealy machine is used (output depends on the present state and the present input), and overlapping sequences are detected. Since the sequence has 4 bits, 4 states are needed, so 2 SR flip-flops (Q1Q0Q_1Q_0) are used, clocked on the positive edge. (A Moore machine would need 5 states.)

Step 1: States

Present stateMeaningNext (X=0)Next (X=1)Z (X=0)Z (X=1)
Areset / no useful bitsAB00
B"1" receivedAC00
C"11" receivedDC00
D"110" receivedAB01

Step 2: State diagram

 Main path (label = X/Z):
 A -1/0-> B -1/0-> C -0/0-> D -1/1-> B
 Other transitions:
 A -0/0-> A    B -0/0-> A
 C -1/0-> C    D -0/0-> A

Step 3: State assignment

StateABCD
Q1 Q00 00 11 01 1

Step 4: Excitation table

SR excitation: 0→0: S=0, R=X; 0→1: S=1, R=0; 1→0: S=0, R=1; 1→1: S=X, R=0.

Q1 Q0XQ1+ Q0+S1R1S0R0Z
0 000 00X0X0
0 010 10X100
0 100 00X010
0 111 010010
1 001 1X0100
1 011 0X00X0
1 100 001010
1 110 101X01

Step 5: K-maps (rows Q1Q_1, columns Q0XQ_0X)

S1: Q1 / Q0X00011110
00010
1XX00
R1: Q1 / Q0X00011110
0XX0X
10011
S0: Q1 / Q0X00011110
00100
110X0
R0: Q1 / Q0X00011110
0X011
10X01
Z: Q1 / Q0X00011110
00000
10010

Step 6: Equations

S1=Q1‾Q0X,R1=Q1Q0S0=Q1Q0‾X‾+Q1‾Q0‾X,R0=Q1‾Q0+Q0X‾Z=Q1Q0X\begin{aligned} &S_1 = \overline{Q_1}Q_0X,\quad R_1 = Q_1Q_0 \\ &S_0 = Q_1\overline{Q_0}\overline{X} + \overline{Q_1}\overline{Q_0}X,\quad R_0 = \overline{Q_1}Q_0 + Q_0\overline{X} \\ &Z = Q_1Q_0X \end{aligned}

Step 7: Logic diagram

   +-----+       +-----+
S0>|S   Q|-Q0 S1>|S   Q|-Q1
   | FF0 |       | FF1 |
R0>|R    |    R1>|R    |
   +--^--+       +--^--+
      |             |
CLK---+-------------+
X = serial input, common to the gates
S1 = Q1'.Q0.X   R1 = Q1.Q0
S0 = Q1.Q0'.X' + Q1'.Q0'.X   R0 = Q1'.Q0 + Q0.X'
Z = Q1.Q0.X

The gates for each flip-flop input are built from the equations; the output gate gives Z directly (Mealy output).

Check with an input stream

X0110110100
StateAABCDBCDBA
Z0000100100

Z = 1 appears exactly on the clock in which the last bit of 1101 arrives; overlapping sequences are also detected.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Digital Logic chapter 9 questions →