Main Content

coder.mexconfig

Code acceleration configuration object for use with fiaccel

Description

A coder.MexConfig object contains all the configuration parameters that the fiaccel function uses when accelerating fixed-point code via a generated MEX function. To use this object, first create it using the coder.mexconfig function, then pass it to the fiaccel function using the -config option.

Creation

Description

example

cfg = coder.mexconfig creates a coder.MexConfig code generation object for use with fiaccel, which generates a MEX function.

Properties

expand all

Number of copies of a function allowed in generated code for compile-time recursion, specified as an integer. To disallow recursion in the MATLAB® code, set CompileTimeRecursionLimit to 0. The default compile-time recursion limit is high enough for most recursive functions that require compile-time recursion. If code generation fails because of the compile-time recursion limit, and you want compile-time recursion, try to increase the limit. Alternatively, change your MATLAB code so that the code generator uses run-time recursion.

Maximum number of instructions to be executed by the constant folder, specified as a positive integer.

Dynamic memory allocation for variable-size data, specified as one of these values:

  • 'Threshold' — Dynamic memory allocation is enabled for all variable-size arrays whose size is greater than DynamicMemoryAllocationThreshold and fiaccel allocates memory for this variable-size data dynamically on the heap.

  • 'AllVariableSizeArrays' — Allocate memory for all variable-size arrays dynamically on the heap. You must use dynamic memory allocation for all unbounded variable-size data.

  • 'Off' — Allocate memory statically on the stack.

You must use dynamic memory allocation for all unbounded variable-size data.

The DynamicMemoryAllocation property is enabled only when the EnableVariableSizing property is set to true. When you set DynamicMemoryAllocation to Threshold, it enables the DynamicMemoryAllocationThreshold property.

Size of the threshold for variable-size arrays above which fiaccel allocates memory on the heap, specified as an integer.

Whether fiaccel treats common visualization functions as extrinsic functions, specified as true or false. When this option is enabled, fiaccel detects calls to many common visualization functions, such as plot, disp, and figure. It calls out to MATLAB for these functions. This capability reduces the amount of time that you spend making your code suitable for code generation. It also removes the requirement to declare these functions extrinsic using the coder.extrinsic function.

Whether to show results of code not terminated with semicolons, specified as true or false.

Set this property to true to have the results of code instructions that do not terminate with a semicolon appear in the MATLAB Command Window. If you set this property to false, code results do not appear in the MATLAB Command Window.

Whether to allow recursive functions in the generated code, specified as true or false. If your MATLAB code requires run-time recursion and this parameter is false, code generation fails.

Whether to compile generated code in debug mode, specified as true or false.

Set this property to true to compile the generated code in debug mode. Set this property to false to compile the code in normal mode.

Whether to enable implicit expansion capabilities in generated code, specified as true or false.

Set this property to true to enable implicit expansion in the generated code. The code generator includes modifications in the generated code to apply implicit expansion. See Compatible Array Sizes for Basic Operations. Set this property to false so the generated code does not follow the rules of implicit expansion.

Whether to enable support for variable-sized arrays, specified as true or false.

Set this property to true to enable support for variable-sized arrays and to enable the DynamicMemoryAllocation property. If you set this property to false, variable-sized arrays are not supported.

An extrinsic function is a function on the MATLAB path that the generated code dispatches to MATLAB software for execution. fiaccel does not compile or generate code for extrinsic functions. Set this property to true to have fiaccel generate code for the call to a MATLAB function, but not generate the function's internal code. Set this property to false to have fiaccel ignore the extrinsic function and not generate code for the call to the MATLAB function. If the extrinsic function affects the output of fiaccel, a compiler error occurs.

ExtrinsicCalls affects how MEX functions built by fiaccel generate random numbers when using the MATLAB rand, randi, and randn functions. If extrinsic calls are enabled, the generated mex function uses the MATLAB global random number stream to generate random numbers. If extrinsic calls are not enabled, the MEX function built with fiaccel uses a self-contained random number generator.

If you disable extrinsic calls, the generated MEX function cannot display run-time messages from error or assert statements in your MATLAB code. The MEX function reports that it cannot display the error message. To see the error message, enable extrinsic function calls and generate the MEX function again.

Whether to create an HTML code generation report, specified as true or false.

MEX function global data synchronization with MATLAB global workspace, specified as one of these values:

  • SyncAlways — Synchronize global data at MEX function entry and exit and for all extrinsic calls to ensure maximum consistency between MATLAB and the generated MEX function. If the extrinsic calls do not affect global data, use this option in conjunction with the coder.extrinsic -sync:off option to turn off synchronization for these calls to maximize performance.

  • SyncAtEntryAndExits — Global data is synchronized only at MEX function entry and exit. If your code contains extrinsic calls, but only a few affect global data, use this option in conjunction with the coder.extrinsic -sync:on option to turn on synchronization for these calls to maximize performance.

  • NoSync — No synchronization occurs. Ensure that your MEX function does not interact with MATLAB globals before disabling synchronization otherwise inconsistencies between MATLAB and the MEX function might occur.

Data Types: char

Stack size limit for inlined functions, specified as a positive integer.

Maximum size of functions to be inlined, specified as a positive integer.

Maximum size of functions after inlining, specified as a positive integer.

Set this property to true to detect any violations of memory integrity in code generated for MATLAB. When a violation is detected, execution stops and a diagnostic message displays. Set this property to false to disable both memory integrity checks and the runtime stack.

Whether to open the HTML code generation report automatically when code generation completes, specified as true or false. This property applies only if you set the GenerateReport property to true.

Whether to report potential behavior differences between generated code and MATLAB code, specified as true or false. If the ReportPotentialDifferences property is set to true, the code generation report has a tab that lists the potential differences. A potential difference is a difference that occurs at run time only under certain conditions.

Whether to enable responsiveness checks, specified as true or false.

Whether to saturate on integer overflow, specified as true or false. Overflows saturate to either the minimum or maximum value that the data type can represent. Set this property to true to have overflows saturate. Set this property to false to have overflows wrap to the appropriate value representable by the data type.

Maximum stack usage per application in bytes, specified as a positive integer. Set a limit that is lower than the available stack size. Otherwise, a runtime stack overflow might occur. Overflows are detected and reported by the C compiler, not by fiaccel.

Examples

collapse all

This example shows how to use the coder.mexconfig function to create a coder.MexConfig configuration object. The object is set to disable run-time checks.

cfg = coder.mexconfig;

Turn off integrity checks, extrinsic calls, and responsiveness checks.

cfg.IntegrityChecks = false;
cfg.ExtrinsicCalls = false;
cfg.ResponsivenessChecks = false;

Use the fiaccel function to generate a MEX function for the file foo.m.

fiaccel -config cfg foo

Version History

Introduced in R2011a