By nature hardware is parallel and familiar software is sequential
Software languages like C are not ideal to describe hardware nor is HDL/RTL code ideal for modeling software component
Codesign simulation traditionally involved ported a model from one domain from the other, sometimes requiring writing component models twice
The are some emerging simulation platforms support co-simulation
At a high level the architecture needs some common framework to describe the application algorithm that captures the data processing and inter-dependence of the hardware and software components.
Data Flow Graphs represent one such method and are well known in digital signal processing communities
Traditional sequential code does not explicitly support representation of concurrency – difficult to identify opportunities for parallelism when examining the order of operations in the specific implementation
Sequential C Code
Fig 2.1 Example: Pulse Amplitude System
Actors represent functions operating on the data
Use of Actors in DFGs represents
Concurrency: Actors operate and execute individually. Their internal implementation may be for example
sequential code or hardware
Distributed Behavior: the modeling does not require a centralized controller. (In practice we will likely
synchronize and coordinate the implementations of the actors with a controller but is not required and not part of the model)
Modularity: components for actors may be used to develop a library that can be reused in another application
Analysis: high level analysis can performed on graphs to determine conditions such as deadlocks and possible
level of algorithmic parallelism. With C, verification is often determined by execution on sample data.
Actors:
Tokens: are the conceptual units that carry information from one actor to the other. Token contain values such as 1,4,5,8 in the example below
Queues: are unidirectional communication links with infinite capacity (examining later if infinite capacity is actually needed )
Firing rule: describes the necessary and sufficient conditions for an actor to fire – such as number of token available.
Actors may only observe data presented to them from their input queue, they may not observe the state of the system.
Actor firing occurs when data is available on the actor’s input queue(s) according to a firing rule.
A marking represents a drawn representation of the state of the system and includes a depiction of the tokens present in each queue The evolution of the system involves actors firing. With each firing, actors consume some number of tokens from input queue(s) defined as the token consumption rates and placing tokens on the output queues according to defined production rates
Fig. 2.4 System Evolution depicted by multiple markings
Fig 2.5: Data flow actor with production and consumption rates
Example adder with firing rule of one on each input and produces 1 output:
Time is not represented by these models only possible ordering of events and states
A PASS is defined as follows:
Example:
The residual tokens left on the edges after these firings are two tokens on edge(A,B) and a token on edge(A,C):
(2.2)
(2.3) * Correction Shown: Equation 2.3 Should have solution: [4 2 0] not [2 1 0]
Step 3: Determine a periodic firing vector. The firing vector indicated above is not a good choice to obtain a PASS: each time this firing vector executes, it adds three tokens to the system. Instead, we are interested in firing vectors that leave no additional tokens on queues. In other words, the result must equal the zero-vector.
(2.4)
Since the rank of G is less than the number of nodes. This system has an infinite number of solutions, Intuitively, this is what we should expect. Assume a firing vector (a,b,c) would be a solution that can yield a PASS. Then also (2a,2b,2c) will be a solution, and so is (3a,3b,3c). and so on. You just need to find the simplest one. One possible solution that yields a PASS is to fire A twice, and B and C each once:
(2.5)
Verification of Relative Rates:
The existence of a PASS firing vector does not guarantee that a PASS will also exist. For example, just by changing the direction of the (A,C) edge, you would still find the same , but the resulting graph is deadlocked since all nodes are waiting for each other. Therefore, there is still a fourth step: construction of a valid PASS.
Step 4: Construct a PASS. We now try to fire each node up to the number of times: specified in . Each node which has the adequate number of tokens on its input queues will fire when tried. If we find that we can fire no more nodes, and the firing count of each node is less than the number specified in qpass. the resulting graph is deadlocked.
We apply this on the original graph and using the firing vector (A = 2,B = 1,C = 1). First we try to fire A, which leaves two tokens on (A,B) and one on (A,C), Next, we try to fire B -- which has insufficient tokens to fire. We also try to fire C but again have insufficient tokens. This completes our first round through -- A has fired already one time. In the second round, we can fire A again (since it has fired less than two times), followed by B and C, At the end of the second round, all nodes have reached the firing count specified in the PASS firing vector. and the algorithm completes. The PASS we are looking for is (A,A,B,C).
The same algorithm, when applied to the deadlocked graph in Fig. 2.11, will immediately abort after the first iteration, because no node was able to fire.
Derivation of Periodic Schedule:
A:
B:
C:
Start with an initial marking with NO tokens. If needed, you can rework the system with initial tokens added.
A: A can fire
B:
C:
B: can't fire
C: can't fire
A can fire:
A:
A:
B: can fire
C:
A:
B:
C: can fire
If at any point in working through a firing schedule you can't fire a node, you can trying rework the system with initial tokens added to the intial marking. These become memory elements later in the implementation.
Example Graph requiring an initial token:
Possible initial marking for graph requiring an initial token:
Approaches to modeling conditional execution/firing are discussed in the text, including an approach of extending the data flow model.
Modeling of IF statements directly using SDF Graphs can be done is as follows
Assumes actors A,B and operate independently on the same data and the actor Sel consumes both results and propagates one or the other
in software:
if (condition) perform A with input else perform B with input
instead:
perform concurrently 1. A with input and 1. B with input producing two results if (condition) use result from A else use result from B
the sel actor acts just like a mux
Modeling using extension to SDF
Loop bound – loop execution time/ # delays
Example: Samples per time unit (a) 1/8 (b) 1/8 (c) 1/5
Iteration Bound highest loop bound. It is an upper bound, not necessarily achievable.
Some actors may not be along an internal loop, meaning we can't analyze them through an analysis covering only internal loops.
These actors can still limit the performance of the system they are in. We can consider implied outter loops with at least one cycle delay to unify the analysis.
Loopbound of outer loop or of a linear graph is implied and may also be accounted for. In this case LB = 8.
System loop (loop through nodes and external system) must have at least one delay (register)