Top Banner
Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab --- make sure you are done before the end of next week Lab --- make sure you are done before the end of next week. Midterm 2: mean 74, median 75, std 15. Last lecture Robot ant in maze Started on FSM simplification a little bit Today M FSM i lifi ti 1 CSE370, Lecture 22 More on FSM simplification 21 FSM Minimization Two simple FSMs for odd parity checking 2 CSE370, Lecture 22 21
15

Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

Oct 02, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

Lecture 21

LogisticsHW8 due on Friday, HW9 due a week from today (last one)Lab --- make sure you are done before the end of next weekLab --- make sure you are done before the end of next week.Midterm 2: mean 74, median 75, std 15.

Last lectureRobot ant in mazeStarted on FSM simplification a little bit

TodayM FSM i lifi ti

1CSE370, Lecture 22

More on FSM simplification

21

FSM Minimization

Two simple FSMs for odd parity checking

2CSE370, Lecture 2221

Page 2: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

Collapsing States

We can make the top machine match the bottom machine by collapsing states S0 and S2 onto one state

3CSE370, Lecture 2221

FSM Design on the Cheap

Let’s say we start with this FSM for even parity checking

4CSE370, Lecture 2221

Page 3: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

FSM Design on the Cheap

Now an enterprising engineer comes along and says, “Hey, we can turn our even parity checker into an odd

it h k b j t ddi t t ”parity checker by just adding one state.”

5CSE370, Lecture 2221

Two Methods for FSM Minimization

Row matchingEasier to do by handMisses minimization opportunitiesMisses minimization opportunities

Implication tableGuaranteed to find the most reduced FSMMore complicated algorithm (but still relatively easy to write a program to do it)

6CSE370, Lecture 2221

Page 4: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

A simple problem

Design a Mealy machine with a single bit input and a single bit output. The machine should output a 0,

t f l if th i fexcept once every four cycles, if the previous four inputs matched one of two patterns (0110, 1010)

Example input/output trace:in: 0010 0110 1100 1010 0011 …out: 0000 0001 0000 0001 0000 …

7CSE370, Lecture 2221

… and a simple solution

8CSE370, Lecture 2221

Page 5: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

Find matching rowsNext State Output

Input Sequence Present State X=0 X=1 X=0 X=1Reset S0 S1 S2 0 0

0 S1 S3 S4 0 01 S2 S5 S6 0 000 S3 S7 S8 0 001 S4 S9 S10 0 010 S5 S11 S12 0 011 S6 S13 S14 0 0000 S7 S0 S0 0 0001 S8 S0 S0 0 0

9CSE370, Lecture 22

010 S9 S0 S0 0 0011 S10 S0 S0 1 0100 S11 S0 S0 0 0101 S12 S0 S0 1 0110 S13 S0 S0 0 0111 S14 S0 S0 0 0

21

Merge the matching rowsNext State Output

Input Sequence Present State X=0 X=1 X=0 X=1Reset S0 S1 S2 0 0

0 S1 S3 S4 0 01 S2 S5 S6 0 000 S3 S7 S8 0 001 S4 S9 S10’ 0 010 S5 S11 S10’ 0 011 S6 S13 S14 0 0000 S7 S0 S0 0 0001 S8 S0 S0 0 0

10CSE370, Lecture 22

010 S9 S0 S0 0 0011 or 101 S10’ S0 S0 1 0

100 S11 S0 S0 0 0110 S13 S0 S0 0 0111 S14 S0 S0 0 0

21

Page 6: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

Merge until no more rows matchNext State Output

Input Sequence Present State X=0 X=1 X=0 X=1Reset S0 S1 S2 0 0

0 S1 S3 S4 0 01 S2 S5 S6 0 000 S3 S7’ S7’ 0 001 S4 S7’ S10’ 0 010 S5 S7’ S10’ 0 011 S6 S7’ S7’ 0 0

Not (011 or 101) S7’ S0 S0 0 0011 or 101 S10’ S0 S0 1 0

11CSE370, Lecture 2221

The final state transition tableNext State Output

Input Sequence Present State X=0 X=1 X=0 X=1Reset S0 S1 S2 0 0

0 S1 S3’ S4’ 0 01 S2 S4’ S3’ 0 0

00 or 11 S3’ S7’ S7’ 0 001 or 10 S4’ S7’ S10’ 0 0

Not (011 or 101) S7’ S0 S0 0 0011 or 101 S10’ S0 S0 1 0

12CSE370, Lecture 2221

Page 7: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

A more efficient solution

13CSE370, Lecture 2221

Simple row matching does not guarantee most reduced state machine

Next StateNext StatePresent State X=0 X=1 Output

S0 S0 S1 0S1 S1 S2 1S2 S2 S1 0

14CSE370, Lecture 2221

Page 8: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

The Implication chart method

Here’s a slightly funkier FSM

15CSE370, Lecture 2221

Step 1: Draw the table

16CSE370, Lecture 2221

Page 9: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

Step 2: Consider the outputs

17CSE370, Lecture 2221

Step 3: Add transition pairs

Implied State PairsImplied State Pairs

18CSE370, Lecture 2221

Page 10: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

Step 4 (repeated): Consider transitions

19CSE370, Lecture 2221

Final reduced FSM

20CSE370, Lecture 2221

Page 11: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

Odd parity checker revisited

Next StateP t St t X 0 X 1 O t t

S1

21CSE370, Lecture 2221

Present State X=0 X=1 OutputS0 S0 S1 0S1 S1 S2 1S2 S2 S1 0

S2

S0 S1

S0-S2

S1–S1

inputs here

More complex state minimization

Multiple input example

present next state outputstate 00 01 10 11S0 S0 S1 S2 S3 1S1 S0 S3 S1 S4 0S2 S1 S3 S2 S4 1S3 S1 S0 S4 S5 0S4 S0 S1 S2 S5 1

inputs here

1001

11

00

00

01

1110

1000

11

00

1110

01

S0[1]

S2[1]

S1[0]

S3[0]

01

22CSE370, Lecture 22

symbolic state transition table

S4 S0 S1 S2 S5 1S5 S1 S4 S0 S5 0

1110

10

01

1100

11

10

1101

00S4[1]

S5[0]

21

Page 12: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

Minimized FSM

Implication chart methodcross out incompatible states based on outputsthen cross out more cells if indexed chart entries are already

S0-S1 S1-S3 S2-S2 S3-S4

S0-S1 S3-S0 S1-S4 S4 S5 minimized state table

present next state outputstate 00 01 10 11S0' S0' S1 S2 S3' 1S1 S0' S3' S1 S3' 0S2 S1 S3' S2 S0' 1S3' S1 S0' S0' S3' 0

then cross out more cells if indexed chart entries are already crossed out

S1

S2

S3

23CSE370, Lecture 22

S0-S0 S1-S1 S2-S2 S3-S5

S4-S5

S0-S1 S3-S4 S1-S0 S4-S5

S1-S0 S3-S1 S2-S2S4-S5

S4-S0S5-S5

S1-S1 S0-S4

minimized state table(S0==S4) (S3==S5)

S4

S5

S0 S1 S2 S3 S421

Minimizing incompletely specified FSMs

Equivalence of states is transitive when machine is fully specified

But its not transitive when don't cares are present

e.g., state outputS0 – 0 S1 is compatible with both S0 and S2S1 1 – but S0 and S2 are incompatibleS2 – 1

24CSE370, Lecture 22

S2 1

Hard to determining best grouping of states to yield the smallest number of final states

21

Page 13: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

Minimizing FSMs isn’t always good

Two FSMs for 0->1 edge detection

25CSE370, Lecture 2221

Minimal state diagram -> not necessarily best circuit

In Q1 Q0 Q1+ Q0

+

0 0 0 0 00 0 1 0 00 1 1 0 01 0 0 0 11 0 1 1 11 1 1 1 1– 1 0 0 0

26CSE370, Lecture 22

Q1+ = In (Q1 xor Q0)

Q0+ = In Q1’ Q0’

Out = Q1’ Q0

21

Page 14: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

Minimal state diagram -> not necessarily best circuit

In Q1 Q0 Q1+ Q0

+

0 0 0 0 00 0 1 1 00 1 0 0 0

0 1 1 1 01 0 0 0 11 0 1 1 11 1 0 0 1

1 1 1 1 1

27CSE370, Lecture 22

Q1+ = Q0

Q0+ = In

Out = Q1’ Q0

21

Circuit is simpler for non-simplified FSM

28CSE370, Lecture 2221

Page 15: Lecture 21 - courses.cs.washington.edu Slid… · Lecture 21 Logistics HW8 due on Friday, HW9 due a week from today (last one) Lab ---makesureyouaredonebeforetheendofnextweekmake

A little perspective

These kinds of optimizations are what CAD(Computer Aided Design)/EDA(Electronic Design Automation) is ll b tall about

The interesting problems are almost always computationally intractable to solve optimally

People really care about the automation of the design of billion-transistor chips

29CSE370, Lecture 2221