Description
Vitis HLS assigns arrays in the code
using specific memory resources (or types). The tool automatically determines the
resource to use. Alternatively, you can define syn.storage
to generally specify the memory type, as explained in
Storage Configuration.
The syn.directive.bind_storage
command
assigns a specific variable in the code (an array, or function argument) to a
specific memory type (type
) in the RTL. For
example, you can use the syn.directive.bind_storage
command to specify which type of memory,
and which implementation to use for an array variable. Also, this allows you to
control whether the array is implemented as a single or a dual-port RAM.
storage_type
and storage_impl
options of syn.directive.interface
.You can also use the latency
option of
syn.directive.bind_storage
to specify the
latency of the implementation. For block RAMs on the interface, the latency
option allows you to model off-chip,
non-standard SRAMs at the interface, for example supporting an SRAM with a latency
of 2 or 3. For internal operations, the latency
option allows the operation to be implemented using more pipelined stages. These
additional pipeline stages can help resolve timing issues during RTL synthesis.
latency
option, the memory must have an
available multi-stage implementation. The HLS tool provides a multi-stage
implementation for all block RAMs.Syntax
syn.directive.bind_storage=[OPTIONS] <location> <variable>
-
<location>
is the location (in the formatfunction[/label]
) which contains the variable. -
<variable>
is the variable to be assigned.Tip: If the variable is an argument of a top-level function, then use thestorage_type
andstorage_impl
options ofsyn.directive.interface
.
Options
-
type=<value>
- Defines the type of memory to bind to the specified variable.
-
impl=<value>
- Defines the implementation for the specified memory type.
Supported implementations include:
bram
,bram_ecc
,lutram
,uram
,uram_ecc
,srl
,memory
, andauto
as described below. -
latency=<int>
- Defines the default latency for the binding of the storage
type to the implementation. The valid latency varies according to the
specified
type
andimpl
. The default is -1, which lets Vitis HLS choose the latency.
Type | Implementation | Min Latency | Max Latency |
---|---|---|---|
FIFO | BRAM | 1 | 4 |
FIFO | LUTRAM | 1 | 4 |
FIFO | MEMORY | 1 | 4 |
FIFO | SRL | 1 | 4 |
FIFO | URAM | 1 | 4 |
RAM_1P | AUTO | 1 | 3 |
RAM_1P | BRAM | 1 | 3 |
RAM_1P | LUTRAM | 1 | 3 |
RAM_1P | URAM | 1 | 3 |
RAM_1WNR | AUTO | 1 | 3 |
RAM_1WNR | BRAM | 1 | 3 |
RAM_1WNR | LUTRAM | 1 | 3 |
RAM_1WNR | URAM | 1 | 3 |
RAM_2P | AUTO | 1 | 3 |
RAM_2P | BRAM | 1 | 3 |
RAM_2P | LUTRAM | 1 | 3 |
RAM_2P | URAM | 1 | 3 |
RAM_S2P | BRAM | 1 | 3 |
RAM_S2P | BRAM_ECC | 1 | 3 |
RAM_S2P | LUTRAM | 1 | 3 |
RAM_S2P | URAM | 1 | 3 |
RAM_S2P | URAM_ECC | 1 | 3 |
RAM_T2P | BRAM | 1 | 3 |
RAM_T2P | URAM | 1 | 3 |
ROM_1P | AUTO | 1 | 3 |
ROM_1P | BRAM | 1 | 3 |
ROM_1P | LUTRAM | 1 | 3 |
ROM_2P | AUTO | 1 | 3 |
ROM_2P | BRAM | 1 | 3 |
ROM_2P | LUTRAM | 1 | 3 |
ROM_NP | BRAM | 1 | 3 |
ROM_NP | LUTRAM | 1 | 3 |
syn.directive.bind_storage
.Examples
In the following example, the coeffs[128]
variable is an argument of the function func1
. The
directive specifies that coeffs
uses a single port
RAM implemented on a BRAM core from the library.
syn.directive.bind_storage=func1 coeffs type=RAM_1P impl=bram
coeffs
are defined in
the RAM_1P core.