+ All Categories
Home > Documents > lect5-fsm.ppt

lect5-fsm.ppt

Date post: 06-Jul-2018
Category:
Upload: sangeetha-sangu-bc
View: 215 times
Download: 0 times
Share this document with a friend

of 23

Transcript
  • 8/17/2019 lect5-fsm.ppt

    1/23

  • 8/17/2019 lect5-fsm.ppt

    2/23

    2

    Finite State Mac ine (FSM! Design

    • FSMs are different from counters in the sense that they have external!"s# and state transitions are de$endent on these !"s and the current

    state%• &xam$le ' "ro(lem StatementThere is a (it)serial !" line% Desi*n an FSM that out$uts a +,-if an even . of 1-s have (een received on the !" line and theout$uts a +1- other/ise%

    Note ' f a synchronous se0uential circuit is (ein* desi*ned# the countin*of the . of 1s occur every cloc cycle%

    FSMx !$ y

    345 345

    x

    . of 1s

    even6,7

    odd617

    even627

    odd687 odd687

  • 8/17/2019 lect5-fsm.ppt

    3/23

  • 8/17/2019 lect5-fsm.ppt

    4/23

    <

    FFs

    &xternal !"s &xternal !"s

    m1 m2

    nn

    3om(%4o*ic

    345

    FFsn

    345

    n

    ut$ut4o*ic

    m2

    Next State3om(%4o*ic

    m1

    &xternal!"s

    &xternal ut$uts

    Mealy Machine Model Moore Machine Model

    even ↓odd

    Time t ' &ven !" ∆ = $ro$a*ation delay of lo*ic of Mealy M!3

    t t>∆ t>T 345 t>T 345 >∆2

    &venx=1

    !"=,

    !"=1

    6Mealy7

    dd !"=1

    6Moore7

    ∆2 = $ro$a*ation delay of !"

    lo*ic unit of Moore M!3

  • 8/17/2019 lect5-fsm.ppt

    5/23

    ?

    State Transition Ta(le

    6&ven)"arity 3hec er7

    &ven State' , @ dd State' 1@ State aria(le A

    A x A > y 1 y 2 D A TA, , , , , , ,

    , 1 1 , 1 1 1

    1 , 1 1 1 1 ,

    1 1 , 1 , , 1

    "resentState

    n$ut NextStateMoore

    !"Mealy

    !"D)FF&xcit%

    T)FF&xcit%

    n$ut varia(lesto com(% lo*ic

    B

    FF

    N%S% C !"

    4o*ic

    345

    x y2

    A D A

    r

    FFs

    y1

    N%S%4o*ic

    !"4o*

    ic

    DAAB

    x

    DA= A⊕x @ TA= xy1 = A for Moorey2 = A⊕x for Mealy

    ut$ut functions

  • 8/17/2019 lect5-fsm.ppt

    6/23

    State=,&ven

    State=1dd

    1!11!,

    ,!1

    9eset ,State=,&ven

    11

    ,

    9eset:,;

    State=1dd

    :1;

    x

    FF

    N%S%4o*ic

    345

    B

    B DD)

    Mealy MooreAssume sin*le (it state information stored in a D)FF

    345

    x

    D

    B6s

    tate7y26Mealy !"7y1 Moore !"

    State Transition is occurrin*

    State Transition is occurrin*

    S%T% is com$lete%

    S%T% is com$lete%

    oddoddevenevenoddeven

    ,!,

  • 8/17/2019 lect5-fsm.ppt

    7/23 E

    Moore M!3 m$lementation

    D B

    B9 345

    y2x=1

    A,

    a7 D)FF

    T B

    B9

    A y 2x

    345

    (7 T)FF

    Moore !" is synchroni ed /ith cloc %

    Mealy M!3 m$lementation

    D B

    B9 345

    y1

    x=1A

    , 1 T B

    B9

    x

    345

    y1

    a7 D)FF (7 T)FF

    Mealy !" is not synchroni ed /ith cloc %

    9eset

    9eset

    9eset

    9eset

  • 8/17/2019 lect5-fsm.ppt

    8/23 G

    Di erence 3et1een Mealy an$ Moore Mac ine

    Mealy Moore617 !"s de$end on the $resent !"s de$end only on the

    state and $resent !"s $resent state627 The !" chan*e asyn Since the !"s chan*e)chronously /ith the /hen the state chan*es#

    ena(lin* cloc ed*e and the state chan*e is synchronous /ith the ena(lin* cloc ed*e# !"s chan*e synchronously

    /ith this cloc ed*e687 A counter is not a Mealy A counter is a Moore

    machine machine6

  • 8/17/2019 lect5-fsm.ppt

    9/23

    Another exam$le' A sim$le vendin* machineHere is ho/ the control is su$$osed to /or % The vendin* machine delivers

    a $ac a*e of *um after it has received 1? cents in coins% The machine has a sin*lecoin slot that acce$ts nic els and dimes# one coin at a time% A mechanical sensor

    indicates to the control /hether a dime or a nic el has (een inserted into the coin slot%The controller-s out$ut causes a sin*le $ac a*e of *um to (e released do/n a chuteto the customer%

    ne further s$ecification' Ie /ill desi*n our machine so it does not *ivechan*e% A customer /ho $ays /ith t/o dimes is out ? centsJ

    endin*Machine

    FSM

    345

    9eset

    3oinSensor Kum9eleaseMechanism

    $en

    endin* Machine (loc dia*ram

    ,3 ≥1?31,3?3

    States'

  • 8/17/2019 lect5-fsm.ppt

    10/23

    1,

    L The fi*ure (elo/ sho/ the Moore and Mealy machine state transition dia*rams%

    , cent:,;

    ? cent:,;

    1, cent:,;

    1? cent:1;

    Moore machine

    1? cent

    1, cent

    ? cent

    , cent

    Mealy machine

    Moore and Mealy machine state dia*rams for the vendin* machine FSM

    9eset ! , N 6 N 6 + D9eset

    9eset9eset ! ,

    N ! ,

    D ! ,

    N ! ,

    N>D!1 N>D

    N

    D

    N

    D

    D!1

    N D

    N ,! D

    N D N ,! D

    9eset 7!, + D 9eset 7!,

  • 8/17/2019 lect5-fsm.ppt

    11/23

    11

    B 1 B 2 D N B 1> B 2> $en $en

    , , , , , , , , , 1 , 1 , , 1 , 1 , , , 1 1 x x x x , 1 , , , 1 , , , 1 1 , , , 1 , 1 1 , 1 1 1 x x x x 1 , , , 1 , , , , 1 1 1 , 1 1 , 1 1 , 1 1 1 x x x x 1 1 , , 1 1 1 1 , 1 1 1 1 1 1 , 1 1 1 1 1 1 x x x x

    "resent State n$uts Next State Moore ut$ut Mealy ut$ut

    &ncoded vendin* machine state transition ta(le%

    B > = D

    B B > D, , ,, 1 11 , ,1 1 1

    LState transition ta(le for Moore and Mealy M!3%6Next state also *ives D)FF excitation7%

  • 8/17/2019 lect5-fsm.ppt

    12/23

    12

    m$lementation usin* D)FFs

    ,, ,1 11 1,

    ,,

    ,1

    11

    1,

    B 1B ,DN ,, ,1 11 1,

    ,,

    ,1

    11

    1,

    B 1B ,DN ,, ,1 11 1,

    ,,

    ,1

    11

    1,

    B 1B ,DN

    , , 1 1

    , 1 1 1

    x x x x

    1 1 1 1

    , 1 1 ,

    1 , 1 1

    x x x x

    , 1 1 1

    , , 1 ,

    , , 1 ,

    x x x x

    , , 1 ,

    5)ma$ for D 1 5)ma$ for D , 5)ma$ for $en 6Moore7

    D1 = B 1 > D > B , N DQ N Q N QQ N D ⋅+⋅+⋅+⋅= 11,,,

    "&N = B1

    B,

    "&N = B1 B , > D B, > D B1 > N B1MooreMealy

    ,, ,1 11 1,

    ,,

    ,1

    11

    1,

    B 1B ,DN

    , , 1 ,

    , , 1 1

    x x x x

    , 1 1 1

    5)ma$ for $en 6Mealy7

  • 8/17/2019 lect5-fsm.ppt

    13/23

  • 8/17/2019 lect5-fsm.ppt

    14/23

    1<

    m$lementation usin* )5 FFS

    B 1 B 2 D N B 1> B 2> 1 5 1 , 5 ,

    , , , , , , , x , x , 1 , 1 , x 1 x 1 , 1 , 1 x , x 1 1 x x x x x x , 1 , , , 1 , x x , , 1 1 , 1 x x 1 1 , 1 1 1 x x ,

    1 1 x x x x x x 1 , , , 1 , x , , x , 1 1 1 x , 1 x 1 , 1 1 x , 1 x 1 1 x x x x x x 1 1 , , 1 1 x , x ,

    , 1 1 1 x , x , 1 , 1 1 x , x , 1 1 x x x x x x

    9ema$$ed next)state functions for the vendin* machine exam$le%

    B B>

    5 , , , x, 1 1 x1 , x 11 1 x ,

    )5 &xcitation

  • 8/17/2019 lect5-fsm.ppt

    15/23

    1?

    ,, ,1 11 1,

    ,,

    ,1

    11

    1,

    B 1B ,DN

    ,, ,1 11 1,

    ,,

    ,1

    11

    1,

    B 1B ,DN ,, ,1 11 1,

    ,,

    ,1

    11

    1,

    B 1B ,DN

    ,, ,1 11 1,

    ,,

    ,1

    11

    1,

    B 1B ,DN

    , , x x

    , 1 x x

    x x x x1 1 x x

    x x , ,

    x x , ,

    x x x x

    x x , ,

    , x x ,

    1 x x 1

    x x x x

    , x x 1

    x , , x

    x 1 , x

    x x x x

    x , , x

    5)ma$ for 1 5)ma$ for 5 1

    5)ma$ for , 5)ma$ for 5 ,5)ma$s for )5 fli$)flo$ im$lementation of vendin* machine%

    1 = D > B , N 5 1 = , DQ N Q J ⋅+⋅= 1,, N Q K ⋅= 1,

  • 8/17/2019 lect5-fsm.ppt

    16/23

    1

    B

    B9

    B 1

    345

    5

    B

    B9

    B,

    345

    5

    "&N N

    B ,

    D

    N

    D

    B 1

    N

    ,Q1Q

    ,Q1Q

    )5 fli$)flo$ im$lementation for the vendin* machine exam$le 6Moore7%

    Similarly# a Mealy im$lementation@ only the "&N function chan*es%

    9eset

  • 8/17/2019 lect5-fsm.ppt

    17/23

    1E

    Oasic Ste$s in the FSM Desi*n "rocedure

    1% Understand the $ro(lem and the different information classes6minimal num(er7 re0uired to solve it%

    2% 3onvert these information classes into distinct states# and

    determine the state transition dia*ram of the FSM%

    8% &ncode states in (inary# and o(tain state transition ta(le and FFexcitation for desired FF ty$e%

  • 8/17/2019 lect5-fsm.ppt

    18/23

  • 8/17/2019 lect5-fsm.ppt

    19/23

    1

    Note' 6A7' is 8y>, = 8y . of 1-s received%

    • No/ the transitions (et/een the8 classes of information is clear'6A7→ 6O17→ 6O27→ 6A7

    1 received 1 received 1 received

    • Hence these classes of information can (e considered states ofthe re0uired as states of the re0uired FSM'

    These 8 states can (e re$resented (y 8y> # i = ,#1#2

    i=,

    i=1

    i=2 i=2:,;

    i=1:,;

    i=,:1;

    9eset 9eset,!1

    ,!,

    ,!,

    1!,

    1!1

    ,,

    1,

    ,1 1

    1

    1

    ,

    ,

    ,

    Moore MachineMealy Machine

    n$ut

    ut$ut

    1!,

  • 8/17/2019 lect5-fsm.ppt

    20/23

    2,

    FSM Iord "ro(lem 2'

    • Desi*n a system that out$uts a +1- /henever it receives'6a7 A multi$le of 8 . of 1-s AND 6(7 A non) ero even . of ,-s

    &%*%# 66,#27 # 68#27 # 68#i# i = ,#1#2:8 classes;

    ) For . of ,-s' 2 >Q# Q = ,#1For Q = ,# /e need to distin*uish (et/een ero 6 = ,7and non) ero 6 R ,7 . of ,-s

    ) Thus /e have 8 classes'2 >,# = , 6 , 72 >,# R , 6 non) ero even 72 >1 6 odd 7

    . of ,-s

    . of 1-s

  • 8/17/2019 lect5-fsm.ppt

    21/23

    21

    The relevant . of 1-s can (e re$resented (y i = ,# 1# 2 6 . of 1-s = 8y>i 7

    L The relevant . of ,-s can (e re$resented (y Q= , , # , R, # 1

    6 . of ,-s = 2 >Q 7 /here the su(scri$t of the , indicates /hether=, or R,%

    L Since at any $oint time# a certain . of 1-s and . of ,-s /ill have

    (een received# the state of the system /ill (e *iven (ya com(ination of relevant . of 1-s and . of ,-s%

    L There are com(inations'

    ,# 1# 2# P , , # , R, # 1 = {6,#, , 7# 6,#,R, 7# 6,#17# 61#,, 7# 61#,R, 7# 61#17# 62#,, 7# 62#,R, 7# 62#17} . of 1-s . of ,-s

    3artesian"roduct

  • 8/17/2019 lect5-fsm.ppt

    22/23

    22

    6,#, , 7

    61#,, 76,#, R, 7

    62#,, 7

    62#17

    61#17 6,#17

    62#,R, 7

    61#,R, 7

  • 8/17/2019 lect5-fsm.ppt

    23/23

    28

    6,#, , 7

    61#,, 7 6,#, R, 7

    62#,, 7

    62#17

    61#17 6,#17

    62#,R, 7

    61#,R, 7

    9eset Note' , R, ≡ 2 >Q# Q = ,

    R ,

    1!,

    1!,

    ,!, 1!,

    ,!,

    ,!,

    ,!,

    ,!,

    ,!,

    ,!1

    1!,

    1!,

    ,!,

    ,!,

    1!,

    1!,

    1!1

    1!,


Recommended