# Comparison between fixed-point DSP and floating-point DSP

Source: Internet
Author: User

Http://www.cnblogs.com/scncart/articles/1805553.html

Comparison between fixed-point DSP and floating-point DSP

It may be helpful for entry-level DSP developers. This article focuses on the comparison between a fixed-point DSP and a floating-point DSP, mainly from three aspects. Thank you for your reference.

In general, the fixed-point DSP processor features fast speed, low power consumption, and low price. The floating-point DSP processor provides precise computing, large dynamic range, fast speed, easy programming, and high power consumption, high price.

1. Macro differences

From a macro perspective, the floating-point DSP has a much larger dynamic range than the fixed-point DSP. In fixed-point operations, the programmer must always pay attention to overflow. To prevent overflow, either shift calibration or tail truncation is performed continuously. The former consumes a lot of time and space, while the latter results in a loss of precision. On the contrary, the floating point operation DSP expands the dynamic range, improves accuracy, and saves operation time and storage space, because it greatly reduces calibration, shift, and overflow checks.

For example(From http://blog.sina.com.cn/s/blog_518dfe5b0100e17w.html)

The fixed-point calculation only processes a data as an integer. Generally, AD samples all the integers. This number has a scale factor relative to the real analog signal, as we all know, if a 16-bit ad is used to sample a signal from 0 to 5 V, the corresponding voltage is obtained by dividing the integer of the ad output by 2 ^ 16 and then multiplied by 5 V. In a fixed-point DSP, the 16-bit sampling is processed directly, instead of converting it into a voltage in decimal places, because the fixed-point DSP cannot represent a decimal point with sufficient precision, it can only calculate integers.
The advantage of floating-point DSP is that it can convert the integer obtained from the sampling to the voltage expressed in decimal places without losing precision (this decimal point is expressed in scientific Notation ), the reason is that the scientific notation can indicate a signal with a large dynamic range. Take the ieee754 floating point number as an example,
Single-precision floating point format: [31] 1-Digit Symbol [30-23] 8-digit index [22-00] 23-digit decimal
The minimum number that can be expressed is +-2 ^-149, and the maximum number is +-(2-2 ^ 23) * 2 ^ 127. (Here we will not study how this minimum and maximum range is calculated.) the dynamic range is 20 * log (Maximum/minimum) = a large dynamic range such as 1667.6db makes it almost unnecessary for us to consider multiplication and accumulation overflow during programming. If we use a fixed-point processor for programming, it is common to round and shift the calculation results, which may result in loss of precision to a certain extent. The reason is that the dynamic range of the signal processed by the fixed point processing is limited. For example, a 16-Bit fixed point DSP can indicate that the Integer Range is 1-65536, and its dynamic range is 20 * log (65536/1) = 96db. for 32-point DSPs, the dynamic range is 20 * log (2 ^ 32/1) = 192db, far smaller than the 32-bit IEEE floating point number 1667.6db. However, in fact, 192db is sufficient for the signals processed by most applications.
Due to the limitation of the number of digits of the AD converter, the dynamic range of the input signal is generally relatively small. However, in the signal processing of the DSP, the dynamic range of the signal of the intermediate node is increased due to the dot product operation, therefore, the DSP is selected based on the dynamic range of intermediate results in the signal processing process and the accuracy requirements of the algorithm for intermediate results.

2. Hardware

Aside from the comparison of these macro features, from a technical perspective, the difference between the fixed point and the floating point mainly lies in two aspects: hardware and software. The hardware difference is that the floating-point DSP processor has a floating-point/Integer multiplier, an integer/floating-point Arithmetic Logic Operation Unit ALU, and is suitable for storing registers with Extended Floating-point results.

3. Software

Let's look at the differences in software development, mainly including the characteristics and precautions of floating point DSP programming; the calibration, shift, and overflow detection operations of fixed point DSP for floating point operations. When comparing two floating point numbers, never use the operator = to determine if they are equal. Even if two identical numbers are compared, there may be slight rounding differences. Even defining accurate 0 is not very safe. Although the C language has 0, never write such code (x = 0), instead of writing it (FABS (X) <tiny), where tiny is defined as a small value, that is, the floating point format rounding error of the processor. (To be continued ~~)

4. Application Example (From http://www.embedcity.com/article.php? Id = 235)

Another important difference lies in the choice of fixed point and floating point DSP processors in application scenarios. Designers care about the final system performance, cost, and time to market.

(1) mobile TV

We hope that the comparison between the fixed-point DSP and floating-point DSP can help beginners establish a global perceptual knowledge.

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.