DD Lec FSM

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Digital Design PHY344

Finite State Machine


Armaghan Mohsin
Department of Physics
CIIT Islamabad

1
Finite State Machine
• A generic model for sequential circuits used in sequential
circuit design
• Unlike regular sequential circuit, the state transitions of an
FSM do not exhibit a simple, repetitive pattern
• FSM next-state logic is usually constructed from scratch
and is sometimes known as "random" logic.
• SMD next state logic is composed mostly of "structured
components, such as incrementors and shifters
Finite state machine block diagram

...
• State memory: Set of n flip-flops that hold the state
of the machine (up to 2^n distinct states)
• Next state logic: Combinational circuit that
determines the next state as a function of the current
state and the input
• Output logic: Combinational circuit that determines
the output as a function of the current state and the
input
Finite State Machine types

• Mealy machine: The


output depends on the

...
current state and input

• Moore machine: The


output depends only

...
on the current state
PREVIOUS STATE

STATE MEMORY
SET
D Q

NEXT CLR Q OUTPUTS


COMBINATIONAL STATE

...
INPUTS LOGIC
SET
D Q

CLR Q

CLK
Mealy or Moore Machine Comparison
• Consider a finite state machine example checks
a pattern of ‘10’ and asserts logic high when it is
detected.
• State diagram representations for the Mealy and
Moore machines are shown.
• The state diagram of the Mealy machine lists the
inputs with their associated outputs on state
transitions arcs.
• The value stated on the arrows for Mealy
machine is of the form Xi/Yi where Xi
represents input value and Yi represents output
value.
• A Moore machine produces a unique output for
every state irrespective of inputs.
• Accordingly, the state diagram of the Moore
machine associates the output with the state in
the form state-notation/output-value.
• The state transition arrows of Moore machine
are labeled with the input value that triggers
such transition.
• Since a Mealy machine associates outputs with
transitions, an output sequence can be
generated in fewer states using Mealy machine
as compared to Moore machine.
Timing Diagram Comparison
• Consider a state-machine, outputs ‘1’ if the input is ‘1’ for
three consecutive clocks.
Sequence Detector: Moore FSM Example

Moore based Finite State Diagram for Sequence Detector, it detects the “1001” pattern
Sequence Detector Testbench
Synchronous Finite State Machine

Block Diagram of FSM

Finite State Diagram ASM Block


Moore based Level Detector

FSD ASM
Mealy based Level detector

FSD

ASM Chart
Switch Bouncing andDebouncing
Debouncing Circuit FSM(Moore)

You might also like