Download presentation
Presentation is loading. Please wait.
Published byKaitlyn Cranfield Modified over 9 years ago
1
TOPIC : Finite State Machine(FSM) and Flow Tables UNIT 1 : Modeling Module 1.4 : Modeling Sequential circuits
2
FSM : Introduction A finite state machine (FSM) is a model of behavior composed of a finite number of states, transitions between those states, and actions Any Circuit with Memory is a Finite State Machine Even computers can be viewed as huge FSMs
3
Designing FSM Defining states : Total states that system can take. Defining transitions between states: Logic behind going from one state to another. Optimization / minimization : Optimizing a FSM means finding the machine with the minimum number of states that performs the same function.
4
FSM in digital circuits In digital circuits FSM can be made using two types of elements : ◦ Sequential : Any storage element such as Registers which will store the state of System. ◦ Combinational : 1) How the states are changing from one to another. 2) How the output is calculated. FSM are of two types : ◦ Moore FSM ◦ Mealy FSM
5
Moore FSM Output only depend on the present state. S0 / 0 S1 / 0 S2 / 1 0 0 0 1 1 1 NOTE: S0/0 = State/output Moore FSM for “10” sequence detector In state S2 output = 1, since 10 sequence is detected
6
Mealy FSM Output Is a Function of a Present State and Inputs Mealy always have less number of state than Moore. S0 S1 0 / 0 1 / 0 0 / 1 reset Mealy FSM for “10” sequence detector
7
HDL code for Moore FSM IF(reset = ‘1’) Moore_state <= S0; ELSIF (clock = ‘1’ AND clock’event) THEN CASE (Moore_state) S0 : IF (input = ‘1’) Moore_state <= S1; ElseMoore_state <= S0; S1: If (input == 0) Moore_state = S2; ElseMoore_state = S1; S2: If (input = ‘0’) Moore_state <= S0; Else Moore_state <= S1; End Case;
8
8 example: A simple vending machine Here is how the control is supposed to work. The vending machine delivers a package of gum after it has received 15 cents in coins. The machine has a single coin slot that accepts nickels and dimes, one coin at a time. A mechanical sensor indicates to the control whether a dime or a nickel has been inserted into the coin slot. The controller’s output causes a single package of gum to be released down a chute to the customer. One further specification: We will design our machine so it does not give change. A customer who pays with two dimes is out 5 cents! Vending Machine FSM CLK Reset Coin Sensor Gum Release Mechanism Open Vending Machine block diagram 0C 15C 10C 5C5C States:
9
9 — The figure below show the Moore and Mealy machine state transition diagrams. 0 cent [0] 5 cent [0] 10 cent [0] 15 cent [1] Moore machine 15 cent 10 cent 5 cent 0 cent Mealy machine Moore and Mealy machine state diagrams for the vending machine FSM Reset / 0 Reset Reset / 0 N / 0 D / 0 N / 0 N+D/1 N+D N D N D D/1 Reset )/0 Reset )/0
10
Flow Tables FSM can be represented in a tabular form which is known as Flow Table. In a flow table the states are named by letter symbols. Present state X1X2X3X4 S0S1,0S3,0 S0,1 S2S1,0S2,0S3,0S0,0 S3S2,0 S0,0 S4S3,0 S0,1 Input S0,1 = next state, output
11
Flow Table for Vendor machine Example
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.