Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 140L Discussion Finite State Machines.

Similar presentations


Presentation on theme: "CSE 140L Discussion Finite State Machines."— Presentation transcript:

1 CSE 140L Discussion Finite State Machines

2 Finite State Machines Two types: Mealy and Moore
Mealy depends on both the current state and the input Moore depends only on the current state. (You can think of it as so: in a moore machine, the output is associated with the state. In a mealy machine, the output is associated with the transitions). Typically, moore has more states, but are easier to implement. Mealy machines have less states, and also are faster in clocked systems (the output happens right away when the inputs are detected). Moore has to wait the clock cycle to transition to the next state before the output is changed. But Mealy is usually more sensitive to race conditions.

3 What you need to think about:
1. All the possible states you could be in 2. All the outputs 3. All the inputs 4. The transitions between the states based on the inputs Note: All inputs and outputs should be accounted for in all the transitions, even when they are “don’t cares.”

4 First step: Draw out the state machine.
Second step: From the state machine, figure out how many bits are needed to encode all the states. If you have 3 states, you need 2 bits. If you have 5 states, you need 3 bits. Encode each of the states. For example, if you have 5 states, then your first state can be 000, and your other states would be 001, 010, etc. Third step: Based on your transitions, draw out the transition table. This is a large table that will map the outputs based on the inputs. You can and should take advantage of “don’t cares.”

5 How to do this Take the initial circuit we give you, which has the D flip flops. The DFFs hold the current state. When the output of the three DFFs is 000 for example, that means that our current state is 0. The inputs into the DFFs correspond to the NEXT STATE. That is because whatever you send into the DFF will be output on the next clock cycle.

6 Once you have figured out your finite state machine, start on your transition table. This should map all your inputs to outputs, your inputs being present state and the actual inputs, and the outputs being the segment display bits and next state. From the table, you can derive the combinational logic for each of the outputs. Once you have finished your transition table, complete the circuit by drawing out all the outputs and connecting them to the “current state” and inputs. For a moore machine, the outputs only depend on the current state. For a mealy, the outputs depend on both the current state and the inputs.

7 For a mealy machine, the outputs depend on both the current state and

8 Also create the circuit for all your next state bits
Also create the circuit for all your next state bits. In the case for our moore machine, there is n0, n1, and n2.


Download ppt "CSE 140L Discussion Finite State Machines."

Similar presentations


Ads by Google