0% found this document useful (0 votes)
7 views23 pages

Embedded System Lec - Week4

Uploaded by

c7740947d2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views23 pages

Embedded System Lec - Week4

Uploaded by

c7740947d2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Fall 2023-2024

Semester 2

Embedded Systems
State Machine

Dr. Ahmed Ezz


Reference
Moore Machines and Mealy Machines
Mealy machines are characterized by producing outputs when
a transition is taken.
All example in lectures of week3 are Mealy machine.

Moore machine, produces out puts when the machine is in a


state, rather than when a transition is taken.
Moore Machine Example

Moore machine for a system that keeps track of the number of


cars in a parking garage.
Moore Machine Example

Moore machine for a system that keeps track of the number of


cars in a parking garage.
Extended State Machines
The notation for FSMs becomes awkward when the number of
states gets large.
An extended state machine solves this problem by augmenting the
FSM model with variables that may be read and written as part of
taking a transition between states. (varible-triggered model.)
The transition indicating the initial state initializes the value of c to zero.
The upper self-loop transition is then taken when the input up is present, the
input down is absent, and the variable c is less than M. When this transition
is taken, the state machine produces an output count with value c + 1, and
then the value of c is incremented by one.
The lower self-loop transition is taken when the input down is present, the
input up is absent, and the variable c is greater than zero. Upon taking the
transition, the state machine produces an output with value c - 1, and then
decrements the value of c.
Note that M is a parameter, not a variable. Specifically, it is assumed to be
constant throughout execution
Extended State Machines
We can build FSM for parking garage using three states:
Empty: when c = 0 , no cars in garage (initial state)
Loaded: when 0 < c < m, there is some cares in garage
Full: when c = m, there is no place in garage
Time-triggered model
Suppose all inputs are discrete and a reaction occurs on the
tick of an external clock. This is a time-triggered model.

Traffic Light Controller


Extended State Machines
Extended state machine model of a traffic light controller that
keeps track of the passage of time, assuming it reacts at
regular intervals.
Nondeterminism
0 1 0 1
State 1 State 1 State 2 State 1 State 1 State 2
State 2 State 3 State 1 State 2 State 3
State 3 State 2 State 1 State 3 State 2 State 1

0 1
State 1 State 1 State 2
State 2 State 3 State 1, State 2
State 3 State 2 State 1
Formal Model OF Nondeterminism
Uses of Nondeterminism
While nondeterminism is an interesting mathematical concept in
itself, it has two major uses in modeling embedded systems:

Environment Modeling: It is often useful to hide irrelevant details


about how an environment operates, resulting in a
nondeterministic FSM model.

Specifications: System specifications impose requirements on


some system features, while leaving other features unconstrained.
Nondeterminism is a useful model ing technique in such settings as
well.
Environment Modeling
The traffic light controller has one pure input signal,
pedestrian
This input is present when a pedestrian arrives at the
crosswalk.
The traffic light will remain green unless a pedestrian arrives.
Some other sub system is responsible for generating the
pedestrian event, presumably in response to a pedestrian
pushing a button to request a cross light.
Environment Modeling
Environment Modeling
Specifications
Consider a specification that the traffic light cycles through
red, green, yellow, in that order, without regard for the timing
between the outputs.
The nondeterministic FSM models this specification.
The guard true on each transition indicates that the transition
can be taken at any step.
Technically, it means that each transition is enabled for any
input valuation in Inputs.
Specifications
Behaviors and Traces (State Sequence)
FSM behavior is a sequence of (non-stuttering) steps.
A trace is the record of inputs, states, and outputs in a behavior.
A computation tree is a graphical representation of all possible traces.
Behaviors and Traces (State Sequence)
FSMs are suitable for formal analysis.
For example, safety analysis might show that some
unsafe state is not reachable.
Non-deterministic Behavior: Tree of Computations
For a fixed input sequence:
• A deterministic system exhibits a single behavior
• A non-deterministic system exhibits a set of behaviors as
tree.
Non-deterministic ≠ Probabilistic (Stochastic)
In a probabilistic FSM, each transition has an associated
probability with which it is taken.

In a non-deterministic FSM, no such probability is known. We


just know that any of the enabled transitions from a state can
be taken.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy