State Machines (Materials taken from: Principles of Computer

State Machines
(Materials taken largely from: Principles of
Computer Hardware by Alan Clements )
Big Picture
Mealy Machine
Remember?
Moore Machine
An Example
• Design a sequence detector that produces a
true output whenever it detects the sequence
010 at its input
– Example:
000110011010110001011 input
000000000000100000010 output
Step 1: Create a state transition
diagram
detect X=010
Next: Create state transition table
Step 2: build table directly
from diagram
Step 3: map from state names
to FF representations
Form truth table using inputs and
outputs
inputs
outputs
Moore machine
D flip-flop
The output is 1 when the state is (1,1)---a Moore Machine
Step 4: construct truth table
Define the combinational logic from
the truth table using SOP
• Using D flip-flops:
Q1+ = ~Q1 Q2 x + Q1 ~Q2 ~ x
Q2+ = ~x
OUT = Q1 Q2
Step 6: define next state & output logic
Build State Machine
Logisim Model
What about using JK
Flip-Flops?
JK flip-flop
State Machine with JK FFs