[Next] [Up] [Previous]

The FLOW Statement

Another popular new parallel architecture is the dataflow architecture. This architecture is based on the idea of several arithmetic units passing numbers from one to another, each set up to perform a single operation.

Conventional expressions can be optimized for this architecture. However, the FLOW statement is provided to allow the direct expression of algorithms in dataflow format.

A typical FLOW statement might look like this:

       FLOW [A,B,C]:{CALL GRAB(A,B,C)},
              [X,Y]:{CALL GRAB2(X,Y)};
            [P,Q,R]:{CALL PUT(P,Q,R)};
                    (REAL) I.;
     { . I1=A+X
       . I2=B*C/Y
       . P=I1*I2
       . Q=I1+I2
       . I3=A/(X+Y*B)
       . I4=I2/(C*X+Y)
       . R=X*(I1+I2)-Y*(I3+I4) }

and its form can be seen to be the following:

       FLOW [(type) in-variable,(type) in-variable...]:in-sequence,...;
            [(type) out-variable,...]:out-sequence,...;
             (type) temp-variable,(type) temp-variable,...;

where temp variables may end in a period, indicating that a temporary IMPLICIT rule, valid only within the FLOW statement's sequence part, is being established.

Each of the assignment statements in the sequence creates a node in the dataflow process; thus, the appearance of a variable name in several different statements does not create additional units of demand for that variable.

If a variable name appears twice on the right-hand side of the equals sign in one statement, however, two separate values from the input or node to which it refers are requested. If this behavior is not desired, the variable name can be preceded by a period to indicate that a duplicate value is required in an expression, but this can also be dealt with by breaking a long expression into multiple parts, and creating additional nodes.

Both system defined and user-written functions can be used within expressions in this sequence.

Note that, since each temp-variable also corresponds to a node, no temp-variable may appear more than once on the left-hand side of the equals sign anywhere in the main-sequence of the FLOW statement.

A statement is executed whenever all the variables in it have values; outside variables are, like constants, continuous sources of the same value. Other variables can be empty or contain a value. When a variable contains a value, that value is given to all statements which have it on the right-hand side of the equals sign, and any fully satisfied statements will execute.

A subscripted outside variable only contains a value when its subscripts contain a value; that is, an outside array acts like a translation function on in-variables, supplying a result whenever its argument contains a value. Also, the notation A(*) creates a limited source of variables, which will supply the first element of A the first time it is used, the second element of A the second time, and so on.

Note that the period indicating an assignment statement can be omitted in the main sequence, as this is the only type of statement it can contain.

While in-variables can be used in in-sequences, and out-variables in out-sequences, otherwise these sequences contain normal FALCON code, except that in-sequences may also contain the LAST statement, which indicates that no further values may be supplied for the variables they are to fill, and these sequences cannot contain branches outside themselves.

A FLOW statement stops executing when it runs out of data with which to do anything.

[Next] [Up] [Previous]