Use the Fixed-Point Tool to Prepare a System for Conversion
Using the Fixed-Point Tool, you can prepare a model for conversion from a floating-point model or subsystem to an equivalent fixed-point representation. 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 that are not compatible. In cases where the tool is not able to automatically change the settings, the tool notifies you of the changes you must make manually to help the conversion process be successful.
To prepare a system for conversion:
Open the Fixed-Point Tool. In the Apps gallery of the model, select Fixed-Point Tool.
Under New, select the
Iterative Fixed-Point Conversion
workflow.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.
The preparation checks performed by the Fixed-Point Tool differ slightly between the range collection methods.
For more information on deciding which method of range collection is right for your application, see Choosing a Range Collection Method.
Under Simulation Inputs, you can specify
Simulink.SimulationInput
objects to exercise your design over its full operating range, or you can select toUse default model inputs
.To specify tolerances for the system, under Signal Tolerances in the table, specify tolerances for any signal in the model with signal logging enabled.
Click Prepare. The Fixed-Point Tool checks the system under design and the model containing the system under design for compatibility with the conversion process.
Selecting any of the checks displays additional information in the Preparation Details pane. This pane also contains details for resolving remaining issues.
After addressing any issues found by the Fixed-Point Tool, click Prepare to rerun the checks and verify that all issues are now resolved.
Preparation Checks
The following sections describe the checks performed by the Fixed-Point Tool during the preparation stage of the conversion.
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 state before converting the data types, click the Restore Original Model button.
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 one of the following occurs:
|
Hardware Implementation Consistency
Before converting your design to fixed point, you must specify the intended target hardware in the Configuration Parameters Hardware Implementation pane. These 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 these 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. |
Pass with change | When the hardware implementation settings of the system under design are specified, but they do not match other systems within the model hierarchy, for example, if the model contains a referenced model that uses a different hardware configuration, 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. |
Fail | This check fails when one of the following two cases occurs.
|
Diagnostic Settings
Certain diagnostics that alert you to numerical issues in your design cannot
be set to none
. This check passes only when the
following diagnostic settings in the Configuration Parameters are set to either
warning
, or error
.
Diagnostics > Data Validity > Signals > Wrap on overflow
Diagnostics > Data Validity > Signals > Saturate on overflow
Diagnostics > Data Validity > Signals > Simulation range checking
Status | Description |
---|---|
Pass | This check passes when the diagnostic settings of the model
containing the system under design are set to either
warning or
error . |
Pass with change | When the diagnostic settings are set to
none , the Fixed-Point Tool
changes these settings to
warning . |
Fail | This check fails when the Fixed-Point Tool is not able to set
the diagnostic settings of the model containing the system under
design to warning . This may be
because the configuration parameters for the model specify a
configuration set. |
Unsupported Constructs
The Fixed-Point Tool identifies any blocks or constructs in your system under design that do not support fixed-point types.
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 any unsupported elements in a subsystem containing the unsupported block surrounded by Data Type Conversion blocks. After you complete the conversion process using the Fixed-Point Tool, you can replace the subsystem containing the unsupported block with a lookup table approximation. For more information, see Convert Floating-Point Model to Fixed Point. |
Fail | This check fails when the Fixed-Point Tool is not able to isolate the unsupported constructs using Data Type Conversion blocks. |
Inport/Outport Design Ranges
When you select Derived ranges or Simulation with Range Analysis as your range collection method, the software performs a static range analysis of your model to derive minimum and maximum range values for signals in the model. This range analysis relies on specified design ranges. The Fixed-Point Tool checks that you have specified design ranges for all 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 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 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 of any Simulink® software data type to the data type and scaling you specify for its 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 ports of the system under design to isolate it during the conversion. |
Fail | This check fails when the Fixed-Point Tool is not able 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 software checks that the chart follows the best practices described in Best Practices for Working with Stateflow Charts in Automated Fixed-Point Conversion Workflows. In particular, the software checks that assignments in Stateflow charts are cast to the data type of the target variable and that data in Stateflow are initialized.
Status | Description |
---|---|
Pass | This check passes when for all Stateflow charts that use MATLAB as the action language, these conditions are met:
|
Warn | This check warns when assignments in Stateflow are not cast or when data in Stateflow charts is not initialized. 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 software checks that the blocks use modeling constructs that are supported for 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 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, follow Best Practices for Working with the MATLAB Function Block in the Fixed-Point Tool. |
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 will cause an error. |