3.5.1.12.2 Dataflow Example: Diamond

Next, consider an example in which there are sub-functions without dependencies.

The sub-functions B and C can execute in parallel, starting when A is finished. Once both B and C are finished, D will begin. An implementation of the dataflow function is shown below.
void diamond(int in1[128], int in2[128], int out[128]) {
#pragma HLS function top
#pragma HLS function dataflow

#pragma HLS dataflow_channel variable(tmp1_0) type(double_buffer)
#pragma HLS dataflow_channel variable(tmp2_0) type(double_buffer)
#pragma HLS dataflow_channel variable(tmp1_1) type(double_buffer)
#pragma HLS dataflow_channel variable(tmp2_1) type(double_buffer)

    int tmp1_0[128], tmp2_0[128], tmp1_1[128], tmp2_1[128];
    subfunction_A(in1, in2, tmp1_0, tmp2_0);
    subfunction_B(tmp1_0, tmp1_1);
    subfunction_C(tmp2_0, tmp2_1);
    subfunction_D(tmp1_1, tmp2_1, out);
}