Non-Blocking Writes - 2022.2 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2022-12-07
Version
2022.2 English

Non-Blocking Writes

This method attempts to push variable src_var into the stream my_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 Writes with Full Check

Non-blocking behavior can also be modeled using non-blocking writes with full checking conditions, as explained in 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);