Map Persistent Arrays and dsp.Delay Objects to RAM - MATLAB & Simulink (original) (raw)

Main Content

Map persistent arrays and dsp.Delay objects to RAM on hardware to reduce the area used on your target device. For more information on general RAM mapping, see Apply RAM Mapping to Optimize Area.

Enable RAM Mapping

  1. In the HDL Workflow Advisor, in the left pane, click > . Then click the Optimizations tab.
  2. Select Map persistent array variables to RAMs.
  3. Set the RAM mapping threshold to either:
    • An integer that specifies the RAM size of the smallest persistent array, user-defined System object™ private property, or dsp.Delay object that you want to map to RAM.
    • A string of format MxN that specifies two thresholds to define the shape of the data to map to RAM, where M is the delay length (for delays) or array size (for persistent array variables) andN is the word length or bit width of the data type. Setting both thresholds excludes delays or persistent arrays from being mapped to RAM that inefficiently map to block RAM on your target hardware.

Map persistent array variables to RAM option in the Workflow Advisor

RAM Mapping Requirements for Persistent Arrays and System object Properties

The following table shows a summary of the RAM mapping behavior for persistent arrays and private properties of a user-defined System object.

Map Persistent Array Variables to RAMs Setting Mapping Behavior
on Map to RAM. For restrictions, see RAM Mapping Restrictions.
off Map to registers in the generated HDL code.

RAM Mapping Restrictions

When you enable RAM mapping, a persistent array or user-defined System object private property maps to a block RAM when all of these conditions are true:

If any of the above conditions is false, the persistent array or user-defined System object private property maps to a register in the HDL code.

RAM Mapping Requirements for dsp.Delay System Objects

This table describes the dsp.Delay System object RAM mapping behavior:

Map Persistent Array Variables to RAMs Option Mapping Behavior
on A dsp.Delay System object maps to a block RAM when all of the following conditions are true:Length property is greater than 4.InitialConditions property is 0.The delay input data type is one of these types: Real scalar with a non-floating-point data typeComplex scalar with real and imaginary parts that are non-floating-pointVector where each element is either a non-floating-point real scalar or complex scalarThe RAM size is greater than or equal to theRAM Mapping Threshold value. The RAM size is the product ofDelayLength *WordLength*VectorLength *Complexity, whereDelayLength is the number of delays.WordLength is the number of bits that represent the input data type.VectorLength is the vector length of the input to the delay.Complexity is 2 for a complex data type or 1 for a real datatype.If any of the conditions are false, the dsp.Delay System object maps to registers in the HDL code.
off A dsp.Delay System object maps to registers in the generated HDL code.

RAM Mapping Comparison

hdl.RAM objects, dsp.Delay objects, persistent array variables, and user-defined System object private properties can map to RAM, but have different attributes. This table summarizes the differences.

Attribute hdl.RAM Objects dsp.Delay Objects Persistent Arrays andUser-Defined System object Properties
RAM mapping criteria Unconditionally maps to RAM Maps to RAM in HDL code under specific conditions. See RAM Mapping Requirements for dsp.Delay System Objects. Maps to RAM in HDL code under specific conditions. See RAM Mapping Requirements for Persistent Arrays and System object Properties.
Address generation and port mapping User specified Automatic Automatic
Access scheduling User specified Automatically inferred Automatically inferred
Overclocking None None Local multirate, if the access schedule requires it.
Latency with respect to simulation in MATLAB®. 0 0 2 cycles if local multirate; 1 cycle otherwise.
RAM type User specified Dual port Dual port

See Also

Topics