Download presentation
Presentation is loading. Please wait.
1
Synthesis of Embedded Software Using Free-Choice Petri Nets
2
Challenges in Embedded System Design Software development and its integration with the hardware − Start with a implementation-independent specification of overall system − Map it to a heterogeneous architecture …
3
Introduction Embedded system specification − Data computations Schedule can be completely computed at compile time,. − Control structures Data dependent control − like if-then-else or do loops Real time controls − Suspension, trigger actions after the occurrence of external or internal events.
4
Introduction − Schedule Static − static(single task, predictable, executed with no run-time overhead) Data dependent − in addition to data computation, the order of operations are executed depends on the value of some data, which is known at run-time. − quasi-static scheduling techniques computing most of the schedule at compile time, leaving at run-time only the solution of data-dependent decisions. partition the functionality of the specification into tasks.
5
Introduction − Dynamic schedule Or real-time controls, the run-time behaviour depends on the occurrence of external events. Classical Real-Time scheduling techniques can be used to decide at run-time which tasks should be executed in reaction to such events. An ideal scheduling technique should combine the best aspects of the scheduling techniques: 1.static scheduling to exploit fixed dependencies between blocks of operations,
6
Introduction 2.quasi-static scheduling to identify data-dependent operations with the same rate and schedule them, 3.dynamic scheduling to determine which tasks, among those identified at the previous step, should be executed. Software synthesis technique: Static and quasi-static scheduling generates sequential code and can statically allocate communication buffers.
7
Introduction An effective software synthesis technique should: 1.check if the specification can be scheduled in finite memory, and thus be implemented on an embedded processor, 2.allow one to evaluate tradeoffs between memory size and execution speed of the final implementation. — This paper: A new approach to software synthesis. PNA set of software tasks
8
Introduction − Transitions: data computations ; − Places: non-FIFO channels between computation units. − Data-dependent control : places, called choices, with multiple output transitions, − Data: tokens passed by transitions through places, − Free-Choice (FCPNs): it has a clear distinction between the concurrency and choice. The outcome of a choice depends on the value rather than on the arrival time of a token.
9
Introduction FCPN is quasi-statically schedulable if for every possible resolution of the control at the choice places, there exists a cyclic finite sequence that returns the tokens of the net to their initial places. cyclic sequences ensures that the number of data tokens that accumulate in any place is bounded even for infinite execution.
10
Definitions − Petri Net: (P,T,F) − Preset: − Postset: − Source, Sink − Choice or conflict: place p, |p|>1 − Marking: μ ={μ1, μ2, μ3 … μn } − Reachability: a marking μ’ is reachable from a marking μ if there exists a firing sequence σ starting at marking μ and finishing at μ’. − Boundedness: k-bounded if the number of tokens in every place of reachable marking <k
11
Definitions Deadlock-freedom: no matter what marking has been reached, it is possible to fire at least one transition of the net − Liveness: for every reachable marking and every transition t it is possible to reach a marking that enables t.
12
Definitions − Common subclasses of PN: Marked Graph: A PN such that each place p has at most one input transition and one output transition Conflict free Net: A PN such that each place p has at most one output transition Free choice Net: A PN such that every arc from a place is either a unique outgoing arc or a unique incoming arc to a transition.
13
Definitions Marked Graphs can represent concurrency and synchronization but not conflict. Free Choice Nets allow one to model both conflict and synchronization, under the condition that every transition that is successor of a choice has exactly one predecessor place. Therefore, Free Choice Nets model data-dependent control by abstracting if-then-else control decisions as non-deterministic choices, but they can not model external conditions or multiple rendezvous.
14
Definitions − Cyclic Schedule: finite complete cycle: A sequence of transition firings that returns the net to its initial marking. The number of tokens that can accumulate in any place of the net is bounded and the net can be executed forever with bounded memory. a static schedule is a periodic sequence of transitions and the period is a finite complete cycle.
15
Definitions To find a finite complete cycle σ, we must first solve the state equations f(σ) T. D = 0. f(σ), called T-invariant, is a vector of times that transition ti fired in sequence σ. A Petri Net is consistent f(σ) T. D = 0. The existence of a T-invariant is a necessary, but not sufficient for a finite complete cycle to exist: deadlock can still occur if there are not enough tokens to fire any transition. once a T-invariant is obtained, it is necessary to verify that there exists a sequence σi that contains transition tj as many times as fj(σ).
16
Qusi-static Scheduling of FCPN
17
Given an FCPN N and an initial marking μ0, the pair (N,μ0) is (quasi-statically) schedulable, if there exists a valid schedule. Valid schedule: for each sequence σi that includes a conflict transition σij, for each transition tk that is in equal conflict relation with σij, there exists another sequence σl s.t. σi and σl are identical up to the (j-1)th transition and have respectively σij and tk at the j-th position in the sequence.
18
Qusi-static Scheduling of FCPN Σ={(t1,t2,t4),(t1,t3,t5)} is a valid schedule because for every solution of the conflict between transitions t2,and t3, it is possible to complete a cycle that returns the net to the initial marking by firing t4 after t2 or t5 after t3.
19
Qusi-static Scheduling of FCPN Σ={(t1t2t1t2t4),(t1t3t5t5)} is a valid schedule. there is no guarantee that this happens within a cycle because it is not possible to know a priori which transition among t2 and t3 fires.
20
Qusi-static Scheduling of FCPN A valid schedule does not necessarily include all the possible cyclic firing sequences, some even of infinite length, that can occur depending on the resolution of the non-deterministic choices. {(t1t3t5t5),(t1t2(t1t3t5t5) n t1t2t4)} A valid schedule should a complete set of cyclic firing sequences that ensure bounded memory execution of the net. (all the sequences that can occur)
21
Qusi-s S of FCPN- find a valid schedule Step1: Decompose the net into Conflict Free (CF) components T-allocation :a function α: P T that chooses exactly one among the successors of each place. T-reduction: associated with a T-allocation is a set of subnets generated from the image of the T-allocation using the Reduction Algorithm.
25
Qusi-s S of FCPN- find a valid schedule Step2: Check if every CF component is statically schedulable A T-reduction Ri is schedulable if (1)it is consistent, (2)for each source transition ts in N, it has a T-invariant Containing ts, (3)there exists a firing sequence that returns Ri to the initial marking without any deadlock when its execution is simulated Step 3. Derive a valid schedule, if there exists one A net is schedulable if for all its T-reductions, each of them corresponding to a sequence of choices, there exist a firing sequence containing at least one occurrence of every transition of the reduction.
26
Qusi-s S of FCPN- find a valid schedule Theorem: Given a FCPN, there exists a valid schedule iff every T-reduction is schedulable.
27
Qusi-s S of FCPN- find a valid schedule R1 is schedulable.
28
C-code generation The goal is: the synthesis of a software implementation that satisfies functional correctness minimizes a cost function of latency and memory size. Task: source transition with independent firing rate.
29
C-code generation
30
Experimental Result ATM server for virtual Private Network Using a FCPN it has 49 t, 41 places and 11 non-deterministic choices.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.