finite state machines

19
FINITE STATE MACHINES

Upload: romeofatima

Post on 13-Jul-2016

1 views

Category:

Documents


0 download

DESCRIPTION

Finite State Machines

TRANSCRIPT

Page 1: Finite State Machines

FINITE STATE MACHINES

Page 2: Finite State Machines

Where can you find applications of FSMs Computer Design Communications Linguistics Theory of Computations

Page 3: Finite State Machines

Basic Concepts Most complex devices are realized by

interconnecting many simple components Only a finite number of physical symbols can

be enclosed a specified volume The symbols used to signal events between

the components are often represented by the values of physical quantities

A given signal or state requires a small but nonzero interval to measure

Page 4: Finite State Machines

Basic Concepts

We convert problem solutions into sequence of steps

Designing machines one step at a time is the simplest way to make its behavior deterministic

Page 5: Finite State Machines

Finite State Machines are

Finite Discrete Sequential Deterministic

Page 6: Finite State Machines

Applied FSMs

Mechanical Systems Digital Electronic Systems Pneumatic and Hydraulic Systems Chemical Systems Informstion Processing Systems

Page 7: Finite State Machines

Properties of Finite State Machines

INPUT CHANNEL OUTPUT CHANNEL

INITIALIZE

s(t) s(t-1)…s(1) r(t) r(t-1)…r(1)

Page 8: Finite State Machines

Properties of FSM The behavior of M is defined only at the

moments t = 0, 1, 2, …

The input symbols s(t) are chosen from a finite input alphabet S

The output symbols r(t) are chosen from a finite output alphabet R

Page 9: Finite State Machines

Properties of FSM The behavior of M is uniquely determined by

the sequence of input symbols presented

The behavior of M carries it through a sequence of states, each of which is a member of the state set Q

There is an initial state qi of M that describes the condition of the parts of M just before any stimulus is presented

Page 10: Finite State Machines

Mathematical Description of FSMFSM consist of the following:1. The finite sets S,R,Q2. A state transition function f that gives the next

state of M in terms of the current state and the next input symbol

3. An output function g that gives the next output symbol of M in terms of the current state and next input symbol

4. A predetermined initial state q(0) = qi in which M is placed prior to instant t = 0

Page 11: Finite State Machines

Machine with Transition-Assigned OutputA transition-assigned finite state machine is a six-tuple M = (Q,S,R,f,g,qi)

WhereQ is a finite set of internal statesS is a finite input alphabetR is a finite output alphabet f is the state transition function, f: Q x S Q g is the output function, g: Q x S R qi is the initial state

Page 12: Finite State Machines

Representations of MachinesState Table

: .

… q’,r …

: .

q

s

s/rQ q’

Page 13: Finite State Machines

Representations of Machines

State Diagram

s/rq q’

q’ = f(q,s) r = g(q,s)

Page 14: Finite State Machines

Example 1

The Modulo-3 Counter

Design a FSM whose output tells the number of inout symbols modulo 3. Let a be the input symbol

Page 15: Finite State Machines

Example 2

The Parity Checker (Even Parity)

Design a FSM that will accept a series of 1’s and 0’s; it should output 0 if there are even number of 1’s in the input stream otherwise it should output 1

Page 16: Finite State Machines

Example 3

Language Recognizer

Design a FSM to identify if an input w is an element of the language

L ={ 11*01*}

Page 17: Finite State Machines

LUNCH BREAK!

Page 18: Finite State Machines

CS Entry 4 (25 points each)1. The 2-Unit DelayThe input and output alphabets of machine M are

{0,1}. The output sequence is to be a replica of the input sequence delayed by two time units

Q = {A,B,C,D}

2. Language RecognizerDesign a FSM to identify the languageL= {abk|k>=0}Q = {A,B,C}

Page 19: Finite State Machines

Class Presentation

BINDING

CONTROL STRUCTURES