LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cic fix point filter

Solved!
Go to solution

Hey guys,

 

I have the attached CIC filter. This one is in fix point format. I have the same CIC filter structure in integer format and there it works well.

Here some info:

 

Inputwidth = 24bit

Rate factor = 512

Stage/Order = 1

Differential Delay = 1

maximum bitgrowth for this setup: 32 Bits =  [Order*log2(Rate*Delay) + Inputwidth - 1]

Outputwidth = 32 bit

CICfxp.PNG

 

 

I hope you guys can help me.

 

Kind regards

Slev1n

 

0 Kudos
Message 1 of 14
(5,234 Views)

I forgot to mention the problem: The value is not stable.Actually I want to retain the DC value but the DC is value after the CIC is extremly volatile

0 Kudos
Message 2 of 14
(5,200 Views)
Solution
Accepted by topic author Slev1n

It looks like your adder is probably overflowing. Its output is configured to grow to the right (gaining more fractional bits), whereas your integer implementation probably had enough room for bit growth on the left. So instead of configuring the add to increase fractional bits (from <s, 24, 1> to <s, 36, 1>, the corresponding bit growth on the left would result in <s, 36, 13>. Then you would need to configure the subtract the same way.

 

I'm not sure how that maps to your requirements of 32 max bitgrowth and 32-bit output, but that's the general idea.

Message 3 of 14
(5,173 Views)

Hey Lewis,

 

thanks for your answer.

 

So you think I should configure the output as I36.13 so that the bits can grow to the left and not the fractional bits are growing. I will try it.

I am configuring it to 36 bits altogether, because maybe I want to increase the decimation rate and therefor the bitgrowth would increase,too.

 

kind regards

 

slev1n

0 Kudos
Message 4 of 14
(5,097 Views)

Ok,

 

my setup is the following: I24.1 goes into my first CIC filter. Adder and subtractor are configured as I36.13, so the output is I36.13 Then I convert it into I36.1 (bit shift) and after that back into I24.1. The I24.1 goes into the second CIC filter and the same conversions are performed.

I know, that I loose some precision when I convert from I36.1 to I24.1 but I can safe resources.

 

Could you explain me why a bit growth to the left is better?

 

Any further suggestions are welcome!

 

kind regards

 

Slev1n

0 Kudos
Message 5 of 14
(5,083 Views)

Hi Slev1n,

 

It's been quite a while since I worked with CIC filters, so my comments are just based on the characteristics of fixed-point adders and subtractors--they can never introduce extra fractional bits, but may grow to the left as they accumulate large numbers of values. So your original VI is adding extra fractional bits that can never be populated. Presumably the integer version is working because your input data is small enough that the integrator can't overflow (so it's inherently padded on the left).

 

My understanding of the CIC is that you would ultimately want to reduce your width back down by extracting the desired number of MSBs at the output, based on the expected bit growth. If you have this working for integers, that would be a good starting point--I can help you produce an exactly equivalent FXP design, then we can look at scaling it to whatever input/output FXP data types you need.

 

Jim

0 Kudos
Message 6 of 14
(5,064 Views)

Hej Jim,

 

I think I got the point with the growth to the left.

 

I am going to compare two types of CIC fix point filters:

cic stages.PNG

From the FIFO I get I24.1 in the first conversion I try I32.1 or I24.1 (as mentioned in my previous post). The output of the CIC filter is I36.13 as both subvis are equal, I have to convert back to I32.1 or I24.1. After the second CIC I just noticed that I only have to bitshift from I36.13 to I36.36 and then convert into I64. I have to change this 🙂

The equation for the total bit growth is the following: Bmax=[N*log2(Dec2)+(N*log2(Dec1)+Bin-1)-1]

 

The first impression, is that the I32.1 version is pretty good and has a small error.

 

Thank you a lot for your offer. At the moment, I think it works pretty well due to your help and I will leave it as it is so far 🙂

 

But maybe you can have a look at my exponentially weighted moving average fix point filter: http://forums.ni.com/t5/forums/replypage/board-id/170/message-id/916531

I still have issues with the stability...

 

kind regards

 

Slev1n

0 Kudos
Message 7 of 14
(5,039 Views)

Hey guys,

 

I just read about the pruning technique from Hogenauer. http://www.dsprelated.com/showcode/269.php

 

Q1:

Can someone tell me how many LSBs I can truncate after my first integrator and after my comb?

Setup:

Bin=24

Bout=24

dif delay = 1

Stages = 1

Rate factor = 2048

 

Q2:

I wanted to see what happens if I use such a high rate factor (8192) that there are not enough bits. R=8192 => Bout = 37 bits but my Integrator only has 36 bits.

Why is it still working?

Has it something to do with the sign bit? Labview says 36bits but actual it's 36bits (number represantation) +1sign bit =  37bits?

 

greetz Slev1n

0 Kudos
Message 8 of 14
(4,961 Views)

Hey guys,

 

although the I32.1 version works pretty good. I would still prefer having I24.1 but just truncating the LSBs between the two CIC filter is not the proper way to do it.

I'd like to use Hogenauers "bit pruning technique". Also explained by Uwe Meyer-Baese I still cant figure it out where to truncate the bits: prune technique by Hogenauer

I dont understand how to calculate the power gain P^2 at a certain point/position in the filter.

 

My setup so far:

N=1 (#stages --> 1 integrator and 1 comb)

D=1 (differential delay)

R=2048 (will be my maximum rate change factor, but can be a lower power of 2)

Bin=24 bits

Bout = 24 bits

 

Maybe someone can explain the technique to me with my setup as example 🙂

 

EDIT:

Q1: Maybe someone can tell me, why my CIC is giving reasonable values although I try a rate change of 16384 which would cause Bout=38 and my first integrator is I13.36 (36bit width)?

Q2: Is a I32.1 fxp number 32bit long or 33bit long because of the sign bit?

 

 

kind regards

 

Slev1n

0 Kudos
Message 9 of 14
(4,995 Views)

Q1 of my EDIT has to be changed!

 

 

For the "I24.1 version" of my CIC Bin=24 and if rate factor of CIC1 is 16384 the values are not plausible.

If I distribute the 16k over both CIC filters it works.

(8192 is the last working rate factor for one of the CIC filters alone, although Bout=37bits...)

 

 

For "I32.1" Bin=32: here 4096 is the last working rate factor for each cic filter; I get Bout=44bits)

I dont have a clue, why the filters are still working. Both versions have 36bits as width for the integrator and comb...

0 Kudos
Message 10 of 14
(4,986 Views)