Operator Declaration

Declares an operator.

Syntax

Declares the operator name and parameters names and types, in a module interface (.swani file).

operator: inline? op_kind ID (<<n1 (, ni)*>>)? params returns params (where_decl)* (spec_decl)? ; 
where
op_kind:function or node
params:(((var_decl;)* var_decl (;)? )? )
where_decl: where 'ID (, 'ID)* numeric_kind
numeric_kind: numeric or float or integer or signed or unsigned
spec_decl: specialize path
  1. a function is a combinational operator, a node is sequential
  2. var_decl: no last declaration for an input, no last or default declarations for an output
  3. where_decl: each 'ID must appear at least once in the operator parameter types
  4. spec_decl: the path must reference an operator without any body definition (called imported operator). It means that it is the declaration of a specialization of a polymorphic imported operator.
  5. inline: not allowed for an imported operator

Signatures

  1. Type

    (T1; ... ;Tm) returns (Tj;...Tn)

    where (T1; ... ;Tm) are the types of the inputs and (Tj;...Tn) are the types of the outputs.

    where_decl allows to specify the kind of a type variable.

  2. Causality

    Each output depends on all inputs if the operator is not inline, else see Causality signature in Operator Definition (Text)

  3. Initialization

    If the operator is imported:

    • for a node: all inputs must have their first value defined. Each output has its first value defined.
    • for a function: each output has its first value defined if the inputs have their first values defined.

    else see Initialisation signature in Operator Definition (Text)

  4. Clock

    The inputs and outputs have the same clock by default.