pragma HLS stream
Description
By default, array variables are implemented as RAM:
- Top-level function array parameters are implemented as a RAM interface port.
- General arrays are implemented as RAMs for read-write access.
- In sub-functions involved inDATAFLOWoptimizations, the array arguments are implemented using a RAM pingpong buffer channel.
- Arrays involved in loop-based DATAFLOW optimizations are implemented as a RAM pingpong buffer channel
If the data stored in the array is consumed or produced in a sequential manner, a more efficient communication mechanism is to use streaming data as specified by theSTREAM
pragma, where FIFOs are used instead of RAMs.
ap_fifo
, the array is automatically implemented as streaming.
Syntax
Place the pragma in the C source within the boundaries of the required location.
#pragma HLS stream variable= depth= dim= off
Where:
variable=
: Specifies the name of the array to implement as a streaming interface.depth=
: Relevant only for array streaming in DATAFLOW channels. By default, the depth of the FIFO implemented in the RTL is the same size as the array specified in the C code. This options lets you modify the size of the FIFO and specify a different depth.When the array is implemented in a DATAFLOW region, it is common to the use the
depth=
option to reduce the size of the FIFO. For example, in a DATAFLOW region when all loops and functions are processing data at a rate of II=1, there is no need for a large FIFO because data is produced and consumed in each clock cycle. In this case, thedepth=
option may be used to reduce the FIFO size to 1 to substantially reduce the area of the RTL design.Tip:Theconfig_dataflow -depth
command provides the ability to stream all arrays in a DATAFLOWregion. Thedepth=
option specified here overrides theconfig_dataflow
command for the assigned variable.dim=
: Specifies the dimension of the array to be streamed. The default is dimension 1. Specified as an integer from 0 toN, for an array withNdimensions.off
: Disables streaming data. Relevant only for array streaming in dataflow channels.Tip:Theconfig_dataflow -default_channel fifo
command globally implies aSTREAM
pragma on all arrays in the design. Theoff
option specified here overrides theconfig_dataflow
command for the assigned variable, and restores the default of using a RAM pingpong buffer based channel.
Example 1
A[10]
to be streaming, and implemented as a FIFO:
#pragma HLS STREAM variable=A
Example 2
B
is set to streaming with a FIFO depth of 12:
#pragma HLS STREAM variable=B depth=12
Example 3
config_dataflow
in this example:
#pragma HLS STREAM variable=C off
See Also
- Vivado Design Suite User Guide: High-Level Synthesis(UG902)