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.
Syntax
set_directive_shared <location> <variable>
-
<location>
is the location (in the formatfunction[/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