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 nodeparams:(((var_decl;)* var_decl (;)? )? )where_decl: where 'ID (, 'ID)* numeric_kindnumeric_kind: numeric or float or integer or signed or unsignedspec_decl: specialize path- a function is a combinational operator, a node is sequential
- var_decl: no last declaration for an input, no last or default declarations for an output
- where_decl: each 'ID must appear at least once in the operator parameter types
- 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.
- inline: not allowed for an imported operator
Signatures
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.
Causality
Each output depends on all inputs if the operator is not inline, else see Causality signature in Operator Definition (Text)
-
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)
Clock
The inputs and outputs have the same clock by default.