Next: , Up: Process Declarations


5.1.1 Ports

A process declaration may be repeated any number of times as long as the port formal instances are equivalent.

Two port formal instance lists are equivalent if and only if the following are true:

  1. The list contains the same number of formal instances.
  2. Each formal instance (in order of each list) is type-equivalent (and size-equivalent).
  3. Each formal instance has the same name.

Unlike C, where formal identifiers are optional in prototypes, port formal lists require names for each instance. This allows one to reference a process's ports individually before the process is defined.

Unlike normal instantiations found in a namespace or definition body, formal instance arrays may not be extended with re-declarations. Since they may only be declared once, they must be densely packed.

Process port types can also be further qualified with direction annotations to indicate whether a port is an input or output.

     defproc foo(bool? in; bool! out) { ... }

The connectivity rules for bools, channels and datatstructs vary slightly. For bools, direction constraints are checked against production rule set (PRS) blocks. Channels obey a point-to-point connection rule: they must be connected to no more than one producer, and no more than one consumer. Data-structs may have driven by one producer, but may fanout (share) to an arbitrary number of (read-only) consumers.