Presentation is loading. Please wait.

Presentation is loading. Please wait.

Instructor: Alexander Stoytchev

Similar presentations


Presentation on theme: "Instructor: Alexander Stoytchev"— Presentation transcript:

1 Instructor: Alexander Stoytchev
CprE 281: Digital Logic Instructor: Alexander Stoytchev

2 Algorithmic State Machine (ASM) Charts
CprE 281: Digital Logic Iowa State University, Ames, IA Copyright © Alexander Stoytchev

3 Administrative Stuff Homework 12 is out It is due on Monday Dec 8
Last homework for the semester!

4 Administrative Stuff The FINAL exam is scheduled for
Friday Dec 12:00 – 2:00 PM It will be in this room.

5

6 Reading Material for Monday
“The Seven Secrets of Computer Power Revealed” by Daniel Dennett. This is Chapter 24 in his latest book “Intuition Pumps and Other Tools for Thinking”, 2013

7 Elements used in ASM charts
State name Output signals 0 (False) 1 (True) Condition or actions expression (Moore type) (a) State box (b) Decision box Conditional outputs or actions (Mealy type) (c) Conditional output box [ Figure 6.81 from the textbook ]

8 State Box State name Output signals or actions (Moore type)
[ Figure 6.81a from the textbook ]

9 State Box Indicated with a rectangle
Output signals or actions (Moore type) State name Indicated with a rectangle Equivalent to a node in the State diagram The name of the state is written outside the box Moore-type outputs are written inside the box Only the output that must be set to 1 is written (by default, if an output is not listed it is set to 0)

10 Decision Box Condition expression 0 (False) 1 (True)
[ Figure 6.81b from the textbook ]

11 Decision Box Indicated with a diamond shape
Condition expression 0 (False) 1 (True) Indicated with a diamond shape Used for a condition expression that must be tested The exit path is chosen based on the outcome of the test The condition is on one or more inputs to the FSM Shortcut notation: w means “is w equal to 1?”

12 Conditional Output Box
Conditional outputs or actions (Mealy type) Indicated with an oval shape Used for a Mealy-type output signals The outputs depend on the state variables and inputs The condition that determines when such outputs are generated is placed in a separate decision box [ Figure 6.81c from the textbook ]

13 Some Examples

14 FSM ASM chart ¤ C z 1 = Reset B A w [ Figure 6.3 from the textbook ]
A w [ Figure 6.3 from the textbook ] [ Figure 6.82 from the textbook ]

15 FSM ASM chart [ Figure 6.23 from the textbook ]

16 FSM ASM chart [ Figure 6.73 from the textbook ]

17 ASM Chart is different from a Flow Chart
The ASM chart implicitly includes timing info It is assumed that the underlying FSM changes from one state to another on every active clock edge Flow charts don’t make that assumption.

18 The general model for a sequential circuit
Combinational circuit Y k 1 y w n z m Outputs Next-state variables Present-state Inputs [ Figure 6.85 from the textbook ]

19 The general model for a sequential circuit

20 Examples of Solved Problems

21 Example 6.12

22 Goal Design an FSM that detects if the previous two values of the input w were equal to 00 or 11 If either condition is true then the output z should be set to 1; otherwise to 0.

23 State Diagram [ Figure 6.86 from the textbook ]

24 State Table for the FSM [ Figure 6.86 from the textbook ]

25 State Table for the FSM [ Figure 6.87 from the textbook ]

26 State-Assigned Table for the FSM
[ Figure 6.88 from the textbook ]

27 State-Assigned Table for the FSM
[ Figure 6.88 from the textbook ]

28 State-Assigned Table for the FSM

29 State-Assigned Table for the FSM

30 Next State and Output Expressions

31 An Improved State-Assigned Table
B,C, D, E – when y3=1 [ Figure 6.87 from the textbook ] [ Figure 6.89 from the textbook ]

32 An Improved State-Assigned Table
[ Figure 6.89 from the textbook ]

33 An Improved State-Assigned Table

34

35 An Improved State-Assigned Table

36 An Improved State-Assigned Table

37 Example 6.13

38 Goal Design an FSM that detects if the previous two values of the input w were equal to 00 or 11 But do this with two different FSMs. The first one detects two consecutive 1's. The second one detects two consecutive 0's. If either condition (i.e., output of FSM) is true then the output z should be set to 1; otherwise to 0.

39 Example 6.13 (Construct the first FSM)

40 FSM to detect two consecutive 1's (this was the first example in Chapter 6)
C: z = 1 Reset B: z = 0 A: z = 0 w = 1 [ Figure 6.3 from the textbook ]

41 Next state Present Output state A B C z w = w = 1 C: z = 1 Reset
B: z = 0 A: z = 0 w = 1 Next state Present Output state z w = w = 1 A B C

42 Next state Present Output state A A B B A C C A C 1 z w = w = 1
Reset B: z = 0 A: z = 0 w = 1 Next state Present Output state z w = w = 1 A A B B A C C A C 1 [ Figure 6.4 from the textbook ]

43 A Better State Encoding
Next state Present Output state z w = w = 1 A A B B A C C A C 1 Suppose we encoded our states another way: A ~ 00 B ~ 01 C ~ 11

44 A Better State Encoding
Next state Present Output state z w = w = 1 A A B B A C C A C 1 Next state Present Output state w = w = 1 A ~ 00 B ~ 01 C ~ 11 z

45 A Better State Encoding
Next state Present Output state z w = w = 1 A A B B A C C A C 1 Present Next state state w = 1 Output y 2 Y z A 00 01 B 11 C 10 dd d

46 Let's Derive the Logic Expressions
Present Next state state w = 1 Output y 2 Y z A 00 01 B 11 C 10 dd d [ Figure 6.16 from the textbook ]

47 Let's Derive the Logic Expressions
Present Next state state w = 1 Output y 2 Y z A 00 01 B 11 C 10 dd d Warning: This table does not enumerate y2y1, in the standard way, so be careful when filling out the K-Map. w 00 01 11 10 1 y 2 Y2 Y1 w 00 01 11 10 1 y 2 1 y 2 z

48 Let's Derive the Logic Expressions
Present Next state state w = 1 Output y 2 Y z A 00 01 B 11 C 10 dd d Warning: This table does not enumerate y2y1, in the standard way, so be careful when filling out the K-Map. Y2 Y1 y y y y z y 2 1 2 1 1 w y 2 00 01 11 10 00 01 11 10 1 w d d 1 1 1 1 d 1 1 1 1 d d 1 Y2(w, y2, y1) = wy1 Y1(w, y2, y1) = w z(y2, y1) = y2

49 Original State Encodings
New State Encodings Y1 Y 1 y y y y 2 1 2 1 w 00 01 11 10 w 00 01 11 10 d d 1 1 d 1 1 1 1 d Y2 Y 2 y y y y 2 1 2 1 w w 00 01 11 10 00 01 11 10 d d 1 1 1 d 1 1 1 d z y z y 1 1 y y 2 1 2 1 1 1 d 1 d 1

50 The Circuit Diagram Y1(w, y2, y1) = w Y2(w, y2, y1) = wy1
Q z Y2(w, y2, y1) = wy1 Q z(y2, y1) = y2 Y y 1 1 w D Q Clock Q Resetn [ Figure 6.17 from the textbook ]

51 Example 6.13 (Construct the second FSM)

52 FSM to detect two consecutive 0's
F: z = 1 Reset E: z = 0 D: z = 0 w 1 = This is similar to the previous one. Just invert the w's and relabel the states to D,E,F.

53 Next state Present Output state D E F z w = w = 1 F: z = 1 Reset
E: z = 0 D: z = 0 w 1 = Next state Present Output state z w = w = 1 D E F

54 Next state Present Output state D E D E F D F F D 1 z w = w = 1
F: z = 1 Reset E: z = 0 D: z = 0 w 1 = Next state Present Output state z w = w = 1 D E D E F D F F D 1

55 FSM that detects a sequence of two zeros
[ Figure 6.90 from the textbook ]

56 FSM that detects a sequence of two zeros
Only these two columns are swapped relative to the first FSM. And the states have different names now. Only these two columns are swapped relative to the first FSM. [ Figure 6.90 from the textbook ]

57 Let's Derive the Logic Expressions
Present Next state state w = 1 Output y 4 3 Y z D 00 01 E 11 F 10 dd d [ Figure 6.90 from the textbook ]

58 Let's Derive the Logic Expressions
Present Next state state w = 1 Output y 4 3 Y z D 00 01 E 11 F 10 dd d Y4 Y3 z y y y y y 4 3 4 3 4 w y 3 00 01 11 10 00 01 11 10 1 w 1 1 1

59 Let's Derive the Logic Expressions
Present Next state state w = 1 Output y 4 3 Y z D 00 01 E 11 F 10 dd d Y4 Y3 z y y y y y 4 3 4 3 3 w y 4 00 01 11 10 1 w 00 01 11 10 1 1 d 1 1 1 d 1 d 1 1 d d 1 Y4(w, y4 , y3 ) = w y3 Y3(w, y4 , y3 ) = w z(y4 , y3 ) = y4

60 The Circuit Diagram Y3(w, y4 , y3 ) = w Y4(w, y4 , y3 ) = w y3
Q z Y4(w, y4 , y3 ) = w y3 Q z(y2, y1 ) = y4 Y y 3 3 w D Q Clock Q Resetn

61 Example 6.13 (Combine the two FSMs)

62 The Two FSMs Detect two consecutive 1's Detect two consecutive 0's
C: z = 1 Reset B: z = 0 A: z = 0 w = 1 F: z = 1 Reset E: z = 0 D: z = 0 w 1 = Detect two consecutive 1's Detect two consecutive 0's

63 The Two Circuit Diagrams
Detect two consecutive 1's Detect two consecutive 0's

64 The Combined Circuit Diagram
Detect two consecutive 1's or two consecutive 0's

65 Example 6.14

66 Goal Design an FSM that detects if the previous two values of the input w were equal to 00 or 11 If either condition is true then the output z should be set to 1; otherwise to 0. Implement this as a Mealy-type machine

67 State Diagram [ Figure 6.91 from the textbook ]

68 Building the State Table
[ Figure 6.92 from the textbook ]

69 State Table [ Figure 6.92 from the textbook ]

70 Building the State-Assigned Table
[ Figure 6.93 from the textbook ]

71 State-Assigned Table [ Figure 6.93 from the textbook ]

72 Example 6.15

73 Goal Implement this state-assigned Table using JK flip-flips

74 Excitation table with JK flip-flops
[ Figure 6.94 from the textbook ]

75 JK Flip-Flops

76 Questions?

77 THE END


Download ppt "Instructor: Alexander Stoytchev"

Similar presentations


Ads by Google