Description
By default, array variables implement as RAM.
- Top-level function array parameters implement as a RAM interface port.
- General arrays implement as RAMs for read-write access.
- Arrays involved in sub-functions, or loop-based DATAFLOW optimizations implement as a RAM ping-pong buffer channel.
If consumption or production of data in the array is sequential, it
is more efficient to use streaming data with FIFOs instead of RAMs. When specifying
an argument of the top-level function as INTERFACE mode=ap_fifo, the array implements as streaming. See the Interfaces
for Vivado IP Flow section of the
Vitis High-Level Synthesis User Guide (UG1399) or more information.
volatile
qualifier. See the Type Qualifiers section of the
Vitis High-Level Synthesis User Guide (UG1399).Syntax
syn.directive.stream=[OPTIONS] <location> <variable>
-
<location>is the location (in the formatfunction[/label]) which contains the array variable. -
<variable>is the array variable to be implemented as a FIFO.
Options
-
depth=<integer> -
Note: Relevant only for array streaming in dataflow channels.By default, the depth of the FIFO in the RTL is the same size as the array in the C code. This options allows you to modify the size of the FIFO.
When implementing the array in a DATAFLOW region, you can use the
-depthoption to reduce the size of the FIFO. For example, in aDATAFLOWregion where all loops and functions are processing data at a rate of II = 1, you don't need a large FIFO. Data production and consumption is in each clock cycle. You can use the-depthto reduce the FIFO size to 2 to substantially reduce the area of the RTL design.The
config_dataflowcommand with the-depthoption provides the same functionality for all arrays in a DATAFLOW region. The-depthoption withset_directive_streamoverrides the default inconfig_dataflow. - type=<arg>
- Specifies a mechanism to select between FIFO, PIPO,
synchronized shared (
shared), and un-synchronized shared (unsync). The supported types include:-
fifo: A FIFO buffer with the specifieddepth. -
pipo: A regular Ping-Pong buffer, with as many “banks” as the specified depth (default is 2). -
shared: A shared channel, synchronized like a regular Ping-Pong buffer, with depth, but without duplicating the array data. Set the depth small enough to ensure consistency by defining the synchronization distance between the producer and consumer.Tip: The default depth for shared is 1. -
unsync: Does not have any synchronization except for individual memory reads and writes. The design need to ensure consistency (read-write and write-write order).
-
Examples
Specifies array A[10] in function
func to be streaming and implemented as a
FIFO.
syn.directive.stream=func A type=fifo
Set array B to streaming with a FIFO depth of 12 in loop_1 of function func, and place the pragma inside loop_1.
syn.directive.stream=depth=12 type=fifo func/loop_1 B
Array C has streaming implemented as a PIPO.
syn.directive.stream=type=pipo func C