Forum Discussion
Round or truncate? 截取和舍入对滤波器输出精度影响?
turncat and rounding on the accuracy of the filter output?
designing filter with Fpga, there are two output modes, turncut and rounding. What effect on accuracy on Both methods have? Is there any way to minimize errors in the output? ? In addition, the Internet, said the biggest interception of errors, will bring the DC noise, does is correct? and which book has detailed studies about this? Thank you! ! ! 截取和舍入对滤波器输出精度影响? fpga 设计滤波器,输出方式一般有两种, 截取和舍入。这两种方式对精度有什么影响?有什么方法可以使 输出的误差最小?? 另外,网上说 截取误差最大,会带来直流噪声,请问 是否正确,那本书上有详细论证, 谢谢大家!!!14 Replies
- Altera_Forum
Honored Contributor
truncating will give your output signal a DC bias. rounding will take more logic and possibly degrade fmax. for a more detailed analysis you should run a simulation
- Altera_Forum
Honored Contributor
Adding further details:
Truncation leads to noise(truncation noise) and dc bias. Noise is worst with direct truncation(no rounding) and results from random error of up to 1 LSB. It is similar to quantisation noise concept when sampling analogue signals and so its distribution is dependent on signal values probabilty. DC bias is negative due to 2's complement and is worst in direct truncation but also occurs in "nearest" below but here it is positive and dependant on probabilty of midvalues (ties) which is highest when discarding only one bit and gets less and less if discarding more bits. There are 4 examples of truncation algorithms below: (1) convergent : round to nearest even. gives unbiased rounding, commonly used in hardware. (2) nearest : simple, leads to dc bias, common in hardware. (3) round : ideal, no dc bias, minimum noise but method 1 more easily implementable in hardware (4) truncate only, dc bias and noise
The above table represents worst case i.e. one bit discarding and midpoint values(ties). For non ties, both nearest and convergent are equivalent to round Finally, note that say 4.5 is as close to 5 as it is to 4 and so the notion that it must 5 is not exactly solid fact except at school.for midpoint values case (ties) Convergent nearest round trunc -7/2 -3.5 -4 -3 -4 -4 -5/2 -2.5 -2 -2 -3 -3 -3/2 -1.5 -2 -1 -2 -2 -0.5 0 0 -1 n/a 0.5 0 1 1 n/a 3/2 1.5 2 2 2 1 5/2 2.5 2 3 3 2 7/2 3.5 4 4 4 3 - Altera_Forum
Honored Contributor
http://www.ovro.caltech.edu/~dwh/correlator/pdf/esc-100paper_hawkins.pdf (http://www.ovro.caltech.edu/%7edwh/correlator/pdf/esc-100paper_hawkins.pdf)
http://www.ovro.caltech.edu/~dwh/correlator/pdf/esc-100slides_hawkins.pdf (http://www.ovro.caltech.edu/%7edwh/correlator/pdf/esc-100slides_hawkins.pdf) Look at p40 and p41 of the slides for examples of truncation noise and the different rounding methods available in MATLAB. The figures show the bias involved in all methods; and that convergent is the rounding method to select. Cheers, Dave - Altera_Forum
Honored Contributor
Hi Dave,
Interesting work and slides. I have been through dsp projects with/without rounding. The notion of dc unbiased version is relatively new. In most cases I had to please the rf engineer by removing a tiny speckle of dc in the spectrum centred on carrier frequency. I am however not clear about round() having positive/negative dc as in your slide. If you look at my table above then there is no way I can imagine dc bias as values are symmetrical around zero. However, I do have some doubts about why the stress has moved to convergent case. Any clarification appreciated. Kaz - Altera_Forum
Honored Contributor
Hi Kaz,
--- Quote Start --- I have been through dsp projects with/without rounding. The notion of dc unbiased version is relatively new. In most cases I had to please the rf engineer by removing a tiny speckle of dc in the spectrum centred on carrier frequency. --- Quote End --- It ends up being important if you do a lot of complex-valued baseband processing, since the quantization noise spike shown in the slides shows up the in 'middle' of your band. If you were only processed real-valued signals, then the DC channel is probably discarded anyway, so its not as critical. --- Quote Start --- I am however not clear about round() having positive/negative dc as in your slide. If you look at my table above then there is no way I can imagine dc bias as values are symmetrical around zero. However, I do have some doubts about why the stress has moved to convergent case. Any clarification appreciated. --- Quote End --- round() is interesting isn't it. There is no bias if you take all the data and perform a 'mean' on it, but you can see from the figure in the slide that the positive values of the signal have a slight positive bias, while the negative have a slight negative bias, due to the rounding of 0.5 values to the next whole value in magnitude, i.e., 2.5 rounds to 3, and -2.5 rounds to -3. Though, I'm not sure how you'd see this effect in practice. The convergent rounding operation is pretty simple to implement in VHDL, see the attached. Since its so simple, I just 'use it' :) Cheers, Dave - Altera_Forum
Honored Contributor
Thanks Dave, very clear and I can assume therefore that for a signal with random values on both sides of zero the issue of dc bias is absorbed and the two algorithms become equivalent.
- Altera_Forum
Honored Contributor
--- Quote Start --- I can assume therefore that for a signal with random values on both sides of zero the issue of dc bias is absorbed and the two algorithms become equivalent. --- Quote End --- They're never quite the same, since the average of the positive values and the average of the negative values would be different for the two rounding methods. As to how you'd show that has an effect on signals, lets see if I can think of a scheme where it would have an effect ... Ah, I have one ... Consider the power in a series of random numbers rounded using round() versus convergent(). Given samples x[n], the power is an average of x[n]^2, or the square-root of this (if you want RMS). Since round() causes a slight bias in the positive and negative values, you should get a slight bias in the power measurement. So, round() and convergent() would give different power estimates ... but is the difference large enough to matter? It would depend on the variance of your power estimate; if you averaged for long enough (small variance), then yes the difference would matter. Cheers, Dave - Altera_Forum
Honored Contributor
Very good example. In fact I am just doing some work on power and PAR meter modules and certainly you are right, I am sort of dc-biased myself with direct processing of bipolar signals !!
Thanks a lot. - Altera_Forum
Honored Contributor
Hi Kaz,
--- Quote Start --- I am just doing some work on power and PAR meter modules --- Quote End --- Put yourself to sleep reading these then: http://www.ovro.caltech.edu/~dwh/carma_board/digitizer_tests.pdf (http://www.ovro.caltech.edu/%7edwh/carma_board/digitizer_tests.pdf) http://www.ovro.caltech.edu/~dwh/wbsddc/correlator_efficiency.pdf (http://www.ovro.caltech.edu/%7edwh/wbsddc/correlator_efficiency.pdf) --- Quote Start --- I am sort of dc-biased myself with direct processing of bipolar signals !! --- Quote End --- :) Cheers, Dave - Altera_Forum
Honored Contributor
Hi Kaz,
thanks a lot for yuor reply. I still has something unclear about "DC bias "and "Noise". Any clarification appreciated. In your table, how can "DC bias "and "Noise" for the 4 examples of truncation algorithms . Take the truncate algorithms for example, truncate -7/2 -3.5 -4 dc= -4+3.5= -0.5 Noise=??? -5/2 -2.5 -3 dc= -3+2.5= -0.5 Noise=??? -3/2 -1.5 -2 dc= -2+1.5= -0.5 Noise=??? -0.5 n/a0.5 n/a
3/2 1.5 1 dc= 1-1.5= -0.5 Noise=??? 5/2 2.5 2 dc= 2-2.5= -0.5 Noise=??? 7/2 3.5 3 dc= 3-3.5= -0.5 Noise=??? but how "noise" ???