Non-Blocking Write - 2023.1 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2023-07-17
Version
2023.1 English

The hls::stream.write_nb() method attempts to push data into the stream, returning a boolean true if successful. Otherwise, false is returned and the queue is unaffected.

// Usage of bool write_nb(const T & wdata)
hls::stream<int> my_stream;
int src_var = 42;

if (my_stream.write_nb(src_var)) {
 // Perform standard operations
 ...
} else {
 // Write did not occur
 return;
}

Non-blocking behavior can also be modeled using non-blocking writes with full checking conditions, as explained in hls::stream.full() Method. This can lead to non-deterministic behavior and should be verified in RTL simulation with a sophisticated test bench.

hls::stream<int> my_stream;
int src_var = 42;
bool stream_full;
 
stream_full = my_stream.full();
if(!stream_full)
   my_stream.write_nb(src_var);