Professional Documents
Culture Documents
Experiment 12: Aim:-Software Used
Experiment 12: Aim:-Software Used
Aim:- Verilog HDL Design examples of Moore machine and Mealy machine.
Software Used:-
HDL Designer (version 2017.1a)
Precision RTL Synthesis (version 2012b.10)
Important Concepts/Theory:-
Mealy State Machine
A Finite State Machine is said to be Mealy state machine, if outputs depend on both present
inputs & present states. The block diagram of Mealy state machine is shown in the following
figure.
As shown in figure, there are two parts present in Mealy state machine. Those are
combinational logic and memory. Memory is useful to provide some or part of previous
outputs presentstatespresentstates as inputs of combinational logic.
So, based on the present inputs and present states, the Mealy state machine produces outputs.
Therefore, the outputs will be valid only at positive ornegativeornegative transition of the
clock signal.In the above figure, there are three states, namely A, B & C. These states are
labelled inside the circles & each circle corresponds to one state. Transitions between these
states are represented with directed lines. Here, 0 / 0, 1 / 0 & 1 / 1 denotes input / output. In
the above figure, there are two transitions from each state based on the value of input, x.
In general, the number of states required in Mealy state machine is less than or equal to the
number of states required in Moore state machine. There is an equivalent Moore state
machine for each Mealy state machine.
Moore State Machine
A Finite State Machine is said to be Moore state machine, if outputs depend only on present
states. The block diagram of Moore state machine is shown in the following figure.
Figure 12.3 Block diagram of Mealy state Figure 12.4 State diagram of Moore state
machine machine
As shown in figure, there are two parts present in Moore state machine. Those are
combinational logic and memory. In this case, the present inputs and present states
determine the next states. So, based on next states, Moore state machine produces the
outputs. Therefore, the outputs will be valid only after transition of the state.
Design Analysis:-
Moore FSM
Codes:-
module else
moore(sequence_in,clock,reset,detector_out)
current_state <= next_state; // otherwise,
;
next state
input clock; input reset; input sequence_in
end
output reg detector_out;
// combinational logic of the Moore FSM
parameter Zero=3'b000, // "Zero" State
// to determine next state
One=3'b001, // "One" State
always @(current_state,sequence_in)
OneZero=3'b011, // "OneZero" State
begin
OneZeroOne=3'b010, // "OnceZeroOne"
case(current_state)
State
Zero:begin
OneZeroOneOne=3'b110;//
"OneZeroOneOne" State if(sequence_in==1)
reg [2:0] current_state, next_state; // current next_state <= One;
state and next state
else
always @(posedge clock, posedge reset)
next_state <= Zero;
begin
end
if(reset==1)
One:begin
current_state <= Zero;
if(sequence_in==0) next_state <= OneZero;
end OneZeroOneOne:begin
OneZero:begin if(sequence_in==0)
OneZeroOne:begin endcase
if(sequence_in==0)
Results/Discussion:-
1.Waveform:
Mealy FSM
Codes:-
module mealy(out, in, rst, clk); input clk, rst;
always @(posedge clk or negedge rst) else begin out=0; state=s0; end
if(rst==0) begin state=s0; out=0; end s3: if(in==0) begin out=0; state=s1; end
Results/Discussion:-
1.Waveform:
b. Tech Schematic:
Concept (A) 2
Implementation (B) 2
Performance (C) 2
Total 6