
From:  Bruce McGuffin 
Subject:  Re: [Discussgnuradio] HalfBand Filter Module Output Clipping? 
Date:  Thu, 3 Sep 2009 09:13:40 0400 
Useragent:  Thunderbird 2.0.0.22 (X11/20090625) 
Matt Ettus wrote:
Bruce McGuffin wrote:HiI've been looking at the USRP2 filter characteristics, to see if it will work for me. After going through the halfband filter code (hb_dec.v from gnuradio 3.2) I understand what the filter coefficients are, but I havea question about the output from this module.Near the end of the module the filtered data is clipped and rounded in lines 152153:...
So I'm curious. If the final sum fit into 20 bits, why were the accumulation andIt looks to me like final_sum_unrounded is 25bits long, so the input to final_round is the 20 LSBs of final_sum_unrounded (final_sum_unrounded[19:0]), and the output final_sum is those 20 bits rounded to 18 bits in the usual way. But this data is two's complement, so clipping the 5 MSBs from final_sum_unrounded can drasticaly change the data value, for example changing both the sign andmagnitude, even when the magnitude of final_sum_unrounded < 2^17. What am I missing here?Based on the coefficients, we can guarantee that the final sum will have a magnitude which fits in 20 bits, including the sign bit. We can just drop those extra sign bits, since they'll all be the same.Matt
following sum carried out with 24 or 25 bits? Bruce
[Prev in Thread]  Current Thread  [Next in Thread] 