module Fsm_dyn:sig
..end
Dynamic model of FSM instances (used by the simulator)
type
t = {
|
f_static : |
(* | Static representation | *) |
|
f_vars : |
(* | name, (type, value) | *) |
|
f_state : |
(* | Current state | *) |
|
f_has_reacted : |
(* | true when implied in the last reaction | *) |
typelenv =
(string * Expr.value) list
type
genv = {
|
fe_inputs : |
(* | Global inputs | *) |
|
fe_csts : |
(* | Global constants | *) |
|
fe_fns : |
(* | Global functions | *) |
|
fe_vars : |
(* | Shared variables | *) |
|
fe_evs : |
(* | Shared events | *) |
val create : Fsm.inst -> t
create sf
creates a dynamic FSM instance from a static description sf
Input and output events
typeevent =
loc * Expr.value
Event location, new value
type
loc =
| |
LVar of |
(* | Scalar | *) |
| |
LArrInd of |
(* | 1D array location | *) |
| |
LRField of |
(* | Record field | *) |
exception IllegalTrans of t * string
exception IllegalAction of t * Action.t
exception Undeterminate of t * string * Types.date
exception NonDetTrans of t * Fsm.transition list * Types.date
exception NonAtomicIoWrite of t * Action.t
val fireable : t -> lenv -> Fsm.Repr.transition -> bool
fireable f env t
returns true
iff transition t
in FSM f
is fireable, given ocal env env
.
val check_cond : t -> lenv -> Condition.t -> bool
check_cond f env c
evaluatues condition c
in FSM f
, in the context of local env env
.
val is_event_set : lenv -> Condition.event -> bool
is_event_set env ev
indicates whether event ev
is set in local environment env
val init : genv -> t -> t * event list
init env f
performs the initial transition of FSM f
, in global environment env
,
Returns an updated fsm and list of events consisting of
val react : Types.date -> genv -> t -> t * event list
react t env f
compute the reaction, at time t
of FSM f
in global environment env
.
The global environment contains the values of global inputs, shared objects and global functions/constants.
As for init
, returns an updated fsm and list of events.