Programming Primitives in the DE Domain

A DE primitive can be viewed as an event-processor; it receives events from the outside, processes them, and generates output events after some latency.

In a DE primitive, the management of the timestamps of the particles (events) is as important as the input/output mapping of particle values. Generating output values and timestamps are separable tasks. For greatest modularity, some DE primitives, so-called delay primitives, are dedicated to time management. Examples of such primitives are Delay and Server. These primitives, when fired, produce output events that typically have larger timestamps than the input events. They usually do not manipulate the value of the particles in any significant way. The other primitives, so-called functional primitives, avoid time management, usually by generating output events with the same timetamp as the input events. They, however, do manipulate the value of the particles.


For managing timestamps, the DEStar class has two DE-specific members: arrivalTime and completionTime, summarized in the table below. Before firing a primitive, a DE scheduler sets the value of the arrivalTime member equally to the timestamp of the event triggering the current firing. When the primitive fired, before returning, it typically sets the value of the completionTime member to the value of the timestamp of the latest event produced by the primitive. The schedulers do not use the completionTime member, however, so it can actually be used in any way the primitive writer wishes. DEStar also contains a field delayType and a method setMode that are used to signal the properties of the primitive, as described below.

Summary of methods of class DEStar



double completionTime

store the completion time of the current execution, which in turn is equal to the next free time

double arrivalTime

is set by the scheduler to the timestamp of the event triggering the current firing

int delayType

flag to indicate whether it is a delay type primitive or not

void setMode (FiringMode m)

set the firing mode to PHASE or SIMPLE

Delay primitives

Delay primitives manipulate timestamps. Two types of examples of delay primitives are pure delays, and servers.

Functional Primitives

A functional primitive will typically read the value of new input particles, compute the value of new output particles, and produce new output particles with timestamps identical to those of the new inputs.

Simultaneous Events

Source Primitives

The DE primitives discussed so far fire in response to input events. In order to build signal generators, or source primitives, or primitives with outputs but no inputs, we need another class of DE primitive, called a self-scheduling primitive.

Init and WrapUp Primitives

The two primitives Init and WrapUp changed in the DE domain with version 2.3.