Main Content

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:

  1. Open the Fixed-Point Tool. In the Apps gallery of the model, select Fixed-Point Tool.

  2. Under New, select the Iterative Fixed-Point Conversion workflow.

  3. Under System Under Design (SUD), select the system or subsystem you want to convert.

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

  5. Under Simulation Inputs, you can specify Simulink.SimulationInput objects to exercise your design over its full operating range, or you can select to Use default model inputs.

  6. To specify tolerances for the system, under Signal Tolerances in the table, specify tolerances for any signal in the model with signal logging enabled.

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

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

StatusDescription
PassThis 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:

  • The Fixed-Point Tool is unable to create a restore point for the model because the model is not in a writeable directory.

  • The Fixed-Point Tool is unable to create a restore point for the model because the model contains unsaved changes.

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.

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

  • The subsystem under design does not specify any target hardware information.

    To fix this issue, specify target hardware information for the system under design in the Configuration Parameters Hardware Implementation pane.

  • The subsystem specifies target hardware information, but the settings do not match other systems in the model hierarchy and the Fixed-Point Tool is not able to change the settings.

    To fix this issue, manually change the settings of other systems in the model hierarchy to match the settings of the system under design.

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

StatusDescription
PassThis check passes when the diagnostic settings of the model containing the system under design are set to either warning or error.
Pass with changeWhen the diagnostic settings are set to none, the Fixed-Point Tool changes these settings to warning.
FailThis 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.

StatusDescription
PassThis check passes when the system under design does not contain any unsupported constructs.
Pass with changeWhen 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.
FailThis 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.

StatusDescription
PassThis check passes when all input ports and output ports in the system under design have design range information specified.
WarnThis 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.
FailThis 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.

StatusDescription
PassThis check passes when the system under design is isolated from the rest of the model by Data Type Conversion blocks.
Pass with changeWhen 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.
FailThis 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.

StatusDescription
Pass

This check passes when for all Stateflow charts that use MATLAB as the action language, these conditions are met:

  • Assignments are cast to the data type of the target variable.

  • Data in Stateflow charts are initialized.

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

Related Topics