Finite state machines.

Slides:



Advertisements
Similar presentations
Modeling Computation Chapter 13.
Advertisements

Lecture 20 Finite State Machines CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
CSE 311 Foundations of Computing I
Finite State Machines (FSMs)
CS1Q Computer Systems Lecture 12 Simon Gay. Lecture 12CS1Q Computer Systems - Simon Gay 2 Design of Sequential Circuits The systematic design of sequential.
TOPIC : Finite State Machine(FSM) and Flow Tables UNIT 1 : Modeling Module 1.4 : Modeling Sequential circuits.
Denise Landau Fundamentals of Problem Solving Finite State Machines Denise Landau 2013 AQA Computing COMP1.
Finite Automata with Output
CS5371 Theory of Computation
1 Intro to Finite Automata Chapter 2 introduces the concept of a Finite Automata (or FA). An FA has several properties: It is theoretical. It allows computer.
1 Synchronous Sequential Circuit Design. 2 Sequential circuit design In sequential circuit design, we turn some description into a working circuit – We.
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
Finite State Machine(FSM)
Finite State Machines – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Graphs and Finite State Machines Reading: Kolman, Sections.
Rosen 5th ed., ch. 11 Ref: Wikipedia
1 COMP541 State Machines Montek Singh Feb 8, 2012.
Elevator Controller We’re hired to design a digital elevator controller for a four-floor building st try: Design a counter that counts up.
Think about the following expression If the number entered is greater than 15 but less than 25 or the number is 100 and the letter chosen is after p but.
Unit 14 Derivation of State Graphs
Finite-State Machines with Output
Lecture 03: Theory of Automata:08 Finite Automata.
Lecture 07: Formal Methods in SE Finite Automata Lecture # 07 Qaisar Javaid Assistant Professor.
CSE 311 Foundations of Computing I Lecture 21 Finite State Machines Autumn 2011 CSE 3111.
CSE 311 Foundations of Computing I Lecture 21 Finite State Machines Spring
1 Lecture 22 Sequential Circuits Analysis. 2 Combinational vs. Sequential  Combinational Logic Circuit  Output is a function only of the present inputs.
Introduction to State Machine
13-Nov-1513-Nov-1513-Nov-15 State Machines. What is a state machine? A state machine is a different way of thinking about computation A state machine.
1 Finite State Machines (FSMs) Now that we understand sequential circuits, we can use them to build: Synchronous (Clocked) Finite State Machines Finite.
State Table Problem #1 An electronic lock is controlled by a keypad, which has three buttons labeled A, B, and R. The keypad is restricted such that, at.
1 ENGG 1203 Tutorial Combinational Logic (II) and Sequential Logic (I) 8 Feb Learning Objectives  Apply Karnaugh map for logic simplification  Design.
Fundamentals of Informatics
Fundamentals of Informatics Lecture 3 Turing Machines Bas Luttik.
Digital System Design using VHDL

Finite State Machines 1.Finite state machines with output 2.Finite state machines with no output 3.DFA 4.NDFA.
Sahar Mosleh California State University San MarcosPage 1 Finite State Machine.
EEE515J1_L4-1/12 EEE515J1 ASICs and DIGITAL DESIGN EGBCDCNT.pdf An example of a synchronous sequential machine.
Govt. Engineering College- Gandhinagar. It is all about……  STATE MACHINE.
CSC-305 Design and Analysis of AlgorithmsBS(CS) -6 Fall-2014CSC-305 Design and Analysis of AlgorithmsBS(CS) -6 Fall-2014 Design and Analysis of Algorithms.
Lecture 2 Compiler Design Lexical Analysis By lecturer Noor Dhia
Theory of Computation Automata Theory Dr. Ayman Srour.
Lecture 14: Theory of Automata:2014 Finite Automata with Output.
Mealy Machines Finite State Machines with Outputs given on the transitions.
Lecture #4 Thinking of designing an abstract machine acts as finite automata. Advanced Computation Theory.
Theory of Computation Automata Theory Dr. Ayman Srour.
Finite-State Machines (FSM) Chuck Cusack Based partly on Chapter 11 of “Discrete Mathematics and its Applications,” 5 th edition, by Kenneth Rosen.
Finite Automata.
Advantages of FSM Their simplicity make it easy for inexperienced developers to implement with little to no extra knowledge (low entry level)
AS Computer Studies Finite State Machines 1.
1.3 Finite State Machines.
Finite State Machines Dr K R Bond 2009
ANALYSIS OF SEQUENTIAL CIRCUITS
Clocks A clock is a free-running signal with a cycle time.
Copyright © Cengage Learning. All rights reserved.
Modeling Arithmetic, Computation, and Languages
AS Computer Studies Finite State Machines 2.
Synchronous Sequential Circuit Design
Deterministic Finite Automata
Chapter 9 TURING MACHINES.
Deterministic Finite Automata
Finite State Machines.
THEORY OF COMPUTATION Lecture One: Automata Theory Automata Theory.
Electronics II Physics 3620 / 6620
Introduction to Sequential Circuits
ECE 352 Digital System Fundamentals
Sequential circuit analysis
ECE 352 Digital System Fundamentals
Recap lecture 19 NFA corresponding to Closure of FA, Examples, Memory required to recognize a language, Example, Distinguishing one string from another,
Ladder Diagram Design: Huffman Method
Presentation transcript:

Finite state machines

Example -1 Consider a very simple version of American vending machine which provides chewing gum at a cost of 15 cents per packets, and candy bars at a cost of 20 cents each. The machine permits the use of nickels and dimes only and does not give change. In addition to the obvious outputs, namely packets of chewing gum and candy bars, we shall assume that the machine makes reassuring clicks when appropriate coins are inserted.

….. Example -1 Let the input and output alphabets therefore can be denoted as follows: Input alphabet = { 5, 10, Candy Bar Request, Gum Request} Output alphabet = { Dispense Candy Bar, Dispense Gum, click, 2 clicks} An FSM for the vending machine may now be represented by the following state transition diagram:

State Transition Diagram Gum Request → Dispense Gum 5 →1 click Nickel 15 Cents 5 →1 click 5 →1 click 5 →1 click Zero 10→ 2 clicks Dime 20 Cents Candy bar Request → Dispense Candy bar

Example-2 If you have ever used a lift, you have used a finite state machine (FSM). The lift can be in one of a finite number of states at any moment. Finite means countable. For example, one state for a lift serving a three- storey building is at the third floor with doors open. Another is travelling between second and third floor with doors closed. The lift system has inputs and outputs. One input occurs when a person calls the lift by pressing the lift request button on, say, the second floor. One input occurs to indicate the position of the lift to the person waiting on the second floor. For the lift to move in the desired floor, it must always know which state it is currently in and what step to take next so it needs memory to store the current state and a logic device to determine the next step.

Finite state machines When the lift arrives at the second floor, the logic device briefly turns on the door motor open the doors. The logic device must also update the memory to reflect the new state of lift stationary at the second floor with the doors open. Fig 1.3.1 shows a model of this FSM.

Finite state machines A finite state machine is a machine that consists of a fixed set of possible states, a set of allowable inputs that change the state, a set of possible outputs. The outputs can depend only on the current state, which depends only on the history of the sequence of inputs. Many types of digitals machine, including general-purpose computers, are FSMs. General-purpose computers advance their state at regular intervals and the rate at which they advance is called the clock rate of the machine. Each state is one step towards the solution to a problem. Increasing the clock rate of a computer should enable the computers to solve a problem more quickly.

State transition diagram A ballpoint pen is example of an FSM: It has a finite number of states: ballpoint extended and ballpoint retracted. It has set of allowable inputs: clicking the pen’s button. It has a set of possible outputs: retracting or extending the ballpoint. The behavior of ballpoint can be described by a state transition diagram (fig1.3.2). The diagram consists of two states, 0 and 1, and two transitions indicated by curved arrows. Each curved arrow is labeled with the input that causes each transition, here button clicked. By repeatedly clicking the button (input), the pen alternates between state 0 (ballpoint retracted) and state 1 (ballpoint extended); the outputs is determined by which state the pen is in when the button is clicked.

State transition diagram

Worked example Consider a combination lock that opens only when it is given the sequence326. Whether mechanical or electrical, this is an FSM with the state transition diagram shown in fig1.3.3. There are no outputs. The initial state of combination lock is indicated by small entering arrow pointing to the state ‘locked’ and it receives the input 3, the lock moves to the state ‘first digit’. When it receives the input 2, the lock moves to the state ‘second digit’. When it receives the input 6, the lock, moves to the state ‘unlocked’. At any stage, if a digit other than the required digit is entered, the lock remains in its current state.

Worked example The final or halting state is reached when the combination lock is unlocked. The state ‘unlocked’ is indicated by a double circle it is the goal state. The goal state is known as the accepting stage.

FSM with outputs An FSN may produce a response when it makes a transition, i.e. an output. This is represented as shown in Fig.1.3.4. If the input is A when this machine is in state 1 then the machine moves to state 2 and outputs “response”. This type of FSM is known as a mealy machine. It does not have an accepting state.

FSM with outputs This type of machine is used when we want to do more than just recognize a sequence, such as the sequence for the combination lock. We might want a machine starting in the initial state S0 to translate a sequence of received 1s 0s and 2s into plain text consisting of the letters A and B and exclamation mark ! according to the following rule: The system begins receiving in the initial state S0. If the received data is 0 and system is in state S0’ output the latter A. If the received digit is 1 and the system is in state is S0 change state to S1 and output the latter B.

FSM with outputs If the received digit is 2 and the system is in state is S0, change state to S2 and output the latter!. If the received digit is 0 and the system is in state is S1, change state to S0 and output the latter A. If the received digit is 1 and the system is in state is S1, and output the latter B. If the received digit is 2 and the system is in state is S1, change state to S2 and output the character !. Figure 1.3.5 shows the corresponding state transition diagram with outputs for this system.

FSM with outputs The sequence 00101102 produces as output AABABBA! Check this for yourself. What does the sequence 101012 produce as output? Answer BABAB!

State Transition Table We can use a table that shows the state that follows for every state and every input. For example, Table 1 summarizes the ballpoint pen operation. Sometimes the state transition table is just called the state table.

State Transition Table If an FSM has outputs, then the state transition table can also shows the outputs. Table 2 shows the state transition diagram in fig.1.3.5 check the table entries for yourself.

Decision Table A decision table is a precise yet compact way to model complicated logic. Decision table make it easy to observe that all possible conditions are accounted for. For example, some logic is written as follows: If X is greater than 6 and Y is less than 7 Then output “Pass” Else Output “Fail” Table 3 shows the corresponding decision table.

Decision Table Note that there are two subconditions in the conditions section of Table 3: X > 6 X < 7

Decision Table When both conditions are true at the same time, the output is pass .when either of the conditions is false or both are false, the output is fail. The pass or fail output is indicated by X in the corresponding table cell. Note that the rules rows are constructed in a systematic way. For example, if there are two condition alternatives, then the first row is constructed with YYNN and the second row with YNYN.

Decision Table