DigitalLogic ComputerOrganization L8 FSM Handout
DigitalLogic ComputerOrganization L8 FSM Handout
COMPUTER ORGANIZATION
Lecture 8: Sequential Logic
Finite State Machines (2)
ELEC3010
ACKNOWLEGEMENT
2
COVERED IN THIS COURSE
❑ Binary numbers and logic gates
❑ Boolean algebra and combinational logic
❑ Sequential logic and state machines
❑ Binary arithmetic
Digital logic
❑ Memories
4
CAN YOU DO IT?
MOORE OR MEALY?
5
FSM DESIGN PROCEDURE
Last lecture
6
FSM DESIGN PROCEDURE
7
EXAMPLE FSM: PATTERN DETECTOR
❑ Monitors the input, and outputs a 1 whenever a specified
input pattern is detected
❑ Example: Output a 1 whenever 111 is detected on the
input over 3 consecutive clock cycles
– Overlapping patterns also detected (1111...)
❑ Input In
❑ Output Out
❑ Reset causes FSM to start in initial state
❑ Clock input not shown (always present)
8
111 PATTERN DETECTOR: MOORE STATE DIAGRAM
Moore
Mealy
9
TRANSITION/OUTPUT TABLE
❑ Shows the next state (S*) and output values for each
combination of current state (S) and inputs
❑ Used to derive the minimized state transition (S*) and
output Boolean equations
10
MOORE TRANSITION/OUTPUT TABLE
11
MEALY TRANSITION/OUTPUT TABLE
12
STATE ENCODING
❑ Binary encoding:
▪ N states need log2N FFs
▪ Example: S0=00; S1=01; S2=10; S3=11
❑ One-hot encoding:
▪ Each state has 1 flip-flop, Q of 1 FF =1, Q of others=0
▪ Example: S0=0001
S1=0010
S2=0100
S3=1000
13
STATE ENCODING-BINARY
Moore
Init=00
Got1=01
Got11=10
Got111=11
14
IMPLEMENT COMBINATIONAL LOGIC
Moore
Q0n = D0
Q1n = D1 Q1Q0
Q1Q0 In 00 01 11 10
In 00 01 11 10
0
0
1 1 1 1
1 1 1 1
Mealy
Init=00
Got1=01
Got11=10
16
IMPLEMENT COMBINATIONAL LOGIC
Mealy
Q0n = D0
Q1n = D1 Q1Q0 Out
Q1Q0 In 00 01 11 10 Q1Q0
In 00 01 11 10 In 00 01 11 10
0 x
0 xx 0 x
1 1 x
1 1 x 1 1 x 1
Moore
Init=0001
Got1=0010
Got11=0100
Got111=1000
18
PUSHBUTTON LOCK: MOORE STATE DIAGRAM
19
PUSHBUTTON LOCK: MEALY STATE DIAGRAM
20
ANALYZING THE SEQUENTIAL LOGIC
21
TRANSITION AND OUTPUT EQUATIONS
S0* =
S1* =
Out =
22
RECONSTRUCT STATE DIAGRAM
23
BEFORE NEXT CLASS
24