Map Persistent Arrays to RAM
To map the persistent variables to RAMs in the generated SystemC code use the RAM Mapping optimization. Without this optimization, the variables are mapped to registers. RAM mapping is an area optimization. It reduces the area of your design in the target hardware.
Enable RAM Mapping
In the HDL Workflow Advisor, select MATLAB to SystemC Workflow > SystemC Code Generation > Optimizations tab.
Select the Map persistent array variables to RAMs option.
Set the RAM mapping threshold to the size (in bits) of the smallest persistent array that you want to map to RAM.
RAM Mapping Requirements for Persistent Arrays
This table lists a summary of the RAM mapping behavior for persistent arrays.
|Map Persistent Array Variables to RAMs Setting||Mapping Behavior|
Map to RAM in the generated SystemC code.
Map to registers in the generated SystemC code.
The large persistent arrays whose size in bits is greater than or equal to RAM mapping threshold are mapped to RAM. The size in bits is calculated as
NumElementsis the number of elements in the array.
WordLengthis the number of bits that represent the data type of the array.
The list of RAM variables is populated inside the
ml.tclmetadata file generated during SystemC Code Generation. This metadata file is read by the Stratus HLS tool during project creation and maps these variables to RAM.
If Initialize Block RAM option is turned off, the RAM variables that have a zero initial value are not initialized inside
If the initial value of the variables is nonzero, then those RAM variables are initialized inside the
initialize_ram_vars()method, irrespective of the Initialize Block RAM option value.