Title: Introduction to Finite State Machine (FSM)
1Introduction to Finite State Machine (FSM)
2Objectives
- Automata Based specification
- Finite State Machine
- Statecharts
- Petri Nets
3FSM
- Key characteristics of FSM
- Focus is on control
- Appropriate for specifying systems having finite
set of states - Used to specify a system with limited states
(e.g. ,lexical analyzers) - Key problem
- State Explosion Problem (SEP)
- A variety of models have been proposed to
overcome SEP
4(No Transcript)
5(No Transcript)
6(No Transcript)
7(No Transcript)
8(No Transcript)
9(No Transcript)
10(No Transcript)
11(No Transcript)
12(No Transcript)
13(No Transcript)
14(No Transcript)
15(No Transcript)
16(No Transcript)
17(No Transcript)
18(No Transcript)
19Simple DFA Lexical analyzer
a d
a
A B
A
B
a
B B B
d
20Simulating DFA
- Input an input string X terminated by eof
- Output
- Yes if M accepts string x,
- No otherwise
21FSM Simulation Algorithm
s S0 c getnextchar() While c? eof do s
move(s,c) cgetnextchar End If s ?F then
return yes Else return no
22Nondeterministic FA (NFA)
- NFA
- Differs from deterministic model
- For any given state and input symbol, there may
exist more than one transition
23example
b
b
0
1
3
2
a
b
a
Possible paths lt0, 0, 1,2,3gt, lt0,0,0,0,0gt
24(No Transcript)
25(No Transcript)
26(No Transcript)
27(No Transcript)
28(No Transcript)
29(No Transcript)
30(No Transcript)
31(No Transcript)
32Example A chocolate Vending Machine (CVM)
- CVM will dispense a chocolate bar for 11 cents.
- The requirements for machine are
- Accepts 1, 10 cents
- Gives no changes
- Refunds all coins if wrong amount (too little or
too much) is given - Cannot accepts more than two coins
33(No Transcript)
34(No Transcript)
35(No Transcript)
36(No Transcript)
37(No Transcript)
38(No Transcript)
39(No Transcript)
40(No Transcript)
41(No Transcript)
42(No Transcript)
43(No Transcript)
44(No Transcript)
45(No Transcript)
46(No Transcript)
47(No Transcript)
48(No Transcript)
49(No Transcript)
50(No Transcript)
51(No Transcript)