0

Is my understanding correct w.r.t Q format.

  1. signed Q15.1 format means, 15 bits for fractional and 1 for integer bits SO max range is - 2^15 / 2^15 to + (2 ^ 15 - 1) / 2^15
  2. signed Q7.0 means, 7 bits for fractional and 0 for integer bits, So max range is -2^7/2^7 to + 2^7 - 1 / 2^7
  3. signed Q7.1 means, 7 bits for fractional and 1 for integer bits, So max range is -2^7/2^6 to + 2^7 - 1 / 2^6
  4. signed Q7.2 means, 7 bits for fractional and 2 bits for integer so max range is -2^7 / 2^5 to + 2^7 - 1 / 2^5

    Also, how sign bit is defined for all the above. for ex Q15.1(15 fractional, 1 integer, what about sign bit since already we reached 16 bits)

Also Can you help me in providing good links for Q format to get familiar with that.

ksi
  • 13
  • 2
  • 1
    Have you tried going through wikipedia page for Qm.n format. It's in pretty much detail : https://en.wikipedia.org/wiki/Q_(number_format) , in Qm.n format n is used to denote fractional part and m to denote integral part. Go through this answer too : https://dsp.stackexchange.com/a/10707/49439 – DSP Rookie Apr 16 '20 at 06:33
  • 2
    you do have it backwards (and i have never seen that before). Q1.15 means one bit left of the binary point and 15 bits to the right of the binary point. but it could be unsigned in which the range is zero to 2(1-2^-15). i have seen people use the notation S1.15 for the signed fixed-point numbers. but i never thought all this Q notation was all that standardized anyway.. – robert bristow-johnson Apr 16 '20 at 07:17

2 Answers2

1

signed Q15.1 format means, 15 bits for fractional and 1 for integer

nope, just the other way around: The notation is meant to be intuitive, and the number left of the decimal point is the bits for the integer part, and right of the decimal point the bits of the fractional part.

The comments already linked to Wikipedia, which is usually at least a good start to research.

However, there's ambguity w.r.t. how sign bits (if any – your Q number format could just be unsigned) are handled – is the integer part a 2-complement number; is this really just a 2-complement integer that gets divided by 2^\text{fractional bits}$? Or do you just carry around an extra bit for the sign?

For that, you'll have to refer to the documentation of what you're doing specifically.

Marcus Müller
  • 30,525
  • 4
  • 34
  • 58
0

Fixed point quantisation is a tricky subject. We discuss this in detail, including deploying the to Arm CMSIS-DSP library in this tutorial.

In order to correctly represent the coefficients and input/output numbers, the system word length (16-bit for the purposes of this application note) is first split up into its number of integers and fractional components. The general format is given by:

Q Num of Integers.Fraction length

If we assume that all of data values lie within a maximum/minimum range of ±1, we can use Q0.15 format to represent all of the numbers respectively. Notice that Q0.15 (or simply Q15) format represents a maximum of $1−2^{−15}=0.9999={\tt 0x7FFF}$ and a minimum of $−1={\tt 0x8000}$ (two’s complement format)

.

Peter K.
  • 25,714
  • 9
  • 46
  • 91
ASN
  • 11
  • 1