SlideShare a Scribd company logo
ENGIN 112
                 Intro to Electrical and Computer
                            Engineering
                                                      Lecture 23
              Finite State Machine Design Procedure




ENGIN112 L23: Finite State Machine Design Procedure                October 27, 2003
Overvie
       w
  ° Design of systems that input flip flops and
    combinational logic
  ° Specifications start with a word description
  ° Create a state table to indicate next states
  ° Convert next states and outputs to output and flip flop
    input equations
          • Reduce logic expressions using truth tables

  ° Draw resulting circuits.


                Lots of opportunities for interesting design



ENGIN112 L23: Finite State Machine Design Procedure   October 27, 2003
Concept of the State
       Machine
      Computer Hardware = Datapath + Control

                                                      Qualifiers
       Registers                                                   FSM generating sequences
       Combinational Functional                                        of control signals
          Units (e.g., ALU)                                        Instructs datapath what to
       Busses                                                          do next
                                                       Control



                                                      Control

                                                        State

                               Qualifiers                          Control
                               and                                 Signal
                               Inputs                              Outputs


                                                      Datapath



ENGIN112 L23: Finite State Machine Design Procedure                 October 27, 2003
Designing Finite State Machines

      ° Specify the problem with words
             ° (e.g. Design a circuit that detects three
               consecutive 1 inputs)
      ° Assign binary values to states
      ° Develop a state table
      ° Use K-maps to simplify expressions
             ° Flip flop input equations and output equations
      ° Create appropriate logic diagram
             ° Should include combinational logic and flip
               flops



ENGIN112 L23: Finite State Machine Design Procedure   October 27, 2003
Example: Detect 3 Consecutive 1 inputs


            0
                                                      ° State S0 : zero 1s detected
                                                      ° State S1 : one 1 detected
                                                      ° State S2 : two 1s detected
                                                      ° State S3 : three 1s detected




         ° Note that each state has 2 output arrows
         ° Two bits needed to encode state

ENGIN112 L23: Finite State Machine Design Procedure                  October 27, 2003
State Table for Sequence Detector

Present                     Next
                                                 ° Sequence of outputs, inputs,
 State        Input         State         Output   and flip flop states enumerated
  A B           x         A B                y     in state table
  0 0           0         0 0                0 ° Present state indicates current
                                                   value of flip flops
  0    0         1         0     1            0
  0    1         0         0     0            0 ° Next state indicates state after
  0    1         1         1     0            0   next rising clock edge
  1    0         0         0     0            0
                                                ° Output is output value on
  1 0            1         1     1            0   current clock edge
  1 1            0         0     0            1
  1 1            1         1     1            1
      ° S0 = 00                      ° S2 = 10

      ° S1 = 01                      ° S3 = 11


ENGIN112 L23: Finite State Machine Design Procedure            October 27, 2003
Finding Expressions for Next State and Output
       Value
     ° Create K-map directly from state table (3 columns = 3 K-maps)
     ° Minimize K-maps to find SOP representations
     ° Separate circuit for each next state and output value




ENGIN112 L23: Finite State Machine Design Procedure   October 27, 2003
Circuit for Consecutive 1s
       Detector




° Note location of state
  flip flops
° Output value (y) is
  function of state
° This is a Moore
  machine.




ENGIN112 L23: Finite State Machine Design Procedure   October 27, 2003
Concept of the State
       Machine
         Example: Odd Parity Checker
                Assert output whenever input bit stream has odd # of 1's

                Reset                                  Present State   Input       Next State     Output
                                                           Even          0           Even           0
                                  0                        Even          1           Odd            0
                  Even
                                                           Odd           0           Odd            1
                   [0]
                                                           Odd           1           Even           1
            1                 1                           Symbolic State Transition Table
                   Odd
                   [1]                                Present State    Input      Next State      Output
       0                                                   0             0            0             0
                                                           0             1            1             0
                                                           1             0            1             1
                 State                                     1             1            0             1
                Diagram
                                                           Encoded State Transition Table

        °       Note: Present state and output are the same value
                 ° Moore machine

ENGIN112 L23: Finite State Machine Design Procedure                            October 27, 2003
Concept of the State
       Machine
                                                 Example: Odd Parity Checker
                                                  Next State/Output Functions
                                                        NS = PS xor PI; OUT = PS

                                                                NS
                                         Input
                                                                     D       Q
                                                       CLK                       PS/Output
                                                                             Q
                                                                         R
                                                       Reset
            D FF Implementation


              Input        1     0       0        1     1       0    1       0     1       1         1       0


                 Clk


           Output           1        1    1        0        1   1    0       0         1       0         1   1

                               Timing Behavior: Input 1 0 0 1 1 0 1 0 1 1 1 0
ENGIN112 L23: Finite State Machine Design Procedure                               October 27, 2003
Mealy and Moore Machines


      Solution 1: (Mealy)                                         Solution 2: (Moore)
                                      0/0                                                      0
                                                         Reset             Even
                      Even             Input                                 [0]                   Output
                                           O/P is dependent
           1/0                    1/1
                                           on current state and    1                       1
                                                                                                   Input
                                    Output input in Mealy
 Transition           Odd                                                   Odd
                                                                              [1]
                                                                                                   Output is
 Arc                                                                                               dependent only
                                                                                       0           on current state
                 0/1
Mealy Machine: Output is associated with
the state transition                                        Moore Machine: Output is associated
- Appears before the state transition is                    with the state
completed (by the next clock pulse).                        -Appears after the state transition
                                                             takes place.


ENGIN112 L23: Finite State Machine Design Procedure                 October 27, 2003
Vending Machine FSM

         Step 1. Specify the problem
  Deliver package of gum after 15 cents deposited

  Single coin slot for dimes, nickels

  No change

  Design the FSM using combinational logic and flip flops



                                      N
                         Coin                         V e nding O pe n    G um
                        S e nsor D
                                                      Ma chine          Re le a se
                                      Re se t           FS M           Me cha nism

                                      Clk




ENGIN112 L23: Finite State Machine Design Procedure                    October 27, 2003
Vending Machine FSM

         State Diagram

            Rese t                                    Present    Inputs        Next     Output
                         0¢
                                                       State     D N           State    Open
                                                        0¢       0   0          0¢        0
                        N
                                                                 0   1          5¢        0
                         5¢
                                    D
                                                                 1   0          10¢       0
                                                                 1   1           X        X
                        N                               5¢       0   0          5¢        0
                         10¢                                     0   1          10¢       0
                D                                                1   0          15¢       0
                     N, D
                                                                 1   1           X        X
                                                       10¢       0   0          10¢       0
                         15¢
                                                                 0   1          15¢       0
                       [o p e n ]
                                                                 1   0          15¢       0
                                                                 1   1           X        X
       Reuse states                                    15¢       X   X          15¢       1

     whenever possible
                                                             Symbolic State Table

ENGIN112 L23: Finite State Machine Design Procedure                  October 27, 2003
Vending Machine FSM

         State Encoding                                   How many flip-flops are needed?


                          Present State        Inputs     Next State       Output
                             Q1 Q0              D N        D1 D0            Open
                               0     0          0     0    0   0               0
                                                0     1    0   1               0
                                                1     0    1   0               0
                                                1     1    X   X               X
                               0     1          0     0    0   1               0
                                                0     1    1   0               0
                                                1     0    1   1               0
                                                1     1    X   X               X
                               1     0          0     0    1   0               0
                                                0     1    1   1               0
                                                1     0    1   1               0
                                                1     1    X   X               X
                               1     1          0     0    1   1               1
                                                0     1    1   1               1
                                                1     0    1   1               1
                                                1     1    X   X               X

ENGIN112 L23: Finite State Machine Design Procedure                    October 27, 2003
Vending Machine FSM

         Determine F/F implementation




                           Q1                                 Q1                            Q1
   Q1 Q0                                       Q1 Q0                       Q1 Q0
 D N                                         D N                         D N



                                      N                              N                               N
  D                                           D                           D


                Q0                                        Q0                            Q0
           K-map for D1                               K-map for D0                  K-map for Open




ENGIN112 L23: Finite State Machine Design Procedure                  October 27, 2003
Minimized Implementation

                                    Q1
                            D                            D1                Q1
                                                              D       Q
                 Q0                                    CLK                     Q1
                                                                  R   Q
                 N                               Reset                                                 OPEN
                 N
                 Q0
                 Q0
                                                       D0                 Q0
                 N                                            D       Q
                                                      CLK
                Q1                                                R   Q   Q0
                N
                                               Reset
                Q1
                D

                   Vending machine FSM implementation based on D flip-flops(Moore).

ENGIN112 L23: Finite State Machine Design Procedure                                 October 27, 2003
Summary


° Finite state machines form the basis of many digital
  systems
° Designs often start from clear specifications
° Develop state diagram and state table
° Optimize using combinational design techniques
° Mealy or Moore implementations possible
        • Can model approach using HDL.




ENGIN112 L23: Finite State Machine Design Procedure   October 27, 2003

More Related Content

What's hot

Registers and counters
Registers and countersRegisters and counters
Registers and counters
Heman Pathak
 
5.8 Integrated circuits
5.8 Integrated circuits5.8 Integrated circuits
5.8 Integrated circuits
lpapadop
 
5.5 Logic circuits
5.5 Logic circuits5.5 Logic circuits
5.5 Logic circuits
lpapadop
 
Lec11 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- De...
Lec11 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- De...Lec11 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- De...
Lec11 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- De...
Hsien-Hsin Sean Lee, Ph.D.
 
Moore Mealy Machine Conversion
Moore Mealy Machine Conversion Moore Mealy Machine Conversion
Moore Mealy Machine Conversion
Aiman Hafeez
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
EasyStudy3
 
Matlab tutorial2
Matlab tutorial2Matlab tutorial2
Matlab tutorial2
Washo Ramos
 
Arithmatic &Logic Unit
Arithmatic &Logic UnitArithmatic &Logic Unit
Arithmatic &Logic Unit
Ibrahim_mohamed9090
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuits
Aneeq Malik
 
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence CounterLab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
Katrina Little
 
Lec15 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Re...
Lec15 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Re...Lec15 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Re...
Lec15 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Re...
Hsien-Hsin Sean Lee, Ph.D.
 
Logic gates
Logic gatesLogic gates
Logic gates
khush amdin
 
Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...
Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...
Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...
Hsien-Hsin Sean Lee, Ph.D.
 
Clock divide by 3
Clock divide by 3Clock divide by 3
Clock divide by 3
Ashok Reddy
 
Arithmetic by aniket bhute
Arithmetic by aniket bhuteArithmetic by aniket bhute
Arithmetic by aniket bhute
Aniket Bhute
 
Logic gates verification using universal gates
Logic gates verification using universal gatesLogic gates verification using universal gates
Logic gates verification using universal gates
Motilal nehru national institute
 
Clock divider by 3
Clock divider by 3Clock divider by 3
Clock divider by 3
Ashok Reddy
 
Free video lectures for mca
Free video lectures for mcaFree video lectures for mca
Free video lectures for mca
Edhole.com
 
TC74LCX244F PSpice Model (Free SPICE Model)
TC74LCX244F PSpice Model (Free SPICE Model)TC74LCX244F PSpice Model (Free SPICE Model)
TC74LCX244F PSpice Model (Free SPICE Model)
Tsuyoshi Horigome
 
Lab 4 Three-Bit Binary Adder
Lab 4 Three-Bit Binary AdderLab 4 Three-Bit Binary Adder
Lab 4 Three-Bit Binary Adder
Katrina Little
 

What's hot (20)

Registers and counters
Registers and countersRegisters and counters
Registers and counters
 
5.8 Integrated circuits
5.8 Integrated circuits5.8 Integrated circuits
5.8 Integrated circuits
 
5.5 Logic circuits
5.5 Logic circuits5.5 Logic circuits
5.5 Logic circuits
 
Lec11 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- De...
Lec11 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- De...Lec11 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- De...
Lec11 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- De...
 
Moore Mealy Machine Conversion
Moore Mealy Machine Conversion Moore Mealy Machine Conversion
Moore Mealy Machine Conversion
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Matlab tutorial2
Matlab tutorial2Matlab tutorial2
Matlab tutorial2
 
Arithmatic &Logic Unit
Arithmatic &Logic UnitArithmatic &Logic Unit
Arithmatic &Logic Unit
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuits
 
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence CounterLab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
 
Lec15 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Re...
Lec15 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Re...Lec15 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Re...
Lec15 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Re...
 
Logic gates
Logic gatesLogic gates
Logic gates
 
Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...
Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...
Lec2 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Num...
 
Clock divide by 3
Clock divide by 3Clock divide by 3
Clock divide by 3
 
Arithmetic by aniket bhute
Arithmetic by aniket bhuteArithmetic by aniket bhute
Arithmetic by aniket bhute
 
Logic gates verification using universal gates
Logic gates verification using universal gatesLogic gates verification using universal gates
Logic gates verification using universal gates
 
Clock divider by 3
Clock divider by 3Clock divider by 3
Clock divider by 3
 
Free video lectures for mca
Free video lectures for mcaFree video lectures for mca
Free video lectures for mca
 
TC74LCX244F PSpice Model (Free SPICE Model)
TC74LCX244F PSpice Model (Free SPICE Model)TC74LCX244F PSpice Model (Free SPICE Model)
TC74LCX244F PSpice Model (Free SPICE Model)
 
Lab 4 Three-Bit Binary Adder
Lab 4 Three-Bit Binary AdderLab 4 Three-Bit Binary Adder
Lab 4 Three-Bit Binary Adder
 

Viewers also liked

VerilogHDL_Utkarsh_kulshrestha
VerilogHDL_Utkarsh_kulshresthaVerilogHDL_Utkarsh_kulshrestha
VerilogHDL_Utkarsh_kulshrestha
Utkarsh Kulshrestha
 
Complaint Letters
Complaint LettersComplaint Letters
Complaint Letters
gmherrera
 
Physical prototyping lab6-motors
Physical prototyping lab6-motorsPhysical prototyping lab6-motors
Physical prototyping lab6-motors
Tony Olsson.
 
Adjustments and claim
Adjustments and claimAdjustments and claim
Adjustments and claim
Mathan Kumar
 
String Matching with Finite Automata,Aho corasick,
String Matching with Finite Automata,Aho corasick,String Matching with Finite Automata,Aho corasick,
String Matching with Finite Automata,Aho corasick,
8neutron8
 
Letters of Complaint
Letters of ComplaintLetters of Complaint
Letters of Complaint
Jafar pp
 
Complaint letter
Complaint letterComplaint letter
Complaint letter
hitesh joshi
 
How to design a machine?
How to design a machine?How to design a machine?
How to design a machine?
swargpatel283
 
Letter of complaint
Letter of complaintLetter of complaint
Letter of complaint
Cristina Oliveira
 
Obstacle detection Robot using Ultrasonic Sensor and Arduino UNO
Obstacle detection Robot using Ultrasonic Sensor and Arduino UNOObstacle detection Robot using Ultrasonic Sensor and Arduino UNO
Obstacle detection Robot using Ultrasonic Sensor and Arduino UNO
Sanjay Kumar
 
How to write a letter of complaint
How to write a letter of complaintHow to write a letter of complaint
How to write a letter of complaint
Paula Gómez
 
Code generation
Code generationCode generation
Code generation
Aparna Nayak
 
Writing Complaint Letter
Writing Complaint LetterWriting Complaint Letter
Writing Complaint Letter
Pumpump
 
Letters of complaint
Letters of complaintLetters of complaint
Letters of complaint
Majorick
 
Complaint letters
Complaint lettersComplaint letters
Complaint letters
Maribel Gonzalez
 
Cldch8
Cldch8Cldch8
Cldch8
sealife24
 
4. letter of complaint
4. letter of complaint4. letter of complaint
4. letter of complaint
kamlesh p joshi
 
Writing Letters by Ganta Kishore Kumar
Writing Letters by Ganta Kishore KumarWriting Letters by Ganta Kishore Kumar
Writing Letters by Ganta Kishore Kumar
Ganta Kishore Kumar
 

Viewers also liked (18)

VerilogHDL_Utkarsh_kulshrestha
VerilogHDL_Utkarsh_kulshresthaVerilogHDL_Utkarsh_kulshrestha
VerilogHDL_Utkarsh_kulshrestha
 
Complaint Letters
Complaint LettersComplaint Letters
Complaint Letters
 
Physical prototyping lab6-motors
Physical prototyping lab6-motorsPhysical prototyping lab6-motors
Physical prototyping lab6-motors
 
Adjustments and claim
Adjustments and claimAdjustments and claim
Adjustments and claim
 
String Matching with Finite Automata,Aho corasick,
String Matching with Finite Automata,Aho corasick,String Matching with Finite Automata,Aho corasick,
String Matching with Finite Automata,Aho corasick,
 
Letters of Complaint
Letters of ComplaintLetters of Complaint
Letters of Complaint
 
Complaint letter
Complaint letterComplaint letter
Complaint letter
 
How to design a machine?
How to design a machine?How to design a machine?
How to design a machine?
 
Letter of complaint
Letter of complaintLetter of complaint
Letter of complaint
 
Obstacle detection Robot using Ultrasonic Sensor and Arduino UNO
Obstacle detection Robot using Ultrasonic Sensor and Arduino UNOObstacle detection Robot using Ultrasonic Sensor and Arduino UNO
Obstacle detection Robot using Ultrasonic Sensor and Arduino UNO
 
How to write a letter of complaint
How to write a letter of complaintHow to write a letter of complaint
How to write a letter of complaint
 
Code generation
Code generationCode generation
Code generation
 
Writing Complaint Letter
Writing Complaint LetterWriting Complaint Letter
Writing Complaint Letter
 
Letters of complaint
Letters of complaintLetters of complaint
Letters of complaint
 
Complaint letters
Complaint lettersComplaint letters
Complaint letters
 
Cldch8
Cldch8Cldch8
Cldch8
 
4. letter of complaint
4. letter of complaint4. letter of complaint
4. letter of complaint
 
Writing Letters by Ganta Kishore Kumar
Writing Letters by Ganta Kishore KumarWriting Letters by Ganta Kishore Kumar
Writing Letters by Ganta Kishore Kumar
 

Similar to Lect23 Engin112

State Machine Design and Synthesis
State Machine Design and SynthesisState Machine Design and Synthesis
State Machine Design and Synthesis
Abhilash Nair
 
Tele4653 l11
Tele4653 l11Tele4653 l11
Tele4653 l11
Vin Voro
 
digital-electronics_7.pdf
digital-electronics_7.pdfdigital-electronics_7.pdf
digital-electronics_7.pdf
sarala9
 
Lecture 3
Lecture 3Lecture 3
Lect21 Engin112
Lect21 Engin112Lect21 Engin112
Lect21 Engin112
John Williams
 
Sequential logic implementation
Sequential logic implementationSequential logic implementation
Sequential logic implementation
Arif Siyal
 
Fsm sequence detector
Fsm sequence detector Fsm sequence detector
Fsm sequence detector
lpvasam
 
A Nutshell On Convolutional Codes (Representations)
A Nutshell On Convolutional Codes (Representations)A Nutshell On Convolutional Codes (Representations)
A Nutshell On Convolutional Codes (Representations)
alka swara
 
16%20 lecture
16%20 lecture16%20 lecture
16%20 lecture
Arif Siyal
 
Lec 25 26_27
Lec 25 26_27Lec 25 26_27
Lec 25 26_27
Zain Ul Abedeen
 
Basics Counters
Basics Counters Basics Counters
Basics Counters
Danial Mirza
 
DD Slides6.pptx aaaaaaaaaaaaaaaaaaaaaaaaaaaa
DD Slides6.pptx  aaaaaaaaaaaaaaaaaaaaaaaaaaaaDD Slides6.pptx  aaaaaaaaaaaaaaaaaaaaaaaaaaaa
DD Slides6.pptx aaaaaaaaaaaaaaaaaaaaaaaaaaaa
kasheenp
 
Unit I_CDA-1 computer design and applications.
Unit I_CDA-1 computer design and applications.Unit I_CDA-1 computer design and applications.
Unit I_CDA-1 computer design and applications.
brijeshgolani77
 
9920Lec12 FSM.ppt
9920Lec12 FSM.ppt9920Lec12 FSM.ppt
9920Lec12 FSM.ppt
SHASHISHARMA850123
 
Lec9
Lec9Lec9
Digital Counter Design
 Digital Counter Design Digital Counter Design
Digital Counter Design
GargiKhanna1
 
Plc 2
Plc 2Plc 2
Sequential Logic
Sequential LogicSequential Logic
Analysis sequential circuits
Analysis sequential circuitsAnalysis sequential circuits
Analysis sequential circuits
G Subramaniamg
 
Convolutional codes
Convolutional codesConvolutional codes
Convolutional codes
Abdullaziz Tagawy
 

Similar to Lect23 Engin112 (20)

State Machine Design and Synthesis
State Machine Design and SynthesisState Machine Design and Synthesis
State Machine Design and Synthesis
 
Tele4653 l11
Tele4653 l11Tele4653 l11
Tele4653 l11
 
digital-electronics_7.pdf
digital-electronics_7.pdfdigital-electronics_7.pdf
digital-electronics_7.pdf
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Lect21 Engin112
Lect21 Engin112Lect21 Engin112
Lect21 Engin112
 
Sequential logic implementation
Sequential logic implementationSequential logic implementation
Sequential logic implementation
 
Fsm sequence detector
Fsm sequence detector Fsm sequence detector
Fsm sequence detector
 
A Nutshell On Convolutional Codes (Representations)
A Nutshell On Convolutional Codes (Representations)A Nutshell On Convolutional Codes (Representations)
A Nutshell On Convolutional Codes (Representations)
 
16%20 lecture
16%20 lecture16%20 lecture
16%20 lecture
 
Lec 25 26_27
Lec 25 26_27Lec 25 26_27
Lec 25 26_27
 
Basics Counters
Basics Counters Basics Counters
Basics Counters
 
DD Slides6.pptx aaaaaaaaaaaaaaaaaaaaaaaaaaaa
DD Slides6.pptx  aaaaaaaaaaaaaaaaaaaaaaaaaaaaDD Slides6.pptx  aaaaaaaaaaaaaaaaaaaaaaaaaaaa
DD Slides6.pptx aaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Unit I_CDA-1 computer design and applications.
Unit I_CDA-1 computer design and applications.Unit I_CDA-1 computer design and applications.
Unit I_CDA-1 computer design and applications.
 
9920Lec12 FSM.ppt
9920Lec12 FSM.ppt9920Lec12 FSM.ppt
9920Lec12 FSM.ppt
 
Lec9
Lec9Lec9
Lec9
 
Digital Counter Design
 Digital Counter Design Digital Counter Design
Digital Counter Design
 
Plc 2
Plc 2Plc 2
Plc 2
 
Sequential Logic
Sequential LogicSequential Logic
Sequential Logic
 
Analysis sequential circuits
Analysis sequential circuitsAnalysis sequential circuits
Analysis sequential circuits
 
Convolutional codes
Convolutional codesConvolutional codes
Convolutional codes
 

More from John Williams

Employee job retention
Employee job retentionEmployee job retention
Employee job retention
John Williams
 
Moore's law & more
Moore's law & moreMoore's law & more
Moore's law & more
John Williams
 
Mobile cellular-telecommunication-system-revised
Mobile cellular-telecommunication-system-revisedMobile cellular-telecommunication-system-revised
Mobile cellular-telecommunication-system-revised
John Williams
 
Mnr
MnrMnr
Microwave engineering jwfiles
Microwave engineering jwfilesMicrowave engineering jwfiles
Microwave engineering jwfiles
John Williams
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
John Williams
 
Lut optimization for memory based computation
Lut optimization for memory based computationLut optimization for memory based computation
Lut optimization for memory based computation
John Williams
 
Llr test english_totalquestions
Llr test english_totalquestionsLlr test english_totalquestions
Llr test english_totalquestions
John Williams
 
Lecture1
Lecture1Lecture1
Lecture1
John Williams
 
Lecture notes -_microwaves_jwfiles
Lecture notes -_microwaves_jwfilesLecture notes -_microwaves_jwfiles
Lecture notes -_microwaves_jwfiles
John Williams
 
Image processing spatialfiltering
Image processing spatialfilteringImage processing spatialfiltering
Image processing spatialfiltering
John Williams
 
Image processing9 segmentation(pointslinesedges)
Image processing9 segmentation(pointslinesedges)Image processing9 segmentation(pointslinesedges)
Image processing9 segmentation(pointslinesedges)
John Williams
 
Image trnsformations
Image trnsformationsImage trnsformations
Image trnsformations
John Williams
 
Image processing3 imageenhancement(histogramprocessing)
Image processing3 imageenhancement(histogramprocessing)Image processing3 imageenhancement(histogramprocessing)
Image processing3 imageenhancement(histogramprocessing)
John Williams
 
Friday xpress
Friday xpressFriday xpress
Friday xpress
John Williams
 
Fft
FftFft
morphological image processing
morphological image processingmorphological image processing
morphological image processing
John Williams
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
John Williams
 
An atm with an eye
An atm with an eyeAn atm with an eye
An atm with an eye
John Williams
 
4 things you_cannot_recover
4 things you_cannot_recover4 things you_cannot_recover
4 things you_cannot_recover
John Williams
 

More from John Williams (20)

Employee job retention
Employee job retentionEmployee job retention
Employee job retention
 
Moore's law & more
Moore's law & moreMoore's law & more
Moore's law & more
 
Mobile cellular-telecommunication-system-revised
Mobile cellular-telecommunication-system-revisedMobile cellular-telecommunication-system-revised
Mobile cellular-telecommunication-system-revised
 
Mnr
MnrMnr
Mnr
 
Microwave engineering jwfiles
Microwave engineering jwfilesMicrowave engineering jwfiles
Microwave engineering jwfiles
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Lut optimization for memory based computation
Lut optimization for memory based computationLut optimization for memory based computation
Lut optimization for memory based computation
 
Llr test english_totalquestions
Llr test english_totalquestionsLlr test english_totalquestions
Llr test english_totalquestions
 
Lecture1
Lecture1Lecture1
Lecture1
 
Lecture notes -_microwaves_jwfiles
Lecture notes -_microwaves_jwfilesLecture notes -_microwaves_jwfiles
Lecture notes -_microwaves_jwfiles
 
Image processing spatialfiltering
Image processing spatialfilteringImage processing spatialfiltering
Image processing spatialfiltering
 
Image processing9 segmentation(pointslinesedges)
Image processing9 segmentation(pointslinesedges)Image processing9 segmentation(pointslinesedges)
Image processing9 segmentation(pointslinesedges)
 
Image trnsformations
Image trnsformationsImage trnsformations
Image trnsformations
 
Image processing3 imageenhancement(histogramprocessing)
Image processing3 imageenhancement(histogramprocessing)Image processing3 imageenhancement(histogramprocessing)
Image processing3 imageenhancement(histogramprocessing)
 
Friday xpress
Friday xpressFriday xpress
Friday xpress
 
Fft
FftFft
Fft
 
morphological image processing
morphological image processingmorphological image processing
morphological image processing
 
Arm teaching material
Arm teaching materialArm teaching material
Arm teaching material
 
An atm with an eye
An atm with an eyeAn atm with an eye
An atm with an eye
 
4 things you_cannot_recover
4 things you_cannot_recover4 things you_cannot_recover
4 things you_cannot_recover
 

Lect23 Engin112

  • 1. ENGIN 112 Intro to Electrical and Computer Engineering Lecture 23 Finite State Machine Design Procedure ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 2. Overvie w ° Design of systems that input flip flops and combinational logic ° Specifications start with a word description ° Create a state table to indicate next states ° Convert next states and outputs to output and flip flop input equations • Reduce logic expressions using truth tables ° Draw resulting circuits. Lots of opportunities for interesting design ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 3. Concept of the State Machine Computer Hardware = Datapath + Control Qualifiers Registers FSM generating sequences Combinational Functional of control signals Units (e.g., ALU) Instructs datapath what to Busses do next Control Control State Qualifiers Control and Signal Inputs Outputs Datapath ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 4. Designing Finite State Machines ° Specify the problem with words ° (e.g. Design a circuit that detects three consecutive 1 inputs) ° Assign binary values to states ° Develop a state table ° Use K-maps to simplify expressions ° Flip flop input equations and output equations ° Create appropriate logic diagram ° Should include combinational logic and flip flops ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 5. Example: Detect 3 Consecutive 1 inputs 0 ° State S0 : zero 1s detected ° State S1 : one 1 detected ° State S2 : two 1s detected ° State S3 : three 1s detected ° Note that each state has 2 output arrows ° Two bits needed to encode state ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 6. State Table for Sequence Detector Present Next ° Sequence of outputs, inputs, State Input State Output and flip flop states enumerated A B x A B y in state table 0 0 0 0 0 0 ° Present state indicates current value of flip flops 0 0 1 0 1 0 0 1 0 0 0 0 ° Next state indicates state after 0 1 1 1 0 0 next rising clock edge 1 0 0 0 0 0 ° Output is output value on 1 0 1 1 1 0 current clock edge 1 1 0 0 0 1 1 1 1 1 1 1 ° S0 = 00 ° S2 = 10 ° S1 = 01 ° S3 = 11 ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 7. Finding Expressions for Next State and Output Value ° Create K-map directly from state table (3 columns = 3 K-maps) ° Minimize K-maps to find SOP representations ° Separate circuit for each next state and output value ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 8. Circuit for Consecutive 1s Detector ° Note location of state flip flops ° Output value (y) is function of state ° This is a Moore machine. ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 9. Concept of the State Machine Example: Odd Parity Checker Assert output whenever input bit stream has odd # of 1's Reset Present State Input Next State Output Even 0 Even 0 0 Even 1 Odd 0 Even Odd 0 Odd 1 [0] Odd 1 Even 1 1 1 Symbolic State Transition Table Odd [1] Present State Input Next State Output 0 0 0 0 0 0 1 1 0 1 0 1 1 State 1 1 0 1 Diagram Encoded State Transition Table ° Note: Present state and output are the same value ° Moore machine ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 10. Concept of the State Machine Example: Odd Parity Checker Next State/Output Functions NS = PS xor PI; OUT = PS NS Input D Q CLK PS/Output Q R Reset D FF Implementation Input 1 0 0 1 1 0 1 0 1 1 1 0 Clk Output 1 1 1 0 1 1 0 0 1 0 1 1 Timing Behavior: Input 1 0 0 1 1 0 1 0 1 1 1 0 ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 11. Mealy and Moore Machines Solution 1: (Mealy) Solution 2: (Moore) 0/0 0 Reset Even Even Input [0] Output O/P is dependent 1/0 1/1 on current state and 1 1 Input Output input in Mealy Transition Odd Odd [1] Output is Arc dependent only 0 on current state 0/1 Mealy Machine: Output is associated with the state transition Moore Machine: Output is associated - Appears before the state transition is with the state completed (by the next clock pulse). -Appears after the state transition takes place. ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 12. Vending Machine FSM Step 1. Specify the problem Deliver package of gum after 15 cents deposited Single coin slot for dimes, nickels No change Design the FSM using combinational logic and flip flops N Coin V e nding O pe n G um S e nsor D Ma chine Re le a se Re se t FS M Me cha nism Clk ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 13. Vending Machine FSM State Diagram Rese t Present Inputs Next Output 0¢ State D N State Open 0¢ 0 0 0¢ 0 N 0 1 5¢ 0 5¢ D 1 0 10¢ 0 1 1 X X N 5¢ 0 0 5¢ 0 10¢ 0 1 10¢ 0 D 1 0 15¢ 0 N, D 1 1 X X 10¢ 0 0 10¢ 0 15¢ 0 1 15¢ 0 [o p e n ] 1 0 15¢ 0 1 1 X X Reuse states 15¢ X X 15¢ 1 whenever possible Symbolic State Table ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 14. Vending Machine FSM State Encoding How many flip-flops are needed? Present State Inputs Next State Output Q1 Q0 D N D1 D0 Open 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 0 1 1 X X X 0 1 0 0 0 1 0 0 1 1 0 0 1 0 1 1 0 1 1 X X X 1 0 0 0 1 0 0 0 1 1 1 0 1 0 1 1 0 1 1 X X X 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 X X X ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 15. Vending Machine FSM Determine F/F implementation Q1 Q1 Q1 Q1 Q0 Q1 Q0 Q1 Q0 D N D N D N N N N D D D Q0 Q0 Q0 K-map for D1 K-map for D0 K-map for Open ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 16. Minimized Implementation Q1 D D1 Q1 D Q Q0 CLK Q1 R Q N Reset OPEN N Q0 Q0 D0 Q0 N D Q CLK Q1 R Q Q0 N Reset Q1 D Vending machine FSM implementation based on D flip-flops(Moore). ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003
  • 17. Summary ° Finite state machines form the basis of many digital systems ° Designs often start from clear specifications ° Develop state diagram and state table ° Optimize using combinational design techniques ° Mealy or Moore implementations possible • Can model approach using HDL. ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003

Editor's Notes

  1. Give qualifications of instructors: DAP teaching computer architecture at Berkeley since 1977 Co-athor of textbook used in class Best known for being one of pioneers of RISC currently author of article on future of microprocessors in SciAm Sept 1995 RY took 152 as student, TAed 152,instructor in 152 undergrad and grad work at Berkeley joined NextGen to design fact 80x86 microprocessors one of architects of UltraSPARC fastest SPARC mper shipping this Fall
  2. credential: bring a computer die photo wafer : This can be an hidden slide. I just want to use this to do my own planning. I have rearranged Culler’s lecture slides slightly and add more slides. This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20. Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs.
  3. credential: bring a computer die photo wafer : This can be an hidden slide. I just want to use this to do my own planning. I have rearranged Culler’s lecture slides slightly and add more slides. This covers everything he covers in his first lecture (and more) but may We will save the fun part, “ Levels of Organization,” at the end (so student can stay awake): I will show the internal stricture of the SS10/20. Notes to Patterson: You may want to edit the slides in your section or add extra slides to taylor your needs.