Package: coder

Code acceleration configuration object for use with fiaccel


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 lowercase coder.mexconfig function and then, pass it to the fiaccel function using the -config option.


cfg = coder.mexconfig creates a coder.MexConfig object, cfg, for fiaccel MEX function generation.



For compile-time recursion, control the number of copies of a function that are allowed in the generated code. 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

Default: integer, 50


Maximum number of constant folder instructions

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

Default: 10000


Dynamic memory allocation for variable-size data

By default, when this property is set to '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. Set this property to 'Off' to allocate memory statically on the stack. Set it to'AllVariableSizeArrays' to allocate memory for all variable-size arrays dynamically on the heap . You must use dynamic memory allocation for all unbounded variable-size data.

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

Default: Threshold


Memory allocation threshold

Specify the integer size of the threshold for variable-size arrays above which fiaccel allocates memory on the heap.

Default: 65536


Specify whether fiaccel treats common visualization functions as extrinsic functions. 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.

Default: true


Show results of code not terminated with semicolons

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.

Default: true


Allow recursive functions in the generated code. If your MATLAB code requires run-time recursion and this parameter is false, code generation fails.

Default: true


Compile generated code in debug mode

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.

Default: false


Variable-sized arrays support

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.

Default: true


Extrinsic function calls

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.

Default: true


Code generation report

Set this property to true to create an HTML code generation report. Set this property to false to not create the report.

Default: false


MEX function global data synchronization with MATLAB global workspace

Set this property to SyncAlways so 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.

If you set this property to 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.

If you set this property to 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.

Default: SyncAlways


Stack size for inlined functions

Specify, as a positive integer, the stack size limit on inlined functions.

Default: 4000


Maximum size of functions to be inlined

Specify, as a positive integer, the maximum size of functions to be inlined.

Default: 10


Maximum size of functions after inlining

Specify, as a positive integer, the maximum size of functions after inlining.

Default: 200


Memory integrity

Sset 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.

Default: true


Code generation report display

Set this property to true to open the HTML code generation report automatically when code generation completes. Set this property to false to disable displaying the report automatically. This property applies only if you set the GenerateReport property to true.

Default: true


Specify whether to report potential behavior differences between generated code and MATLAB code. If ReportPotentialDifferences is 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.

Default: true


Responsiveness checks

Set this property to true to turn on responsiveness checks. Set this property to false to disable responsiveness checks.

Default: true


Integer overflow action

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.

Default: true


Maximum stack usage per application

Specify, as a positive integer, the maximum stack usage per application in bytes. 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.

Default: 200000

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects (MATLAB).


Use the lowercase coder.mexconfig function to create a coder.MexConfig configuration object. Set this object 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 fiaccel to generate a MEX function for file foo.m
fiaccel -config cfg foo
Was this topic helpful?