Pattern or Sequence Detector
Pattern or Sequence Detector
DETECTOR
KRISHNAPRIYA M
EDT
SEQUENCE DETECTOR
A stream of bit has been feed as input, when the clock is high and a
particular pattern/sequence is detected.
As soon as sequence is detected ,the output become high and then again
becomes low.
OVERLAPPING AND NON OVERLAPPING
In overlapping sequence detector, the last bit of one sequence becomes the first
bit of the next sequence.
Example : Detect ‘1001’
Input : 100100100111
Output : 000100100100
In non-overlapping sequence detector, the last bit of one sequence does not
become the first bit of the next sequence.
Example : Detect ‘1001’
Input : 100100100111
Output : 000100000100
1001 Sequence detector
MEALY MACHINE - OVERLAPPING
STATE DIAGRAM
1001 Sequence detector
MEALY MACHINE - OVERLAPPING
STATE TABLE
STATE ASSIGNMENT
A -00
B - 01
C - 10
D - 11
1001 Sequence detector
MEALY MACHINE - OVERLAPPING
Using K-map, _
QO+ = X + Q1 Q0
__ _ _
Q1+ = X Q1 Q0 + X Q1 QO
Y = X Q1 Q0
1001 Sequence detector
MEALY MACHINE - OVERLAPPING
_
DO = X + Q1 Q0
__ _ _
D1 = X Q1 Q0 + X Q1 QO
Y = X Q1 Q0
1001 Sequence detector
VERILOG CODE
STATE DIAGRAM
1001 Sequence detector
MEALY MACHINE - NON-OVERLAPPING
STATE TABLE
STATE ASSIGNMENT
A -00
B - 01
C - 10
D - 11
1001 Sequence detector
MEALY MACHINE - NON-OVERLAPPING
Using K-map,
_ _
QO+ = X Q1 + Q1 Q0
__ _ _
Q1+ = X Q1 Q0 + X Q1 QO
Y = X Q1 Q0
1001 Sequence detector
MEALY MACHINE - NON-OVERLAPPING
_ _
DO = X Q1 + Q1 Q0
__ _ _
D1 = X Q1 Q0 + X Q1 QO
Y = X Q1 Q0
1001 Sequence detector
MOORE MACHINE - OVERLAPPING
STATE DIAGRAM
1001 Sequence detector
MOORE MACHINE - OVERLAPPING
STATE TABLE
STATE ASSIGNMENT
A -000
B - 001
C - 010
E - 011
D - 100
1001 Sequence detector
MOORE MACHINE - OVERLAPPING
_ _ _
Q2+ = X Q1 Q0 Q1+ = X Q0 + X Q2
Q0+ = X Y = Q1 Q0
1001 Sequence detector
MOORE MACHINE - OVERLAPPING
_ _
D2 = X Q1 Q0
_
D1 = X Q0 + X Q2
D0 = X
Y = Q1 Q0
VERILOG CODE
1001 Sequence detector
if(x==1'b1) next_state<=B;
module 1010_detector (clk, reset, x, y);
else next_state<=C;
input clk, reset, x;
end
output y;
C:begin
parameter [2:0] A=3'b000;
parameter [2:0] B=3'b001; if(x==1'b1) next_state<=B;
parameter [2:0] C=3'b010; else next_state<=D;
parameter [2:0] E=3'B011 end
parameter [2:0] D=3'b100; D:begin
reg [3:0] state,next_state; if(x==1'b1) next_state<=E
always @(posedge clk or posedge reset) else next_state<=A;
begin end
if(reset) state<=A; E:begin
else if(x==1'b1) next_state<=B;
case(state) else next_state<=C;
A:begin end
if(x==1'b1) next_state<=B; endcase
else next_state<=A; end
end assign y=(state==E)?1:0;
B:begin endmodule
APPLICATIONS