Inside the canonical region, the canonical body should follow these guidelines:
- Use a local, non-static scalar or array/pointer variable, or local static stream variable. A local variable is declared inside the function body (for dataflow in a function) or loop body (for dataflow inside a loop).
- A sequence of function calls that pass data forward (with no feedback), from a
function to one that is lexically later, under the following conditions:
- Variables (except scalar) can have only one reading process and one writing process.
- Use write before read (producer before consumer) if you are using local variables, which then become channels.
- Use read before write (consumer before producer) if you are using function arguments. Any intra-body anti-dependencies must be preserved by the design.
- Function return type must be void.
- No loop-carried dependencies among different processes via
- Inside the canonical loop (i.e., values written by one iteration and read by a following one).
- Among successive calls to the top function (i.e., inout argument written by one iteration and read by the following iteration).
- No control whatsoever is supported inside a dataflow region, except for
function calls (that define processes).
- No conditional, no loop, no return, no goto, no throw.
- The only control supported around dataflow is:
Simple for loop, with unsigned integer induction variable initialized to 0, incremented by 1, and compared either with a non-negative constant or with an unsigned input of the function containing the dataflow-in-loop without any other statement in the function containing dataflow in loop, except for variable declarations. Typically only streams used in the loop body can be declared at that level.