Streaming - 2023.2 English

Vitis HLS Messaging (UG1448)

Document ID
Release Date
2023.2 English


Warning: ERROR: [HLS 200-2009] Unsupported coding style in function proc1. Use 'size()==0' instead of 'empty()' for the writer of a stream, or 'cap() == size()' instead of 'full()' for the reader of the stream.


The hls::stream::empty() function is meant to be used with the read() function of a stream (i.e. only in the consumer function or process).

Similarly, the full() function is meant to be used only in conjunction with the write() function (i.e. only in the producer).

If you need to check if a stream is empty or near-empty in the producer (for example, for flow control reasons), or if you need to check if it is full or almost full in the consumer, consider using the hls::stream::size() and hls::stream::capacity(). These streams can both be used indifferently from the producer and consumer side and are meant to address the flow control scenarios for empty producers or full consumers.

hls::stream::size() returns how many elements the stream contains.

hls::stream::capacity() returns the total actual number of elements that the stream may contain, which depends on global configurations, automated tool decisions or explicit user sizing.

In summary:

if (strm.empty()) is similar to if (strm.size() == 0) and

if (strm.full()) is similar to if (strm.size() == strm.capacity())

Note: Using empty() or full() APIs with blocking APIs such as read()/write() effectively makes the read/write APIs non-blocking.