syn.directive.stream - 2024.1 English

Vitis Unified Software Platform Documentation: Application Acceleration Development (UG1393)

Document ID
UG1393
Release Date
2024-07-03
Version
2024.1 English

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.
  • Arrays involved in sub-functions, or loop-based DATAFLOW optimizations are implemented as a RAM ping-pong 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, where FIFOs are used instead of RAMs. When an argument of the top-level function is specified as INTERFACE mode=ap_fifo, the array is automatically implemented as streaming. See the Interfaces for Vivado IP Flow section of the Vitis High-Level Synthesis User Guide (UG1399) for more information.

Important: To preserve the accesses, it might be necessary to prevent compiler optimizations (in particular dead code elimination) by using the volatile qualifier as described in 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 format function[/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 implemented in the RTL is the same size as the array specified in the C code. This options allows you to modify the size of the FIFO.

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 where 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, you can use the -depth to reduce the FIFO size to 2 to substantially reduce the area of the RTL design.

This same functionality is provided for all arrays in a DATAFLOW region using the config_dataflow command with the -depth option. The -depth option used with set_directive_stream overrides the default specified using config_dataflow.

type=<arg>
Specify 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 specified depth.
  • 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. Consistency can be ensured by setting the depth small enough, which acts as the distance of synchronization 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. Consistency (read-write and write-write order) must be ensured by the design itself.

Examples

Specifies array A[10] in function func to be streaming and implemented as a FIFO.

syn.directive.stream=func A type=fifo

Array B in named loop loop_1 of function func is set to streaming with a FIFO depth of 12. In this case, 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