Keywords: modèle de temps, MARTE, langages synchrones, Esterel, SyncCharts

CCSL et Esterel pour combiner et vérifier des propriétés de temps Résumé : Le profil UML pour la modélisation et l'analyse de systèmes temps réel et embarqués (MARTE) a été récemment adopté par l'OMG. Son modèle de temps étend le paquetage SimpleTime de UML2 qui est à la fois simple et informel. MARTE ajoute une grande variété d'éléments requis pour modéliser les systèmes temps réel et embarqués, et en particulier la prise en compte du temps logique et chronométrique, discret ou dense. La spécifiaction OMG de MARTE propose un modèle de causalité temporel inspiré des modèles de temps de la théorie de la concurrence et propose un nouveau langage de spécification de contraintes temporelles appelé specification introduces a Time Structure inspired (CCSLclock constraint specification language) Ce rapport présente la sémantique formelle des contraintes d'horloge de CCSL et propose un processus pour utiliser CCSL à la fois comme langage abstrait de spécification de modèles UML et comme modèle de référence pour vérifier la conformité d'implantations candidates.

Un application de filtrage numérique d'un flux vidéo est utilisée tout au long du rapport pour illustrer le propos. L'application est d'abord spécifiée avec CCSL, puis rafinée par retro-ingénierie en utilisant les retours fournis par un simulateur dédié à CCSL. Dans une deuxième phase, un programme Esterel est considéré comme implantation possible de la spécification. Ce programme est instrumenté avec des observateurs dérivés de la spécification CCSL. L'environnement de vérification formelle Esterel Studio permet alors de garantir la conformité de l'implantation Esterel avec la spécification CCSL. Une bibliothèque d'observateurs spécifiques à CCSL a été construite à cette fin.

Introduction

Synchronous languages [START_REF] Halbwachs | Synchronous Programming of Reactive Systems[END_REF]5] are well-suited to formal specification and analysis of reactive system behavior. They are even more relevant with safety-critical applications where lives may be at stake. However, to cover a complete design flow from system-level specification to implementation, synchronous languages need to interoperate with other, more general, specification languages. One of the candidates is the Unified Modeling Language (UML) [START_REF] Omg | Unified Modeling Language, Superstructure[END_REF] associated with SysML, the UML profile for systems engineering [START_REF] Weilkiens | Systems Engineering with SysML/UML: Modeling, Analysis, Design[END_REF][START_REF] Omg | Systems Modeling Language (SysML) Specification 1.1. Object Management Group[END_REF]. This is very tempting since synchronous languages internal formats rely on state machines or data flow diagrams both very close to UML constructs state machines and activities. Moreover, SyncCharts [START_REF] André | Representation and analysis of reactive behaviors: A synchronous approach[END_REF] are a synchronous, formally well-founded, extension of UML state machines and are mathematically equivalent to Esterel [START_REF] Berry | The foundations of Esterel[END_REF], one of the three major synchronous languages. As for SysML, it adds two constructs most important for specification: requirements and constraint blocks.

There have been attempts to bridge the gap between UML and synchronous languages. Some [START_REF] Guennec | Bridging UML and safety-critical software development environments[END_REF] choose to import UML diagrams into Scade, a synchronous environment that combines safe state machines (a restriction of SyncCharts) together with block diagrams, the semantics of which is based on Lustre. Others [4] prefer to define an operational semantics of UML constructs with a synchronous language, like Signal [START_REF] Benveniste | Synchronous programming with events and relations: the SIGNAL language and its semantics[END_REF]. In both cases, the semantics remains outside the UML and within proprietary tools. Other tools, from the same domain, would interpret the same models with a completely different semantics, not necessarily compatible. Therefore, it is impossible to exchange diagrams between tools, not only because of syntactical matters but also for semantic reasons. Different environments are then competing rather than being complementary. To provide full interoperability between tools of the embedded domain, the UML absolutely requires a timed causality model. The UML Profile for Modeling and Analysis of Real-Time and Embedded systems [START_REF]UML Profile for MARTE, beta 2. Object Management Group[END_REF] (MARTE), which is currently in its finalization process, has introduced a time model [3] with that purpose. This time model comes with a companion language, called Clock Constraint Specification Language (CCSL) and defined in one annex of the MARTE specification. CCSL is advertised as a pivot language to make explicit the interactions between different models of computations, like Ptolemy directors [START_REF] Eker | Taming heterogeneity -the ptolemy approach[END_REF]. It offers a rich set of constructs to specify time requirements and constraints.

This paper introduces the formal semantics of a fundamental subset of CCSL and focuses on possible connections with Esterel programs. MARTE Time model is briefly introduced in Section 2. In Section 3, we then describe the system used as a running example, a digital filtering video application. Section 4 gives the semantics of the selected CCSL clock constraints, which is our first contribution. Section 5 uses CCSL to specify the behavior of the example. The specification is simulated with TimeSquare, an environment dedicated to MARTE Time Specification and CCSL analysis. We then rely on Esterel Studio formal verification facilities to check the conformance of a candidate Esterel/SyncChart implementation with its specification. This is our second contribution. Finally, we further comment on some related works in Section 6.

Logical Time

MARTE Time model deals with both discrete and dense time. In MARTE, a clock gives access to a time structure. A clock can be either chronometric or logical. The former is related to "physical time" while the latter is not. This paper focuses on the structural relations between clocks and these relations do not differentiate between chronometric and logical clocks. However, some relations only apply to discrete clocks (logical or chronometric) and others apply to both discrete and dense clocks. Dense clocks considered in MARTE are necessarily chronometric. Logical clocks refer to discrete-time logical clocks and represent logical time. Logical time is the time model in use in synchronous languages. Logical clocks as originally defined by Lamport [START_REF] Lamport | Time, clocks, and the ordering of events in a distributed system[END_REF] are a special case where the labeling function is an increasing monotonic function.

On the example, we mainly exhibit causal/logical problems and we do not discuss much the chronometric aspects.

Clock

A Clock is a 5-tuple I, ≺, D, λ, u where I is a set of instants, ≺ is a quasi-order relation on I, named strict precedence, D is a set of labels, λ : I → D is a labeling function, u is a symbol, standing for a unit. For logical clocks, u is often called tick, it can be processorCycle as well or any other logical activation of a behavior. The ordered set I, ≺ is the temporal structure associated with the clock. ≺ is a total, irreflexive, and transitive binary relation on I.

A discrete-time clock is a clock with a discrete set of instants I. Since I is discrete, it can be indexed by natural numbers in a fashion that respects the ordering on I: let N = N\{0}, idx : I → N , ∀i ∈ I, idx(i) = k if and only if i is the k th instant in I. In MARTE, a logical clock can be associated with any Event: this clock "ticks" at each event occurrence.

For any discrete time clock

c = I c , ≺ c , D c , λ c , u c , c[k] denotes the k th instant in I c (i.e., k = idx c (c[k])).
For any instant i ∈ I c of a discrete time clock, °i is the unique immediate predecessor of i in I c . For simplicity, we assume a virtual instant the index of which is 0, and which is the (virtual) immediate predecessor of the first instant. i°is the unique immediate successor of i in I c , if any.

Time structure

A Time Structure is a pair C,
where C is a set of clocks, is a binary relation on c∈C I c , named precedence.

is reflexive and transitive. From we derive four new relations:

Coincidence (≡ ∩ ), Strict precedence (≺ \ ≡), Independence ( ∪ )
, and Exclusion (# ≺ ∪ ). The graphical representation of instant relations is given in Figure 1.

Let

I = c∈C I c / ≡. The Time Structure T = C, is well-structured if I, is a partially ordered set (POset).
CCSL defines a concrete syntax to specify instant relations or more generally clock relations, which represent infinitely many instant relations. The next section introduces our 3 Example: Digital Filter This section introduces the example selected to illustrate our proposal: a simple digital image filtering (DF) application. This example is borrowed from the "Getting Started Manual " of Esterel Studio and was designed as a tutorial on its modeling capabilities.

INRIA i j i j ≡ i j i j i j i j ≺ i j # i j i j || i j

Informal Specification

DF is used in a video system. It reads image pixels from a memory, filters them and sends output pixels out to a display device.

One image is composed of LP I lines per image, each line consists of P P L pixels per line. The pixels are stored in words. A word contains P P W pixels per word, a line W P L words per line W P L = P P L/P P W . The pixel transformation (digital filtering) is defined by a dot product:

y[k] = j=+L j=-L c[j] * x[k -j] (1)
where k is a natural number, index of pixels in a line, y is an array of output pixels, x is an array of input pixels, c is an array of 2L + 1 constant coefficients.

Modeling with logical clocks

Each event of the system is modeled as a logical clock and the specification is imposed by applying constraints to these clocks. An event can be a signal receipt (e.g., inW ord), a signal emission (e.g., outP ixel), or the presence of a pure signal (e.g., ready, endOf Line). A logical clock ticks each time the associated event occurs. For convenience, we denote the clock associated with a signal by the name of the signal in italic and with an initial lower case letter.

Precedence arrows and coincidence edges in Figure 3 represent some instant relations implied by the specification. Precedence relation x states that for each request (each tick of ready) a new word must be released (inW ord must tick). Precedence y expresses that each received word produces four output pixels. The rounded-corner rectangle makes it explicit that a word gives rise to four output pixels exactly. Coincidence z says (for the unlikely case of a 8-pixel line) that the first tick of endOf Line is coincident with the 8 th outpixel.

INRIA

Of course, the instant relations represented in Figure 3 hold for all lines of the image and all parameter settings. Instead of expressing instant relations on an instant-pair base, it is more convenient to apply constraints on clocks directly. Adequate clock constraints that implement the specification correctly are informally described in the following subsection.

Clock constraints

Clock constraints are a generic way to define various aspects of a specification. They may derive from the algorithm itself or from performance requirements, and also from the data structure used or the operating mode. We have identified here four primary constraints covering several of these aspects.

(Cstr 1) The specified protocol implies that each request (ready) is followed by a new word (inW ord) and that no new request is sent before the preceding request has been acknowledged. This is an alternation constraint where, ready alternates with inW ord.

In terms of clocks, an instant of ready precedes an instant of inW ord, which precedes the next instant of ready, and so on.

(Cstr 2) Because of the chosen data structure, input pixels are packed within words of length P P W , whereas output pixels are released individually. The algorithm imposes that the number of pixels is preserved. A by-packet precedence relation denotes such a fact. Each tick of inW ord precedes a group of P P W consecutive ticks of outP ixel.

(Cstr 3) endOf Line ticks every P P L ticks of outP ixel. This constraint directly reflects the semantics of the end of line.

(Cstr 4) Additional non-functional constraints must be set to impose readiness and reduce communication buffers. Such a constraint should avoid to delay unnecessarily the processing of received input words and gives rise to further precedence constraints between outP ixel and inW ord (see subsection 5.1).

The pixel transformation being a dot product (Eq. 1), each output pixel depends on 2L + 1 consecutive input pixels. CCSL only deals with the structural relations, therefore the actual transformation is not relevant and the data dependencies (between inputs and ouputs of the pixel transformation) are implemented by several precedence constraints that are surely much stronger than (Cstr 2). Figure 4 shows these precedence constraints for one single image row in the simplistic case where P P L = 8, and L = 2. A more general characterization is given in Annex B.

As always in pipelined specifications, three phases must be considered for each line. The prolog, when filling the pipeline, the kernel, when the pipeline is in a steady state, the epilog, when draining the pipeline.

Figure 4 (A) shows the beginning of the line processing (prolog) where padding pixels must be assumed to apply the dot product. Figure 4 (C) represents the ending of the 8-pixel line processing (epilog). OutPixel[7] depends on InPixel [5] . . . InPixel [START_REF] Cohen | Nsynchronous kahn networks: a relaxed model of synchrony for real-time systems[END_REF]. InPixel [START_REF] Boulanger | Simulation of multi-formalism models with modhelx[END_REF] and InPixel [START_REF] Cohen | Nsynchronous kahn networks: a relaxed model of synchrony for real-time systems[END_REF] are also padding pixels for which a default value is assumed. Since signal InPixel is not part of the interface, the precedence relations between InPixel and OutPixel have to be expressed as precedence relations between InWord and OutPixel. This is done in subsection 5.1.

Overall, the specification mixes synchronous (Cstr 3) and asynchronous (Cstr 1, 2, 4) constraints and involves functional and non-functional aspects. CCSL has been designed to address such specifications. It is heavily inspired by the Tagged Signal Model [START_REF] Lee | A framework for comparing models of computation[END_REF], which intends to define a common framework for comparing several Models of Computation and Communication in the RTE domain, and from various works around synchronous languages and more generally polychronous/multiclock languages well-suited to specify Globally Asynchronous and Locally Synchronous (GALS) systems. TimeSquare is our analysis framework that provides a support for expressing, simulating and formally analyzing CCSL constraints.

Clock constraints in CCSL

Relationships introduced in Section 2.2 are binary relations relating pairs of instants. Specifying a full time structure using only these elementary relationships is not realistic, all the more so since a clock usually has an infinite number of instants therefore forbidding an enumerative specification of instant constraints. Instead of defining individual instant pairings, a clock constraint specifies generic associations between (infinitely) many instants of the constrained clocks.

In this section we define the more general clock constraints and we introduce some usual constraints, derived from the basic ones. The clock constraints are classified in three main INRIA categories: 1) coincidence-based constraints, 2) precedence-based constraints, and 3) mixed constraints.

Coincidence-based clock constraints

Coincidence-based clock constraints are classical in synchronous languages and can then be very easily specified with such languages.

Sub-Clocking is the most basic coincidence-based clock constraint relationship. B isSubClockOf A, where A and B are clocks, imposes B to be a sub-clock of A. Intuitively, this means that each instant in B is coincident with one instant in A, and this without introducing causality loop (Figure 5). More formally:

∃h : I B → I A such that (1) h is injective (2) h is order preserving: (∀i, j ∈ I B ) (i ≺ B j) =⇒ (h(i) ≺ A h(j))
(3) an instant of I B and its image are coincident:

(∀i ∈ I B ) i ≡ h(i) A B h Figure 5: Coincidence-based clock constraint
In what follows, this constraint is denoted as B ⊂ A that reads "B is a sub-clock of A" or equivalently "A is a super-clock of B".

Derived coincidence-based clock constraints

h can be specified in many different ways.

Equality A = B is the symmetric relation that makes the two clock A and B "synchronous": h is a bijection and the instants of the two clocks are pair-wise coincident. It is strictly equivalent to B = A.

Other coincidence-based clock expressions allow the creation of a new clock, sub-clock of a given clock (denoted new clock def ining expression). Four such clock expressions are presented hereafter.

Restriction B A restrictedTo P where A is a given clock, B is a new clock, and P is a predicate on I A × I B , such that

(∀i ∈ I A , ∀j ∈ I B ) i ≡ h(j) ⇐⇒ P (i, j) = true
Discretization B A discretizedBy r, where A is a dense-time clock, r is a real number, and B a discrete-time clock. Discretization is a special restriction the predicate of which takes account of the labeling function λ A :

I A → R such that (∀i ∈ I A , ∀j ∈ I B ) (∃d ∈ R) P (i, j) = true ⇐⇒ λ A (i) = d + (idx B (j) -1) * r
This is the main operator to discretize dense clocks and therefore to discretize chronometric clocks.

Filtering B A filteredBy w, where A and B are discrete-time clocks, and w is a binary word. For filtering, the associated predicate is such that

(∀i ∈ I A , ∀j ∈ I B ) P (i, j) = true ⇐⇒ idx A (i) = w ↑ idx B (j)
where w ↑ k is the index of the k th 1 in w. The use of infinite k-periodic binary words in this kind of context has previously been studied in N-Synchronous Kahn networks [START_REF] Cohen | Nsynchronous kahn networks: a relaxed model of synchrony for real-time systems[END_REF]. This constraint is frequently used in clock constraint specifications and is denoted A w in this paper. It allows the selection of a subset of instants, on which other constraints can then be enforced.

In what follows, a (periodic) binary word is denoted as w = u(v) ω , where u is called the transient part of w and v its periodic part. The power ω means that the periodic part is repeated an unbounded number of times. So, u(v)

ω denotes u.v.v. • • • .v. • • • .
Periodicity Defining the periodicity of discrete clocks consists in using a binary word with a single 1 in the periodic part. A isPeriodicOn B period p offset d defines a periodic clock A. The same clock can be built with a filtering A B 0 d .(1.0 p-1 ) ω . In this expression, for any bit b, b 0 stands for the empty binary word. Note that this is a very general definition of periodicity that does not require B to be chronometric contrary to the usual definition.

INRIA

Precedence-based clock constraint

Precedence-based clock constraints are easy to specify with concurrent models like Petri nets but are not usual in synchronous languages. A discussion on main differences with Time Petri nets can be found in some of our previous work [START_REF] Mallet | On the semantics of UML/MARTE clock constraints[END_REF].

Precedence The clock constraint Precedence consists in applying infinitely many precedence instant relations. Two forms can be distinguished: the strict precedence A strictly precedes B, and the non strict precedence A precedes B. A and B are clocks. Intuitively, this means that each instant in B (immediately) follows one instant in A (Fig. 6). More formally:

For A (strictly) precedes B, ∃h :

I B → I A such that (1) h is injective (2) h is order preserving: (∀i, j ∈ I B ) (i ≺ B j) =⇒ (h(i) ≺ A h(j))
(3) an instant of I B and its image are ordered:

(∀i ∈ I B ) h(i) i if non strict (∀i ∈ I B ) h(i) ≺ i if strict A B h

Derived precedence-based clock constraints

When A and B are discrete-time clocks, the precedence relationship gives rise to more specific constraints. Three often used precedence constraints are discussed here.

Discrete precedence A precedes B (denoted A B) if (∀i ∈ I B )(k = idx B (i)) =⇒ A[k] B[k]. There also exists a strict form (denoted A ≺ B) of this constraint: A strictly precedes B if (∀i ∈ I B )(k = idx B (i)) =⇒ A[k] ≺ B[k]. Alternation A alternatesWith B (denoted A ∼ B) is defined by: A ≺ B ∧ B ≺ A , where A A 0.1 ω
The following specification is equivalent and uses instant relations instead of clock relations,

(∀i ∈ I A )(k = idx A (i)) =⇒ (A[k] ≺ B[k] ≺ A[k + 1]). Synchronization A synchronizesWith B (denoted A B) is such that A ≺ B ∧ B ≺ A where A A 0.1 ω , and B B 0.1 ω
This constraint can also be expressed using instant relations:

(∀k ∈ N )(A[k] ≺ B[k + 1]) ∧ (B[k] ≺ A[k + 1]).
Precedences used in the definition of Alternation and Synchronization can be non-strict precedences, thus there exist four different variants of these clock relations. Another extension considers instants by "packets". For instance, A by α strictly precedes B by β (denoted

A/α ≺ B/β) is a short notation for A f ≺ B s where A f A 0 α-1 .1 ω , and B s B 1.0 β-1 ω

Mixed constraints

Mixed constraints combine coincidences and precedences. They are used to synchronize clock domains in globally asynchronous and locally synchronous models.

Sampling The commonest constraint of this kind is the Sampling constraint. C A sampledOn B, where B and C are discrete-time clocks, defines C as a sub-clock of B that ticks only after a tick of A (Fig. 7).

(∀c

∈ I C )(∃b ∈ I B )(∃a ∈ I A )(c ≡ b) ∧ (a b) ∧ (°b ≺ a)
The strict form C A strictly sampledOn B has the following characterization:

(∀c ∈ I C )(∃b ∈ I B )(∃a ∈ I A )(c ≡ b) ∧ (a ≺ b) ∧ (°b a)
5 Design and analysis of the example

CCSL specification

CCSL constraints build on UML semantic variation points to extend UML models with a specification of time requirements. The following five CCSL relations are the formal counterpart to the informal specification given in Section 3. Circled numbers after clock constraints are not part of CCSL code; There are just comments referring to the requirement numbers in Figure 3 and introduced in subsection 3.3. CCSL relations can either be fully textual or be symbolically represented. The textual representation, although very verbose attempts to be close to some plain English specification. The symbolic representation is much more compact, this is why we have selected the latter here.

ready ∼ inW ord x inW ord ≺ outP ixel/4 y endOf Line = outP ixel (0 7 .1) ω z inW ord (0.1)

ω ≺ outP ixel 0 2 . 1.0 7 ω { outP ixel 0. 1.0 7 ω ≺ inW ord (0.1) ω |
The first three relations x-z are immediate representations of Cstr 1, 2 and 3, described in subsection 3.3, when there are four pixels per words (P P W = 4) and eight pixels per line (P P L = 8). Alternation ∼ is often used to model asynchronous protocols, where a request alternates with an acknowledgement. Here ready is the request and inW ord the acknowledgement. Packet-based precedence (as in y) denotes the way pixels are gathered within words. In z, end of line periodically occurs when eight output pixels have been emitted. The periodic pattern (in z-|) models regular data flows. Here, each pixel line has the same length, and the same transformation periodically applies to each line. Eq. z is a good illustration of the clock relation filteredBy ( ). With the binary word (0 7 .1) ω = (00000001) ω , the seven first output pixels are ignored and the first instant of endOf Line is synchronous with the 8 th output pixel (Fig. 3). The following seven output pixels are also ignored and so on.

The last two relations are a bit trickier. They rely on the periodic pattern combined with a precedence relation. Relation { is directly implied by the dot product. As discussed in subsection 3.3, it relates the input words (clock inW ord) to the output pixels (clock outP ixel) since these two clocks are part of the interface. Figure 8 illustrates this constraint and emphasizes on the relation between the input pixels and the input words by circling pixels belonging to the same word. The general case for whatever pixels per word and per line, is further discussed in Annex B. Relation | is a back-pressure constraint to guarantee that output pixels are delivered fast enough so the communication buffer contains at most two words.

Running simulations

From this specification, TimeSquare can run simulations. For each constraint, a set of Boolean equations determines disabled clocks, which must not tick, and enabled clocks that may tick. From there, the simulation policy selects clocks that are actually fired. At each step, depending on the fired clocks, CCSL expressions are rewritten according to the operational semantics. Some SOS rewriting rules are given in Annex A.3. Several simulation policies are offered. The random policy randomly chooses one possible solution amongst the set of solutions. The minimum policy chooses a consistent solution where the number of firing clocks is minimal. The maximum policy chooses a consistent solution where the number of firing clocks is maximal. Boolean equations associated with INRIA each kernel CCSL constraint are given in Annex A.2. In TimeSquare, Boolean equations are encoded using JavaBDD, a generic Java API that supports implementation of various Binary Decision Diagrams (BDD) libraries. The simulation produces an output in the Value Change Dump (VCD) format, which is a normative trace format released as part of the IEEE standard for Verilog-HDL and which is often used in Electronic Design Automation (EDA) tools. The VCD file is annotated with proprietary comments (pragmas) so the TimeSquare VCD viewer can display feedback on causality relations that leads to this specific run. Tracability is indeed very important.

Figure 9 illustrates a correct run for the given specification generated by TimeSquare simulation engine. Note that alternative runs may also be correct since the simulation engine generates one possible solution. Even though simulation can help to discover some specification inconsistencies, it only considers one possible solution at a time. It must be combined with exhaustive analysis for corner bug detection and formal verification of safety requirements. This is addressed in the next two subsections.

Esterel/SyncCharts modeling

The full syntax and semantics of these programming languages are beyond the scope of this paper. The combined usage of Esterel and SyncCharts is richly illustrated in a textbook [START_REF] Zaffalon | Programmation synchrone de systèmes réactifs avec Esterel et les Sync-Charts[END_REF]. The foundations of the Esterel language are given in a paper [START_REF] Berry | The foundations of Esterel[END_REF], SyncCharts are introduced in another paper [START_REF] André | Representation and analysis of reactive behaviors: A synchronous approach[END_REF], and their compilation is explained in a book [23]. Esterel and SyncCharts semantics are fully compatible, and any SyncChart can be translated into a semantically equivalent Esterel code. As synchronous reactive languages, they have a cycle-based semantics: a run is a sequence of non-overlapping reactions consisting of input reading, computation, and output writing.

In this presentation we just comment some design choices present in the solution proposed in the previously mentioned Esterel-Studio's Getting Started manual. The DF program consists of two parts: the Feeder, written in SyncCharts, and the Filter, written in Esterel. The Feeder specifies the protocol (request/acknowledge) for getting input words, the unpacking of input words into input pixels, the feeding of the Filter with input and padding pixels, and the detection of the end of line. The Filter is a pipelined version of a sliding-window filtering, not detailed here. The behavior of the Feeder is specified by the SyncChart in Figure 10. SyncCharts are akin to StateCharts (hierarchical and concurrent composition of state machines) with a richer variety of transitions that express different kinds of preemptions (strong, weak, and normal termination). Macrostate ProcessInputLine manages the request/acknowledge protocol and the decomposition of an input word. The request (signal Ready ) is sustained up to the receipt of the acknowledge (signal InWord ). This behavior is specified by state WaitForWord, which emits signal Ready at each instant, until signal InWord occurs. This occurrence triggers the outgo-INRIA ing transition from state WaitForWord (strong preemption). When an input word has been completely decomposed, a local signal (EndOfWord) is emitted. The process is cyclically repeated until the last word of the line has been processed (transition exiting macrostate ProcessInputLine). This is a weak preemption, letting macrostate ProcessInputLine react before its effective preemption. State PadEoL provides LAT EN CY padding pixels to the Filter to drain its pipeline. After emitting the last padding pixel, a normal termination occurs (self transition to ProcessOutputLine) and the same process starts again with a new input line processing.

Checking an Esterel program against a CCSL specification

Formal verification tools in Esterel Studio

Since any SyncChart can be transformed into an equivalent Esterel code [2,[START_REF] Zaffalon | Programmation synchrone de systèmes réactifs avec Esterel et les Sync-Charts[END_REF], from now on the expression "Esterel or SyncCharts program" is abbreviated as "Esterel program". The Esterel compiler is part of a comprehensive development environment named Esterel Studio. This environment provides compilation, simulation, coverage, verification and code generation facilities. In this subsection we consider only the fourth one. Formal verification of Esterel programs relies on two complementary technologies: 1) Symbolic model checking based on a BDD technology, 2) Bounded and Full model checking based on SAT-technology. Bounded Model Checking (BMC) is efficient in searching for bugs in design and property specifications. Since BMC can only falsify properties, it cannot be used to prove a property correct. On the contrary, Full Model Checking (FMC) can prove that a property holds, but the process may take a great amount of time. The FMC makes its best to combine SATsolver with induction [25] and improved strategy combining interpolation and SAT-based model checking [START_REF] Mcmillan | Interpolation and SAT-based model checking[END_REF]. Symbolic Model Checking (SMC) can be used both to falsify and to prove properties. The drawback of this BDD-based model checking is the possibility to run out of memory and thus being inconclusive.

A property to check is directly expressed in Esterel either as an assertion or as an observer. An assertion may represent an assumption about the execution environment of the program to check. An assertion also allows implementing parts of its intended behavior as executable and verifiable predicates, into the design code. An observer is a special program unit, not part of the design, and used in property checking. It continuously observes input and output signals of the program and detects possible property violations. Used in combination with model checking, observers are a powerful means to find bugs and formally establish properties. If a violation occurs, the model checker generates a simulation trace leading to this violation, thus exhibiting a counter-example of the checked property. Note that the observers are non-intrusive: they do not alter the behavior of the tested Esterel program.

CCSL clock constraints in Esterel

Clock constraints are predicates that can be expressed as Esterel assertions or observers. The mathematical semantics of CCSL, partially given in Annex A, enables these translations. Note that, because an observer detects possible violations, an Esterel observer for a given clock relation actually programs the negation of the logical expression associated with this relation. To ease clock constraint checking, we have developed a library of generic Esterel modules called CcslStrlLib. This library provides one observer for each clock relation, one Esterel module for each clock expression, and special modules called Adaptors that bind program signals to CCSL clocks.

The verification of the clock constraints specifications is performed without any change in the Esterel program. The user has only to build one Esterel observer for each CCSL clock relation, and put these observers in the Observer directory of the Esterel Studio project.

Figure 11 shows the observer of Cstr 3. The V3 signal is emitted if and only if Cstr 3 is violated. All the blocks in the observer module are instantiations of generic modules from CcslStrlLib. The upper Adaptor takes the program valued signal OutPixel and generates the pure signal S_OutPixel which represents the CCSL clock outP ixel. This clock ticks whenever OutPixel is present. The lower adaptor is a simple repeater: signal S_EndOfLine is emitted whenever the program pure signal EndOfLine is present. S_EndOfLine represents CCSL clock endOf Line. In Cstr 3, the clock relation is Equality = , so we instantiate a CCSL Equality observer, which may emit the violation signal V3. The left-hand side of the relation is a clock expression involving a filtering. This expression is represented in the observer by an instantiation of the generic module for periodic expressions, with the actual parameters (period=8, offset=7). The two dashed rounded-corner rectangles are just annotations that highlight the observer structuration.

Esterel Observer of ( )

INRIA

The corresponding Esterel code is trivial for the adaptors:

sustain { S_OutPixel i f OutPixel , S_EndOfLine i f EndOfLine }
The CCSL equality observer is also a simple Esterel code:

module CR_equal : input A, B ; output V i o l a t i o n ; sustain V i o l a t i o n i f (A xor B) end module
The signal Violation is emitted whenever the presence status of signal A differs from the one of signal B. This is merely the negation of the logical specification given in Annex A.2, clock relation (equal).

The module "Generic CCSL Periodic" is a bit more complex: The values of the two constants OFFSET and PERIOD are set at the compile-time module instantiation. The static keyword in line 7 is exploited by the compiler to instantiate either the then-statement if OFFSET is positive or the else-statement if OFFSET is 0. The reactive behavior relies on the language capability to wait for a given number of occurrences of a signal (await OFFSET Super) and possibly in an infinite loop (every PERIOD Super do ... end).

Design verification

Generally, verification starts with a fast search for bugs or property violations. This is done by BMC. In the application at hand, a violation is detected when checking Cstr 1 (Figure 12). The model checker generates a counter-example sequence of 13 reactions (file V1.esi). This counter-example scenario can be displayed as a waveform (see screen copy in Figure 13). Signal OutWord is emitted by the memory, which contains the image, and therefore is the same as signal InWord. This trace confirms the presence, at instant 12, of a spurious signal Ready. This unexpected emission of Ready is caused by the weak preemption of macrostate ProcessInputLine, which lets state WaitForWord emit Ready before leaving the macrostate.

Related

In UML, Time is seldom part of the behavioral modeling, which is essentially untimed. By default, events are handled in their arrival order. In UML2, the subpackage Simple Time introduces metaclasses to represent time and duration. This very simple model of Time explicitely calls for extensions (by an appropriate Profile) to provide both a more sophisticated model and a precise semantics. Several models of Time and Concurrency (outside the scope of UML) have been defined and have inspired our work. We briefly describe them in this section.

There have been several attempts to give a formal semantics to UML constructs. Lots of the existing work focus on behavioral models (activities and interactions) [START_REF] Li | Timing analysis of UML activity diagrams[END_REF][START_REF] Damm | A discrete-time UML semantics for concurrency and communication in safety-critical applications[END_REF][START_REF] Störrle | Semantics and verification of data flow in UML 2.0 activities[END_REF] and attempt to give a semantics to UML metaclasses in a transformational way. MARTE Time model includes both structural and behavioral aspects (not the behavior only) and does not focus on one specific diagram. However, we do not consider the whole behavior nor the whole metamodel. Our intent is rather to give a global consistency to timing aspects of a UML model. MARTE time model, which CCSL relies on, is based on partial ordering of instants. This is close to Petri's work on concurrency theory [START_REF] Petri | Concurrency theory[END_REF]. Petri's model restricts coincidence to single points in space-time. In CCSL, the coincidence relationship "melts" a priori independent points (instants) to reflect design choices and thus is a foundational relation. General Net theory has also influenced this work. The precedence-based relations and especially the clock constraint synchronization are inspired from the synchronic distance concept [START_REF] Reisig | Petri nets: an introduction[END_REF].

Petri nets have well-established mathematical foundations and offer rich analysis capabilities. Petri nets support true concurrency and could be used to specify CCSL clock relations (at least some of them). However, it is very difficult to express simultaneity. It is not possible to force two transitions to fire "at the same time". An extension, Time Petri Net [START_REF] Merlin | A Study of the Recoverability of Computer Systems[END_REF] adds time intervals to transitions, thus providing a support for simultaneity. Even with that extension, the specification of CCSL constraints is far from straight forward.

MARTE logical time model is also akin to synchronous language time model. Coincidencebased CCSL clock constraints are easily expressed with the language Signal [START_REF] Benveniste | Synchronous programming with events and relations: the SIGNAL language and its semantics[END_REF]. Signal is a relational language that supports multiclock (polychronous) specifications. A signal is a sequence of values of the same type, which are present at some instants. The set of instants where a signal is present is the clock of the signal. There are two kinds of operators. Monochronous operators act only on synchronous signals, i.e., signals that are always present at the same instants. These operators mainly operate on values rather than clocks. Polychronous operators act on signals with any clock and their result may have another clock. In MARTE, the Time Structure only refers to the instants and a labeling function can be given to associate values with instants. In this paper, we have focused on the Time Structure ignoring the labeling function (the values). CCSL clocks compare to pure signals (type event in Signal) and CCSL constraints compare to Signal polychronous operators.

A more complete comparison between CCSL, Signal and Time Petri net has been presented in a separate work [START_REF] Mallet | On the semantics of UML/MARTE clock constraints[END_REF].

ModHel'X [START_REF] Boulanger | Simulation of multi-formalism models with modhelx[END_REF] is a framework for simulating multi-formalism models. Each model conforms to a specific Model of Computation (MoC). Parts of hierarchical models can be described using different MoCs. The separation is performed by using InterfaceBlocks, which specify the adaptation semantics between the two MoCs. ModHel'X deals with data, control and temporal aspects of models. It relies on imperative OCL to describe an execution INRIA semantics based on delta cycles. Therefore, ModHel'X focuses on simulation and testing aspects and does not cope with formal verification.

Conclusion

This paper introduces the formal semantics of UML/MARTE Clock Constraint Specification Language. A simple (but not trivial) example illustrates the use of CCSL in modeling time requirements.

MARTE OMG Specification has proposed a conceptual view of the Time Model with an informal (natural language) semantics and the adequate UML syntax to refer to this Time Model in UML user models. To avoid divergent interpretations a formal semantics is needed, especially for real-time critical systems. MARTE Time Model has also introduced in UML, the notion of logical time, missing in the standard and very useful to digital circuit design. Logical time is a common concept in synchronous languages and Petri nets.

The initial intent of MARTE being to cover both design and analysis, a large set of CCSL constraints have been introduced for convenience on top of a relatively small set of kernel primitives. This paper provides a classification of the constraints based on two fundamental relationships (coincidence and precedence).

This paper presents CCSL as a support for specifying timing requirements on UML models, as well as simulating and analyzing them. The adopted process starts with a UML model. The model is annotated with CCSL constraints by applying the profile MARTE and using its stereotypes in a way not discussed here. The resulting executable specification is assessed and refined by using feedback from TimeSquare simulation. Finally, the implementation is validated through observers generated from the CCSL specification. This process has been applied on an Esterel implementation of a digital filtering application. A specific library of Esterel observers has been developed for verification purpose. Relying on Esterel gives access to its formal verification suite, thus extending TimeSquare capabilities. The same process could also be applied with other implementation languages. Changing the language is mainly a matter of building the library of observers for the target language. Since our observers are written in Esterel, we can also use the Esterel Studio code generation facilities to generate observers in SystemC or in VHDL, thus opening new perspectives.

A Semantics of CCSL

This section discusses the structural operational semantics of CCSL kernel relations and expressions. This is the semantics used in TimeSquare to process valid runs. Its equivalence with the denotational semantics given in Section 4 is not trivial and not addressed here.

A.1 Kernel CCSL

Figure 16 is an excerpt of CCSL kernel meta-model. A clock constraint is a set of clock relations. Binary relations apply to two expressions (lef t and right), the simplest expression being a simple reference to a clock. We use the wording relation to emphasize the fact that CCSL is a declarative language. In particular, Equality differs from the imperative assignment and is not a directed relationship. As discussed in Section 4 there are three kinds of relations: synchronous (coincidence-based), asynchronous (precedence-based) and mixed. We only discuss here the operational semantics of discrete clocks, chronometric clocks are discretized before being handled. For a specification, i.e., a set of discrete clocks C, we associate a function c called configuration, c : C → N that gives the current time, i.e., the index of the current instant for each clock. The initial configuration c 0 is so that (∀i ∈ N )(c 0 [i] = 0), each clock is initialized at its first instant. A step is function that transforms a given configuration into the next one : step : (C → N) → (C → N).

To process a step, we determine the disabled clocks (D), the set of clocks that CANNOT fire at configuration c. All the remaining clocks are enabled and belong to E. E is made of two distinct kinds of clocks, the clocks that MUST fire F and the clocks that MAY fire X (because nothing says they cannot). This computation is done according to the Boolean equations associated with each relation (Annex A.2 and each expression (Annex A.3). Solving the set of Boolean equations gives D and E.

The second step is to apply the simulation policy. The detail of all simulation policies is not given here. The random policy chooses one clock randomly in the set of underdetermined clocks (X) and deduces the new set of clocks that cannot fire or that must fire. This non deterministic process is applied until all clocks from X are either assigned to D or F . All clocks in F are then fired and their index is incremented by 1, whereas the index of all other clocks stalls.

INRIA

A.2 Clock relations

For each clock t, t denotes the Boolean associated with t. Four rules are given below. Each rule explains how set of Boolean equations are composed from the two Boolean expressions (b1 and b2) when two clocks t1 and t2 are in a specific relation.

Sub-clocking

t 1 , c b 1 t 2 , c b 2 t 1 ⊂ t 2 , c b 1 ∧ b 2 ∧ (t 1 ⇒ t 2 ) ( subclock ) Equality t 1 , c b 1 t 2 , c b 2 t 1 = t 2 , c b 1 ∧ b 2 ∧ (t 1 = t 2 ) ( equal ) Strict precedence t 1 , c b 1 t 2 , c b 2 β (c(t 1 ) = c(t 2 )) t 1 ≺ t 2 , c b 1 ∧ b 2 ∧ (β ⇒ ¬t 2 ) ( spred )
Non-strict precedence t 1 , c b 1 t 2 , c b 2 β (c(t 1 ) = c(t 2 ))

t 1 t 2 , c b 1 ∧ b 2 ∧ (β ⇒ (t 2 ⇒ t 1 )) ( pred )

A.3 Clock expressions

Expressions are also described by a set of Boolean equations. The main difference is that a relation applies at each step in the exact same way depending only on the current configuration. Expressions have additional state information (mostly integer counters) and may apply differently depending on both the configuration and their local state. At each step, when the clock t 1 associated with an expression is fired (t 1 ∈ F ), the expression is rewritten according to the rewriting rule.

We only give here one example for illustration purpose. It concerns expression filteredBy (denoted ). The first two rules (filter1, filter2) give the Boolean equations for the two possible cases (when n = 1 and n > 1). The last two rules (RWfilter1, RWfilter2) are the rewriting rules for the same two cases.

Clock projection

t 1 , c b 1 t ∼ = t 1 1.σ, c b 1 ∧ (t = t 1 ) ( filter1 ) t 1 , c b 1 n > 1 t ∼ = t 1 n.σ, c b 1 ∧ ¬t ( filter2 ) t 1 ∈ F t ∼ = t 1 1.σ - → t ∼ = t 1 σ ( RWfilter1 ) t 1 ∈ F n > 1 t ∼ = t 1 n.σ - → t ∼ = t 1 (n -1).σ ( RWfilter2 )

B Filtering constraint

Constraint { applies to the special case where L = 2, P P L = 8, and P P W = 4. Here we consider the general case. We start with the input/output pixel transformation. Equation 1 implies the following clock relation:

(inP ixel w 1 ) ≺ (outP ixel w 2 ) where w 1 = 0 L .1 P P L-L ω , w 2 = 1 P P L-L .0 L ω (2) Since inP ixel is not in the interface, we have to express clock relation 2 directly between inW ord and outP ixel.

Figure 1 :

 1 Figure 1: Graphical representation of instant relations

Figure 2 showsFigure 2 :

 22 Figure 2: DF component

Figure 3 :

 3 Figure 3: Some time constraints on the DF behavior

  OutPixel[0] depends on InPixel[-2] . . . InPixel[2]. A default value is given to padding pixels InPixel[-2] and InPixel[-1].

Figure 4 (

 4 Figure 4 (B) illustrates the steady phase (kernel) where the computation of each output pixel depends on five inputs pixels. OutPixel[2] depends on InPixel[0] . . . InPixel[4]. Because of the implicit ordering on input pixels (InPixel[j] precedes InPixel[k], for any j < k), only one precedence is required: InPixel[4] must precede OutPixel[2].Figure4(C) represents the ending of the 8-pixel line processing (epilog). OutPixel[7] depends on InPixel[5] . . . InPixel[START_REF] Cohen | Nsynchronous kahn networks: a relaxed model of synchrony for real-time systems[END_REF]. InPixel[START_REF] Boulanger | Simulation of multi-formalism models with modhelx[END_REF] and InPixel[START_REF] Cohen | Nsynchronous kahn networks: a relaxed model of synchrony for real-time systems[END_REF] are also padding pixels for which a default value is assumed.

Figure 4 :

 4 Figure 4: Pixel dependency

Figure 6 :

 6 Figure 6: Precedence-based clock constraint

  This section illustrates the use of CCSL constraints to specify and analyze the digital image filtering example. The first subsection focuses on the specification. The second one briefly INRIA

Figure 7 :

 7 Figure 7: Sampling constraints

Figure 8 :

 8 Figure 8: Additional precedences

Figure 9 :

 9 Figure 9: One acceptable solution generated by TimeSquare TimeSquare VCD viewer displays instant relations when requested. Precedence relations are displayed as dashed arrows. Coincidence relations are shown as vertical lines with a diamond on the side of the super clock. When packet-based constraints (as in x) are used, the packets are depicted as rounded-corner rectangles surrounding the related clock ticks.Even though simulation can help to discover some specification inconsistencies, it only considers one possible solution at a time. It must be combined with exhaustive analysis for corner bug detection and formal verification of safety requirements. This is addressed in the next two subsections.

Figure 10 :

 10 Figure 10: Behavior of the Feeder

Figure 11 :

 11 Figure 11: Esterel Observer of Cstr 3

1 module CE_periodic : 2 input 3 output 4 constant 5 constant 6 await immediate Super ; 7 i f s t a t i c OFFSET > 0 then 8 await OFFSET Super // t r a n s i e n t 9 e

 23456789 Super ; // t h e s u p e r c l o c k Output ; // t h e g e n e r a t e d s u b c l o c k OFFSET : unsigned ; // p a r a m e t e r s PERIOD : unsigned ; // assumed > 0

Figure 12 :

 12 Figure 12: Violation detection of Cstr 1

Figure 13 :Figure 14 :

 1314 Figure 13: Trace of a violation of Cstr 1

Figure 15 :

 15 Figure 15: Verification of the modified DF

Figure 16 :

 16 Figure 16: Clock constraint meta-model

inW ord w 3 ≺

 3 outP ixel w 4 where w 3 = 0 α .1 β ω w 4 = 0 γ . 1.0 P P W -1 β .0 L ω α = L/P P W β = W P L -α γ = P P L -L -β * P P W INRIA

RR n°6839