The difference between fixed point and floating point of DSP

Source: Internet
Author: User
Tags arithmetic radar

may be useful for entry-level DSP developers. This paper focuses on the comparison between fixed-point DSP and floating-point DSP, mainly from three aspects. Thanks to the author of the information I quoted.

In general, the fixed-point DSP processor has the characteristics of fast speed, low power consumption and cheap price, while floating-point DSP processor is accurate, dynamic range, fast, easy to program, power consumption, high price.

1, the difference on the macroscopic

From the macroscopic point of view, the floating points DSP is much larger than the fixed-point DSP dynamic range. In fixed-point operations, programmers must always be concerned about the occurrence of overflow, in order to prevent overflow, or constantly shift the calibration, or do a truncated end. The former consumes a lot of time and space, while the latter leads to the loss of precision. Instead, the floating-point arithmetic DSP expands the dynamic range, improves accuracy, saves computational time and storage space, because it significantly reduces calibration, shift, and overflow checking.

Take An example (from http://blog.sina.com.cn/s/blog_518dfe5b0100e17w.html)

Fixed-point calculation is to treat a data as an integer, usually ad sampling is an integer, this number relative to the real analog signal has a scale factor, we all know that a 16-bit AD to sample a 0 to 5V signal, then the ad output of the integer divided by 2^16 multiplied by 5V is the corresponding voltage. This 16-bit sampling is processed directly in the fixed-point DSP and does not convert it to a fractional voltage, because the fixed-point DSP cannot represent a decimal with sufficient precision, and it can only evaluate integers.
The advantage of the floating-point DSP is that it can convert the sampled integer to a fractional voltage, without loss of precision (this fraction is represented by scientific notation), because scientific notation can represent a signal of a large dynamic range, with IEEE754 floating-point numbers as an example,
Single-precision floating-point format: [31] 1-bit sign [30-23]8 bit exponent [22-00]23 decimal
The smallest number that can be represented is +-2^-149, and the largest number is +-(2-2^23) *2^127. (This is not to study how the minimum maximum range is calculated) Dynamic range is 20*log (maximum/minimum number) =1667.6db Such a large dynamic range makes it almost unnecessary to consider multiplication and cumulative overflow when programming, and if you use a fixed-point processor to program, rounding and shifting the results is a common occurrence, which in some degree loses precision. The reason is that the fixed-point processing signal dynamic range is limited, such as 16-bit fixed-point DSP, can represent the integer range of 1-65536, its dynamic range is 20*log (65536/1) =96db. For 32-point DSP, the dynamic range is 20*log (2^32/1) = 192dB, which is much smaller than the 1667.6dB of the 32-bit IEEE floating-point number, but in fact 192dB is sufficient for most applications to process signals.
Because of the limit of the number of ad converters, the dynamic range of the general input signal is relatively small, but in the signal processing of DSP, because the dot product operation will increase the dynamic range of the middle node signal, the dynamic range of intermediate results in the signal processing process is considered, and the accuracy requirement of the algorithm to the intermediate result is chosen accordingly.

2, on the hardware

Temporarily put aside these macro characteristics of the contrast, purely from a technical point of view, fixed point and floating point is mainly in two aspects, namely hardware and software. Hardware differences come from: floating-point DSP processors have floating-point/integer multipliers, integer/floating-point arithmetic logic unit ALU, suitable for storing the floating-point results of extended precision registers and so on.

3, the software

Look at the differences in software development, the main features of floating-point DSP programming and considerations, fixed-point DSP calibration, shift, detection overflow operation. When comparing two floating-point numbers, never use operator = = to determine equality. Even if you compare two identical numbers, there may be a slight rounding difference. Even defining the exact 0 is not very safe, although there are 0 representations in C that never write such a code (X==0), but should be written (Fabs (x) <tiny), where TINY is defined as a very small value, that is, the processor's floating-point format rounding error. (To Be Continued ~ ~)

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

Another important difference relates to the choice of fixed-point and floating-point DSP processors in application scenarios. Designers are concerned with the final system performance, cost and time to market.

(1) Mobile TVThis is another easy-to-decide option. There is absolutely no need for floating-point processing in Mobile TV. Most of the signal chain processing is done in standard decoders, such as MPEG-2, MPEG-4, JPEG-2000 and H. These algorithms are designed to be performed by fixed-point operations.   Floating-point operations with higher precision and greater dynamic range are not only unhelpful, they are not available at all, because these algorithms are usually only accurate to bits. For example, the transformation of the frequency domain used in the video codec is actually some form of DCT transform (discrete cosine transform). On the surface, it seems that floating-point arithmetic is more suitable for DCT computation, as it is for FFT computation. Floating-point arithmetic does produce more accurate DCT.   Unfortunately, the DCT in the video codec is designed to be done on a fixed-point processor and is only accurate to bits, so it is completely wrong to pursue higher accuracy here. Moreover, much of the work of the video codec is used to control the code, where floating-point encoding is also not required.   For example, the Entropy encoder used in the video codec accounts for a significant portion of the overall workload (especially in the CABAC encoder used in the H. S algorithm). The two processors considered here can make the right choice based on the fact that the Blackfin processor has a specially designed instruction to accelerate the performance of the video algorithm. In contrast, the SHARC processor does not have special video instructions. In addition, power consumption is critical to the mobile market, which almost excludes floating-point processors.   These make the choice easy. The rest of the application will require more in-depth analysis in order to make the correct processor selection.(2) Military radarWe'd better start with an easy choice. In the military radar you will often use floating-point processors. Why. Because floating-point performance is indispensable in this application. Radar relies on the determination of the maximum absolute value of the self-ambiguity function.   This function expresses the mutual correlation between the emitted test signal and the received echo. This is the integral of an exponential function. This integral can be calculated using FFT technology. Floating-point arithmetic is useful when computing large FFT, and there are no barriers to using floating-point processors here. As long as the heat can be discharged (that is, the processor is not hot), power is not a big problem. The cost of the unit is also not a major problem, as these processors cost only a fraction of the overall system cost. In fact, it is unlikely that ADSP-21367 Sharc will be chosen to accomplish such a task because one goal of the application is to provide as much processing power as possible in every square millimeter. As a result, the high performance adsp-ts201 in Adi's Tigersharc family of products is better suited for this application.

    hope the above for the comparison of fixed-point DSP and floating-point DSP can enable beginners to establish a global perceptual knowledge.

Contact Us

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.