Specify Type Proposal Options - MATLAB & Simulink (original) (raw)
To specify data type proposal options, create a coder.FixPtConfig object.
The following options are available.
Basic Type Proposal Settings
Values
Description
Fixed-point type proposal mode
Propose fraction lengths for specified word length
Use the specified word length for data type proposals and propose the minimum fraction lengths to avoid overflows.
Propose word lengths for specified fraction length (default)
Use the specified fraction length for data type proposals and propose the minimum word lengths to avoid overflows.
Default word length
16 (default)
Default word length to use when is set to Propose fraction lengths for specified word lengths
Default fraction length
4 (default)
Default fraction length to use when is set to Propose word lengths for specified fraction lengths
Advanced Type Proposal Settings
Values
Description
When proposing types NoteManually-entered static ranges always take precedence over simulation ranges.
ignore simulation ranges
Propose data types based on derived ranges.
ignore derived ranges
Propose data types based on simulation ranges.
use all collected data (default)
Propose data types based on both simulation and derived ranges.
Propose target container types
Yes
Propose data type with the smallest word length that can represent the range and is suitable for C code generation ( 8,16,32, 64 … ). For example, for a variable with range [0..7], propose a word length of 8 rather than 3.
No (default)
Propose data types with the minimum word length needed to represent the value.
Optimize whole numbers
No
Do not use integer scaling for variables that were whole numbers during simulation.
Yes (default)
Use integer scaling for variables that were whole numbers during simulation.
Signedness
Automatic (default)
Proposes signed and unsigned data types depending on the range information for each variable.
Signed
Propose signed data types.
Unsigned
Propose unsigned data types.
Safety margin for sim min/max (%)
0 (default)
Specify safety factor for simulation minimum and maximum values. The simulation minimum and maximum values are adjusted by the percentage designated by this parameter, allowing you to specify a range different from that obtained from the simulation run. For example, a value of 55 specifies that you want a range at least 55 percent larger. A value of -15 specifies that a range up to 15 percent smaller is acceptable.
Search paths
'' (default)
Add paths to the list of paths to search for MATLAB® files. Separate list items with a semicolon.
fimath Settings
Values
Description
Rounding method
Ceiling
Specify the fimath properties for the generated fixed-point data types. The default fixed-point math properties use theFloor rounding andWrap overflow because they are the default actions in C. These settings generate the most efficient code but might cause problems with overflow. After code generation, if required, modify these settings to optimize the generated code, or example, avoid overflow or eliminate bias, and then rerun the verification. For more information on fimath properties, seefimath Object Properties (Fixed-Point Designer).
Convergent
Floor (default)
Nearest
Round
Zero
Overflow action
Saturate
Wrap (default)
Product mode
FullPrecision (default)
KeepLSB
KeepMSB
SpecifyPrecision
Sum mode
FullPrecision (default)
KeepLSB
KeepMSB
SpecifyPrecision
Generated File Settings
Value
Description
Generated fixed-point file name suffix
_fixpt (default)
Specify the suffix to add to the generated fixed-point file names.For example, by default, if you generate a static library for a project namedtest, the generated files are in the subfolder codegen\lib\test_fixpt. The generated static library is named test.lib, but the generated C code files use the suffix, for example,test_fixpt.c.
Plotting and Reporting Settings
Values
Description
Custom plot function
'' (default)
Specify the name of a custom plot function to use for comparison plots.
Plot with Simulation Data Inspector
No (default)
Specify whether to use the Simulation Data Inspector for comparison plots.
Yes
Highlight potential data type issues
No (default)
Specify whether to highlight potential data types in the generated html report. If this option is turned on, the report highlights single-precision, double-precision, and expensive fixed-point operation usage in your MATLAB code.