coder.hdl.ramconfig - Specify RAM mapping configuration for persistent array variables - MATLAB (original) (raw)

Specify RAM mapping configuration for persistent array variables

Since R2023b

Syntax

Description

coder.hdl.ramconfig([p](#mw%5Fe277d1ec-5b01-41d2-af1b-b0f039c9a186)) sets the default RAM mapping configuration for the persistent array p to a simple dual-port RAM. HDL Coder™ maps the persistent array to the specified RAM during HDL code generation.p is not required to meet the RAM mapping threshold to be mapped to RAM.

coder.hdl.ramconfig([p](#mw%5Fe277d1ec-5b01-41d2-af1b-b0f039c9a186),[Name=Value](#namevaluepairarguments)) sets the RAM mapping configuration for the persistent variable p to a single, simple dual, dual, or simple tri-port RAM with properties set using one or more name-value pairs.

example

coder.hdl.ramconfig([{p1,...,pN}](#mw%5Fbad42c40-7429-4629-8402-7fefc2d0484e),[Name=Value](#namevaluepairarguments)) sets the RAM mapping configuration for the persistent variables p1 through pN to a single, simple dual, dual, or simple tri-port RAM with properties set using one or more name-value pairs.

example

coder.hdl.ramconfig([Name=Value](#namevaluepairarguments)) sets the RAM mapping configuration for all persistent variables that meet the RAM mapping threshold to a single, simple dual, dual, or simple tri-port RAM with properties set using one or more name-value pairs.

example

coder.hdl.ramconfig([p](#mw%5Fe277d1ec-5b01-41d2-af1b-b0f039c9a186),`'none'`) disables RAM mapping for the persistent variable p, even ifp meets the RAM mapping threshold.

example

Examples

collapse all

Set the default RAM mapping configuration for persistent variables above the RAM mapping threshold as a simple tri-port RAM and enable asynchronous read.

... persistent A B; if isempty(A) A = int16(zeros(1,32)); B = int16(zeros(1,32)); end coder.hdl.ramconfig(RAMType="Simple Tri Port", AsyncRead=true);

HDL Coder maps the persistent variables that are above the RAM mapping threshold to the specified RAM configuration during HDL code generation, even if the MATLAB Function block HDL block property MapPersistentVarsToRAM is set to off. For more information on RAM mapping threshold, see RAM mapping threshold.

Set the RAM mapping configuration as a dual port RAM for persistent variableA.

... persistent A B; if isempty(A) A = int16(zeros(1,32)); B = int16(zeros(1,32)); end coder.hdl.ramconfig(A,RAMType="Dual Port")

HDL Coder maps A to RAM during HDL code generation, even if it does not meet the RAM mapping threshold or the MATLAB Function block HDL block property MapPersistentVarsToRAM is set tooff.

Set the RAM mapping configuration as a dual port RAM for the persistent variablesA and B.

... persistent A B C; if isempty(A) A = int16(zeros(1,32)); B = int16(zeros(1,32)); C = int16(zeros(1,32)); end coder.hdl.ramconfig({A,B},RAMType="Dual Port")

HDL Coder maps A and B to RAM during HDL code generation, even if they do not meet the RAM mapping threshold or the MATLAB Function block HDL block property MapPersistentVarsToRAM is set to off.

Disable RAM mapping for the persistent variable A.

... persistent A B; if isempty(A) A = int16(zeros(1,32)); B = int16(zeros(1,32)); end coder.hdl.ramconfig(A,'none')

HDL Coder does not map A to RAM, even if it meets the RAM mapping threshold and the MATLAB Function block HDL block propertyMapPersistentVarsToRAM is set to on.

Input Arguments

collapse all

Persistent array variable to map to the specified RAM configuration, specified as a persistent array. You must define the persistent variable in the code before using thecoder.hdl.ramconfig pragma.

Persistent array variables to map to the specified RAM configuration, specified as a persistent array. You must define the persistent variables in the code before using thecoder.hdl.ramconfig pragma.

Name-Value Arguments

collapse all

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: coder.hdl.ramconfig(RAMType="Simple Tri Port")

Type of RAM to map persistent variables to, specified as one of these values:

Option to use the asynchronous read feature in your target hardware, specified as a numeric or logical 1 (true) or 0 (false). Boards that support asynchronous read allow the hardware to execute a read instruction immediately instead of waiting one cycle.

Behavior for the write output, specified as either:

This property is not available when you specify RAMType asSimple dual port or Simple tri port or if you set AsyncRead to true.

Version History

Introduced in R2023b