# Fixed-point and ARM CMSIS-DSP FIR filters

I am using Q1.15 fixed-point values to represent a 12-bit signed integer value. I was wondering if it matters if I use the 11 MSB or LSB of the fractional part to represent my 11 magnitude bits? Only thing I can think of is using LSB might in some cases reduces the chance of overflow errors and maybe allow me to use larger fixed-point FIR coefficients.

But I am using the ARM CMSIS-DSP FIR filtering functions and from what I understand the Q15 set of functions expects Q15 coefficients, Q15 state variables, Q15 result and of course Q15 input data. So in this case I will not be able to increase the precision on my Q15 filter coefficients.

Is there then any difference?

I don't think either will increase your precision as such, although there are benefits to each approach.

Using the lower 11 bits of 1.15 would provide you with 24dB of extra headroom (obviously being careful to sign extend properly). Alternatively, using the upper 11 bits could potentially lower the power in your quantisation error after 1.15 * 1.15 multiplication (for example).

The design is a compromise being headroom and dynamic range, and hence the best route probably depends on the magnitude of your coefficients.

The following example shows how extra headroom can be useful:

Let's say you have an FIR filter (1.15 fractional binary) with 2 coefficients, which are both 0.8 (for some reason). If your input was 0.9 for two samples in a row, your output would be (0.8 * 0.9) + (0.8 * 0.9) = 1.44. This value would lead to an overflow or hard clipping since it doesn't fit into 1.15 (fractional). To avoid this you could first shift the input down by 1 bit, to give yourself 6dB of headroom. This would change the sum to be (0.4 * 0.9) + (0.4 * 0.9) = 0.72, which now safely fits into a 1.15 container.

In a normal system where you're using all 16 bits you'd then have to worry about (or just remember!) the fact that your signal is halved in amplitude. In your case you don't need to worry about this, as your full scale signal is only 12 bits to start with.

• Could you give an example on what headroom can be good for? This so I can better understand what this means. And thank you for the answer, it was very helpful. – uniquenamehere Aug 21 '13 at 15:43
• I now understand how headroom can prevent overflow/clipping and how one can avoid this. In the FIR filter (and other fixed-point functions) I use the products of multiplication are stored in a larger fixed-point type than the input is to prevent this problem, but it's great to have this in mind. Thanks again! – uniquenamehere Aug 21 '13 at 21:25
• please move the content of these comments into the answer and then delete them – endolith Jun 26 '14 at 17:12