Why does DSP need Q format? What do q31, q15, q7, and f32 mean?

Post Reply
Dylan Hsieh
Posts: 31
Joined: 22 Mar 2017, 09:54

28 Mar 2017, 16:04

In DSP operations, when a problem cannot be solved by using an integer, and the floating-point operation spends too much time, the Q format can be used to solve the problem regarding performance and operation time.
  • q31, q15, and q7 use a fixed-point number to represent the bits of fractional part. The data size is 32, 16, and 8 bits respectively, and the values are in the range of -1 to 0.9999.
  • f32 is the floating-point number that uses 32 bits to store and represent.

The hexadecimal number 0x2000 = 8192, but in the q15 format is 0.25, the reason is that 0x2000 expands into the binary number 0010 0000 0000 0000, and then includes 15 fractional bits, i.e. 0.010 0000 0000 0000 is equal to 0.25 of the 10's carry (the first digit of the left is the number of symbols).

In addition, after the multiplication of Q format, it needs to be shifted to the right. The shift depends on the Q format. The multiplication of q15 represents to shift 15 bits to the right; q7 represents to shift 7 bits to the right, and so on.
There are two decimal digits, 0.25 and 0.5, expressed in the q7 format as 0.010 0000 and 0.100 0000, which becomes 0000 1000 0000 0000 after multiplication, and then becomes 0.001 0000 after 7 bits to the right. In q7 format, it is equal to 0.125 of the 10's carry.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests