ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

38
ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

Transcript of ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

Page 1: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 – Digital Electronics

Sequential Logic Circuits:

FSM Design

(Lecture #19)

Page 2: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 2

FSM Design: Procedure• Understand specifications

• Derive state diagram

• Create state table

• Perform state minimization (if necessary)

• Encode states (state assignment)

• Create state-assigned table

• Select type of Flip-Flop to use

• Determine Flip-Flop input equations and FSM output equation(s)

• Draw circuit diagram

Page 3: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 3

Mealy Machines

FSM Design

Page 4: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 4

Example:

Design a FSM that detects a sequence of three or more consecutive ones on an input bit stream.

The FSM should output a 1 when the sequence is detected, and a 0 otherwise.

This is another example of a sequence detector.

FSM Design (Mealy)

Page 5: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 5

FSM Design: Example (Mealy)

Input: 0 1 1 1 0 1 0 1 1 0 1 1 1 0 1 …

Output: 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 …

Page 6: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 6

FSM Design: Example (Mealy)

State Diagram

StateDiagram

Page 7: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 7

FSM Design: Example (Moore)

StateDiagram

Page 8: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 8

FSM Design: Example (Mealy)

State Table

Present State Next State Output

w = 0 w = 1 w = 0 w = 1

QA

QB

QA

+ QB

+ QA

+ QB

+ z z

A 0 0 A 0 0 B 0 1 0 0

B 0 1 A 0 0 C 1 0 0 0

C 1 0 A 0 0 C 1 0 0 1

D 1 1 d d d d d d

Next state is a functionof the present state

and the input

Output is a functionof the present state

and the input(Mealy Machine)

Using Binary Encodingfor the State Assignment

Page 9: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 9

FSM Design: Example (Mealy)

The choice of Flip-Flop determines the complexity of the combinational logic required in the design of the state machine.

Each type of Flip-Flop has a unique characteristic equation.

SR Flip-Flop

Q+ = S + R'.Q

D Flip-Flop

Q+ = D

JK Flip-Flop

Q+ = J.Q' + K'.Q

T Flip-Flop

Q+ = T '.Q + T.Q'

Page 10: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 10

Synthesis using D Flip-Flops

(Q+ = D)

FSM Design (Mealy)

Page 11: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 11

FSM Design: Example (Mealy)

Present State Next State FF Inputs

w = 0 w = 1 w = 0 w = 1

QA

QB

QA

+ QB

+ QA

+ QB

+ DA

DB

DA

DB

A 0 0 0 0 0 1 0 0 0 1

B 0 1 0 0 1 0 0 0 1 0

C 1 0 0 0 1 0 0 0 1 0

D 1 1 d d d d d d d d

Page 12: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 12

FSM Design: Example (Mealy)

Page 13: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 13

FSM Design: Example (Mealy)

Page 14: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 14

FSM Design: Example (Mealy)

Circuit Diagram

Page 15: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 15

Synthesis using JK Flip-Flops

(Q+ = J.Q' + K'.Q)

FSM Design (Mealy)

Page 16: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 16

FSM Design: Example (Mealy)

Excitation Table

+ Q Q+

Page 17: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 17

FSM Design: Example (Mealy)

Present State Next State FF Inputs

w = 0 w = 1 w = 0 w = 1

QA

QB

QA

+ QB

+ QA

+ QB

+ JA

KA

JB

KB

JA

KA

JB

KB

A 0 0 0 0 0 1 0 d 0 d 0 d 1 d

B 0 1 0 0 1 0 0 d d 1 1 d d 1

C 1 0 0 0 1 0 d 1 0 d d 0 0 d

D 1 1 d d d d d d d d d d d d

Page 18: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 18

FSM Design: Example (Mealy)

Karnaugh Maps

Page 19: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 19

FSM Design: Example (Mealy)

Circuit Diagram

Page 20: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 20

Example:

Design a Finite State Machine (FSM) that meets the following specifications:

This is another example of a sequence detector.

1. The circuit has one input, w, and one output, z.

2. All changes in the circuit occur on the positive edge of the clock.

3. The output z is equal to 1 if the pattern 010 is detected on the input w. Otherwise, the value of z is equal to 0. Overlapping sequences should not be detected.

FSM Design (Mealy)

Page 21: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 21

FSM Design: Example (Mealy)

Input (w): 0 0 0 0 1 0 1 0 0 1 0 0 1 0 1 …

Output (z): 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 …

Page 22: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 22

FSM Design: Example (Mealy)

State Diagram

Page 23: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 23

Example:

Design a Finite State Machine (FSM) that meets the following specifications:

This is another example of a sequence detector.

1. The circuit has one input, w, and one output, z.

2. All changes in the circuit occur on the positive edge of the clock.

3. The output z is equal to 1 if the pattern 010 is detected on the input w. Otherwise, the value of z is equal to 0. Overlapping sequences should be detected.

FSM Design (Mealy)

Page 24: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 24

FSM Design: Example (Mealy)

Input (w): 0 0 0 0 1 0 1 0 0 1 0 0 1 0 1 …

Output (z): 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 …

Page 25: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 25

FSM Design: Example (Mealy)

State Diagram

Page 26: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 26

Example:

Design a Finite State Machine (FSM) that meets the following specifications:

This is example of a sequence detector that can detect 2 sequences.

1. The circuit has one input, w, and one output, z.

2. All changes in the circuit occur on the positive edge of the clock.

3. The output z is equal to 1 if the pattern 010 or the pattern 110 is detected on the input w. Otherwise, the value of z is equal to 0. Overlapping sequences should be detected.

FSM Design (Mealy)

Page 27: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 27

FSM Design: Example (Mealy)

Input (w): 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 …

Output (z): 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 …

Page 28: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 28

FSM Design: Example (Mealy)

State Diagram

Page 29: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 29

Counters

Page 30: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 30

Example:

Design a 3-bit Counter

(using the formal FSM Design Procedure)

FSM Design (Counter)

Page 31: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 31

FSM Design: Example

Page 32: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 32

FSM Design: Example

What is the output of a counter?

Page 33: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 33

Synthesis using T Flip-Flops

(Q+ = T'.Q + T.Q')

Page 34: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 34

FSM Design: Example

+

Excitation Table

Page 35: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 35

FSM Design: Example

Q+ = T.Q' + T'.Qnext state

flip-flop input

Page 36: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 36

FSM Design: Example

Page 37: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 37

FSM Design: Example

Page 38: ECE 301 – Digital Electronics Sequential Logic Circuits: FSM Design (Lecture #19)

ECE 301 - Digital Electronics 38

Acknowledgments

The slides used in this lecture were taken, with permission, from those provided by Pearson Prentice Hall for

Digital Design (4th Edition).

They are the property of and are copyrighted by Pearson Education.