Data Type Conversion Overview
Within digital hardware, numbers are represented as either fixed-point or floating-point data types. For both these data types, word sizes are fixed at a set number of bits. Fixed-point representation often offers advantages in terms of the power consumption, size, memory usage, speed, and cost of the final product. However, the dynamic range of fixed-point values is much smaller than floating-point values with equivalent word sizes. Therefore, in order to avoid overflow or unreasonable quantization errors, fixed-point values must be scaled.
The following summarizes the process of converting data types in a system from floating point to fixed point. After converting data types in your model to an embedded-efficient representation, you can further optimize your design for your intended hardware, generate code and then deploy code onto your target.
Identify system requirements.
Model ideal system.
Convert data types of system to data types that are efficient on target hardware.
Verify numeric behavior of the converted system.
Verify performance of the converted system. Optimize performance of the system based on target hardware.
Deploy code onto hardware.
Methods for Converting a System to Fixed Point
The Fixed-Point Designer™ software provides three methods for automatically specifying fixed-point data types for a system in your model. The following table summarizes the methods available for converting a floating-point system to fixed-point data types.
The Fixed-Point Tool is a user interface that automates specifying fixed-point data types in a model.
For an example, see Convert Floating-Point Model to Fixed Point.
For an example, see Convert a Model to Fixed Point Using the Command Line.
If you know your system behavior tolerances, then the
For an example, see Optimize Fixed-Point Data Types for a System
After converting a system to fixed point, verify that the behavior of the fixed-point system meets your requirements. For more information, see Verify New Settings.
Optimize performance of the system based on target hardware. For example, replace trigonometric functions with equivalent CORDIC implementations, or use the Lookup Table Optimizer app to replace parts of your model with an embedded-efficient lookup table implementation.