SlideShare a Scribd company logo
1 of 8
Download to read offline
University of Florida                                                                Joel D. Schipper
ECE Department                                                                         Summer 2007


                 LECTURE #16: Moore & Mealy Machines
                        EEL 3701: Digital Logic and Computer Systems
                            Based on lecture notes by Dr. Eric M. Schwartz

Sequential Design Review:
      - A binary number can represent 2n states, where n is the number of bits.
              - The number of bits required is determined by the number of states.
                      Ex. 4 states requires 2 bits (22 = 4 possible states)
                      Ex. 19 states requires 5 bits (25 = 32 possible states)
      - One flip-flop is required per state bit.

        Steps to Design Sequential Circuits:
                1) Draw a State Diagram
                2) Make a Next State Truth Table (NSTT)
                3) Pick Flip-Flop type
                4) Add Flip-Flop inputs to NSTT using Flip-Flop excitation equation
                        (This creates an Excitation Table.)
                5) Solve equations for Flip-Flop inputs (K-maps)
                6) Solve equations for Flip-Flop outputs (K-maps)
                7) Implement the circuit



Moore State Machines:
      - Outputs determined solely by the current state
             - Outputs are unconditional (not directly dependent on input signals)

                                                INPUT


       INPUT                                                                            INPUT

                        STATE                                                STATE


                        OUTPUT                                           OUTPUT



                                                INPUT


                            GENERIC MOORE STATE MACHINE

Note: This should look at lot like the counter designs done previously.




                                            Page 1 of 8
University of Florida                                                             Joel D. Schipper
ECE Department                                                                      Summer 2007

Example: Design a simple sequence detector for the sequence 011. Include three outputs
             that indicate how many bits have been received in the correct sequence.
             (For example, each output could be connected to an LED.)

        1) Draw a State Diagram (Moore) and then assign binary State Identifiers.

         X=1                                                               X=0
                                             X=0
                             A                              B                     STATES
                                                                                   A=00
                                                                                   B=01
                             000                            001
                                                                                   C=11
                                                                                   D=10
                                   X=0

                 X=1                                X=0           X=1




                             D                              C


                             111                            011
                                             X=1

                 MOORE SEQUENCE DETECTOR FOR 011

Note: State ‘A’ is the starting state for this diagram.

        2) Make a Next State Truth Table (NSTT)
                              State      X    O2      O1     O0   State+
                                A        0    0       0      0      B
                                A        1    0       0      0      A
                                B        0    0       0      1      B
                                B        1    0       0      1      C
                               D         0    1       1      1      B
                               D         1    1       1      1      A
                               C         0    0       1      1      B
                               C         1    0       1      1      D

                        Q1       Q0      X     O2     O1     O0    Q1+      Q0+
                        0        0       0     0      0      0      0        1
                        0        0       1     0      0      0      0        0
                        0        1       0     0      0      1      0        1
                        0        1       1     0      0      1      1        1
                        1        0       0     1      1      1      0        1
                        1        0       1     1      1      1      0        0
                        1        1       0     0      1      1      0        1
                        1        1       1     0      1      1      1        0



                                              Page 2 of 8
University of Florida                                                                          Joel D. Schipper
ECE Department                                                                                   Summer 2007

        3) Pick Flip-Flop type
                - Pick D Flip-Flop

        4) Add Flip-Flop inputs to NSTT to make an excitation table

              Q1        Q0        X        O2        O1       O0       Q1+    Q0+     D1       D0
              0         0         0        0         0        0         0      1      0        1
              0         0         1        0         0        0         0      0      0        0
              0         1         0        0         0        1         0      1      0        1
              0         1         1        0         0        1         1      1      1        1
              1         0         0        1         1        1         0      1      0        1
              1         0         1        1         1        1         0      0      0        0
              1         1         0        0         1        1         0      1      0        1
              1         1         1        0         1        1         1      0      1        0

        5) Solve equations for Flip-Flop inputs (K-maps)

     XQ1Q0        00        01       11        10             XQ1Q0        00     01     11        10
       0            0         0        0         0               0            1      1      1         1
       1            0         1        1         0               1            0      1      0         0
                   D1 = XQ0                                                  D0 = X + Q1Q0

        6) Solve equations for Flip-Flop outputs (K-maps)

      Q1Q0        0         1              Q1Q0         0        1              Q1Q0    0        1
        0          0         0                0           0        0                0      0        1
        1          1         0                1           1        1                1      1        1
         O2 = Q1Q0                               O1 = Q1                             O0 = Q1 + Q0

Note: Moore designs do not depend on the inputs, so X can be neglected.

        7) Implement the circuit




                                                     Page 3 of 8
University of Florida                                                          Joel D. Schipper
ECE Department                                                                   Summer 2007

Example: Design a sequence detector that searches for a series of binary inputs to satisfy
             the pattern 01[0*]1, where [0*] is any number of consecutive zeroes. The
             output (Z) should become true every time the sequence is found.

        1) Draw a State Diagram (Moore) and then assign binary State Identifiers.




Recall: Picking state identifiers so that only one bit changes from state to state will
        generally help reduce the amount of hardware required for implementation.
        Only the transition from Success to First requires two bits to change.

        2) Make a Next State Truth Table (NSTT)

   State        Q2      Q1   Q0       X       Z      State+     Q2+     Q1+    Q0+
   Start        0       0    0        0       0       First      0       0      1
   Start        0       0    0        1       0      Start       0       0      0
   First        0       0    1        0       0       First      0       0      1
   First        0       0    1        1       0     Second       0       1      1
  Success       0       1    0        0       1       First      0       0      1
  Success       0       1    0        1       1      Start       0       0      0
  Second        0       1    1        0       0      Delay       1       1      1
  Second        0       1    1        1       0     Success      0       1      0
  unused        1       0    *        *       X        X         X       X      X
 SuccessD       1       1    0        0       1      Delay       1       1      1
 SuccessD       1       1    0        1       1     Success      0       1      0
   Delay        1       1    1        0       0      Delay       1       1      1
   Delay        1       1    1        1       0    SuccessD      1       1      0

        3-7) Do the remainder of the design steps.


                                          Page 4 of 8
University of Florida                                                        Joel D. Schipper
ECE Department                                                                 Summer 2007

Mealy State Machines:
      - Outputs determined by the current state and the current inputs.
             -Outputs are conditional (directly dependent on input signals)

                                     INPUT/OUTPUT


  INPUT/OUTPUT                                                            INPUT/OUTPUT


                        STATE                                   STATE




                                     INPUT/OUTPUT


                           GENERIC MEALY STATE MACHINE


Example: Design a sequence detector that searches for a series of binary inputs to satisfy
             the pattern 01[0*]1, where [0*] is any number of consecutive zeroes. The
             output (Z) should become true every time the sequence is found.

        1) Draw a State Diagram (Mealy) and then assign binary State Identifiers.




                                       Page 5 of 8
University of Florida                                                                                   Joel D. Schipper
     ECE Department                                                                                            Summer 2007

                                            Moore vs. Mealy Timing Comparison
Clock (CLK):          Initialize    1       2       3        4        5       6        7       8       9        A      B         C
Input (X):                 _        1       0       0        1        0       0        1       0       1        1      1         0
Moore Output (Z):          0        0       0       0        0         0      0        0       1       0        1      1         0
Mealy Output (Z):          _        0       0       0        0         0      0        1       0       1        1      0         0
Current State (Qi):     Start      Start   Start   First    First   Second   Delay   Delay   SuccD   Delay    SuccD   Succ      Start
Next State (Qi+):          _       Start   First   First   Second    Delay   Delay   SuccD   Delay   SuccD     Succ   Start     First


     Note: The Moore Machine lags one clock cycle behind the final input in the sequence.
            The Mealy Machine can change asynchronously with the input.


     One of the states in the previous Mealy State Diagram is unnecessary:




     Note: The Mealy Machine requires one less state than the Moore Machine! This is
            possible because Mealy Machines make use of more information (i.e. inputs) than
            Moore Machines when computing the output. Having less states makes for an
            easier design because our truth tables, K-maps, and logic equations are generally
            less complex. In some cases, the reduction of states is significant because it
            reduces the number of flip-flops required for design implementation. In spite of
            the advantages of using a design with less states, we will still use the 6-state
            Mealy Machine for the remainder of these notes to facilitate a direct
            comparison with the 6-state Moore Machine.


                                                             Page 6 of 8
University of Florida                                                                          Joel D. Schipper
 ECE Department                                                                                   Summer 2007

           2) Make a Next State Truth Table (NSTT)
         State           Q2     Q1        Q0       X        Z        State+        Q2+        Q1+     Q0+
         Start           0      0         0        0        0         First         0          0       1
         Start           0      0         0        1        0        Start          0          0       0
         First           0      0         1        0        0         First         0          0       1
         First           0      0         1        1        0       Second          0          1       1
        Success          0      1         0        0        0         First         0          0       1
        Success          0      1         0        1        0        Start          0          0       0
        Second           0      1         1        0        0        Delay          1          1       1
        Second           0      1         1        1        1       Success         0          1       0
        unused           1      0         *        *        X          X            X          X       X
       SuccessD          1      1         0        0        0        Delay          1          1       1
       SuccessD          1      1         0        1        1       Success         0          1       0
         Delay           1      1         1        0        0        Delay          1          1       1
         Delay           1      1         1        1        1      SuccessD         1          1       0

 Note: This is identical to the Moore Machine, except for output Z.


           3) Pick Flip-Flop type
                   Select D Flip-Flops..


           4) Add Flip-Flop inputs to NSTT using Flip-Flop excitation equation
              State       Q2    Q1   Q0    X   Z         State+    Q2+      Q1+   Q0+    D2    D1    D0
              Start       0     0    0     0   0          First     0        0     1     0     0     1
              Start       0     0    0     1   0         Start      0        0     0     0     0     0
              First       0     0    1     0   0          First     0        0     1     0     0     1
              First       0     0    1     1   0        Second      0        1     1     0     1     1
             Success      0     1    0     0   0          First     0        0     1     0     0     1
             Success      0     1    0     1   0         Start      0        0     0     0     0     0
             Second       0     1    1     0   0         Delay      1        1     1     1     1     1
             Second       0     1    1     1   1        Success     0        1     0     0     1     0
             unused       1     0    *     *   X           X        X        X     X     X     X     X
            SuccessD      1     1    0     0   0         Delay      1        1     1     1     1     1
            SuccessD      1     1    0     1   1        Success     0        1     0     0     1     0
              Delay       1     1    1     0   0         Delay      1        1     1     1     1     1
              Delay       1     1    1     1   1       SuccessD     1        1     0     1     1     0



           5) Solve equations for Flip-Flop inputs (K-maps)
Q2Q1Q0X     00   01     11    10     Q2Q1Q0X         00   01    11   10         Q2Q1Q0X      00   01     11   10
   00        0    0      0     0         00            0    0     1    0             00         1    0      1    1
   01        0    0      0     1         01            0    0     1    1             01         1    0      0    1
   11        1    0      1     1         11            1    1     1    1             11         1    0      0    1
   10        X    X      X     X         10            X    X     X    X             10         X    X      X    X
 D2 = Q2 Q0 + Q2 X + Q1Q0 X               D1 = Q2 + Q1Q0 + Q0 X                   D0 = Q0 X + Q0 X + Q1Q0

 Note: This is identical to the Moore Machine.



                                               Page 7 of 8
University of Florida                                                                 Joel D. Schipper
ECE Department                                                                          Summer 2007

         6) Solve equations for Flip-Flop outputs (K-maps)
         Moore                                       Mealy
 Q2Q1Q0          0       1           Q2Q1Q0X            00        01   11           10
   00             0       0              00                0         0    0            0
   01             1       0              01                0         0    1            0
   11             1       0              11                0         1    1            0
   10             X       X              10               X         X    X            X
         Z Moore = Q1Q0                            Z Mealy = Q2 X + Q1Q0 X

Recall: Moore outputs do not depend on the input.
              - ZMoore can only change when the state changes (synchronous).
              - ZMealy can change asynchronously because it can change with X.

Note: The Moore and Mealy Machines solve the same problem.


         7) Implement the circuit

                               D2                                  Q2
                                           D                   Q
  X, Q2, Q1, Q0
                      Combo
                       Logic                       D-FF


                                               C               Q


                               D1                                  Q1
                                           D                   Q                                 Z
  X, Q2, Q1, Q0       Combo
                       Logic                                                 Combo
                                                   D-FF
                                                                              Logic

                                               C               Q


                               D0                                  Q0
                                           D                   Q
  X, Q2, Q1, Q0       Combo
                       Logic                       D-FF


                                               C               Q
  Clk


Notes: The 3 boxes of combinational logic on the left are the same for both of the Moore
       and Mealy designs because the state transitions are the same. This would not
       have been the case had we implemented the 5-state Mealy Machine.

         The larger box of combinational logic on the right is different for the Moore and
         Mealy designs because the output, Z, is computed differently.




                                         Page 8 of 8

More Related Content

What's hot

Moore and mealy machines
Moore and mealy machinesMoore and mealy machines
Moore and mealy machines
lavishka_anuj
 
Analysis of state machines & Conversion of models
Analysis of state machines & Conversion of modelsAnalysis of state machines & Conversion of models
Analysis of state machines & Conversion of models
Abhilash Nair
 
Moore and Mealy machines
Moore and Mealy machinesMoore and Mealy machines
Moore and Mealy machines
Irfan Anjum
 
Designing Clocked Synchronous State Machine
Designing Clocked Synchronous State MachineDesigning Clocked Synchronous State Machine
Designing Clocked Synchronous State Machine
Abhilash Nair
 
State Machine Design and Synthesis
State Machine Design and SynthesisState Machine Design and Synthesis
State Machine Design and Synthesis
Abhilash Nair
 
Finite state machines
Finite state machinesFinite state machines
Finite state machines
dennis gookyi
 
2009-2 기말고사문제(초고주파공학)
2009-2 기말고사문제(초고주파공학)2009-2 기말고사문제(초고주파공학)
2009-2 기말고사문제(초고주파공학)
Yong Heui Cho
 
Ignou mca mcs 12 solved assignment 2011
Ignou mca mcs 12 solved assignment 2011Ignou mca mcs 12 solved assignment 2011
Ignou mca mcs 12 solved assignment 2011
Subeesh Up
 
Half adder and full adder
Half adder and full adderHalf adder and full adder
Half adder and full adder
Kamil Hussain
 
2010-2 기말고사문제(초고주파공학)
2010-2 기말고사문제(초고주파공학)2010-2 기말고사문제(초고주파공학)
2010-2 기말고사문제(초고주파공학)
Yong Heui Cho
 

What's hot (19)

Moore and mealy machines
Moore and mealy machinesMoore and mealy machines
Moore and mealy machines
 
Analysis of state machines & Conversion of models
Analysis of state machines & Conversion of modelsAnalysis of state machines & Conversion of models
Analysis of state machines & Conversion of models
 
Analysis of state machines
Analysis of state machinesAnalysis of state machines
Analysis of state machines
 
Moore and Mealy machines
Moore and Mealy machinesMoore and Mealy machines
Moore and Mealy machines
 
Designing Clocked Synchronous State Machine
Designing Clocked Synchronous State MachineDesigning Clocked Synchronous State Machine
Designing Clocked Synchronous State Machine
 
Moore and mealy machines
Moore and mealy machinesMoore and mealy machines
Moore and mealy machines
 
State Machine Design and Synthesis
State Machine Design and SynthesisState Machine Design and Synthesis
State Machine Design and Synthesis
 
Lec 25 26_27
Lec 25 26_27Lec 25 26_27
Lec 25 26_27
 
Mealy and moore machine
Mealy and moore machineMealy and moore machine
Mealy and moore machine
 
Finite state machines
Finite state machinesFinite state machines
Finite state machines
 
Combinational logic 2
Combinational logic 2Combinational logic 2
Combinational logic 2
 
Sequential Circuit
Sequential CircuitSequential Circuit
Sequential Circuit
 
Combinational logic 1
Combinational logic 1Combinational logic 1
Combinational logic 1
 
2009-2 기말고사문제(초고주파공학)
2009-2 기말고사문제(초고주파공학)2009-2 기말고사문제(초고주파공학)
2009-2 기말고사문제(초고주파공학)
 
Ignou mca mcs 12 solved assignment 2011
Ignou mca mcs 12 solved assignment 2011Ignou mca mcs 12 solved assignment 2011
Ignou mca mcs 12 solved assignment 2011
 
Half adder and full adder
Half adder and full adderHalf adder and full adder
Half adder and full adder
 
Tabela derivada
Tabela derivadaTabela derivada
Tabela derivada
 
Lecture.1
Lecture.1Lecture.1
Lecture.1
 
2010-2 기말고사문제(초고주파공학)
2010-2 기말고사문제(초고주파공학)2010-2 기말고사문제(초고주파공학)
2010-2 기말고사문제(초고주파공학)
 

Viewers also liked

Sequential logic implementation
Sequential logic implementationSequential logic implementation
Sequential logic implementation
Arif Siyal
 

Viewers also liked (20)

Semana por la paz 2016
Semana por la paz 2016Semana por la paz 2016
Semana por la paz 2016
 
Semana 8
Semana 8Semana 8
Semana 8
 
Agenda 25 al 29 de abril
Agenda 25 al 29 de abrilAgenda 25 al 29 de abril
Agenda 25 al 29 de abril
 
Semana 4
Semana 4Semana 4
Semana 4
 
Semana 27
Semana 27Semana 27
Semana 27
 
Win trust lucky chain
Win trust lucky chainWin trust lucky chain
Win trust lucky chain
 
Semana 26
Semana 26Semana 26
Semana 26
 
Semana 37
Semana 37Semana 37
Semana 37
 
Semana 23
Semana 23Semana 23
Semana 23
 
Alfatihah ayat 6348
Alfatihah ayat 6348Alfatihah ayat 6348
Alfatihah ayat 6348
 
Mealy machine
Mealy machineMealy machine
Mealy machine
 
Semana 2
Semana 2Semana 2
Semana 2
 
10 al 13 de mayo
10 al 13 de mayo10 al 13 de mayo
10 al 13 de mayo
 
Semana 13
Semana 13Semana 13
Semana 13
 
טלי P.p
טלי P.pטלי P.p
טלי P.p
 
Mission: Space
Mission: SpaceMission: Space
Mission: Space
 
Semana 38
Semana 38Semana 38
Semana 38
 
Tugas pendahuluan
Tugas pendahuluanTugas pendahuluan
Tugas pendahuluan
 
Sequential logic implementation
Sequential logic implementationSequential logic implementation
Sequential logic implementation
 
Big infrastructure is building Canada’s future
Big infrastructure is building Canada’s futureBig infrastructure is building Canada’s future
Big infrastructure is building Canada’s future
 

Similar to 16%20 lecture

Mux decod pld2_vs2
Mux decod pld2_vs2Mux decod pld2_vs2
Mux decod pld2_vs2
WanNurdiana
 
Dateof birthdesignproblem 1_
Dateof birthdesignproblem 1_Dateof birthdesignproblem 1_
Dateof birthdesignproblem 1_
rofldork
 
Fault tolerant and online testability
Fault tolerant and online testabilityFault tolerant and online testability
Fault tolerant and online testability
Sajib Mitra
 
Microsoft Word Hw#2
Microsoft Word   Hw#2Microsoft Word   Hw#2
Microsoft Word Hw#2
kkkseld
 
Electronic Circuits
Electronic  CircuitsElectronic  Circuits
Electronic Circuits
gavhays
 
Tele4653 l11
Tele4653 l11Tele4653 l11
Tele4653 l11
Vin Voro
 
Copy of 7.digital basicsa
Copy of 7.digital basicsaCopy of 7.digital basicsa
Copy of 7.digital basicsa
Chethan Nt
 
7.digital basicsa
7.digital basicsa7.digital basicsa
7.digital basicsa
Chethan Nt
 

Similar to 16%20 lecture (20)

Mux decod pld2_vs2
Mux decod pld2_vs2Mux decod pld2_vs2
Mux decod pld2_vs2
 
Lect21 Engin112
Lect21 Engin112Lect21 Engin112
Lect21 Engin112
 
Dateof birthdesignproblem 1_
Dateof birthdesignproblem 1_Dateof birthdesignproblem 1_
Dateof birthdesignproblem 1_
 
MCS 012 computer organisation and assembly language programming assignment…
MCS 012 computer organisation and assembly language programming assignment…MCS 012 computer organisation and assembly language programming assignment…
MCS 012 computer organisation and assembly language programming assignment…
 
Fault tolerant and online testability
Fault tolerant and online testabilityFault tolerant and online testability
Fault tolerant and online testability
 
Bca i sem de lab
Bca i sem  de labBca i sem  de lab
Bca i sem de lab
 
Lect23 Engin112
Lect23 Engin112Lect23 Engin112
Lect23 Engin112
 
Plc 2
Plc 2Plc 2
Plc 2
 
Microsoft Word Hw#2
Microsoft Word   Hw#2Microsoft Word   Hw#2
Microsoft Word Hw#2
 
Electronic Circuits
Electronic  CircuitsElectronic  Circuits
Electronic Circuits
 
Tele4653 l11
Tele4653 l11Tele4653 l11
Tele4653 l11
 
EASA Part 66 Module 5.5 : Logic Circuit
EASA Part 66 Module 5.5 : Logic CircuitEASA Part 66 Module 5.5 : Logic Circuit
EASA Part 66 Module 5.5 : Logic Circuit
 
Copy of 7.digital basicsa
Copy of 7.digital basicsaCopy of 7.digital basicsa
Copy of 7.digital basicsa
 
7.digital basicsa
7.digital basicsa7.digital basicsa
7.digital basicsa
 
Informatico
InformaticoInformatico
Informatico
 
Lec16 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Fi...
Lec16 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Fi...Lec16 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Fi...
Lec16 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Fi...
 
Lecture 18 M - Copy.pptx
Lecture 18 M - Copy.pptxLecture 18 M - Copy.pptx
Lecture 18 M - Copy.pptx
 
Class 13: Digital Logic
Class 13: Digital LogicClass 13: Digital Logic
Class 13: Digital Logic
 
Register and counter
Register and counter Register and counter
Register and counter
 
Lec9
Lec9Lec9
Lec9
 

16%20 lecture

  • 1. University of Florida Joel D. Schipper ECE Department Summer 2007 LECTURE #16: Moore & Mealy Machines EEL 3701: Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Sequential Design Review: - A binary number can represent 2n states, where n is the number of bits. - The number of bits required is determined by the number of states. Ex. 4 states requires 2 bits (22 = 4 possible states) Ex. 19 states requires 5 bits (25 = 32 possible states) - One flip-flop is required per state bit. Steps to Design Sequential Circuits: 1) Draw a State Diagram 2) Make a Next State Truth Table (NSTT) 3) Pick Flip-Flop type 4) Add Flip-Flop inputs to NSTT using Flip-Flop excitation equation (This creates an Excitation Table.) 5) Solve equations for Flip-Flop inputs (K-maps) 6) Solve equations for Flip-Flop outputs (K-maps) 7) Implement the circuit Moore State Machines: - Outputs determined solely by the current state - Outputs are unconditional (not directly dependent on input signals) INPUT INPUT INPUT STATE STATE OUTPUT OUTPUT INPUT GENERIC MOORE STATE MACHINE Note: This should look at lot like the counter designs done previously. Page 1 of 8
  • 2. University of Florida Joel D. Schipper ECE Department Summer 2007 Example: Design a simple sequence detector for the sequence 011. Include three outputs that indicate how many bits have been received in the correct sequence. (For example, each output could be connected to an LED.) 1) Draw a State Diagram (Moore) and then assign binary State Identifiers. X=1 X=0 X=0 A B STATES A=00 B=01 000 001 C=11 D=10 X=0 X=1 X=0 X=1 D C 111 011 X=1 MOORE SEQUENCE DETECTOR FOR 011 Note: State ‘A’ is the starting state for this diagram. 2) Make a Next State Truth Table (NSTT) State X O2 O1 O0 State+ A 0 0 0 0 B A 1 0 0 0 A B 0 0 0 1 B B 1 0 0 1 C D 0 1 1 1 B D 1 1 1 1 A C 0 0 1 1 B C 1 0 1 1 D Q1 Q0 X O2 O1 O0 Q1+ Q0+ 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 1 1 1 0 1 1 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 0 Page 2 of 8
  • 3. University of Florida Joel D. Schipper ECE Department Summer 2007 3) Pick Flip-Flop type - Pick D Flip-Flop 4) Add Flip-Flop inputs to NSTT to make an excitation table Q1 Q0 X O2 O1 O0 Q1+ Q0+ D1 D0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 1 0 1 1 1 1 0 1 1 1 0 1 0 5) Solve equations for Flip-Flop inputs (K-maps) XQ1Q0 00 01 11 10 XQ1Q0 00 01 11 10 0 0 0 0 0 0 1 1 1 1 1 0 1 1 0 1 0 1 0 0 D1 = XQ0 D0 = X + Q1Q0 6) Solve equations for Flip-Flop outputs (K-maps) Q1Q0 0 1 Q1Q0 0 1 Q1Q0 0 1 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 1 1 1 O2 = Q1Q0 O1 = Q1 O0 = Q1 + Q0 Note: Moore designs do not depend on the inputs, so X can be neglected. 7) Implement the circuit Page 3 of 8
  • 4. University of Florida Joel D. Schipper ECE Department Summer 2007 Example: Design a sequence detector that searches for a series of binary inputs to satisfy the pattern 01[0*]1, where [0*] is any number of consecutive zeroes. The output (Z) should become true every time the sequence is found. 1) Draw a State Diagram (Moore) and then assign binary State Identifiers. Recall: Picking state identifiers so that only one bit changes from state to state will generally help reduce the amount of hardware required for implementation. Only the transition from Success to First requires two bits to change. 2) Make a Next State Truth Table (NSTT) State Q2 Q1 Q0 X Z State+ Q2+ Q1+ Q0+ Start 0 0 0 0 0 First 0 0 1 Start 0 0 0 1 0 Start 0 0 0 First 0 0 1 0 0 First 0 0 1 First 0 0 1 1 0 Second 0 1 1 Success 0 1 0 0 1 First 0 0 1 Success 0 1 0 1 1 Start 0 0 0 Second 0 1 1 0 0 Delay 1 1 1 Second 0 1 1 1 0 Success 0 1 0 unused 1 0 * * X X X X X SuccessD 1 1 0 0 1 Delay 1 1 1 SuccessD 1 1 0 1 1 Success 0 1 0 Delay 1 1 1 0 0 Delay 1 1 1 Delay 1 1 1 1 0 SuccessD 1 1 0 3-7) Do the remainder of the design steps. Page 4 of 8
  • 5. University of Florida Joel D. Schipper ECE Department Summer 2007 Mealy State Machines: - Outputs determined by the current state and the current inputs. -Outputs are conditional (directly dependent on input signals) INPUT/OUTPUT INPUT/OUTPUT INPUT/OUTPUT STATE STATE INPUT/OUTPUT GENERIC MEALY STATE MACHINE Example: Design a sequence detector that searches for a series of binary inputs to satisfy the pattern 01[0*]1, where [0*] is any number of consecutive zeroes. The output (Z) should become true every time the sequence is found. 1) Draw a State Diagram (Mealy) and then assign binary State Identifiers. Page 5 of 8
  • 6. University of Florida Joel D. Schipper ECE Department Summer 2007 Moore vs. Mealy Timing Comparison Clock (CLK): Initialize 1 2 3 4 5 6 7 8 9 A B C Input (X): _ 1 0 0 1 0 0 1 0 1 1 1 0 Moore Output (Z): 0 0 0 0 0 0 0 0 1 0 1 1 0 Mealy Output (Z): _ 0 0 0 0 0 0 1 0 1 1 0 0 Current State (Qi): Start Start Start First First Second Delay Delay SuccD Delay SuccD Succ Start Next State (Qi+): _ Start First First Second Delay Delay SuccD Delay SuccD Succ Start First Note: The Moore Machine lags one clock cycle behind the final input in the sequence. The Mealy Machine can change asynchronously with the input. One of the states in the previous Mealy State Diagram is unnecessary: Note: The Mealy Machine requires one less state than the Moore Machine! This is possible because Mealy Machines make use of more information (i.e. inputs) than Moore Machines when computing the output. Having less states makes for an easier design because our truth tables, K-maps, and logic equations are generally less complex. In some cases, the reduction of states is significant because it reduces the number of flip-flops required for design implementation. In spite of the advantages of using a design with less states, we will still use the 6-state Mealy Machine for the remainder of these notes to facilitate a direct comparison with the 6-state Moore Machine. Page 6 of 8
  • 7. University of Florida Joel D. Schipper ECE Department Summer 2007 2) Make a Next State Truth Table (NSTT) State Q2 Q1 Q0 X Z State+ Q2+ Q1+ Q0+ Start 0 0 0 0 0 First 0 0 1 Start 0 0 0 1 0 Start 0 0 0 First 0 0 1 0 0 First 0 0 1 First 0 0 1 1 0 Second 0 1 1 Success 0 1 0 0 0 First 0 0 1 Success 0 1 0 1 0 Start 0 0 0 Second 0 1 1 0 0 Delay 1 1 1 Second 0 1 1 1 1 Success 0 1 0 unused 1 0 * * X X X X X SuccessD 1 1 0 0 0 Delay 1 1 1 SuccessD 1 1 0 1 1 Success 0 1 0 Delay 1 1 1 0 0 Delay 1 1 1 Delay 1 1 1 1 1 SuccessD 1 1 0 Note: This is identical to the Moore Machine, except for output Z. 3) Pick Flip-Flop type Select D Flip-Flops.. 4) Add Flip-Flop inputs to NSTT using Flip-Flop excitation equation State Q2 Q1 Q0 X Z State+ Q2+ Q1+ Q0+ D2 D1 D0 Start 0 0 0 0 0 First 0 0 1 0 0 1 Start 0 0 0 1 0 Start 0 0 0 0 0 0 First 0 0 1 0 0 First 0 0 1 0 0 1 First 0 0 1 1 0 Second 0 1 1 0 1 1 Success 0 1 0 0 0 First 0 0 1 0 0 1 Success 0 1 0 1 0 Start 0 0 0 0 0 0 Second 0 1 1 0 0 Delay 1 1 1 1 1 1 Second 0 1 1 1 1 Success 0 1 0 0 1 0 unused 1 0 * * X X X X X X X X SuccessD 1 1 0 0 0 Delay 1 1 1 1 1 1 SuccessD 1 1 0 1 1 Success 0 1 0 0 1 0 Delay 1 1 1 0 0 Delay 1 1 1 1 1 1 Delay 1 1 1 1 1 SuccessD 1 1 0 1 1 0 5) Solve equations for Flip-Flop inputs (K-maps) Q2Q1Q0X 00 01 11 10 Q2Q1Q0X 00 01 11 10 Q2Q1Q0X 00 01 11 10 00 0 0 0 0 00 0 0 1 0 00 1 0 1 1 01 0 0 0 1 01 0 0 1 1 01 1 0 0 1 11 1 0 1 1 11 1 1 1 1 11 1 0 0 1 10 X X X X 10 X X X X 10 X X X X D2 = Q2 Q0 + Q2 X + Q1Q0 X D1 = Q2 + Q1Q0 + Q0 X D0 = Q0 X + Q0 X + Q1Q0 Note: This is identical to the Moore Machine. Page 7 of 8
  • 8. University of Florida Joel D. Schipper ECE Department Summer 2007 6) Solve equations for Flip-Flop outputs (K-maps) Moore Mealy Q2Q1Q0 0 1 Q2Q1Q0X 00 01 11 10 00 0 0 00 0 0 0 0 01 1 0 01 0 0 1 0 11 1 0 11 0 1 1 0 10 X X 10 X X X X Z Moore = Q1Q0 Z Mealy = Q2 X + Q1Q0 X Recall: Moore outputs do not depend on the input. - ZMoore can only change when the state changes (synchronous). - ZMealy can change asynchronously because it can change with X. Note: The Moore and Mealy Machines solve the same problem. 7) Implement the circuit D2 Q2 D Q X, Q2, Q1, Q0 Combo Logic D-FF C Q D1 Q1 D Q Z X, Q2, Q1, Q0 Combo Logic Combo D-FF Logic C Q D0 Q0 D Q X, Q2, Q1, Q0 Combo Logic D-FF C Q Clk Notes: The 3 boxes of combinational logic on the left are the same for both of the Moore and Mealy designs because the state transitions are the same. This would not have been the case had we implemented the 5-state Mealy Machine. The larger box of combinational logic on the right is different for the Moore and Mealy designs because the output, Z, is computed differently. Page 8 of 8