Abstract
This paper presents a formal framework for translating Statecharts—a widely used graphical formalism for reactive system design—into Esterel, a synchronous text-based language. The translation process bridges the gap between intuitive visual modeling and rigorous formal verification. By mapping Statechart hierarchies and concurrency to Esterel’s deterministic semantics, the authors provide a pathway for engineers to mathematically prove safety and liveness properties in complex designs, such as deadlock avoidance in interrupt-driven systems.
Introduction
Designing reactive systems, such as flight controllers or medical devices, requires managing a continuous stream of external events in real-time. While engineers favor Statecharts for their ability to visually represent hierarchy and concurrency, these diagrams often lack a unified mathematical semantics, complicating formal verification. Conversely, Esterel offers a robust mathematical foundation and powerful verification tools but lacks the visual clarity of a diagrammatic approach. This work introduces a syntax-directed translation that preserves the structural meaning of Statecharts while enabling the use of Esterel's verification suite.
Methodology
The translation methodology relies on a multi-step process to convert visual logic into structured code. Central to this is the transformation of the Statechart into an AND-OR Tree Representation. In this model, "AND" nodes denote concurrent states executing in parallel, while "OR" nodes represent mutually exclusive states.
Transitions are classified into four distinct types (T1 through T4) based on their scope within the hierarchy. This classification allows the translator to handle complex jumps across different levels of the state nesting. To resolve conflicts where multiple transitions might fire simultaneously, the system utilizes Esterel’s trap and signal constructs, ensuring that higher-level transitions maintain priority according to "Statemate" semantics. Furthermore, a specialized STEP signal is introduced to emulate the Statechart "superstep" model, managing internal reactions before processing new external inputs.
Case Studies and Experimental Results
The proposed translation was evaluated using "industrial-strength" case studies, including a complex Switching Interrupts Model and a classic Priority Inversion scenario.
The Switching Interrupts Model (Figure 1) demonstrates the tool's ability to handle intricate task switching and interrupt service routines (ISRs). By translating these models into Esterel, the authors were able to employ verification tools like FC2Tools to confirm critical safety properties, such as correct state toggling during failure modes. In the Priority Inversion case, the Esterel-based verification successfully identified a potential deadlock—a flaw that is notoriously difficult to detect through visual inspection of a Statechart alone.
Discussion
A key insight of this approach is that Esterel’s inherent determinism acts as a diagnostic tool. If a Statechart contains nondeterministic ambiguities, the translation process naturally flags them as errors, forcing a cleaner design. The mapping of physical drawing hierarchies to lexical scoping in code (via nested trap statements) provides an elegant solution for preemption logic. This "what you prove is what you execute" philosophy ensures that the verified model is identical to the production logic.
Conclusion and Future Work
While the current prototype effectively handles deterministic Statecharts and simple event structures, limitations remain. The tool is currently restricted to a deterministic subset of Statecharts and does not yet support complex data variables or general actions. Future work aims to expand the translation to include these elements and to improve the detection of infinite loops within the "superstep" model, which remain a challenge for existing synchronous language tools.
Summary updated