Skip to main content

Module model

Module model 

Source
Expand description

Fiducia → UPPAAL NTA transpilation.

Three passes over tast, beside the Ccfg:

  1. data-layer constants → global declarations;
  2. channels → global declarations (async ones relayed by the ChannelAutogen template, a bidirectional one as two unidirectional ones);
  3. each PD → one template: its Orchestration (one graph per entry point) is printed by [handler] under the platform’s two rules — init once, committed (MK-Init), then notified, its exit wired back to its head (MK-Restart). Interleaving between PDs is UPPAAL’s parallel composition, as it is the glts’s. Every notified location is urgent: the model does not count time, so no PD waits while it can move. Progress, not fairness. A protected graph is entered by a Sync channel’s call, answers the waiting caller, and goes back to where the callee was (call).

The model is a slight over-approximation of the application, not a bisimulation of it: constructors run in any order rather than by priority, and PDs interleave freely, without the scheduler’s priorities or run to completion. An invariant verified on it holds of the application; a counterexample may be one the platform cannot produce.

Translation scheme summary:

  • A struct → a global typedef struct { … } Name; of the same fields, after the structs its fields are of; a variable’s type is bool, the struct’s name, or int (UPPAAL has no widths), an array’s length on its declarator, and a local’s default fills every field
  • Unbuffered Chan → native UPPAAL chan c;; a Sync send is c!, its value, if any, in c_val, then a wait for the callee’s ret_<pd>?
  • Computation events → template-local functions; an edge firing the event carries update label name()
  • Calls to contracted foreign functions (Viper or ACSL) → a declared UPPAAL function per function a PD calls, ffi_<name>: requires as asserts, never a guard, so the enabled edges are the Ccfg’s; ensures retval == E as its return. x = io.f(a) becomes x = ffi_f(a);, a guard [io.p(a)] becomes (ffi_p(a)) != (0), a discarded value is still a call. An uncontracted call stays opaque (a comment, or 0 in a guard).
  • Ccfg edge → transition: the guard printed as is, the event as (synchronisation, update); a silent edge is unlabelled and hang is an unlabelled self-loop

Functions§

transpile
Transpile a typed Fiducia project and its graphs to a UPPAAL NTA.