What is the difference between the fixed point and floating point modeling in simulink ?

27 vues (au cours des 30 derniers jours)
Which method is preferable and why ? Could any one explain this concept with example if possible.

Réponses (2)

M
M le 16 Déc 2019

Andy Bartlett
Andy Bartlett le 18 Déc 2019
Design choices like where to use floating-point or fixed-point are about embedded implementation efficiency.
Implementation efficiency is an important factor in determining the success of an embedded design.
Efficient designs run faster and use less resources including power, memory, bandwidth, and gates.
Efficient designs can also achieve their mission on smaller less costly compute devices.
The choices of data types and algorithms can have a big impact on efficiency.
The efficiency level of a choice is often heavily impacted by what types and mathematics are directly supported by the intended embedded compute device.
Most chips for embedded use do not have any hardware support for double precision floating point math. Thus, any use of double types and math would have to use emulation. This emulation would be very slow. So, except where absolutely necessary, any use of double precision would be a really bad choice.
Chips intended for low power applications often don't have hardware support for floating point, neither single nor double. So, except where absolutely necessary, any use of floating-point would typically be a really bad choice when targeting these devices. Note, this statement is tempered when targeting an FPGA where the cost of emulating single precision is much more modest than for a microprocessor. Maximally efficient emulation of singles is a valuable feature of HDL Coder.
The alternative is to use fixed-point data types and mathematics. Fixed-point utilizes the integer type and math capabilities that almost all chips can support efficiently in terms of size, power, and speed. For a microprocessor, 8, 16, 32, and increasingly 64-bit fixed-point types are available. FPGAs can support arbitrary bits sizes and will have DSP math units that can very efficiently do multiplication-addition on inputs with 18 (or 25) bits or less.
When the target device can do floating-point efficiently, the choice of where in the design to use floating-point and where to use fixed-point requires deeper engineering analysis. If fixed-point will satisfy the mathematical requirements, especially with smaller sizes like 16 bits or less, then fixed-point will almost always be more efficient for both microprocessors and FPGAs. But fixed-point will require more engineering design effort to select the optimal bit sizes and scalings.
Fixed-Point Designer provides multiple tools for highly automating the engineering effort of selecting and setting target efficient types and math. For example, in Simulink, Fixed-Point Tool and Single Precision Converter tool can fully automate moving an embedded intent design from double precision to fixed-point and/or single precision. For floating-point, fixed-point, and mixtures, the Function Approximation and Lookup Table Optimization tools automate finding optimally efficient approximations of math operations that would otherwise be very costly to implement on an embedded compute device.
Sometimes the use of numeric efficiency tools and techniques is done to solve a crisis. A design might initially make the very simple effort of using Single Precision Converter to go from double to the much more efficient single. But as development progresses, a crisis occurs. For example, the resources of the embedded compute device have been exhausted, and the Lead System Engineer is demanding that your part of the project reduce memory usage by 30%. In a case like this, application of Lookup Table Optimization can be an easy way to get dramatic memory use reduction. As another crisis example, it is discovered that a competitor’s device has twice the battery life for your market offering. In this case, you will want to use Fixed-Point Tool or fxpopt to find a design that uses the smallest fixed-point types possible.
Sometimes the use of numeric efficiency tools and techniques is driven by opportunity. Suppose a more numerically efficient design would free up resources on your embedded device. This creates an opportunity to fit more features on your device and to achieve market differentiation that helps your product win more customers.
In summary, embedded design choices like where to use floating-point, fixed-point, and approximations is about numeric efficiency. Fixed-Point Designer provides multiple automation tools to support making optimal engineering choices. Achieving high numeric efficiency can avoid design failure and amplify design success.

Produits


Version

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by