Ch 1

Chapter 1, part 3: Embedded
Computing
High Performance Embedded
Computing
Wayne Wolf
High Performance Embedded Computing
© 2007 Elsevier
Topics









Why models of computation?
Structural models.
Finite-state machines.
Turing machines.
Petri nets.
Control flow graphs.
Data flow models.
Task graphs.
Control flow models.
© 2006 Elsevier
Models of computation



Models of computation affect programming
style.
No one model of computation is good for all
algorithms.
Large systems may require different models
of computation for different parts.

Models must communicate compatibly.
© 2006 Elsevier
Processor graph
L1
M1
M2
L2
L3
M3
M4
© 2006 Elsevier
Finite state machine

State transition graph
and table are
equivalent:
0/0
1/0
s1
s2
1/1
s2 0
1 s1
s1 0
0 s2
s2 1
1 s2
s3 0
0 s3
s3 0
1 s3
s1 1
0/1
1/0
s3
0/0
0 s1
© 2006 Elsevier
Finite state machine properties


Finite state.
Nondeterministic variant.
© 2006 Elsevier
Nondeterministic FSM

Several transitions out
of a state for a given
input.


Equivalent to executing
all alternatives in parallel.
Can allow e moves--goes to next state
without input.
a
s1
s2
a
© 2006 Elsevier
Deterministic FSM from nondeterministic
FSM
a

Add states for the
various combinations
of nondeterminism.
a
s1
s2
c
b
s4
s3
nondeterministic
a
s1
c
s4
© 2006 Elsevier
s12
c
b
s3
deterministic
Turing machine

General model of computing:
tape
1
0
1
0
0
1
1
0
state
1
1
0
head
program
© 2006 Elsevier
1
0
1
Turing machine step
1.
2.
3.
Read current square.
Erase current square.
Take state-dependent action:
1.
2.
3.
Print new value.
Move to adjacent cell.
Set machine to next state.
© 2006 Elsevier
Turing machine properties

Example program:



If (state = 2 and cell = 0):
print 0, move left, state =
4.
If (state = 2 and cell = 1):
print 1, move left, state =
3.


© 2006 Elsevier
Can be implemented on
many physical devices.
Turing machine is a
general model of
computability.
Can be extended to
probabilistic behavior.
Turing machine properties


Infinite tape = infinite state machine.
Basic model of computability.


Lambda calculus is alternative model.
Other models of computing can be shown to be
equivalent/proper subset of Turing machine.
© 2006 Elsevier
Control flow graph
x=a

Commonly used to
model program
structure.
i = 0?
x=a-b
y=c+d
© 2006 Elsevier
CDFG properties



Finite state model.
Single thread of control.
Can handle subroutines.
© 2006 Elsevier
Petri net

Parallel model of computation.
place
token
transition
arc
© 2006 Elsevier
Firing rule

A transition is enabled if each place at its
inputs have at least one token.



A transition doesn’t have to fire right away.
Firing a transition removes tokens from inputs
and adds a token to each output place.
In general, may require multiple tokens to
enable.
© 2006 Elsevier
Properties of Petri nets


Turing complete.
Arbitrary number of tokens.


Nondeterministic behavior.
Naturally model parallelism.
© 2006 Elsevier
Task graph
t2
t1
P1
P2
P3

P4
P5
Used to model multi-rate systems.
© 2006 Elsevier
Task graph properties

Not a Turning machine.



Possible models of execution time:




No branching behavior.
May be extended to provide conditionals.
Constant.
Min-max bounds.
Statistical.
Can model late arrivals, early departures by adding
dummy processes.
© 2006 Elsevier
Data flow graph

Partially-ordered computations:
+ -, *
+, -, *
+
-
-, +, *
*
© 2006 Elsevier
Data flow streams


Captures sequence but not time.
Totally-ordered set of values.


New values are appended at the end as they
appear.
May be infinite.
+
88 -23
-44
88 7
-23
447944
-28
9
© 2006 Elsevier
Firing rules


A node may have one or more firing rules.
Firing rules determine when tokens are
consumed and produced.

Firing consumes a set of tokens at inputs,
generates token at output.
© 2006 Elsevier
Example firing rules

Basic rule fires when
tokens are available at
all inputs:

Conditional firing rule
depends on control
input:
a
a
+
c
b
b
T
© 2006 Elsevier
Data flow graph properties



Finite state model.
Basic data flow graph is acyclic.
Scheduling provides a total ordering of
operations.
© 2006 Elsevier
Kahn process network

Process has unbounded FIFO at each input:
channel


process
Each channel carries a possibly infinite sequence
or stream.
A process maps one or more input sequences to
one or more output sequences.
© 2006 Elsevier