<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>A Program State Machine Based Virtual Processing Model in SystemC</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Tim Schmidt</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Kim Grüttner</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Rainer Dömer</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Achim Rettberg</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Carl von Ossietzky University Oldenburg</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>OFFIS - Institute for Information Technology</institution>
          ,
          <addr-line>Oldenburg</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>University of California</institution>
          ,
          <addr-line>Irvine</addr-line>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2014</year>
      </pub-date>
      <abstract>
        <p>The Program State Machine (PSM) Model of Computation o ers a rich set of modeling elements to describe behavioral and structural hierarchy, concurrency, synchronization, state transitions and timing. With the rising software complexity of today's embedded systems, the use of Real-Time Operating Systems (RTOS) has become state-of-the-art for nearly all System-on-Chip designs. Regrettably, the PSM model itself has insu cient support for the speci cation of the preemptive dynamic scheduling behavior of an RTOS. In this paper, we propose a model for dynamically dispatching PSM models on a virtual processing element. Our model aims to abstract from the targeted RTOS and the processor core through execution time annotations and a exible preemptive scheduler model. Mapping a PSM model to a set of scheduled virtual processing elements only requires minor model transformation and enables early exploration of different processing element mappings and scheduling policies. Our virtual processing model for PSMs is realized on top of the SystemC library. We evaluate the proposed virtual processing model using a Canny edge detection lter.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. INTRODUCTION</title>
      <p>
        The development process of state-of-the-art embedded
systems is complex and a ects many di erent disciplines.
Among others, the design process requires hardware and
software design decisions. Today's system complexity of
embedded Multi-Processor System-on-Chip (MPSoC) designs
is continuing at an almost exponential rate [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. The strongly
growing complexity includes the integration of the
functionality as well as the associated software complexity. The
development of hardware is associated with immense costs.
Consequently, whenever possible, designers prefer software
solutions and realize algorithms on software processors.
      </p>
      <p>
        To cope with the increasing complexity and the
time-tomarket pressure, new design methodologies are required. One
design challenge for embedded system designers is mapping
the functionality on the individual processing elements while
meeting the required extra-functional properties (e.g. timing
and power consumption) at minimal cost. To support this
challenge, System-Level Design Languages (SLDLs) enable
to raise the level of abstraction and support early design
decisions. In [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], di erent abstraction levels have been proposed.
The speci cation level enables untimed modeling of
functionality and causality between behaviors in an executable model.
Behaviors can be statically composed in a sequential order,
as nite-state machine or parallel. Communication between
functions is described using double handshake channels with
message passing and shared variables. The architecture level
introduces processing elements (PE) that execute behaviors
in sequential order. Behaviors are annotated with delays to
specify the estimated execution times on the PEs.
Communication between PEs is described through message passing
communication with annotated delays. The implementation
level adds instruction and cycle accurate timing for PEs and
signal level protocols with cycle accurate communication
times.
      </p>
      <p>APPLICATION</p>
      <p>COMM &amp; SYNC
CHANNELS</p>
      <p>SLDL
(a) specification model</p>
      <p>APPLICATION APPLICATION APPLICATION</p>
      <p>COCMHAMN&amp;NSEYLSNC COCMHAMN&amp;NSEYLSNC RTOS COCMHAMN&amp;NSEYLSNC
VIRTUALUPNRIOTCESSING RTOS MODEL INSSTRIMUUCLTAITOONRSET</p>
      <p>SLDL SLDL SLDL
(b) virtual processing model (c) architecture model (d) implementation model</p>
      <p>
        In this work we focus on systems that implement their
behavior in software, which can be mapped and executed
on di erent PEs of an MPSoC. Fig. 1 (a), (c) and (d) show
the layers for executable MPSoC models proposed in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
All models are executed on top of a SLDL, e.g. SpecC or
SystemC. The Application is user-de ned behavior to be
executed on the MPSoC. The layers between Application and
SLDL introduce communication, scheduling and timing
techniques to enable a stepwise re nement from the speci cation
level down to the implementation.
      </p>
      <p>The design step from a non-scheduled speci cation model
(a) to a complete RTOS scheduled architecture model (c)
is a complex re nement step. It requires to transform the
application or behavioral description into a process- or
threadbased model and to use the con guration and scheduling
primitives of the selected RTOS. At this time the choice of
the task granularity and the supported scheduling primitives
have usually been taken. At this level, the comparison of
di erent task granularities and di erent scheduling policies,
supported by di erent RTOSs induces major redesign e ort.
In this paper, we introduce a virtual processing model (b)
to support a smoother re nement from the unscheduled
speci cation to an RTOS scheduled architecture model for
PSMs.</p>
      <p>Our approach supports PSM modeling at the speci cation
layer and enables early estimation of dynamic scheduling
e ects when mapping parallel behaviors on the same PE.
This step can be performed without any behavior to process
or RTOS speci c re nements. This way, designers can pro t
from simple speci cation model modi cations in
combination with early estimated execution time annotations, thus
enabling early decisions regarding PE allocation, behavior
to process re nement granularity, process to PE binding and
scheduling policy selection.</p>
      <p>The rest of the paper is organized as follows. In Section 2
we analyze related work. Next, we discuss the design of the
virtual processing model in Section 3. Followed by a brief
description of the implementation in Section 4, we evaluate
the new virtual processing model using a Canny lter for still
image edge detection in Section 5. Finally, we conclude our
work in Section 6.</p>
    </sec>
    <sec id="sec-2">
      <title>RELATED WORK</title>
      <p>
        An early proposal of a generic RTOS model based on
SystemC has been published in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. The presented abstract
RTOS model achieves time-accurate task preemption via
SystemC events and models time passing via a delay() method.
The RTOS overhead can be modeled as well. Two di erent
task scheduling schemes are studied: the rst one uses a
dedicated thread for the scheduler, while the second is based
on cooperative procedure calls, avoiding this overhead.
Although in this approach explicit inter-task communication
resources are required (message queue, ...), the simulation
time advances simultaneously as the tasks consume their
delays.
      </p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], an RTOS modeling tool is presented. Its main
purpose is to accurately model an existing RTOS on top of
SystemC. A system designer cannot directly use it. In this
approach, the next RTOS \event" (interrupt, scheduling event,
etc.) is predicted during run-time. This improves
simulation speed, but requires deeper knowledge of the underlying
system.
      </p>
      <p>
        An RTOS based scheduling approach with focus on
precise interrupt scheduling has been proposed in [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]. For
this purpose, a separate scheduler is introduced to handle
incoming interrupt requests. Timing annotations and
synchronization within user tasks are handled by a replacement
of the SystemC wait(). In [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ] an annotation method for
time estimation has been presented that supports exible
simulation and validation of real-time constraints for task
migration between di erent target processors. The concept
allows preemptive scheduling in the context of priority-based
scheduling, supporting nested interrupts.
      </p>
      <p>All mentioned solutions above work on architecture level
models and allow to create and handle processes and
interrupts on an RTOS speci c abstraction. Our solution
addresses scheduling at a higher abstraction level and keeps
communication at speci cation abstraction, thus no need for
interrupts.</p>
      <p>
        Several approaches based on abstract task graphs [
        <xref ref-type="bibr" rid="ref10 ref12 ref15 ref9">9, 10,
12, 15</xref>
        ] have been proposed as well. In this case, a pure
functional SystemC model is mapped onto an architecture
model including an abstract RTOS. The mapping requires
an abstract task graph of the model, where estimated
execution times can be annotated on a per-task basis only,
ignoring control- ow dependent durations. This reduces the
achievable accuracy.
      </p>
      <p>
        The proposed RTOS model in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] can be implemented on
top of any SLDL (see Fig. 1) that supports the concepts
of process handling and time modeling. An extension of
this approach [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] presents a high-level, host-compiled
multicore RTOS simulator. This multi-core processor model can
run more than one process simultaneously which can be
organized by a separate ready queue per core (Asymmetric
Multi-Processing) or one global ready queue (Symmetric
Multi-Processing) used for dynamic process to core
dispatching. The proposed extension supports the concept of
Transaction Level Modeling (TLM) for intra-core communication.
Both solutions focus on a process level RTOS abstraction at
the architecture and implementation level including features
like process creation and interrupt handling. In contrast,
our proposed approach avoids process-level RTOS
operations and operates on an estimated execution time annotated
speci cation model. Moreover, our solution keeps
communication abstract and each processing element has its own
ready queue. After exploration, based on our virtual platform
model, we can transform the scheduled speci cation model
into an RTOS model on the architecture level.
      </p>
      <p>
        The timing accuracy and therefore the simulation
performance of [
        <xref ref-type="bibr" rid="ref13 ref4">4, 13</xref>
        ] is limited by the xed minimal resolution of
discrete time advances. An extension deploying techniques
with respect to preemptive scheduling models has been
presented in [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. The Result Oriented Modeling collects and
consumes consecutive timing annotations while still handling
preemptions accurately.
      </p>
      <p>
        A two layer for modeling approach for software task
scheduling considering shared resources has been proposed in [
        <xref ref-type="bibr" rid="ref6 ref7">6, 7</xref>
        ].
The design starts with an Application Layer (AL) model,
which describes the functionality in terms of software tasks,
hardware modules and shared communication objects. These
modeling elements are mapped on modeling elements of the
Virtual Target Architecture Layer (VTAL): software
processing elements with an RTOS model similar to [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ], hardware
processing elements with xed static scheduling, memories
and SystemC TLM for modeling shared buses and
point-topoint communication channels. Communication is realized
via Remote Method Invocation (RMI) via shared buses or
dedicated point-to-point channels. The individually mapped
software tasks can be annotated with Estimated Execution
Time (EET) blocks that represent computation time. The
design ow is supported with preemptive and cooperative
scheduling strategies, as well as deadline driven strategies.
This approach covers speci cation and architecture level
modeling. The main di erence to our approach is that the
RTOS model works with explicit tasks (i.e. processes). Our
model could be re ned as well to [
        <xref ref-type="bibr" rid="ref6 ref7">6, 7</xref>
        ] after PSM scheduling
exploration.
3.
3.1
      </p>
    </sec>
    <sec id="sec-3">
      <title>VIRTUAL PROCESSING MODEL</title>
    </sec>
    <sec id="sec-4">
      <title>Basic Modeling Elements</title>
      <p>We use an expressive subset of the program state machine
(PSM) model of computation (MoC) to describe the
functionality of a system. A hierarchical PSM model with the
corresponding thread graph is shown in Fig. 2(a) and (b). A
sequential composition of n behaviors describes a total
execution order, denoted as a n dimensional tuple: (beh1; :::; behn).
The execution starts with beh1and nishes with behn. A
parallel composition of n behaviors describes a partial
execution order, denoted as a set of n behaviors fbeh1; :::; behng.
The parent behavior of a parallel composition of child
behaviors will not nish until all child behaviors have completed
(Fork-Join semantics). The nite-state machine behavior
composition is a special case of a sequential execution from
a start state to an end state. The execution order is de ned
by state transitions.</p>
      <p>The virtual processing model supports communication
between behaviors via double handshake channels
(synchronized) and shared variables (unsynchronized). A double
handshake channel operates in rendezvous fashion (see Fig. 3).
When the data is transferred from the sender to the receiver,
both behaviors resume their execution at the same time. A</p>
      <p>D → t2
E → t2
F → t2
[t3,t4] = fork(t2)
t2H= →joint4(t3,t4)
F → t2</p>
      <p>J → t2</p>
      <p>A → ttop
b) Thread graph
Processing Element: Scheduler</p>
      <p>PE1 Strategy
G → t3</p>
      <sec id="sec-4-1">
        <title>SequAence:</title>
        <p>Paral el:</p>
        <p>B
FSM:</p>
        <p>C
State: State: State:
C1 C2 C3
E
J
G
d) Nested behaviors</p>
      </sec>
      <sec id="sec-4-2">
        <title>SequDence:</title>
        <p>Paral el:</p>
        <p>F</p>
        <p>H
communicating behavior can be blocked through
communication for some time, until the other communication partner is
ready and the handshake has been completed. To achieve a
high utilization of a PE the scheduler will be able to preempt
blocked behaviors.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>3.2 Processing Elements</title>
      <p>A PE maintains a single thread of execution (i.e. a single
core processor). We associate exactly one scheduler with
one PE one scheduling algorithm. We use the terms
simulated time and simulation time to express the amount of task
execution time currently simulated. The terms simulation
execution time and execution time refer to the amount of time
the simulator requires on the host computer1. Fig. 2(c) shows
the scheduler S which is assigned to PE1 and associated
with the xed priority scheduling strategy. In this case all
behaviors mapped on PE1 need a speci c xed priority, such
that the scheduler can make a scheduling decision.
Furthermore, we assume that computation is only in leaf behaviors
(C1, C2, C3, E, G, H and J in Fig. 2), and hierarchical
behaviors (A, B, C, D, and F in Fig. 2) describe the causal
chain of execution in the model that must be followed by the
scheduler.</p>
    </sec>
    <sec id="sec-6">
      <title>3.3 Scheduling</title>
      <p>We describe now the concept of scheduling for PSM models
for the two requested xed priority and round robin
schedul1Which is of course dependent on the host CPU, clock frequency
etc. and a comparison between simulation execution times of di erent
model is only possible on the same reference simulation host.
ing algorithms. We decided to provide these two fundamental
strategies because more complex strategies can be easily
derived from them.</p>
      <sec id="sec-6-1">
        <title>3.3.1 Fixed Priority</title>
        <p>The xed priorities are statically de ned. The scheduler
always executes the behavior that has the highest priority
and is ready to execute. We are interested in making the
process of priority assignment to the behaviors on the virtual
processing model as simple as possible. The designer assigns
xed priorities only to leaf behaviors. A hierarchical higher
behavior cannot hide the priority of a leaf behavior.</p>
        <p>Set of ready behaviors</p>
        <p>F
inner behaviors</p>
        <p>C1, C2, C3
leaf behaviors
inner behaviors</p>
        <p>Set of ready behaviors</p>
        <p>C1, C2, C3,</p>
        <p>G, H
leaf behaviors
a) Before scheduling decision
b) After simulation of behavior F</p>
        <p>The scheduler distinguishes between inner and leaf
behaviors. As shown in Fig. 4(a), the set of ready behaviors
can be categorized into two subsets. Inner behaviors
always have an in nite high priority and leaf behaviors have a
xed priority de ned by the designer. The scheduler always
prefers an inner behavior over a leaf behavior. Let's assume
the behaviors C1, C2, C3, and F are ready to execute. In
this situation, the scheduler selects behavior F because F is
an inner behavior (see Fig. 2(c)) and has in nite priority.
Behavior F has two child behaviors G and H, which are leaf
behaviors. Behavior F is waiting until the child behaviors
have completed. Fig. 4(b) shows both child behaviors G and
H added to the set of behaviors ready to execute.</p>
      </sec>
      <sec id="sec-6-2">
        <title>3.3.2 Round Robin</title>
        <p>All mapped behaviors on a processing element get time
slices of the same length. If a behavior has terminated, the
scheduler selects immediately the next running behavior. The
scheduler executes the behaviors in a circular order. If a
behavior is not ready to execute, the next ready behavior
with respect to the circular iteration is chosen. Fig. 5 depicts
a round robin scheduling example. The parallel behaviors
G and H are mapped on the same processing element. The
behaviors G and H are scheduled by round robin and the
time slice is 5 time units. In the following, we keep the
focus on behavior G that requests once 3 and once 12 time
units. The start behavior is arbitrary because the model
in the gure does not de ne one; we assume the simulation
starts with behavior G. Behavior G requests 3 time units,
computes, and requests 5 more time units. The request of
3 time units can be consumed completely in one time slice;
however, the following request is too complex. 2 more time
units can be consumed after behavior H preempts behavior
G and can start executing. At time 10, behavior G is active
again and continues consuming the remaining 10 time units.
first time request second time
of 3 time units request of 12 time untis
Processing Element: PE1 Behavior of G:</p>
        <p>G</p>
        <p>H
Scheduler: Round robin,
time slice: 5 time units
1. Request 3 time units G G H G H G
2. Compute something
3. Request 12 time units 0 2 4 6 8 10 12 14 16 18 20 22 24
45.. .C..ompute something simulated time
1. time 2. time 3. time
slice slice slice
Depending on the scheduling algorithm and the
communication status, a behavior can have one of the following
states (see Fig. 6): ready, running, communicating and
waiting. A ready behavior can be selected by the scheduler and
executed on the associated processing element. A behavior
has the state running, if it is currently executing on the
mapped processing element. A running behavior can be
preempted in two di erent ways: (a) end of the time-slice,
as de ned by the scheduling algorithm (waiting state), (b)
blocked communication request on double handshake channel
(communicating ). If a behavior has completed, its status is
terminated. Fig. 6 shows all possible transitions between the
described states.</p>
        <p>end of
communication
activation</p>
        <p>ready
completed after
communication
communicating
executes estimated</p>
        <p>computation
finished estimated
computation
resume
running
waiting</p>
        <p>start of
communication</p>
        <p>termination
preempted
terminated</p>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>4. IMPLEMENTATION 4.1 Processing Element</title>
      <p>
        The class osss_processing_element represents a PE and
inherits from the osss_behaviour. Fig. 7 shows the extension of
the OSSS-Behaviour class diagram [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. The designer derives
a class from osss_processing_element class and de nes in the
constructor the execution order of the mapped behaviors on
the highest hierarchical level.
&lt;os&lt;svsi_rtfiuxaeld&gt;o_&gt;pssrsicsoh_restydc_uhsleetdr()au:tlveeogriyd osss_rou&lt;nd&lt;_vrirotbuainl&gt;_s&gt;t+ramteoagisnys(s):_vb#ooewsihdasaistv(_…imou)o:rdvouilde sc_0m..*o1d10u.l.e* osscs_sp_poortrt IIFF::CCllaassss
d&lt;is&lt;pvaoitrsctsuhsa()_l:&gt;pvr&gt;ooicdaevsa11silainbgle__etlimeme(e)n:stc_time #&lt;&lt;##ooo&lt;&lt;sssvvsssiisssrrtt___uufspaaseamllq&gt;&gt;r(((&gt;&gt;oooss##ssssifsssni_n__itpass(ealt)(aqr:)at:uveleov_enoitld_rtidaibanel_shibtaievohinoa_uvlriiso_tul)isr:_tv)l:iosivtd)o:idvoid 1moossassinss(__):fcsvomomid_pboesh1iatev_iobuerhaviour
sopcrso_sccseo_osrpsesrsi:_o:sssr_tcitas_ytct*ui:hmsme:edm_:upm_lrpii_norsogicm_eaustltsar_tiebsdtua_ttetuismse 0..1 1 osss_initial_stoastess_sotsastes_end_state oossssss__psaerqaulleenl_tibael_hbaevhioauvriour
In the following, we describe how the basic scheduling
algorithms are designed to support preemption and
communication.
      </p>
    </sec>
    <sec id="sec-8">
      <title>4.2 Simulation of Time</title>
      <p>Fig. 8 shows an example where the behaviors B1 and B2
are mapped on the same PE under xed priority
scheduling strategy. Thread t1 is associated with behavior B1 and
thread t2 with behavior B2. We assume behavior B2 is
running and B1 ready (see Fig. 6) at the beginning and
neither B1 nor B2 have consumed any time. Thread t2
starts executing the main() function of B2 and enters the 3
milliseconds estimated waste_time() function of the
scheduler, see Alg. 1. The while loop runs until the entire
requested time of a timing annotation has been consumed.
At the beginning of the loop, thread t2 calls the function
available_time(requested_time), which asks the scheduling
strategy how much of the totally requested time can be
consumed. In our example, the scheduling strategy is xed
priority and the current behavior has the highest priority. In
this case, the xed priority scheduler accepts the complete
time (i.e. 3 milliseconds).
status: ready, low priority
driven by thread t1
status: ready, high priority</p>
      <p>driven by thread t2
waste_time(5ms)</p>
      <p>B1</p>
      <p>B2</p>
      <p>C1
...</p>
      <p>We allow preemption of running behaviors. The function
then of preemption is to suspend the current running
process and to resume a process the scheduling algorithm has
selected to be executed next. If we suspend a process waiting
on a timed event,we have to interrupt the waiting process,
store how much time the process has already consumed, and
consume the remaining time later. For this reason, the
SystemC wait() statement in Line 6 is sensitive to two di erent
or-composed sets of events. The rst event max_time noti es
the thread after the provided time slice of the scheduler is
over. The second parameter is an or-composed event list.
All behaviors that start communication add the
corresponding synchronization event of the channel to that list. This
mechanism allows preempting a current running behavior by
a behavior with higher priority that has completed
communication.</p>
      <p>Algorithm 1 function waste time(requested time)
1: req time requested time
2: while req time &gt; 0 do
3: max time available time(requested time)
4: start time current time
5: behavior status running
6: wait(max time or registered communication events)
7: req time req time - (current time - start time)
8: if req time = 0 then
9: return
10: else
11: behavior status waiting
12: dispatch()
13: end if
14: end while</p>
      <p>Each PE represents a single core processor. For this reason,
only one behavior can be ready for the SLDL scheduler.
Otherwise, the scheduler would execute multiple behaviors
in parallel on the same PE. Communicating behaviors are an
exception because they are waiting for their synchronization
event. If the process of a communicating behavior would be
suspended, the behavior would ignore the synchronization
event. The function dispatch() (see Alg. 2) guarantees this
requirement. The set of behaviors is stored in two lists,
namely a list for inner behaviors and a list for leaf behaviors.
The rst behavior in the list of ready behaviors de nes the
next running behavior. In this situation behavior B1 needs
to be suspended and behavior B2 should be ready.</p>
    </sec>
    <sec id="sec-9">
      <title>4.3 Scheduling Strategy</title>
      <p>We decided to separate the scheduler and the scheduling
strategies (see Fig. 7). The designer derives a class from
osss_scheduler. The function schedule() takes a list of all
leaf behaviors as argument. The function moves the next
executing behavior to the beginning of the list. The
function available_time de nes the size of a consumable time
quantum.</p>
    </sec>
    <sec id="sec-10">
      <title>5. EXPERIMENTS AND EVALUATION</title>
      <p>In order to evaluate our proposed virtual processing model,
we focus on scheduling di erent partitions of a speci cation
Algorithm 2 function dispatch()
1: Unsorted List: inner behaviors, leaf behaviors
2: Process successor process null
3: Process current process get current process()
4: if inner behaviors = ; then
5: schedule(leaf behaviors)
6: successor process rst element(leaf behaviors)
7: else
8: successor process
9: end if
10: for all Behavior b in inner behavior do
11: if process(b) 6= current process and</p>
      <p>status(b) 6= communicating then
12: suspend(process(b))
13: end if
14: end for
15: if current process 6= successor process then
16: resume(successor process)
17: suspend(current process)
18: end if</p>
      <p>rst element(inner behavior)
model and measure the simulated time, count the
scheduler calls and measure the execution time of the SystemC
program. The count of scheduler calls is compared to the
expected number of scheduler calls depending on the scheduling
strategy. Based on the results, we can show that the
communication via shared variables and double handshake channels,
as well as the individual scheduler on the PEs, do not violate
the causal execution order de ned in the speci cation model.</p>
      <p>
        The design we use for evaluation is a Canny edge detector
[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], a graphical lter to detect edges in a gray-scale image. As
starting point, we used an existing SpecC PSM model of the
lter, transformed it into an OSSS-Behaviour [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] model, and
implemented di erent virtual processing models, as shown
in Fig. 9. Communication is performed via shared variables
and double handshake channels. An array containing the
complete image is shared among the blur behaviors. Each
of these behaviors manipulates pixels on non-overlapping
tiles of the image. In the Canny algorithm blurring is the
most computationally intensive block and therefore we map
di erent combinations of blur leaf behaviors to a second
processing element. For our evaluation, we only require
timing annotations for parallel and mapped leaf behaviors.
We annotated each blur behavior with 20ms.
      </p>
      <p>Speci cation
IndividualPE
BlurX
Blur2X
Blur2X2Y</p>
      <p>Simulated
time [ms]
40</p>
      <p>The following models, as shown in Fig. 9, are evaluated:
Speci cation (untimed, without virtual PE), Individual
PE (timed blur leaf behaviors, all behaviors mapped on a
single PE), BlurX (timed blur leaf behaviors, blurX4 mapped
to P E2, synchronization between P E1 and P E2 via double
handshake channel (behavior blurX4 on P E2 can only start
if behavior blurX_par on P E1 has been entered)), Blur2X
(timed blur leaf behaviors, parallel composition of blurX3
and blurX4 mapped to P E2, synchronization of parallel
composition like in BlurX) and Blur2X2Y (timed blur leaf
behaviors, parallel composition of blurX3 and blurX4 and
parallel composition of blurY3 and blurY4 mapped to P E2,
synchronization like in Blur2X with additional
synchronization barrier between sequential composition of parallel blur
behaviors).</p>
      <p>When neglecting communication (shared array access),
synchronization and scheduling (including context
switching) times, our model's total simulated times, as expected
by Amdahl's law, are shown in Tab. 1. We compare the
complexity of the di erent models using a simple Lines of
Code (LoC) metric. The major e ort was to allocate new
channels and behaviors for synchronization. For instance,
for the model BlurX a new PE and three sync behaviors
have been instantiated. Furthermore, the double handshake
channel was hierarchically bound from the ports of the PE's
to the ports of the blur leaf behaviors.</p>
      <p>In the following, we discuss the simulation of the four
virtual processing models using a round robin scheduler with
di erent time slice granularities from 1ns up to 100; 000ns
on each individual PE. We measured the number of context
switches and associated them with a constant cost of 1 ms.
Fig. 10 shows the simulated time of model Blur2X2Y with
context switching costs for a round robin scheduling of P E1
and P E2. As expected, we can observe that ne grained time
slices &lt; 100 ns have a huge impact on the overall simulated
time. On the other hand, the responsiveness (although not
necessary for the image lter design) rises.</p>
      <p>Simula'on  'me  of  the  model  Blur2X2Y  with  'me  </p>
      <p>annota'ons  for  context  switches    
240,000 
]s 220,000 
[em 128000,,000000  
no'm 116400,,000000  
a'120,000 
lu100,000 
ism80,000 
60,000 
1 
10  100  1,000  10,000 
Time  slice  of  the  individual  schedulers  [ns]  
100,000 
Fig. 11 visualizes the ratio between the simulated time for
context switches and computation for a 20 ms leaf behavior
timing annotation. When the time slice is very short, almost
70 % of the simulated time is spent on context switches.
Fig. 12 shows the measured execution time of the various
models on an Intel(R) Core(TM)2 Quad CPU Q9650 @ 3.00
GHz with 4 GB RAM running Fedora 12 Linux using the
Context  
switch  2me  
time command. From this measurement, we can observe that
the execution time of the individual models is proportional
to the number of context switches, as shown in Fig. 10.
We traced the individual scheduler calls and compared the
Execu&amp;on  &amp;me  for  round  robin  scheduled  processing  
elements  </p>
      <p>Spec.  Model  
Individual  PE  
Blur  X  
Blur  2X  </p>
      <p>Blur  2X  2Y  
10   100   1,000   10,000   100,000  </p>
      <p>Time  slice  of  the  individual  schedulers  [ns]  
execution order of leaf behaviors (i.e. the causal chain)
between the speci cation and the Virtual Processing Models.
In the speci cation model, the blur behavior's execution
order was blurX1, ... , blurX4, while in the di erent VPM
models the execution order changed to blurX4, ... , blurX1.
Even though the ordering is di erent, validity of causality
for parallel compositions (partial order) only requires to be
order isomorph, which is the case.</p>
    </sec>
    <sec id="sec-11">
      <title>CONCLUSION AND OUTLOOK</title>
      <p>
        In this paper, we extended the proposed methodology in
[
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] and introduced a novel virtual processing model for PSM
based models. The existing methodology allowed scheduling
of processes using generic RTOS primitives. The design step
from a non-scheduled speci cation model to a process-based
RTOS scheduled architecture model is a major re nement
step. For this reason, we proposed to introduce an
intermediate model, called virtual processing model. This model
enables to add a scheduler with user de ned scheduling
algorithm to a behavior, called virtual processing unit. This
exible scheduling annotation enables fast and easy
exploration, regarding scheduling granularities of behaviors and
assignments of scheduling policies. After successful
exploration, the behavior to process transformation and RTOS
con guration for architecture re nement can be performed.
We have sketched how to use SystemC to implement our
virtual processing model. Furthermore, we have integrated
the virtual processing model into the OSSS-Behaviour
library, supporting program state machine (PSM) modeling
in SystemC. Our implementation concept allows designers to
implement new scheduling strategies. For the evaluation, we
used a Canny lter design and created di erent behavior
partitions and scheduler con gurations. The evaluation showed
that our extension retains the functional causalities of the
original PSM model when using a round robin scheduling
1.100  
  1.000  
]
ce0.900  
[s 0.800  
em0.700  
&amp; 0.600  
n
o0.500  
&amp;
cu0.400  
xe0.300  
E0.200  
1  
with di erent time slice granularities. So far we did not
evaluate our simulation results against measurements on a
real platform. To do a trade-o between simulation speed
and accuracy, a comparison with measurement results is
necessary and part of future work. Currently, the context
switch penalty and communication delay is handled in a very
simple way and after the conduction of measurement trails
these timing models will be re ned.
      </p>
    </sec>
    <sec id="sec-12">
      <title>Acknowledgement</title>
      <p>This work has been partially supported by the ARAMiS
project (01IS11035M) and the EMC2 collaborative ARTEMIS
project (01IS14002R), both funded by the German Federal
Ministry of Research and Education (BMBF).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>J.</given-names>
            <surname>Canny</surname>
          </string-name>
          . A Computational Approach to Edge Detection.
          <source>Pattern Analysis and Machine Intelligence</source>
          ,
          <source>IEEE Transactions on, PAMI-8</source>
          (
          <issue>6</issue>
          ):
          <volume>679</volume>
          {698, nov.
          <year>1986</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>D. D.</given-names>
            <surname>Gajski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Abdi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Gerstlauer</surname>
          </string-name>
          , and
          <string-name>
            <given-names>G.</given-names>
            <surname>Schirner. Embedded System</surname>
          </string-name>
          <article-title>Design: Modeling, Synthesis and Veri cation</article-title>
          .
          <source>Springer, 1st edition</source>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>D. D.</given-names>
            <surname>Gajski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Zhu</surname>
          </string-name>
          , R. Domer,
          <string-name>
            <given-names>A.</given-names>
            <surname>Gerstlauer</surname>
          </string-name>
          , and
          <string-name>
            <given-names>S.</given-names>
            <surname>Zhao</surname>
          </string-name>
          .
          <source>SpecC: Speci cation Language and Methodology</source>
          . Springer,
          <volume>1</volume>
          <fpage>edition</fpage>
          ,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>A.</given-names>
            <surname>Gerstlauer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Yu</surname>
          </string-name>
          , and
          <string-name>
            <given-names>D. D.</given-names>
            <surname>Gajski</surname>
          </string-name>
          .
          <article-title>RTOS Modeling for System Level Design</article-title>
          .
          <source>In Proceedings of DATE. IEEE Computer Society</source>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>K.</given-names>
            <surname>Gru</surname>
          </string-name>
          <article-title>ttner and</article-title>
          W. Nebel. Modelling Program{
          <article-title>State Machines in SystemC</article-title>
          .
          <source>In Forum on Speci cation and Design Languages</source>
          <year>2008</year>
          ,
          <volume>09</volume>
          2008.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>P.</given-names>
            <surname>Hartmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Kleen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Reinkemeier</surname>
          </string-name>
          , and
          <string-name>
            <given-names>W.</given-names>
            <surname>Nebel</surname>
          </string-name>
          .
          <article-title>E cient modelling and simulation of embedded software multi-tasking using SystemC and OSSS</article-title>
          . In Speci cation,
          <source>Veri cation and Design Languages</source>
          ,
          <year>2008</year>
          . FDL 2008. Forum on, pages
          <volume>19</volume>
          {
          <fpage>24</fpage>
          ,
          <string-name>
            <surname>Sept</surname>
          </string-name>
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>P. A.</given-names>
            <surname>Hartmann</surname>
          </string-name>
          ,
          <string-name>
            <surname>K.</surname>
          </string-name>
          <article-title>Gruttner, A. Rettberg, and I. Podolski. Distributed Resource-Aware Scheduling for Multi-Core Architectures with SystemC</article-title>
          .
          <source>In Distributed, Parallel and Biologically Inspired Systems</source>
          , volume
          <volume>329</volume>
          , pages
          <fpage>181</fpage>
          {
          <fpage>192</fpage>
          . Springer,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>Z.</given-names>
            <surname>He</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Mok</surname>
          </string-name>
          , and
          <string-name>
            <given-names>C.</given-names>
            <surname>Peng</surname>
          </string-name>
          .
          <article-title>Timed RTOS modeling for Embedded System Design</article-title>
          .
          <source>In Real Time and Embedded Technology and Applications Symposium (RTAS'05)</source>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>S.</given-names>
            <surname>Huss</surname>
          </string-name>
          and
          <string-name>
            <given-names>S.</given-names>
            <surname>Klaus</surname>
          </string-name>
          .
          <article-title>Assessment of Real-Time Operating Systems Characteristics in Embedded Systems Design by SystemC models of RTOS services</article-title>
          .
          <source>In Proceedings of Design &amp; Veri cation Conference and Exibition (DVCon'07)</source>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>T.</given-names>
            <surname>Kempf</surname>
          </string-name>
          , M. Dorper, R. Leupers, G. Ascheid,
          <string-name>
            <given-names>H.</given-names>
            <surname>Meyr</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Kogel</surname>
          </string-name>
          , and
          <string-name>
            <given-names>B.</given-names>
            <surname>Vanthournout</surname>
          </string-name>
          .
          <article-title>A Modular Simulation Framework for Spatial and Temporal Task Mapping onto Multi-Processor SoC Platforms</article-title>
          .
          <source>In Proceedings of DATE</source>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>R.</given-names>
            <surname>Le Moigne</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Pasquier</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J.</given-names>
            <surname>Calvez</surname>
          </string-name>
          .
          <article-title>A Generic RTOS Model for Real-Time Systems Simulation with SystemC</article-title>
          .
          <source>In Proceedings of DATE</source>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>S.</given-names>
            <surname>Mahadevan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Storgaard</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Madsen</surname>
          </string-name>
          , and
          <string-name>
            <given-names>K.</given-names>
            <surname>Virk</surname>
          </string-name>
          .
          <article-title>Arts: A System-Level Framework for Modeling MPSoC Components and Analysis of their Causality</article-title>
          .
          <source>In 13th IEEE International Symposium on Modeling, Analysis, and Simulation of Computer and Telecommunication Systems</source>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>P.</given-names>
            <surname>Razaghi</surname>
          </string-name>
          and
          <string-name>
            <given-names>A.</given-names>
            <surname>Gerstlauer</surname>
          </string-name>
          .
          <article-title>Host-Compiled Multicore RTOS Simulator for Embedded Real-Time Software Development</article-title>
          .
          <source>In Proceedings of DATE. IEEE</source>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>G.</given-names>
            <surname>Schirner and R. Do</surname>
          </string-name>
          <article-title>mer. Introducing preemptive scheduling in abstract RTOS models using result oriented modeling</article-title>
          .
          <source>In Proceedings of DATE</source>
          , New York, NY, USA,
          <year>2008</year>
          . ACM.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>M.</given-names>
            <surname>Streubu</surname>
          </string-name>
          <article-title>hr</article-title>
          , J. Falk,
          <string-name>
            <given-names>C.</given-names>
            <surname>Haubelt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Teich</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Dorsch</surname>
          </string-name>
          , and
          <string-name>
            <given-names>T.</given-names>
            <surname>Schlipf</surname>
          </string-name>
          .
          <article-title>Task Accurate Performance Modeling in SystemC for Real-Time Multi-Processor Architectures</article-title>
          .
          <source>In Proceedings of DATE</source>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>H.</given-names>
            <surname>Zabel</surname>
          </string-name>
          and
          <string-name>
            <given-names>W.</given-names>
            <surname>Mu</surname>
          </string-name>
          <article-title>ller. An E cient Time Annotation Technique in Abstract RTOS Simulations for Multiprocessor Task Migration</article-title>
          .
          <source>In Distributed, Parallel and Biologically Inspired Systems</source>
          , volume
          <volume>271</volume>
          <source>of IFIP Advances in Information and Communication Technology</source>
          . Springer,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>H.</given-names>
            <surname>Zabel</surname>
          </string-name>
          ,
          <string-name>
            <surname>W.</surname>
          </string-name>
          <article-title>Muller, and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Gerstlauer</surname>
          </string-name>
          .
          <article-title>Accurate RTOS Modeling and Analysis with SystemC</article-title>
          . In W. Ecker, W. Muller, and R. Domer, editors,
          <source>Hardware-dependent Software</source>
          , pages
          <volume>233</volume>
          {
          <fpage>260</fpage>
          . Springer Netherlands,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>