simple finite state machines

16
Simple Finite State Machines Last updated 8/3/20

Upload: others

Post on 05-May-2022

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Simple Finite State Machines

Simple Finite State Machines

Last updated 8/3/20

Page 2: Simple Finite State Machines

2 © tjEE 3921

Simple FSMs

These slides review the basics of HDL based Finite State Machines

Upon completion: You should be able to design and simulate basic FSMs

Page 3: Simple Finite State Machines

3 © tjEE 3921

Simple FSMs

• Finite State Machine

• Moore Machine

• Outputs depend only on the current state(S)

Next StateLogic

Register(D-FFs)

k kinputs

outputs

SS’M

OutputLogic

N

clk

Page 4: Simple Finite State Machines

4 © tjEE 3921

Simple FSMs

• Finite State Machine

• Mealy Machine

• Outputs depend on the current state(S) and the inputs

Next StateLogic

Register(D-FFs)

kk

inputs

outputs

SS’M

OutputLogic

N

clk

Page 5: Simple Finite State Machines

5 © tjEE 3921

Simple FSMs

• Finite State Machine

• To create an FSM in VHDL you combine• Enumerated types

• Simple register logic

• Combinatorial logic process

• Reset

• An abstraction of the FSM is used for RTL simulation

• Ensure that all states have entry and exit conditions

• Ensure that all states are covered in the code

Page 6: Simple Finite State Machines

6 © tjEE 3921

Simple FSMs

• Sequence detector - CD

• Detecting 11001101

rst

detect = 0resetb

A

detect = 0

1

0

B

detect = 0

1

0

C

detect = 0

0

1

D

detect = 0

0

1

det

detect = 1

G

detect = 0

1 F

detect = 0

0 E

detect = 0

1

10

01 0

Page 7: Simple Finite State Machines

7 © tjEE 3921

Simple FSMs

• Sequence detector - CD

Page 8: Simple Finite State Machines

8 © tjEE 3921

Simple FSMs

• Sequence detector - CD

Page 9: Simple Finite State Machines

9 © tjEE 3921

Simple FSMs

• Sequence detector - CD

Page 10: Simple Finite State Machines

10 © tjEE 3921

Simple FSMs

• Sequence detector - CD

Page 11: Simple Finite State Machines

11 © tjEE 3921

Simple FSMs

• Sequence detector - CD

repeat B Back to start Back to startBack to A

full sequence re-start

Page 12: Simple Finite State Machines

12 © tjEE 3921

Simple FSMs

• Priority Stoplight

ST0

NS: greenEW: red

ST1

NS: yellowEW: red

ST3

NS: redEW: yellow

ST2

NS: redEW: green

reset

TNS

TEW

TNS

TEW

Page 13: Simple Finite State Machines

13 © tjEE 3921

Simple FSMs

• Priority Stoplight

Page 14: Simple Finite State Machines

14 © tjEE 3921

Simple FSMs

• Priority Stoplight

Page 15: Simple Finite State Machines

15 © tjEE 3921

Simple FSMs

• Priority Stoplight

Page 16: Simple Finite State Machines

16 © tjEE 3921

• Priority Stoplight

Simple FSMs

normal cycle N/S Priority