Fixed-Point Designer

Key Features

  • Fixed-point data type specification in MATLAB, Simulink, and Stateflow
  • Bit-true simulation of fixed-point and single-precision algorithms
  • Histograms and related tools for exploring and optimizing data types
  • Apps for converting from doubles to fixed point or single precision
  • Instrumentation for collecting simulation min and max values
  • Range analysis for assessing full design min and max values
  • Overflow detection and precision loss tools for debugging and visualization

Using Fixed-Point Designer to specify and view data types and scaling for MATLAB, Simulink, and Stateflow.

Fixed-Point Specification

Fixed-Point Designer enables you to specify all the fixed-point properties of your MATLAB® code, Simulink® models, and Stateflow® charts. It provides full control of signedness, word length, and scaling. It supports application-specific word lengths from 1 bit to 128 bits or more. Binary-point scaling and arbitrary slope and bias scaling needed by sensors and actuators are also supported. You can control the details of the mathematical operations, such as how to deal with rounding and overflow.

Fixed-Point Designer provides a large number of functions, such as math and bitwise operations, array and matrix operations, CORDIC implementations, and trigonometric functions, to support fixed-point computation.

With Fixed-Point Designer, you can control the fixed-point arithmetic. In MATLAB, fixed-point variables can either share a single set of arithmetic attributes or have their own specified arithmetic attributes.

Utilizando Fixed-Point Designer con MATLAB Coder™ o Embedded Coder®, puede generar código C puramente entero a partir de su código de MATLAB en punto fijo. Utilizando Fixed-Point Designer con HDL Coder™, puede generar código bit-true sintetizable de Verilog® y VHDL® a partir de su código de MATLAB en punto fijo, modelos de Simulink y gráficos de Stateflow.

Explore gallery (2 images)

Bit-True Design Workflow

Fixed-Point Designer provides bit-true agreement across a workflow that uses Model-Based Design. The response of a fixed-point algorithm is bit-true for all forms of simulation and code generation, including acceleration and software-in-the-loop. Analysis and verification of a fixed-point algorithm are based on bit-true representations. Bit-true agreement maximizes many benefits of Model-Based Design, such as the ability to discover issues early in the workflow, when they are easier and less costly to fix.

Once your design has been configured with fixed-point data types, you can simulate its performance to explore implementation tradeoffs between limited range and precision for fixed-point embedded systems.

Using the tools in Fixed-Point Designer, you can access these values and change the data types of signals, optimizing precision while ensuring that their range is covered. You can specify data type ranges using design minimums and maximums, simulation results, or derived minimum and maximum results. For Simulink models, you can lock output data types to prevent them from being changed.

Explore gallery (2 images)

Data Type Exploration and Optimization

Fixed-Point Designer provides tools for system-wide visualization of the simulation ranges and explores how the various signals fit a certain data type choice. Fixed-Point Designer makes it easy to do a back-to-back comparison of your ideal floating-point design and your embedded efficient implementation using optimal data types.

Using data type override, your embedded fixed-point or single-precision design can be instantly switched to double precision to analyze the impact of quantization. It is easy to perform back-to-back simulations of idealized behavior and embedded behavior. Integration of the workflow with Simulation Data Inspector makes it easy to determine whether the embedded responses, such as the quantization noise, are within desired tolerances of the doubles responses.

It is easy to iteratively adjust data types, collect the new embedded responses, and then determine whether the new design meets tolerances relative to the doubles design. This simple iteration loop makes it easy to explore and optimize data types, rounding modes, and saturation settings.

Histogram visualization of signals highlighting overflows and underflows.

Double Precision to Single or Fixed-Point Conversion

Fixed-Point Designer provides analysis tools for efficiently converting a design from double precision to single precision or fixed point. The Fixed-Point Tool provides a guided workflow to iteratively explore the different data type choices in meeting the numerical accuracy requirements and make optimal use of your embedded hardware. The analysis framework allows you to observe the dynamic range of variables involved in your design and ensure that the algorithm behaves consistently in floating-point and fixed-point representations.

In MATLAB or Simulink, you can use Fixed-Point Designer to collect minimum and maximum values through simulation or range analysis and get proposed data types. A histogram is generated for each signal and variable in your design, and you can use this histogram to optimize the word and fraction lengths. You can replace any unsupported MATLAB functions in your design with a lookup table approximation function.

The Fixed-Point Tool in Fixed-Point Designer can collect range data either by performing simulation and logging range information or by derived range analysis.
Collect and display simulation ranges for variables inside a MATLAB Function block using the Fixed-Point Tool. Use this simulation range analysis to propose data types for the variables based on the simulation data
Discover how simple it is to convert your Simulink model to single precision as well as verify the numerical behavior of the converted model when targeting an embedded target.

Workflow for converting an ideal floating-point design to an embedded efficient design.

Model Instrumentation and Range Analysis

Fixed-Point Designer enables you to collect simulation range data through model-wide instrumentation without the explicit need to log all the signal data in your model. This range data is the basis for proposing data types and collecting statistics, such as the histogram data, that aid in the analysis of your design.

Fixed-Point Designer also provides you with derived ranges based on mathematical analysis of your designs. This enables you to determine the worst-case ranges of your design without having to create fully exhaustive simulation test benches. Using derived ranges, you can make sure your design prevents or handles all possible overflows.

Fixed-Point Tool showing the simulation minimum and maximum values based on the test bench inputs and the option to derive ranges based on design minimums and maximums specified in the model.

Overflow and Precision Loss Detection

Fixed-Point Designer provides tools that make it easy to quickly identify the sources of overflow, precision loss, and wasted range or precision. Using scaled doubles override, it is possible to visualize the ideal floating-point behavior of a model and analyze that behavior against the specified embedded fixed data types.

A visual display using histograms that overlay the idealized range and the embedded fixed data type representable range makes it easy to spot sources of overflows, underflows, wasted range bits, and wasted precision bits. This makes it easy to identify locations where data type improvements are warranted.

You can trace an overflow/underflow to the specific design element, like the particular block, Stateflow chart element, or section of MATLAB code. Fixed-Point Designer integration with Simulink diagnostics allows design errors like run-time overflows to be detected and isolated. The ability to suppress diagnostics for individual model elements, such as a correctly overflowing timer, lets you spend time only on real issues.

Tracing an overflow to the specific block in the model.