Use the Fixed-Point Tool to Prepare a System for Conversion
You can use the Fixed-Point Tool to prepare a model for conversion to fixed-point data types. During the preparation stage, the Fixed-Point Tool checks the system under design for compatibility with the conversion process and reports any issues found in the model. When possible, the Fixed-Point Tool automatically changes settings and design patterns that are not compatible with automated fixed-point conversion. In cases where the tool is not able to automatically fix an issue, the tool notifies you of the changes you must make to help the conversion process be successful.
Note
Running preparation checks before fixed-point conversion is a best practice.
However, the tool does allow you the option to skip this step. Preparation checks
are not available in the DataTypeWorkflow.Converter and
fxpopt command-line workflows.
Set Up System Under Design
Before preparing a system for conversion, first set up your system under design. Some preparation checks differ slightly depending on your model and setup in the Fixed-Point Tool.
Open the Fixed-Point Tool. On the Apps tab, select Fixed-Point Tool.
Under New, select the
Iterative Fixed-Point ConversionorOptimized Fixed-Point Conversionworkflow.Preparation checks are not available in the
Range Collectionworkflow of the Fixed-Point Tool.Under System Under Design (SUD), select the system or subsystem you want to convert.
Under Range Collection Mode, select the method that you want to use to collect ranges. The Fixed-Point Tool uses these collected ranges to later generate data type proposals.
Note
The preparation checks performed by the Fixed-Point Tool differ slightly between the range collection modes.
Under Simulation Inputs, you can specify a
Simulink.SimulationInputobject to include additional model inputs for simulation, or you can selectUse default model inputs.To specify tolerances for the system, under Signal Tolerances in the table, specify tolerances for signals in the model that have signal logging enabled.
Run Preparation Checks
After you set up the system under design, run preparation checks:
Click Prepare.
The Fixed-Point Tool checks the system under design and the model containing the system under design for compatibility with the automated fixed-point conversion process and summarizes the results in a table.
Select the radio button for a row in the table to display additional information about the preparation check in the Preparation Details pane. This pane also contains details to help you resolve issues found by the preparation check.
Note
Clicking Prepare can result in changes to your model.
After addressing any issues found by the Fixed-Point Tool, click Prepare again to rerun the checks and verify that all issues are now resolved.
Preparation Checks
The following sections describe the preparation checks performed by the Fixed-Point Tool when you click Prepare.
Create Restore Point
The Fixed-Point Tool creates a restore point of your model at its current state. If after the conversion you want to restore your design to its original state before converting the data types, click Restore Original Model.
| Status | Description |
|---|---|
| Pass | This check passes when the Fixed-Point Tool is able to create a restore point for the model. |
| Fail | This check fails when the Fixed-Point Tool is unable to create a restore point for the model. This failure can happen when:
|
Hardware Implementation Consistency
Before converting your design to fixed point, you must specify the intended target hardware in the Hardware Implementation of the Configuration Parameters dialog box. Hardware implementation settings must be consistent throughout the model hierarchy of the model containing the system under design.
For more information on how the Fixed-Point Tool uses hardware implementation settings when proposing data types, see How the Fixed-Point Tool Uses Target Hardware Information.
| Status | Description |
|---|---|
| Pass | This check passes when the intended target hardware is specified for the system under design and the settings do not conflict with the settings of any other systems in the model hierarchy. |
| Pass with change | When hardware implementation settings are specified for the system under design but do not match other systems within the model hierarchy, the Fixed-Point Tool updates the hardware implementation settings of the other systems in your model so that they match the settings of the system under design. For example, this outcome can happen when the model contains a referenced model that uses a different hardware configuration than the system under design. |
| Fail | This check fails when one of these cases occurs:
|
Diagnostic Settings
These diagnostics alert you to numerical issues in your model and must be enabled:
| Status | Description |
|---|---|
| Pass | This check passes when the diagnostic settings of the
model containing the system under design are set to either
|
| Pass with change | When the diagnostic settings are set to
|
| Fail | This check fails when the Fixed-Point Tool
is unable to set the diagnostic settings of the model
containing the system under design to
For example, this failure can happen when the configuration parameters for the model specify a configuration set. See Model Configuration Sets for more information. |
Unsupported Constructs
The Fixed-Point Tool identifies blocks or other constructs in your system under design that are not supported for automated fixed-point conversion. Unsupported constructs include blocks that do not support fixed-point data types and read-only blocks and subsystems, such as linked library blocks.
| Status | Description |
|---|---|
| Pass | This check passes when the system under design does not contain any unsupported constructs. |
| Pass with change | When the system under design contains unsupported constructs, the Fixed-Point Tool encapsulates the unsupported constructs in a subsystem surrounded by Data Type Conversion blocks. These unsupported constructs are then ignored by the fixed-point conversion process. After you complete the fixed-point conversion process, you can replace the subsystem containing the unsupported block with a lookup table approximation or other alternative which does support fixed-point data types. For an example, see Convert Floating-Point Model to Fixed Point. |
| Fail | This check fails when the Fixed-Point Tool is unable to isolate unsupported constructs. |
Inport/Outport Design Ranges
This preparation check runs only when you set the range collection mode to Derived ranges or Simulation with derived ranges.
When you select derived ranges as the range collection mode, the tool performs a static analysis to derive minimum and maximum values for signals in the model. This analysis depends on the design ranges that you specify for input and output ports of the system under design.
| Status | Description |
|---|---|
| Pass | This check passes when all input ports and output ports in the system under design have design range information specified. |
| Warn | This check warns when inputs to the subsystem specify design ranges, but outputs do not specify design ranges. To get the best results from derived range analysis, specify design ranges for both inputs and outputs to the system. |
| Fail | This check fails when inputs and outputs to the system under design are missing design range information. Specify design range information for all inputs of the system under design. |
System Under Design Boundary
When model objects within the system under design share a data type with objects outside of the system under design, data type propagation issues can occur after conversion to fixed point. You can prevent these data type propagation issues by isolating the system under design using Data Type Conversion blocks at the inputs and outputs of the system. The Data Type Conversion block converts an input signal to the data type you specify for the Output data type parameter.
| Status | Description |
|---|---|
| Pass | This check passes when the system under design is isolated from the rest of the model by Data Type Conversion blocks. |
| Pass with change | When the system under design is not isolated from the rest of the system, the Fixed-Point Tool places Data Type Conversion blocks at the input and output ports of the system under design to isolate it during the conversion. |
| Fail | This check fails when the Fixed-Point Tool is unable to place Data Type Conversion blocks at the ports of the system under design. |
Stateflow Best Practices
If your design contains Stateflow® charts that use MATLAB® as the action language, the Fixed-Point Tool checks that these charts follow the best practices described in Best Practices for Working with Stateflow Charts in Automated Fixed-Point Conversion Workflows.
| Status | Description |
|---|---|
| Pass | This check passes when all Stateflow charts that use MATLAB as the action language meet these conditions:
|
| Warn | This check warns when:
To get the best results from automated fixed-point conversion, follow Best Practices for Working with Stateflow Charts in Automated Fixed-Point Conversion Workflows. |
MATLAB Function Block Best Practices
If your design contains MATLAB Function blocks, the Fixed-Point Tool checks whether MATLAB Function blocks contain modeling constructs that are supported for automated fixed-point conversion as described in MATLAB Language Features Supported for Automated Fixed-Point Conversion.
| Status | Description |
|---|---|
| Pass | This check passes when all MATLAB Function blocks contain only supported modeling constructs for automated fixed-point conversion. |
| Warn | This check warns when MATLAB Function blocks in the system under design contain modeling constructs that will cause a warning during fixed-point conversion. To get the best results:
|
| Fail | This check fails when MATLAB Function blocks in the system under design contain modeling constructs that are not supported for fixed-point conversion and cause an error. |
See Also
Topics
- Best Practices for Working with Stateflow Charts in Automated Fixed-Point Conversion Workflows
- MATLAB Language Features Supported for Automated Fixed-Point Conversion
- Iterative Fixed-Point Conversion Using the Fixed-Point Tool
- Convert Floating-Point Model to Fixed Point
- Optimize the Fixed-Point Data Types of a System Using the Fixed-Point Tool