Implementation of floating-point operations in FPGA-calibration and fpga floating-point operations

Source: Internet
Author: User

Implementation of floating-point operations in FPGA-calibration and fpga floating-point operations

In some FPGAs, floating point numbers cannot be operated directly, but only fixed points can be used for numerical operations. For FPGA, the book involved in mathematical operations is a 16-bit integer number. What if there is a decimal number in the mathematical operation? You must know that FPGA is powerless to decimal places. One solution is to adopt calibration. The number calibration is to increase the number of floating-point numbers to many times, then take an integer, and use this number for calculation. Then, the result of the calculation can be reduced to a specific multiple. Do not forget the decimal point during design. In FPGA, decimal points are not displayed. Only programmers know the decimal point. Q indicates the decimal place. Q15 indicates that the decimal point is 15th digits.

Convert a floating point number (x) to a fixed point number (xq): xq = (int) x * 2 ^ Q

X: x = (float) xq * 2 ^ (-Q)

For example, if the hexadecimal number is 2000 H, Q0 is 8192. If Q15 is used, it is 0.25.

The following describes how to determine the Q value in Q format calculation:

(1) fixed-point addition and subtraction: The addition and subtraction must be converted to the same Q format.

(2) Fixed-Point multiplication: data in different Q formats is multiplied, which is equivalent to the sum of Q values.

(3) fixed-point Division: Division of data in different Q formats, equivalent to subtraction of Q values

(4) shift left: equivalent to increasing the Q value

(5) shift right of a fixed point: equivalent to reducing the Q value

For example, Q15 represents 4000 H (floating point number 0.5) multiplied by Q15 represents 4000 H, 4000 H × 4000 H = 1000 0000 H, after which the Q value becomes 15 + 15 = 30, the result is 0.01B, indicating that the floating point number is 0.25.

How can fpga perform floating point operations?

Multiply the floating point number by the nth power of 2 and convert it to an integer. Only the approximation can be achieved.

FPGA-assisted computing of floating-point numbers using OpenGL

What is the decimal format of DSP. Is the number of points or floating point number format. If it is a fixed point, you can use the FPGA's fixed-point to floating-point IP core for conversion, and then call the floating-point computing IP core. There is a floating-point computing addition, subtraction, multiplication, division.

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: 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.