Presentation is loading. Please wait.

Presentation is loading. Please wait.

Finite State Machines Mealy machine inputs Outputs next state function

Similar presentations


Presentation on theme: "Finite State Machines Mealy machine inputs Outputs next state function"— Presentation transcript:

1 Finite State Machines Mealy machine inputs Outputs next state function
current state next state function output function Outputs inputs clock 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) carNS carEW state(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 NSgo EWgo
carEW or both directions NSgo EWgo carNS or both directions carNS or nothing carEW 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 Machine Models Moore Machine Mealy Machine Inputs Combinatorial
Logic to Determine State Present State Register Bank Determine Output Based on: Output Moore Machine Inputs Combinatorial Logic to Determine State Present State Register Bank Determine Output Based on: Present Inputs Output Mealy Machine

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 Moore FSM that Recognizes Sequence 10
1 reset S0: No elements of the sequence observed S1: “1” observed S1: “10” 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
Moore S S S S S0 Mealy S S S S 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.


Download ppt "Finite State Machines Mealy machine inputs Outputs next state function"

Similar presentations


Ads by Google