USRP2 Halfband filter coefficients help

Hello folks,

I need to analyze the filter characteristics of two halfband filters in
USRP2. Since I have littel experience on Verilog HDL, I cannot pinpoint
what
exact coefficients the two halftband filters are adopting(I am reviewing
‘gnuradio/usrp2/fpga/sdr_lib/hb_dec.v’ and
‘gnuradio/usrp2/fpga/sdr_lib/small_hb_dec.v’ for hb1 and hb2.).

Would somebody help me with finding out the seven and thirty one
coefficents
of filters directly?

ILKYOUNG.

On Mon, Nov 9, 2009 at 11:20 AM, ILKYOUNG KWOUN [email protected]
wrote:

Hello folks,

I need to analyze the filter characteristics of two halfband filters in
USRP2. Since I have littel experience on Verilog HDL, I cannot pinpoint what
exact coefficients the two halftband filters are adopting(I am reviewing
‘gnuradio/usrp2/fpga/sdr_lib/hb_dec.v’ and
‘gnuradio/usrp2/fpga/sdr_lib/small_hb_dec.v’ for hb1 and hb2.).

Would somebody help me with finding out the seven and thirty one coefficents
of filters directly?

From the comments in the header and the frequency response, these seem
to be the coefficients:

h = [ -107 0 445 0 -1271 0 2959 0 -6107 0 11953 0 -24706 0 82359
131072 82359 0 -24706 0 11953 0 -6107 0 2959 0 -1271 0 445 0 -107 ] ;
h_small = [ -10690 0 75809 131072 75809 0 -10690 ] ;

Does that make sense to you? Inner and outer coefficients? The
comments at the top of the file?

Brian

Thank you so much, Brian.

It saves a lot of time for me.

I don’t have any idea for the outer and inner coefficients. But it seems
that the sequence is 'Outer - Inner - 131072( = 0.5 * 2^18) - Inner -
Outer.
I can keep going for the analysis with this result.
It seems that the ‘inner’ and ‘outer’ coefficient things are related to
the
implementation of FIR filter. But I haven’t seen them in my DSP books.
:frowning:

Gotta google the things soon. :slight_smile:

Regards,

ILKYOUNG

2009/11/10 Brian P. [email protected]

Hi

I think Brian is just referring to the fact that you can see that the
HBFs are implemented as symmetric FIR filters (the coefficients). A
HBF is just a special filter that is designed so that the cutoff
frequency will always be at fs/2, so if you filter with it and
decimate by 2 afterwards (which is why you would use an HBF), you
don’t get aliasing. Also, the decimation in the CIC filters can be
set to a wide range of values, so the HBF will always have to cut at
fs/2 regardless of the decimation in the CIC. From what I’ve read,
Goodman and Carey came up with them so you can probably look for some
papers if you’re interested.

Sebastiaan


Sebastiaan H.
Radar Remote Sensing Group, University of Cape Town, South Africa
Tel: +27 72 950 9370

Hello, Sebastiaan,

Thank you for your advice. Actually I am aware of basic characteristics
of
half band filter. It is very well explained in Rick Ryon’s
“Understanding
Digital Signal Processing (2nd Ed.)” (

)

The thing I do not have any clue is the ‘inner’ and ‘outer’ coefficient
things in FIR filter. I guess this is something related to the practical
implementation issue rather than the fundamental concept. I did a simple
googling yesterday and found a paper. (
http://ce.et.tudelft.nl/publicationfiles/1090_509_shahbahrami_prorisc2005.pdf)
I hope I can find a way to get started. :slight_smile:

I will also try with ‘Goodman’ and ‘Carey’ as keywords for further
searching. I appreciate your comment and advice.

Best regards,

ILKYOUNG.

2009/11/10 Sebastiaan H. [email protected]

Ilkyoung Kwoun-

http://ce.et.tudelft.nl/publicationfiles/1090_509_shahbahrami_prorisc2005.pdf)
I hope I can find a way to get started. :slight_smile:

Here is a Hypersignal log-magnitude plot showing the frequency response
of the two halfband filters (31-tap in blue,
7-tap in red):

http://www.signalogic.com/images/gnu_radio_halfband_filters.jpg

In the plots I used an arbitrary sampling rate of 25 MHz – don’t know
what you’re using. Note that both filters have
an approx -6 dB point at Fs/4 as would be expected due to halfband
symmetry properties.

As for “inner and outer” mention in the Verilog code, I might guess that
refers to 2 multiplies needed when filtering
a complex signal. As for why there are two (2) filters, one is used for
higher rate up/down conversions and the other
for lower rate. Firas’ documentation has some information on this…
also here is Q&A exchange between Firas and Matt
that might help you out:

http://old.nabble.com/Some-USRP2-Questions-td20729711.html

-Jeff

I will explain the RX side, the TX side is basically the same.

small_hb_dec is the short filter which works at the higher rate. There
are 2 of them instantiated, one for I and one for Q. It has 7 taps.
One of those taps is the center tap which only requires a shift and not
a multiply, and 2 of those taps are zeros. That leaves 4 taps. The
taps are symmetric, which leaves 2 multiplies per output. Since we have
at least 2 cycles to produce each output, we can use a single
multiplier.

hb_dec is 2nd halfband filter and it works at the lower rate. There are
2 of them instantiated, one for I and one for Q. It has 31 taps. One
of those taps is the center tap which only requires a shift and not a
multiply, and half of the remainder are zeros. That leaves 16 taps.
They are symmetric, so that means we need to do 8 multiplies to produce
each output. There are at least 4 cycles to produce each output, so we
need to do 2 multiplies at a time.

One of those multipliers does the “outer” coefficients, meaning the ones
at the very beginning and end of the impulse response, and one does the
“inner” coefficients, meaning the ones around the center of the impulse
response. This division is purely an implementation choice, and does
not affect the output. I could have put the odd ones on one mult and
the even ones on the other, or any other split you could imagine. It
doesn’t matter.

Matt

Hi

I can help a bit with the implementation of the one HBF. It has
31taps, of which every second one, apart from the center one is zero.
the center one is scaled relative to one (2^18 on the FPGA). In total
there is therefore (16+the center one) non-zero taps. This requires 8
multiplications (because of the symmetry, we can simply add the 1st
and 31st,3rd and 29th values,etc. and then multiply by the appropriate
tap value. For the center tap,we just need to bit-shift the sample at
that position appropriately.

Hope this helps a bit.

Sebastiaan

Thank you folks,

Jeff, thank you for your snapshot. I modified Firas’ MATLAB m file(
http://www.nabble.com/file/8506/usrpddc.m) to get similar picture. :slight_smile:

Sebastiaan and Matt, thank you for your kind explanation. Now, I get it
clearly. :slight_smile:

Regards,

ILKYOUNG.

2009/11/12 Matt E. [email protected]