Difficulty utilizing Dataflow

Hi,

How to send back an output stream of a sub-function to itself as one of its input param in a dataflow region?

This is supposed to happen in a loop.

Dataflow is necessary as the hls::stream cannot be stagnant and thus consume BRAM (by providing depth).

The exact problem code: using merge sort (from vitis hls library).
It takes in two SORTED streams as input and outputs a merged & sorted stream.

Since one of the stream is sorted in chunks, the other stream has to be the result of the previous output stream.

PSEUDO-CODE (simplified):

void top_func(hls::stream<DataType> in, .....)
hls::stream<DataType> left, right, res;

#pragma HLS DATAFLOW
for (int i = 0; i < DataSetSize/ChunkSize; i++) {
    for(int j = 0; j < ChunkSize; j++) {
        left.write(in.read());
    }
    mergeSort(left, right, res);
    // pass res to right for the next iter
    while(!res.empty()) {
       right.write(res.read());
    }
}        

As you can see, I am missing something here. The data just can’t flow and at the same time not consume some kind of storage. So I’d have to fill in the missing logic here to accommodate a large DataSetSize without consuming PL memory (not sufficient at all).

Maybe m_axi writes and reads, I don’t know how it’ll fit here in order to complete the logic.

Thanks in advance, Would highly appreciate the assistance.

Hi @rav2n,

This is not a PYNQ question. You may be better off asking in the Xilinx forum.

Mario

Thanks. Just did that