set_directive_shared - 2020.2 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2021-03-22
Version
2020.2 English

Description

The SHARED pragma specifies that an array local variable or argument in a given scope is viewed as a single shared memory, distributing the available ports to the processes that access it.

If the array is a local variable in a dataflow region, the resulting memory implementation depends whether it is also stable or not. If a variable is also marked STABLE it 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.

However, if a variable is not STABLE it is synchronized like a regular Ping-Pong buffer, with depth but without a duplication of 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.

Important: There is no checking for the SHARED pragma or directive, so you must ensure the functional correctness of the sharing, including during co-simulation.

Syntax

set_directive_shared <location> <variable>
  • <location> is the location (in the format function[/label]) where the variable to share is found.
  • <variable> is the name of the variable that does not change during execution of the function.

Options

This command has no options.

Examples

In this example, variable a is shared among processes under the p1 dataflow region:

set_directive_shared p1 a