hls::stream and hls::stream_buffer

This provides a hls::stream compatible implementation.

When used with C/C++, the code is synthesizable to FPGA.

Function Reference

Command to construct a stream_buffer

`stream_buffer::stream_buffer()`

Command to read specified number of bytes from the stream_buffer

`read(void *out, size_t size)`

If the size provided is lesser than the size of first chunk, then only the specified number of bytes are read and truncated from the chunk. If the size of larger than the available chunk then the chunk is popped off and is returned as it is. The returned size is guaranteed to be less or equal to the requested size.

Parameters

  • out: Target raw buffer.
  • size: size of the data to read.
  • return: the size of actual bytes read.

Command to return the size of all the data available in the stream pipeline

`length()`

Parameters

  • return: The total bytes of data that can be read. Note that these might be divided between multiple chunks and may requite multiple reads.

Command to pop off the first chunk of data from the stream and return it

`read(Buffer buf)`

Parameters

  • Buffer: A buffer element is returned. The element is automatically freed once it is no longer in use or the function/scope exits.