Asynchronous Circular Buffer - 2023.2 English

AI Engine Kernel and Graph Programming Guide (UG1079)

Document ID
UG1079
Release Date
2023-12-04
Version
2023.2 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();
}