You can now apply data type override to models and subsystems that use virtual and non-virtual buses. The bus element types obey the data type override settings. This capability allows you to:
Obtain the idealized floating-point behavior of models that use buses.
Obtain the ideal derived ranges for models that use buses.
Easily compare the idealized floating-point behavior with the fixed-point behavior of models that use buses.
Use data type override to share fixed-point models that use buses with users who do not have a fixed-point license.
You can autoscale models that use virtual and non-virtual buses. This capability facilitates fixed-point conversion and optimization of models. The Fixed-Point Tool automatically proposes fixed-point data types for bus elements which removes the need to perform manual analysis and conversion of bus element data types.
For more information, see Refine Data Types of a Model with Buses Using Simulation Data.
Using the Fixed-Point Tool, you can now derive ranges for complex signals in Simulink®. For more information, see Conversion Using Range Analysis.
The MATLAB® Coder™ Fixed-Point Conversion tool now provides the capability to detect overflows. At the numerical testing stage in the conversion process, the tool simulates the fixed-point code using scaled doubles. It then reports which expressions in the generated code produce values that would overflow the fixed-point data type. For more information, see Detect Overflows Using the Fixed-Point Conversion Tool and Detecting Overflows.
These capabilities require a MATLAB Coder license.
Fixed-point ARM® Cortex®-M code replacement library support is now available for the Discrete FIR block and the dsp.FIRFilter System object.
These capabilities require a DSP System Toolbox™ license.
The Fixed-Point Advisor now supports referenced configuration sets. For more information, see Preparing for Data Typing and Scaling.
R2014a includes the following enhancements to the fixed-point conversion capability in MATLAB Coder projects.
These capabilities require a MATLAB Coder license.
You can now use the MATLAB Coder Fixed-Point Conversion tool to convert floating-point MATLAB code that uses MATLAB classes. For more information, see Fixed-Point Code for MATLAB Classes.
The generated fixed-point code now:
Uses subscripted assignment (the colon(:) operator). This enhancement produces concise code that is more readable.
Has better code for constant expressions. In previous releases, multiple parts of an expression were quantized to fixed point. The final value of the expression was less accurate and the code was less readable. Now, constant expressions are quantized only once at the end of the evaluation. This new behavior results in more accurate results and more readable code.
For more informations, see Generated Fixed-Point Code.
In R2014a, when you convert floating-point MATLAB code to fixed-point C/C++ code, the code generation software generates a fixed-point report in HTML format. For the variables in your MATLAB code, the report provides the proposed fixed-point types and the simulation or derived ranges used to propose those types. For a function, my_fcn, and code generation output folder, out_folder, the location of the report is out_folder/my_fcn/fixpt/my_fcn_fixpt_Report.html. If you do not specify out_folder in the project settings or as an option of the codegen command, the default output folder is codegen.
In earlier releases, to set up a compiler before using fiaccel to accelerate MATLAB algorithms, you were required to run mex -setup. Now, the code generation software automatically locates and uses a supported installed compiler. You can use mex -setup to change the default compiler. See Changing Default Compiler.
For all dsp.LMSFilter System object fixed-point settings, you can now specify independent fixed-point data types.
This capability requires a DSP System Toolbox license.
If your target hardware and your compiler support the C99 long long integer data type, you can use this data type for code generation. Using long long results in more efficient generated code that contains fewer cumbersome operations. Multi-line fixed-point helper functions can be replaced by simple expressions. This data type also provides more accurate simulation results for fixed-point and integer simulations. If you are using Microsoft® Windows® (64-bit), using long long improves performance for many workflows including:
Using Accelerator mode in Simulink
Working with Stateflow® software
Generating C code with Simulink Coder
Accelerating fixed-point code using fiaccel
Generating C code and MEX functions with MATLAB Coder
For more information about enabling long long in Simulink, see the Enable long long and Number of bits: long long configuration parameters on the Hardware Implementation Pane.
For more information about enabling long long for MATLAB Coder, see coder.HardwareImplementation.
The Model Advisor fixed-point checks now cover additional blocks in base Simulink and System Toolboxes. The checks also now include the MATLAB Function block, System objects, Stateflow, and fi objects. These improved checks consider model settings such as hardware configuration and code generation settings. These updated checks also avoid false negative results.
These checks require an Embedded Coder® license.
The bitsra, bitsrl, bitsll, bitrol, and bitror functions now accept fi objects as the shift-value input argument. You can use fi and built-in data type shift values interchangeably in MATLAB functions. This new capability facilitates fixed-point conversion.
Effective R2013b, the numel function returns the number of elements in a fi array. Using numel in your MATLAB code returns the same result for built-in types and fi objects. Use numel to write data-type independent MATLAB code for array handling; you no longer need to use the numberofelements function.
The numel function is supported for simulation and code generation and with the MATLAB Function block in Simulink.
For more information, see numel.
Blocks in the Lookup Tables library have a new internal rule for fixed-point data types to enable faster hardware instructions for intermediate calculations (with the exception of the Direct Lookup Table (n-D), Prelookup and Lookup Table Dynamic blocks). To use this new rule, select Speed for the Internal Rule Priority parameter in the dialog box. To use the R2013a internal rule, select Precision.
Using the Fixed-Point Conversion tool in MATLAB Coder projects, you can now derive ranges for complex variables. For more information, see Propose Data Types Based on Derived Ranges. This capability requires a MATLAB Coder license.
Fixed-Point Designer™ now uses strict single-precision algorithms for operations between singles and integer or fixed-point data types. Operations, such as cast, multiplication and division, use single-precision math instead of introducing higher-precision doubles for intermediate calculations in simulation and code generation. You no longer have to explicitly cast integer or fixed-point inputs of these operations to single precision. To detect the presence of double data types in your model, use the Model Advisor Identify questionable operations for strict single-precision design check.
In R2013b, for both simulation and code generation, Fixed-Point Designer avoids the use of double data types to achieve strict single design for operations between singles and integers or fixed-point types. In previous releases, Fixed-Point Designer used double data types in intermediate calculations for higher precision. You might see a difference in numerical behavior of an operation between earlier releases and R2013b.
For example, when you cast from a fixed-point or integer data type to single or vice versa, the type used for intermediate calculations can significantly affect numerical results. Consider:
Input type: ufix128_En127
Input value: 1.999999999254942 — Stored integer value is (2^128 -2^100).
Output type: single
|Release||Calculation performed by Fixed-Point Designer||Output Result||Design Goal|
|R2013b||Y = single(2^-127) * single(2^128-2^100)|
= single(2^-127) * Inf
|Previous releases||Y = single( double(2^-127) * double(2^128 - 2^100)) |
= single(2^-127 * 3.402823656532e+38)
|2||Higher-precision intermediate calculation|
There is also a difference in the generated code. Previously, Fixed-Point Designer allowed the use of doubles in the generated code for a mixed multiplication that used single and integer types.
m_Y.Out1 = (real32_T)((real_T)m_U.In1*(real_T)m_U.In2);
In R2013b, it uses strict singles.
You can revert to the numerical behavior of previous releases, if necessary. To do so, insert explicit casting from integer and fixed-point data types to doubles for the inputs of these operations.
You can now perform derived range analysis of your model on Mac platforms. For more information, see Conversion Using Range Analysis.
When generating a printable instrumentation report, you can now choose to display only the tables that show information about logged variables. Used with the -printable option, the -nocode option suppresses display of the MATLAB code. Displaying only the logged variable information is useful for large projects with many lines of code.
The showInstrumentationResults function -browser option has been removed. Use the -printable option instead. The -printable option creates a printable report and opens it in the system browser.
For more information, see showInstrumentationResults.
The Continuous Simulink blocks State-Space, Transfer Fcn, and Zero-Pole are not supported and not stubbable for range analysis. For more information on blocks that are supported for range analysis, see Supported and Unsupported Simulink Blocks.
If you have a model that contains one or more continuous State-Space, Transfer Fcn, or Zero-Pole blocks, your model is incompatible with range analysis. Consider analyzing smaller portions of your model to work around this incompatibility.
If you are using Microsoft Windows (64-bit), LCC-64 is now available as the default compiler. You no longer have to install a separate compiler to perform fixed-point acceleration using fiaccel.
All fi and fimath property names are case sensitive and require that you use the full property names. Effective R2013b, if you use inexact property names, Fixed-Point Designer generates a warning.
To avoid seeing warnings for fi and fimath properties, update your code so that it uses the full names and correct cases of all these properties. The full names and correct cases of the properties appear when you display a fi or fimath object on the MATLAB command line.
You can now convert a numeric variable into a Simulink.Parameter object using a single step.
myVar = 5; % Define numerical variable in base workspace myObject = Simulink.Parameter(myVar); % Create data object and assign variable value to data object value
Previously, you did this conversion using two steps.
myVar = 5; % Define numerical variable in base workspace myObject = Simulink.Parameter; % Create data object myObject.Value = myVar; % Assign variable value to data object value
The MATLAB Coder Fixed-Point Conversion tool now provides test file coverage results. After simulating your design using a test file, the tool provides an indication of how often the code is executed. If you run multiple test files at once, the tool provides the cumulative coverage. This information helps you determine the completeness of your test files and verify that they are exercising the full operating range of your algorithm. The completeness of the test file directly affects the quality of the proposed fixed-point types.
This capability requires a MATLAB Coder license.
For more information, see Code Coverage.
Using the Fixed-Point Conversion tool in MATLAB Coder projects, you can now propose data types for enumerated data types using derived and simulation ranges.
For more information, see Propose Fixed-Point Data Types Based on Derived Ranges and Propose Fixed-Point Data Types Based on Simulation Ranges. This capability requires a MATLAB Coder license.
Using the Fixed-Point Conversion tool in MATLAB Coder projects, you can propose data types for variable-size data using simulation ranges.
For more information, see Propose Fixed-Point Data Types Based on Simulation Ranges. This capability requires a MATLAB Coder license.
The bitconcat function now generates an error in the unary syntax case, bitconcat(a), if the input argument a is a scalar or is empty. To use bitconcat with one input argument, the argument must have more than one array element available for bit concatenation (that is, length(a)>1).
In previous releases, the following functions returned a MATLAB structure describing a fixed-point data type:
Effective R2013b, they return a Simulink.NumericType object. If you have existing models that use these functions as parameters to dialog boxes, the models continue to run as before and there is no need to change any model settings.
These functions do not offer full Data Type Assistant support. To benefit from this support, use fixdt instead.
|Function||Return Value in Previous Releases — MATLAB structure||Return Value Effective R2013b — NumericType|
Class: 'FIX' IsSigned: 1 MantBits: 16
DataTypeMode: 'Fixed-point: unspecified scaling' Signedness: 'Signed' WordLength: 16
Class: 'FIX' IsSigned: 0 MantBits: 7
DataTypeMode: 'Fixed-point: unspecified scaling' Signedness: 'Unsigned' WordLength: 7
Class: 'FRAC' IsSigned: 1 MantBits: 33 GuardBits: 5
DataTypeMode: 'Fixed-point: binary point scaling' Signedness: 'Signed' WordLength: 33 FractionLength: 27
Class: 'FRAC' IsSigned: 0 MantBits: 44 GuardBits: 0
DataTypeMode: 'Fixed-point: binary point scaling' Signedness: 'Unsigned' WordLength: 44 FractionLength: 44
Class: 'INT' IsSigned: 1 MantBits: 55
DataTypeMode: 'Fixed-point: binary point scaling' Signedness: 'Signed' WordLength: 55 FractionLength: 0
Class: 'INT' IsSigned: 0 MantBits: 77
DataTypeMode: 'Fixed-point: binary point scaling' Signedness: 'Unsigned' WordLength: 77 FractionLength: 0
MATLAB code that depends on the return arguments of these functions being a structure with fields named Class, MantBits or GuardBits no longer works correctly. Change the code to access the appropriate properties of a NumericType object, for example, DataTypeMode, Signedness, WordLength, FractionLength, Slope and Bias.
Update C code that expects the data type of parameters to be a legacy structure to handle NumericType objects instead. For example, if you have S-functions that take legacy structures as parameters, update these S-functions to accept NumericType objects.
Effective R2013b, if you open a Simulink model that uses a MAT-file that contains a data type specification created using the legacy functions, the model uses the same data types and behaves in the same way as in previous releases but Simulink generates a warning. To eliminate the warning, recreate the data type specifications using NumericType objects and save the MAT-file.
You can use the fixdtupdate function to update a data type specified using the legacy structure to use a NumericType. For example, if you saved a data type specification in a MAT-file as follows in a previous release:
oldDataType = sfrac(16); save myDataTypeSpecification oldDataType
use fixdtUpdate to recreate the data type specification to use NumericType:
load DataTypeSpecification fixdtUpdate(oldDataType)
ans = NumericType with properties: DataTypeMode: 'Fixed-point: binary point scaling' Signedness: 'Signed' WordLength: 16 FractionLength: 15 IsAlias: 0 DataScope: 'Auto' HeaderFile: '' Description: ''
For more information, at the MATLAB command line, enter:
The Fixed-Point Designer product replaces two pre-existing products: Fixed-Point Toolbox™ and Simulink Fixed Point™. You can access archived documentation for both products on the MathWorks® Web site.
The buildInstrumentedMex and showInstrumentationResults instrumentation functions now can generate log2 histograms. A histogram is generated for each named and intermediate variable and for each expression in your code. The code generation report Variables tab includes a link to the histogram for each variable. You can use this histogram to determine the word and fraction lengths for your fixed-point values. Refer to the buildInstrumentedMex and showInstrumentationResults reference pages for information.
Effective this release, you can use fi objects as indices to arrays of built-in types and fi types. You can also use fi objects in switch-case expressions. These changes let you use fi objects without having to convert them. See the fi reference page for examples.
The zeros, ones, and cast functions now work with fixed-point data types as well as built-in data types. The functions can now return an output whose class matches that of a specified numeric variable or fi object. For built-in data types, the output assumes the numeric data type, sparsity, and complexity (real or complex) of the specified numeric variable. For fi objects, the output assumes the numerictype, complexity (real or complex), and fimath of the specified fi object.
>> a = fi(,1,24,12); >> c = cast(pi,'like',a) c = 3.1416 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 24 FractionLength: 12 >> z = zeros(2,3,'like',a) z = 0 0 0 0 0 0 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 24 FractionLength: 12 >> o = ones(2,3,'like',a) o = 1 1 1 1 1 1 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 24 FractionLength: 12
This capability allows you to cleanly separate algorithm code in MATLAB from data type specifications. Using separate data type specifications enables you to:
Reuse your algorithm code with different data types.
Switch easily between fixed-point and floating-point data types to compare fixed-point behavior to a floating-point baseline.
Try different fixed-point data types to determine their effect on the behavior of your algorithm.
Write clean, readable code.
For more information, see Implement FIR Filter Algorithm for Floating-Point and Fixed-Point Types using cast and zeros.
The Fixed-Point Advisor now performs checks on referenced models. It checks the entire model reference hierarchy against fixed-point guidelines. The Advisor also provides guidance about model configuration settings and unsupported blocks to help you prepare your model for conversion to fixed point.
You can now convert floating-point MATLAB code to fixed-point C code using the fixed-point conversion capability in MATLAB Coder projects. You can choose to propose data types based on simulation range data, static range data, or both.
During fixed-point conversion, you can:
Propose fraction lengths based on default word lengths.
Propose word lengths based on default fraction lengths.
Optimize whole numbers.
Specify safety margins for simulation min/max data.
Validate that you can build your project with the proposed data types.
Test numerics by running the test file with the fixed-point types applied.
View a histogram of bits used by each variable.
For more information, see Propose Fixed-Point Data Types Based on Simulation Ranges and Propose Fixed-Point Data Types Based on Derived Ranges.
Autoscaling with the Fixed-Point Tool now handles data type constraints for virtual buses that do not have any associated bus objects. The data type proposals take into account the constraints introduced by these bus signals.
This improved autoscaling reduces data type mismatch errors. It also enables the Fixed-Point Tool to provide additional diagnostic information when you accept autoscaling proposals. For more information, see Shared Data Type Summary.
The data type override rules for MATLAB Function block input signals and parameters have changed. If the input signals and parameters are double or single, and you specify data type override to be Double or Single, the overridden data types are now built-in double or built-in single, not fi double and fi single as in previous releases. If the input signals and parameters are fi objects or fixed-point signals, and you specify data type override to be Double or Single, the overridden data types are fi double and fi single as in previous releases. For more information, see MATLAB Function Block with Data Type Override.
If you have MATLAB Function block code from previous releases that contains special cases for fi double or fi single, and you specify data type override to be Double or Single, you might have to update this code to handle built-in double and single.
The following file I/O functions are now supported for code acceleration and generation:
To view implementation details, see Functions Supported for Code Acceleration or Generation.
You can now accelerate code using fiaccel for local variables that contain references to handle objects or System objects. In previous releases, accelerating code for these objects was limited to objects assigned to persistent variables.
fiaccel now supports a subset of the load function for loading run-time values from a MAT-file. It also provides a new function, coder.load, for loading compile-time constants. This support facilitates code generation from MATLAB code that uses load to load constants into a function. You no longer have to manually type in constants that were stored in a MAT-file.
To view implementation details for the load function, see Functions Supported for Code Acceleration or Generation.
To view implementation details, see Functions Supported for Code Acceleration or Generation.
The saveglobalfimathpref will be removed in a future release.
Do not save globalfimath as a MATLAB preference. If you have previously saved globalfimath as a MATLAB preference, use removeglobalfimathpref to remove it.
The emlmex function has been removed.
The emlmex function generates an error in R2013a. Use fiaccel instead.
|Release||Features or Changes with Compatibility Considerations|