1 / 14

Finite State Machines

next state function. current state. clock. inputs. Outputs. output function. Finite State Machines. Mealy machine. next state function: F next state ( I, S(i) )  S(i+1) output function: F output ( I, S(i) )  O(i). S(i) - Current state.

mhassler
Download Presentation

Finite State Machines

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. next state function current state clock inputs Outputs output function Finite State Machines Mealy machine next state function: Fnext state ( I, S(i) )  S(i+1) output function: Foutput ( I, S(i) )  O(i) S(i) - Current state

  2. Example -- Traffic Lights Controller • The controller operates the traffic lights at one intersection. • Detectors in both directions provide input signals to controllers: car approaching NS /car approaching EW. • Outputs control the traffic light: set to green / set to red. • When cars approach in both directions, toggle the light. • The controller needs two states, green/red. state(i)carNScarEWstate(i+1) NSgo no no NSgo NSgo no yes EWgo NSgo yes no NSgo NSgo yes yes EWgo EWgo no no EWgo EWgo no yes EWgo EWgo yes no NSgo EWgo yes yes NSgo A state/output table is used to construct the controller

  3. State Diagram carEW or both directions NSgo EWgo carNS or both directions carEW or nothing carNS or nothing Calculate next state transitions using the table and Boolean identities This example is a Moore machine  the outputs are a function only of the state. In this case the output function is trivial: In state NSgo we want a signal for a NS green light. In state EWgo we want a signal for an EW green light.

  4. Moore and Mealy Machines • Both these machine types follow the basic characteristics of state machines, but differ in the way that outputs (not next state) are produced. • Moore Machine: • Outputs are independent of the inputs, i. e. outputs are effectively produced from within only the state of the state machine. • Mealy Machine: • Outputs can be determined by the present state alone, or by the present state and the present inputs, i. e. outputs are produced as the machine makes a transition from one state to another.

  5. Inputs Inputs Combinatorial Logic to Determine State Combinatorial Logic to Determine State Present State Register Bank Present State Register Bank • Combinatorial • Logic to • Determine • Output Based on: • Present State • Combinatorial • Logic to • Determine • Output Based on: • Present State • Present Inputs Moore Machine Mealy Machine Output Output Machine Models

  6. Advantages of Mealy FSM • Moore and Mealy FSMs Can Be Functionally Equivalent. • Mealy FSM Has a Richer Description and Usually Requires Smaller Number of States • Smaller circuit area. • Mealy FSM Computes Outputs as soon as Inputs Change • Mealy FSM responds one clock cycle sooner than equivalent Moore FSM.

  7. Advantages of Moore FSM • Moore FSM Has No Combinational Path Between Inputs and Outputs. • output changes only when clock ends  short inputs that temporarily generated during the clock cycles will be ignored.

  8. 0 1 0 S0 / 0 1 S1 / 0 S2 / 1 1 0 Moore FSM that Recognizes Sequence 10 reset S0: No elements of the sequence observed S1: “10” observed S1: “1” observed Meaning of states:

  9. Mealy FSM that Recognizes Sequence 10 0 / 0 1 / 0 1 / 0 S0 S1 reset 0 / 1 S0: No elements of the sequence observed S1: “1” observed Meaning of states:

  10. Moore & Mealy Time Line clock input 0 1 0 0 0 Moore S0 S1 S2 S0 S0 Mealy S0 S1 S0 S0 S0

  11. Finite State Machine • Any circuit with memory is a Finite State Machine • Even computers can be viewed as huge FSMs • Design of FSMs Involves • Defining states • Defining transitions between states • Optimization / minimization

  12. Implementation Finite state machine with a state variable Outputs Combinational Logic State Register inputs

  13. General Digital System Control control lines Combinational Logic Architecture State Register CLOCK Opcode

  14. Finite State Machine: Conclusion • State Diagram • Illustrates the form and function of a state machine. Usually drawn as a bubble-and-arrow diagram. • State • A uniquely identifiable set of values measured at various points in a digital system. • Next State • The state to which the state machine makes the next transition, determined by the inputs present when the device is clocked. • Mealy Machine • A state machine that determines its outputs from the present state and from the inputs. • Moore Machine • A state machine that determines its outputs from the present state only.

More Related