MOORE FSM SEQUENCE DETECTOR
• OBJECTIVE
• INTRODUCTION
• FSM(FINITE STATE MACHINE)
• SEQUENCE DETECTOR
• MEALY MACHINE AND MOORE MACHINE
• VERILOG CODE
• TEST BENCH
• RTL SCHEMATIC
➢This Verilog project is to present a full Verilog code for Sequence
Detector using Moore FSM. A Verilog Testbench for the Moore FSM
sequence detector is also provided for simulation.
➢The Moore FSM keeps detecting a binary sequence from a digital
input and the output of the FSM goes high only when a "1011"
the sequence is detected.
➢ The Moore FSM output depends on only the current state of the
FSM. The state diagram of the Moor FSM for the sequence detector
is as follows: Next state of the Moore FSM depends on the sequence
input and the current state.
➢ The output of the Moore FSM only depends on the current state.
➢ The output of the sequence detector only goes high when the
"1011" sequence is detected
There are basically two types of
sequence detector depending on
the type of sequence they identify,
which are as follows:
• Overlapping Sequence
Detector
• Non-Overlapping Sequence
Detector:
Mealy machine: A simple Mealy machine has one input and one output.
Each transition edge is labeled with the value of the input (shown in red) and the
value of the corresponding output (shown in blue).
The machine starts in state Si.
Unit-IV; Professional Sales Representative (PSR).pptx
FSM.pdf
1. PONDICHERRY UNIVERSITY
DEPARTMENT OF ELECTRONICS
ENGINEERING
SUBMITTED TO:
PROF. DR. K ANUSUDHA
DEPT. OF ELECTRONICS ENGINEERING
SUBMITTED BY:
AWANISH KUMAR
M.TECH(ECE)-1st Year
21304006
MOORE FSM SEQUENCE DETECTOR
3. OBJECTIVE
➢This Verilog project is to present a full Verilog code for Sequence
Detector using Moore FSM. A Verilog Testbench for the Moore FSM
sequence detector is also provided for simulation.
➢The Moore FSM keeps detecting a binary sequence from a digital
input and the output of the FSM goes high only when a "1011"
sequence is detected.
10-06-2022 AWANISH KUMAR 3
4. INTRODUCTION
➢ The Moore FSM output depends on only the current state of the
FSM. The state diagram of the Moor FSM for the sequence detector
is as follows: Next state of the Moore FSM depends on the sequence
input and the current state.
➢ The output of the Moore FSM only depends on the current state.
➢ The output of the sequence detector only goes high when the
"1011" sequence is detected
10-06-2022 AWANISH KUMAR 4
5. SEQUENCE DETECTOR
• There are basically two types of
sequence detector depending on
the type of sequence they identify,
which are as follows:
• Overlapping Sequence
Detector
• Non-Overlapping Sequence
Detector:
10-06-2022 AWANISH KUMAR 5
Figure : - Sequence Detector
6. MEALY MACHINE AND MOORE MACHINE
Mealy machine: A simple Mealy machine has one input and one output.
Each transition edge is labelled with the value of the input (shown in red) and the
value of the corresponding output (shown in blue).
The machine starts in state Si.
Figure : - Mealy Machine
7. MOORE MACHINE
• Simple Moore machines have one input and one output. Output
depends only upon the present state.
• Generally, it has more states than Mealy Machine. Input change can
cause change in output change as soon as logic is done.
• In Moore machines, more logic is needed to decode the outputs since
it has more circuit delays.
10-06-2022 AWANISH KUMAR 7
8. VERILOG CODE
module
sequence_detector_moore(sequence_in,clock,reset,detector_out);
input clock;
input reset;
input sequence_in;
output reg detector_out;
parameter Zero=3'b000,
One=3'b001,
OneZero=3'b011,
OneZeroOne=3'b010,
OneZeroOneOne=3'b110;
reg [2:0] current_state, next_state;
// sequential memory of the Moore FSM
always @(posedge clock, posedge reset)
begin
if(reset==1)
current_state <= Zero;
// when reset=1, reset the state of the FSM to "Zero" State
else
current_state <= next_state; // otherwise, next state
end
always
@(current_state,sequence_in)
begin
case(current_state)
Zero:begin
if(sequence_in==1)
next_state = One;
else
next_state = Zero;
end
One:begin
if(sequence_in==0)
next_state = OneZero;
else
next_state = Zero;
end
One:begin
if(sequence_in==0)
next_state = OneZero;
else
next_state = One;
end
10-06-2022 AWANISH KUMAR 8
15. CONCLUSION
➢ The simulation waveform of the sequence detector shows exactly
how a Moore FSM works.
➢ Next state of the Moore FSM depends on the sequence input and the
current state.
➢ The output of the Moore FSM only depends on the current state.
➢ The output of the sequence detector only goes high when the "1011"
sequence is detected.