Core Model
Cfg Model
Core
Cfg
+
bin Dead code
Figure 1: Current development methodology.
the configuration is not perfectly tuned to the appli-
cation demands, so that unnecessary behaviors make
it into the code and may be executed. This comes at
the cost of decreased performance and greater mem-
ory footprint, in terms of stack size, ROM and RAM
usage. The consistency of the configuration must also
be checked in order to be sure that the driver cannot
behave in an unspecified way.
The proposed approach. Instead of doing complex
verification on existing systems, we propose to use an
MBD approach to generate the device driver. How-
ever, to reduce the flaws of the current methodology,
we combine the use of formal models, the lifting of
configuration at the model level and well-known con-
troller synthesis techniques (Ramadge and Wonham,
1989) to generate correct-by-construction software.
Given the real-time nature of these systems, the
model of timed automata (Alur and Dill, 1994) and
timed games (De Alfaro et al., 2003) is an appropri-
ate formalism to express and model the required timed
properties. In a timed game, we model two players,
the controller and the environment, playing moves at
a certain time on a shared model called the board. The
board represents all possible states of the two play-
ers and the possible actions available at all times. In
this case, the controller is the device driver, and the
environment is the hardware device along with its en-
vironment (communication bus, analog signals, etc.).
Moves played by the device driver are also known as
controllable actions and moves played by the hard-
ware device and its environment are known as uncon-
trollable actions.
Their level of expressiveness and well-known
controller synthesis techniques and tools (Behrmann
et al., 2007) allow the modeling of complex systems,
while providing a formal proof on the behavior of the
systems.
However, these timed models require a good un-
derstanding of all the components, including the
knowledge of the timings of both players. These tim-
ings are rarely known: the hardware timings are not
always described exhaustively, and the software exe-
cution times are rarely known precisely.
In addition, embedded systems hardware re-
sources (computing power, memory, etc.) are limited.
The basis of timed controlled, namely explicit clocks,
are very expensive to use in a critical embedded en-
vironment. Implementation wise, the infrastructure
needed to implement these clocks in a timed con-
troller is not acceptable for implementing real-time
systems at low level such as device drivers. In or-
der to function properly, a timed driver may need an
exact timing. These exact timings do translate into
low-level software to hardware clocks triggering in-
terrupts each time a controller needs to wait during an
arbitrary amount of time. Even with this, a controller
cannot guarantee all the timing constraints, because
interrupts might have been masked for a certain com-
putation.
Our contribution. In this paper, we explore an-
other way of modeling embedded systems, starting
from peripheral devices. We would like to derive a
controller — a device driver — without explicit timed
models. However, the untimed automata framework
does not have the necessary level of expressiveness in
order to generate useful drivers.
Beside the controllable and uncontrollable actions
used in untimed games, device drivers rely on addi-
tional behaviors of the device in order to work. These
behaviors can be reduced into two types of uncontrol-
lable actions:
• Delayed actions, that take time to complete or
cannot happen immediately, such as writing to an
external memory, sending a message on a bus,
performing a specific computation on a hardware
dedicated unit, etc. These actions come usually
with some kind of abortion mechanism, so they
are avoidable in a certain point of view. They are
modeled in an explicit timed context by guards
with lower bounds on clocks as constraints.
• Ineluctable actions, that are known to happen in
a nominal context: the end of a transmission or
a conversion, or more generally an acknowledge-
ment of the reception of a command. These can be
modeled using invariants on states, however in the
explicit timed context we need to know an upper
bound on the delay, which is not always possible
with a quantitative approach.
We propose to extend the semantics of untimed
games with two properties of uncontrollable actions:
SIMULTECH2014-4thInternationalConferenceonSimulationandModelingMethodologies,Technologiesand
Applications
164