Data dependencies – Altera Nios II C2H Compiler User Manual
Page 71

Altera Corporation
9.1
3–31
November 2009
Nios II C2H Compiler User Guide
C-to-Hardware Mapping Reference
hardware. After the C2H Compiler creates the functional units, it
generates a hierarchy of state machines to control the operation and
interaction of these units.
The C2H Compiler generates a distinct state machine for each of the
following:
■
Accelerated function (top level)
■
Loop
■
Subfunction
The states comprise a sequence of stages that compute the results of the C
function. The C2H Compiler assigns each operation to a state of the state
machine. An arbitrary number of operations can execute during one state,
allowing multiple operations to execute in parallel. Generally, the time for
one state to execute equates to one clock cycle, although certain
conditions cause stalls in the state machine's progression through states.
Data Dependencies
Scheduling of assignments within an accelerator is based on the data
dependencies between the assignments. If assignment B depends on a
value calculated in assignment A, then B cannot execute until A has
completed. If two or more assignments are not dependent on each other,
they can be scheduled in parallel.
One way to illustrate data dependencies is through a dependency graph.
For each expression, arrows in a dependency graph represent where the
inputs come from, and where the output is used. These arrows illustrate
the flow of data through this function.
shows the dependency graph for
Example 3–26. Data Dependency
int foo(int a, int b, int c)
{
int x = a * b;
int y = b * c;
int z = x + y;
return z;
}