Sei sulla pagina 1di 34

Embedded Systems

EEE 540
Session 4
Anshul Mittal
Asst. Professor (Sr.) (SENSE)
VIT University

Session Objectives
Understand Embedded System
Modelling [ Flow graph, FSM, Petri
nets]

Questions
What are the units inside a processor
and what are their functionalities?
What is the final stage of software
that is put into microcontroll ?
Can the requirements change in the
design life cycle?

Answers
Units inside a processor : Program
Flow Unit, Control Unit
Final stage of software is called ROM
Image.
It depends on the company policy.

WHY MODELLING ?
Modelling a system before making it into a
product is mandatory.
for eg : If a designer is posted with a challenge of
making an elevator , the designer should first
model it.
Modelling will help the designer to understand the
system better and will increase the confidence
level.
Many modelling techniques are available and it is
upto the designer to make a choice out of it.

VIT University

Typical Embedded System

VIT University

Finite State Machine ( FSM )


Finite state machine is a simple modelling
approach that is very useful to understanding a
system, however complex the system may be.
FSM a model composed of
the number of finite states,
the possible transitions between the finite states ,
actions caused due to transitions and it shall also show
what an action would be taken.

The FSM modelling will start with one of the states


available. It can be quoted as START in the
diagram. It will go through series of transitions and
may finally end with any of the states available.
VIT University

Finite State Machine


A current state is determined by the past states of the
system.
The number and names of states depend on the
different possible states of memory e.g if the memory
is 3 bits long , there are 8 possible states.
A transition indicates a state change and is described
by a condition that would need to be fulfilled to
enable transition.
An Action is description of an activity that is to be
performed at a given moment.
VIT University

Finite State Machine


There are several action types
Entry action which is performed when entering a state
Exit action which is performed when exiting a state
Input action which is performed depending on present state
and input conditions
Transition action which is performed when performing a
certain transition

The Current state is basically determined by the past


states. In short or to be more precise it records the
changes from the starting point to present state.
Number of states is basically governed by the number
of Bits in the memory, for example, if memory is 4
bits long there would be 16 possible states.
VIT University

Finite State Machine


Other than state there are few other terms as well
such as transition and action.
A transition is an indication of a state change that has
happened as a result of meeting a condition
An action is simply a description of an activity that has
to be performed at a given point of time. Actions can be
performed at entry, exit, transition and input.

There are two different groups of state machines :


Acceptors / Recognizers and Transducers
Acceptors and recognizers produce a binary output,
saying either yes or no to answer weather the input is
accepted by the machine or not.

VIT University

Finite State Machine


All states of an FSM are said to be either
accepting or not accepting.
At the time when all input is processed if the
current state is accepting state, the input is
accepted; otherwise it is rejected.
FSM basically works on the principle of CURRENT
STATE and
INPUT to determine the next state.

Figure 1 indicates the FSM principle

VIT University

Finite State Machine : Elevator FSM


model

VIT University

Finite State Machine


Consider that the elevator has been deployed in 3
floor building.
Elevator initially shall be in idle state in any one of
the three floors.
Elevator system does moving up and down based
on the request given by the user.
Assume that elevator is in ground floor and user
got into elevator and has given request to move
to 2nd floor
From idle state after receiving the input from user the
controller designed for the elevator will compare the
input with the current floor number.
VIT University

Finite State Machine


If greater it is overt that the elevator has to move up
and care should be taken that door should not open
when the lift is in motion. So disabling the door open
function during motion is much appreciable.
After reaching the floor the door has to be kept open for
some time (15 seconds) so that user can step out and
will keep it open until a new request comes in.

VIT University

Finite State Machine


The different applications of finite state machine
are discussed in lengths below.
Hardware Applications :
In a digital circuit an FSM may be built using a
programmable logic device, a programmable logic
controller, logic gates and flip flops or relays.
More specifically an hardware implementation requires a
register to store variables, a block of combinatorial logic
which determines state transition and a second block of
combinatorial logic that determines the output of an
FSM.

VIT University

Software Applications
The following concepts are commonly used to
build software applications with finite state
machines
Automata based programming
Event driven FSM
Virtual FSM (VFSM)

The model used for modelling is purely based on


ones comfort and expertise with the method.

VIT University

Perti Net Graph


Bipartite weighted directed graph
Places : Circles
Transitions : bars and boxes
Arcs : arrows labelled with weights

Tokens : Black dots

VIT University

Transition firing rule


A marking is changed according to the following
rules
A transition is enabled if there are enough tokens in
each input place.
An enabled transition may or may not fire.
The firing of a transition modifies marking by consuming
tokens from the input places and producing tokens in
output places.

Transition firing rule


A marking is changed according to the following
rules
A transition is enabled if there are enough tokens in
each input place.
An enabled transition may or may not fire.
The firing of a transition modifies marking by consuming
tokens from the input places and producing tokens in
output places.

Perti Net Modelling


Petri net is primarily used for studying the
dynamic concurrent behavior of network based
systems where there is a discrete flow.
The basic elements of petri net modelling are
places and transitions. An arc is the third element
being used which exists only from a transition to
place or place to a transition.

VIT University

Petri Net Properties


Sequential Execution : In alphabets the letter C
will appear only after A and B are encountered.
Same is the case here. Transition t2 can fire only
after t1 has completed its firing.

VIT University

Synchronization
This property is simple where transition t1 will be
enabled only when atleast one token is there at
each of its input places.

VIT University

Merging
When there are several tokens arriving from
several places at the same transition , merging
happens.

VIT University

Concurrancy
This is one of the most important properties or
petri nets.
Here in this case shown t1 and t2 are concurrent.
This makes petri nets to be used to model
systems of distributed control with multiple
process executing concurrently in time.

VIT University

Conflict
Consider a situation where t1 and t2 are both
ready to fire but the firing of any leads to
disabling of the other transition.
This is like a deadlock situation.

VIT University

An Example
Consider a situation where t1 and t2 are both
ready to fire but the firing of any leads to
disabling of the other transition.
This is like a deadlock situation.

VIT University

An Example
Choclate Vending Machine

VIT University

An Example

VIT University

An Example

VIT University

An Example

VIT University

An Example

VIT University

An Example
Finally the user will get the 15C
choclate.
Advantage of petri net Is that it gives
visual effect and is very simple to
understand.

VIT University

Conclusion
Embedded System Can be modelled using flow
graphs, FSM or petri nets. The selection of
methodology is purely based on users
convinience.
Petri nets have few important properties such as
sequential execution, synchronization, merging,
Concurrancy and conflict.

VIT University

Thank You

Potrebbero piacerti anche