what is state
play

What"is"state?" - PowerPoint PPT Presentation

1 2 What"is"state?" You"see"delicious"looking"potato"salad"in"the"cafeteria?""" Do"you"eat"it?"


  1. 1 2 What"is"state?" • You"see"delicious"looking"potato"salad"in"the"cafeteria?""" Do"you"eat"it?" – Ate"potato"salad"as"a"kid…Good!" EE"109"Unit"9"–"State"Machines" – As"a"teen,"ate"potato"salad"at"a"picnic"aEer"a"long"hot"day…Uh"oh!" • Your"decision"is"influenced"not"just"on"how"it"looks"now,"but" the"sum"of"all"your"previous"experiences" – The"sum"of"all"your"previous"experiences"is"what"is"known"as" state% – Your"'state'"determines"your"interpretaOon"of"your"senses"and" thoughts" • In"a"circuit,"'state'"refers"to"all"the"bits"being"remembered" (registers"or"memory)" • In"soEware,"'state'"refers"to"all"the"variable"values"that"are" being"used" 3 4 State"Machine"Block"Diagram" State"Diagrams" • A"system"that"uOlizes"state"is"oEen"referred"to"as"a"state"machine"" • Abstractly"a"state"machine"can"be"visualized"and"represented" – A.k.a."Finite"State"Machine"[FSM]" as"a"flow"chart"(or"state"diagram)" • Most"state"machines"can"be"embodied"in"the"following"form" – Circles"or"boxes"represent"state" – Logic"examines"what's"happening"NOW"(inputs)"&"in"the"PAST"(state)"to…" – Arrows"show"what"input"causes"a"transiOon" • Produce"outputs"(acOons"you"do"now)"" – Outputs"can"be"generated"whenever"you"reach"a"parOcular"state"or" • Update"the"state"(which"will"be"used"in"the"future"to"change"the"decision)" based"on"the"combinaOon"of"state"+"input" • Inputs"will"go"away"or"change,"so"state"needs"to"summarize/ State Machine to check for two consecutive 1's on a digital input capture"anything"that"might"need"to"be"remembered"and"used"in" the"future" Input=1 Input=1 Input=1 Input=0 Inputs Logic Outputs (ADC, Timer, S0 S1 S2 Buttons) Out=False Out=False out=True Input=0 State On startup Input=0 (memory)

  2. 5 6 Another"Example" Formal"DefiniOon" • Potato"salad"eaOng…Let's"let"state"represent"our"present"feeling/ • MathemaOcally,"a"state"machine"is"defined"by"a"6dtuple"(a" experience" tuple"is"just"several"pieces"of"informaOon"that"go"together):" • NoOce"I"don't"remember"every"occasion"that"I"ate"potato"salad…my"state" – A"set"of"possible"input"values" summarizes"just"enough"for"me"to"make"a"decision" – A"set"of"possible"states" – SomeOmes"two"states"with"same"output"but"it"helps"differenOate"future" – A"set"of"possible"output"values" acOon"(I"have"to"get"sick"twice)"to"not"eat"(if"I"just"had"a"posiOve"and"negaOve" state"I"would"change"my"mind"the"1st"Ome"I"got"sick)" – An"iniOal"state" – A"transiOon"funcOon:""{States"x"Inputs}"d>"the"Next"state" Bad Taste && – An"output"funcOon:"{States"x"Inputs}"d>"Output"value(s)" Not Sick Good Taste && Bad Taste || Get Sick Neutral Get Sick Positive Negative (Eat) (Don't Eat) (Eat) Bad Taste || Get Good Taste && Good Taste && Good Taste && Sick Not Sick Not Sick Not Sick 7 8 Formal"DefiniOon" Washing"Machine"State"Diagram" • MathemaOcally,"a"state"machine"consists"of:" /RESET Inputs% – A"set"of"possible"input"values:""{0,"1}" Stay in the initial state State% 0% 1% – A"set"of"possible"states:"{S0,"S1,"S2}" until there is enough COINS + DOOR Idle S0% S0" S1" money (coins) and – A"set"of"possible"outputs:"{False,"True}" N=2 the door is closed S1% S0" S2" COINS • DOOR – An"iniOal"state"="S0" S2% S0" S2" Fill – A"transiOon"funcOon:""" FULL WV = 1 • {States"x"Inputs}"d>"the"Next"state" State Transition FULL Function – An"output"funcOon:"" Agitate We move through the 5 MIN Motor = 1 states based on the • {States"x"Inputs}"d>"Output"value(s)" State% Outputs% conditions. Outputs 5 MIN / Reset_Timer=1 get asserted when the S0% False" Drain machine is in that EMPTY DV = 1 S1% False" state and the transition is true. EMPTY S2% True" N > 0 N = N - 1 Output Function N = 0

  3. 9 10 Washing"Machine"State"Diagram" Washing"Machine"State"Diagram" /RESET /RESET Move to the Fill state when there is enough COINS + DOOR COINS + DOOR Idle Idle money (coins) and Stay in the Fill state N=2 N=2 the door is closed until it is full … also COINS • DOOR COINS • DOOR set the Water Valve Open output to be Fill Fill FULL FULL true WV = 1 WV = 1 FULL FULL Agitate Agitate 5 MIN 5 MIN Motor = 1 Motor = 1 5 MIN / Reset_Timer=1 5 MIN / Reset_Timer=1 Drain Drain EMPTY EMPTY DV = 1 DV = 1 EMPTY EMPTY N > 0 N > 0 N = N - 1 N = N - 1 N = 0 N = 0 11 12 SoEware"vs."Hardware" Washing"Machine"State"Diagram" /RESET • SoEware" • Hardware" – State"="just"a"variable(s)"" – State"="Register"" COINS + DOOR Idle (DdFlipdFlops)" – Logic"="if"statements"to" N=2 update"the"next"state" – Logic"="AND/OR"Gates"to" Move to the Agitate COINS • DOOR state after it is full produce"the"next"state"&"outputs" • if(state"=="'A'"&&"input"=="1)" Fill FULL WV = 1 """{"state"="'B';"}" – TransiOons"triggered"by"clock" FULL – TransiOons"triggered"by"input" signal" Agitate or"Omers" – More%on%this%in%EE%154% 5 MIN Motor = 1 – In%EE%109,%we'll%implement% 5 MIN / Reset_Timer=1 our%state%machines%in%SW% Drain EMPTY DV = 1 Inputs Outputs Logic EMPTY (ADC, Timer, N > 0 N = N - 1 Buttons) State N = 0 (memory)

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend