Apply RAM Mapping to Optimize Area - MATLAB & Simulink (original) (raw)

Main Content

RAM mapping is an area optimization that maps storage and delay elements in your Simulink® model or MATLAB® code to random access memory (RAM) rather than to individual registers on hardware. RAM mapping can reduce the amount of area that your design uses in the target hardware by reducing the number of registers that elements consume and store those elements in RAM blocks.

You can map these Simulink model elements to RAM:

To specify RAM mapping for persistent arrays in a MATLAB Function block or Delay blocks:

  1. Set the associated RAM mapping property for the elements that you want to map to RAM. For example, to map a Delay block to RAM, set the UseRAM HDL block property toon. To map persistent arrays, set theMATLAB Function block HDL block propertyMapPersistentVarsToRAM toon or use the pragmacoder.hdl.ramconfig in your MATLAB Function block after defining the persistent variables.
  2. Specify a minimum RAM mapping threshold by using the RAM mapping threshold configuration parameter. See Map pipeline delays to RAM and RAM mapping threshold.

RAM Mapping for a MATLAB Design

You can map these MATLAB code elements to RAM:

Specify RAM Mapping for a MATLAB Design

To specify RAM mapping for delays or persistent arrays in a MATLAB function, in the Optimizations section of theHDL Code Generation tab of the MATLAB HDL Workflow Advisor:

  1. Set the associated RAM mapping property for the elements that you want to map to RAM. For example, to map persistent arrays, select the Map persistent array variables to RAMs option. For more information, see Map Persistent Arrays and dsp.Delay Objects to RAM. To map pipelines delays to RAM, select the Map pipeline delays to RAM option.
  2. Specify a value for the RAM mapping threshold option. For more information, see RAMThreshold.

For an example, see Map Matrices to Block RAMs to Reduce Area.

You can also map persistent array variables to RAM by using the pragmacoder.hdl.ramconfig in your MATLAB code after you define and assign persistent variables in the code.coder.hdl.ramconfig allows you to select persistent variables to map to RAM and to map persistent variables to a specific RAM architecture, such as a simple tri port RAM. For more information, see coder.hdl.ramconfig.

Settings that Affect RAM Mapping

For an explanation of the settings that affect how HDL Coder™ maps design elements to RAM, see Manage How HDL Coder Maps RAM.

See Also

Model Settings

Topics