Asynchronous Circular Buffer - 2024.1 English

AI Engine-ML Kernel and Graph Programming Guide (UG1603)

Document ID
UG1603
Release Date
2024-06-06
Version
2024.1 English

Declare kernel function k3 with asynchronous circular input one dimension buffer that operates on data type int32 with buffer size specified in graph and margin size MARGIN_SIZE that is named in0 and output stream that operates on data type int32 that is named out0.

void k3(input_async_circular_buffer<int32, adf::extents<adf::inherited_extent>, adf::margin<MARGIN_SIZE>> &in0, output_stream<int32> *out0)
{
    in0.acquire();
    auto in0Iter = aie::begin_circular(in0);
    for (int ind = 0; ind < INPUT_SAMPLE_SIZE + MARGIN_SIZE; ++ind)
    {
        writeincr(out0, *in0Iter++);
    }

    in0.release();
}