State Machines (Closed Loop / Moore) Synch 2.1 Paul R. Godin Updated: January 2008
Synchronous Counters In a synchronous design, each Flip-Flop receives its own clock input, significantly reducing the instances of glitches. This module investigates how to provide a sequential output in any sequence desired. Synch 2.2
Synchronous Counters With each Flip-Flop receiving its own edge, there exists the flexibility to “steer” the output of each flip- flop independently by applying input states from an external source at the appropriate time. Synch 2.3 DQ0 or 1 Edge 0 or 1
State Machines A state machine is a device that will provide a sequence of binary numbers that may not follow a natural count sequence. An example of a state machine count: Synch State Diagram
Starting and Recycling When first applying power to the circuit the starting output is typically all low (000…). When designing a state machine this and any other unwanted state must be taken into account. Note that the recycling point is not necessarily all low (000…) Synch State Diagram
State Table Synch 2.6 PresentNext QAQA QBQB QCQC QAQA QBQB QCQC
Input versus Output states For state machine counts, the input to steer the output of each of the Flip-Flops can come from the outputs of any of the other Flip-Flops. By the use of external gates (if necessary), specific, usable sequences of Flip-Flop outputs can be used to create the necessary next input levels. K-Mapping techniques can be used to record and simplify the available outputs to create these inputs. Synch 2.7
Transition Tables It is necessary to know what inputs to the Flip-Flops are necessary to create the desired output states. Transition tables help define the operation of the Flip- Flop based on input states. Synch 2.8
Transition Tables D-Flip-Flop Transition Table The present and the next states of the outputs are indicated. The arrows indicate after the clocking edge. The input is what is required for the output transition to occur. Synch 2.9 Note: You must be able to build this table on your own.
Transition Tables J-K Flip-Flop Transition Table Indicated are the present and next Q-output states. If the flip-flop toggles or holds, indicate that binary value. Also note that both the J and K inputs need to be determined. The “X” indicates “Don’t Care” states (can be ‘1’ or ‘0’ input). Synch 2.10 Note: You must be able to build this table on your own.
J-K Flip Flop Transition Table Synch 2.11 Hold or Reset Toggle or Set Toggle or Reset Hold or Set States Note each output of the J-K Flip-Flop is the result of 2 possible states.
K-Mapping D-Flip-Flop Synch 2.12
Building a K-Map To build a K-Map the following is needed: ◦ State Diagram of the output sequence ◦ State Table of the output sequence ◦ Transition Table for the Flip-Flop we intend to use Present and Next outputs Necessary inputs to create those outputs Synch
K-Mapping a Sequence: Step 1 Draw the State Table and State Diagram of the output sequence. ( We will use our previous sequence example): Synch State DiagramState Table
K-Mapping a Sequence: Step 2 Determine the type of Flip-Flop and its Transition Table. For this example, we will use the D Flip-Flop: Synch 2.15 Transition Table
Present NextInput Q C Q B Q A D C D B D A K-Mapping a Sequence: Step 3 Synch 2.16 Build the State Table with the inputs indicated:
Present NextInput Q C Q B Q A D C D B D A K-Mapping a Sequence: Step 3 Synch 2.17 Build the State table with the inputs indicated: 010 Animated
K-Mapping a Sequence: Step 4 Produce K-Mapping Tables for each output: Synch QAQA QCQBQCQB Present NextInput Q C Q B Q A D C D B D A DCDC 010X010X 0XXX0XXX QAQA QCQBQCQB DBDB 110X110X 0XXX0XXX QAQA QCQBQCQB DADA 001X001X 0XXX0XXX
K-Mapping a Sequence: Step 4 Produce K-Mapping Tables for each output: Synch QAQA QCQBQCQB Present NextInput Q C Q B Q A D C D B D A DCDC 010X010X 0XXX0XXX QAQA QCQBQCQB DBDB 110X110X 0XXX0XXX QAQA QCQBQCQB DADA 001X001X 0XXX0XXX ANIMATEDANIMATED
K-Mapping a Sequence: Step 5 Simplify, using K-Mapping rules, and determine the inputs. Synch QAQA QCQBQCQB DCDC 010X010X 0XXX0XXX QAQA QCQBQCQB DBDB 110X110X 0XXX0XXX QAQA QCQBQCQB DADA 001X001X 0XXX0XXX D A =Q C D C =Q C Q B D B =Q C Q A
K-Mapping a Sequence: Step 6 Draw the Circuit Diagram, and verify its operations. Synch 2.21
K-Mapping J-K Flip-Flop Synch 2.22
Building a K-Map To build a K-Map, needed are: ◦ State Diagram of the output sequence ◦ State Table of the output sequence ◦ Transition Table for the Flip-Flop we intend to use Present and Next outputs Necessary inputs to create those outputs Synch
K-Mapping a Sequence: Step 1 Draw the State Table and State Diagram of the output sequence. ( We will use our previous sequence example): Synch State DiagramState Table
K-Mapping a Sequence: Step 2 Determine the type of Flip-Flop and its Transition Table. For this example, we will use the J-K Flip-Flop: Synch 2.25 Transition Table
K-Mapping a Sequence: Step 3 Synch 2.26 Build the State Table with the inputs indicated: 0 X 1 X 0 X PresentNextInput Q C Q B Q A J C K C J B K B J A K A X X 0 0 X X 1 X 1 1 X 0 X 0 X X 1
K-Mapping a Sequence Step 3 Synch X 1 X 0 X PresentNextInput Q C Q B Q A J C K C J B K B J A K A X X 0 0 X X 1 X 1 1 X 0 X 0 X X 1 Animated Build the State table with the inputs indicated:
K-Mapping a Sequence: Step 4a Produce K-Mapping Tables for each output: Synch QAQA QCQBQCQB JCJC 01XX01XX 0XXX0XXX QAQA QCQBQCQB KCKC XX1XXX1X XXXXXXXX QAQA QCQBQCQB JBJB 1XXX1XXX 0XXX0XXX 0 X 1 X 0 X PresentNextInput Q C Q B Q A J C K C J B K B J A K A X X 0 0 X X 1 X 1 1 X 0 X 0 X X 1
K-Mapping a Sequence: Step 4a Produce K-Mapping Tables for each output: Synch QAQA QCQBQCQB JCJC 01XX01XX 0XXX0XXX QAQA QCQBQCQB KCKC XX1XXX1X XXXXXXXX QAQA QCQBQCQB JBJB 1XXX1XXX 0XXX0XXX 0 X 1 X 0 X PresentNextInput Q C Q B Q A J C K C J B K B J A K A X X 0 0 X X 1 X 1 1 X 0 X 0 X X ANIMATEDANIMATED
K-Mapping a Sequence: Step 4b Produce K-Mapping Tables for each output: Synch QAQA QCQBQCQB KBKB X01XX01X XXXXXXXX QAQA QCQBQCQB JAJA 001X001X XXXXXXXX QAQA QCQBQCQB KAKA XXXXXXXX 1XXX1XXX 0 X 1 X 0 X PresentNextInput Q C Q B Q A J C K C J B K B J A K A X X 0 0 X X 1 X 1 1 X 0 X 0 X X 1
K-Mapping a Sequence: Step 5a Simplify, using K-Mapping rules, and determine the inputs. Synch 2.31 J C =Q B K C = QAQA QCQBQCQB JCJC 01XX01XX 0XXX0XXX QAQA QCQBQCQB KCKC XX1XXX1X XXXXXXXX QAQA QCQBQCQB JBJB 1XXX1XXX 0XXX0XXX J B =Q A
K-Mapping a Sequence: Step 5b Simplify, using K-Mapping rules, and determine the inputs. Synch QAQA QCQBQCQB KBKB X01XX01X XXXXXXXX QAQA QCQBQCQB JAJA 001X001X XXXXXXXX QAQA QCQBQCQB KAKA XXXXXXXX 1XXX1XXX K B =Q C J A =Q C K A =1
K-Mapping a Sequence: Step 6 Draw the Circuit Diagram, and verify its operations. Synch 2.33
Questions Which of the flop-flops is simpler to use for state machine counting? What would happen if all the flip-flops were changed from negative to positive edge devices? In what instances would we use custom count sequences? Synch 2.34
Review Customized state machine counting can be accomplished by using synchronous counter design. K-Mapping is useful in simplifying state machine design. Transition tables take the previous state into account for determining the digital state of the output. Synch 2.35
Exercise Design a counter with the following sequence: ◦ ◦ Using D-Flip Flops ◦ Using J-K Flip-Flops Verify the sequence using EWB Synch 2.36
END Synch 2.37 ©Paul R. Godin gmail.com