0
$\begingroup$

I am designing a low pass filter which takes a 19 bit input.

\begin{align} \log_2(\max(\mbox{LPF_COEFF})) &= 16.64\\ \log_2(\mbox{sum}(\mbox{LPF_COEFF})) &= 17.87 \end{align}

Now should I take the output as 19+17 =36 bit output or 19+18=37 bit output.

$\endgroup$

2 Answers 2

0
$\begingroup$

The log2 computation is really a consideration for the size of the (extended precision) accumulator for a fixed point FIR filter design: The sum of the absolute value of the coefficients is the predicted maximum bit growth in the accumulator, but to note importantly after accumulation the output can be truncated (or rounded if DC offset error is a concern) back to a much smaller bit width. Further and importantly we must also consider the precision of the coefficients and any rounding or truncation that might be done at each multiplier output.

As a guideline, the bit width for the output should typically be $log_{10}(f_s/(2f_c))$ bigger than the bit width of the input where $f_c$ is the bandwidth of the low pass filter (for example with a quarter-band low pass filter, the final output should be 1 bit larger than the input to support the expected 6 dB decrease in noise floor). This assumes our input bit width is limiting our noise floor and cannot be decreased without decreasing our SNR.

Further, as a guideline the coefficients themselves should be at least 2 bits wider than the datapath (you will get 5 to 6 dB of stop band rejection for every bit used in the coefficients), but this can be easily verified by reviewing the frequency response with the fixed point coefficient values. With a 19 bit input and 21 bit coefficients, each multiplier if 2s complement signed would have a $19+21-1=39$ bit output without additional truncation error. Not all of these output bits are needed and can be truncated somewhat; without doing a detailed model I would suggest carrying 4 extra bits or 25 bits at the multiplier output into the accumulator and thus use a $25+18=43$ bit accumulator which is then truncated back after accumulation as I first advised.

This assumes all 19 bits of input precision are actually required, and follows the approach I suggested since quantization (rounding or truncation) noise at the multiplier outputs grow by $N$ in power to the FIR filter output (as detailed in the graphic below), while the output quantization when truncated or rounded there is only added once. That said, the truncation or rounding at the multiplier outputs can be done if kept to sufficiently low levels and depends on FIR filter length. (And to see with that hopefully how it would be really bad to truncate or round the multiplier outputs back to the 19 bit datapath precision inputs!). My approach is to use the guidelines I provided and then confirm SNR a performance via fixed point simulation.

fixed point FIR

$\endgroup$
0
$\begingroup$

You should look at the sum of the magnitude of the coefficients, if what you mean log2(sum(abs(LPF_COEFF))) = 17.87 then we know that

$$\begin{eqnarray} \left|\sum h_i x_{k-i}\right| &\ge& \sum |h_i x_{k-i}| \\ &=& \sum |h_i| |x_{k-i}| \\ &=& \sum |h_i| \max(|x_{k-i}|) \\ &=& \max(|x|) \sum |h_i| \end{eqnarray}$$

If the input signal can go is not limited then you would need 19 + 18.

But for instance if both coefficients and inputs are 2-complement values. The worst you can get is $2^{18} \cdot 2^{17.87} = 2^{35.87}$, that requires the bits 0-35, and an additional sign bits, thus 37 bits are required.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.