You are on page 1of 4

State Machine Design Digital Electronics

Lesson 3.4 State Machine Design

State Machine Design


This presentation will
• Define a state machine.
• Provide several examples of everyday items that
are controlled by state machines.
State Machine Design • Illustrate the block diagram for a state machine.
• Review the design steps in the state machine
Digital Electronics design process.
• Provide an example of a simple state machine
design. 2

Definition of a State Machine Examples of State Machines


Many everyday devices are controlled by
State Machine state machines.
A synchronous sequential circuit,
consisting of a sequential logic section Traffic Light
and a combinational logic section,
whose outputs and internal flip-flops Garage Door Numeric Keypad
progress through a predictable
sequence of states in response to a
clock and other input signals. Vending Machine
3 4

Project Lead The Way, Inc.


Copyright 2009 1
State Machine Design Digital Electronics
Lesson 3.4 State Machine Design

State Machine Block Diagram State Machine Design Steps


1. Create State Graph
2. Determine State Variables and Assign
Input Output
Memory
...

...

...
Combo Combo Output(s) 3. Encode Outputs to States
...

Input(s) Flip-Flops
Logic Logic

4. Create State Transition Table


Clock
5. Write and Simplify Design Equations
6. Design Circuit
5 6

Anatomy of a State Graph State Machine Design Example


Example:
Transition Arc
Input Variable (X) Design a state machine that will count out the last four digits of the
(For Input X=0)
X=0 phone number 585-476-4691.
“4”  “6”  “9”  “1”
State (S0)
S0 In addition to the clock input, this design has a second input called
State “Bubble” Qa Qb Enable (EN). Whenever the Enable is a logic (1), the outputs will
0 0 X=1 Transition Arc continuously cycle through the four values 4,6,9,1. Whenever the
Y=0 & Z=1 (For Input X=1) Enable is a logic (0), the outputs will hold at their current values.

For this design any form of combinational logic may be used, but
State Variables
the sequential logic must be limited to D flip-flops.
(Qa & Qb)
C3
Output Variables Enable Phone C2
Clock Numbers C1
(Y & Z) 7 8
C0

Project Lead The Way, Inc.


Copyright 2009 2
State Machine Design Digital Electronics
Lesson 3.4 State Machine Design

Step #2: Determine State Variables


Step #1: Create State Graph and Assign
EN = 0 EN = 0

S0 S0
EN = 1 EN = 1 EN = 1 Qa Qb EN = 1
0 0
“4” “4”

EN = 0 EN = 0 EN = 0 EN = 0
S3 S1 S3 S1
Qa Qb Qa Qb
1 1 0 1
“1” “6” “1” “6”

S2 S2
Qa Qb
EN = 1 EN = 1 EN = 1 1 0 EN = 1
“9” “9”

EN = 0 9 EN = 0 10

Step #3: Encode Outputs to States Step #3: Create State Transition Table
EN = 0
Inputs Outputs
State

State

Present Input Next F/F Encoded


S0 State State Inputs Outputs
EN = 1 Qa Qb EN = 1
0 0
Qa Qb EN Qa* Qb* Da Db C3 C2 C1 C0
“4” S0 0 0 0 S0 0 0 0 0 0 1 0 0
C3=0 C2=1 C1=0 C0=0
EN = 0 EN = 0 S0 0 0 1 S1 0 1 0 1 0 1 0 0
S3 S1
Qa Qb Qa Qb
S1 0 1 0 S1 0 1 0 1 0 1 1 0
1 1 0 1
S1 0 1 1 S2 1 0 1 0 0 1 1 0
“1” “6”
C3=1 C2=0 C1=0 C0=1
S2 1 0 0 S2 1 0 1 0 1 0 0 1
C3=0 C2=0 C1=0 C0=1 C3=0 C2=1 C1=1 C0=0
S2 S2 1 0 1 S3 1 1 1 1 1 0 0 1
Qa Qb
EN = 1 1 0 EN = 1 S3 1 1 0 S3 1 1 1 1 0 0 0 1
“9” S3 1 1 1 S0 0 0 0 0 0 0 0 1

EN = 0 11 12

Project Lead The Way, Inc.


Copyright 2009 3
State Machine Design Digital Electronics
Lesson 3.4 State Machine Design

Step #4: Write and Simplify


Design Equations Step #5: Circuit Design
Da  Qa Qb EN  Qa Qb EN  Qa Qb EN  Qa Qb EN
Da  Qa Qb EN  Qa EN  Qa Qb

Db  Qa Qb EN  Qa Qb EN  Qa Qb EN  Qa Qb EN
Db  Qb EN  Qb EN
Db  Qb  EN

C3  Qa Qb EN  Qa Qb EN  Qa Qb
C2  Qa Qb EN  Qa Qb EN  Qa Qb EN  Qa Qb EN  Qa
C1  Qa Qb EN  Qa Qb EN  Qa Qb
C0  Qa Qb EN  Qa Qb EN  Qa Qb EN  Qa Qb EN  Qa 13 14

Block Diagram / Schematic

15

Project Lead The Way, Inc.


Copyright 2009 4

You might also like