Forums

Back to back CIC filters

Started by flutekick 4 years ago27 replieslatest reply 4 years ago151 views

Hi,

If I have to design a decimation filter for a 4-bit sigma-delta ADC, decimation factor say 6, I plan to split the filter into 2 stages of CIC filtering (first stage by 2 of order 3 and second stage by 3 of order 4). This can be done in single stage but separating into 2 will give me power benefits (first stage integrators can run at lower bit widths). My CIC structures will look like below.

First stage:

cic3_60911.png

Second stage:

cic4_10145.png

When these 2 are cascaded, can all the differentiators of first stage and 3 integrators of second stage be removed? Don't they cancel out? Though conceptually it seems fine, I am not able to prove it right in Matlab.The first stage integrators/differentiators are 7-bits wide and second stage will be all 14-bit wide. If we have to optimize by removing the differentiators and integrators, what would the bit widths of remaining integrator/differentiator be for second stage?

-Krishna


[ - ]
Reply by cfeltonApril 21, 2017

No the integrator (accumulators) and the comb sections do not "cancel" each other.  The pole in the integrator is cancel by the zero in the comb so you don't have infinite gain at DC.

[ - ]
Reply by Tim WescottApril 21, 2017

I'm pretty sure that's not true, or at least not in the way that you think.  You have \(\frac{z - 1}{z}\) cascaded with \(\frac{z}{z - 1}\), so the product is one.  So I'm pretty sure that from that point of view you should be able to eliminate all but one of the integrators in the middle.

Where I do see a problem, however, is in the differing bit widths of the two data paths -- AFAIK, the CIC overflow canceling magic only works if all of the integrators and differentiators in the filter are of the same width. 

If that's true, you could cancel out the three pairs of integrators and differentiators, but only at the cost of increasing your data path width at the front end.

I could be wrong on that -- hopefully if I am, someone will speak up.

[ - ]
Reply by gretzteamApril 21, 2017

Yes you can definitely do this. But as Tim pointed out in one answer, make sure you get the wordlength right. Draw the two filters in cascade, with the wordlength at each stage that you would normally use, and only then do the cancelling so you clearly see how many bits (and where) you have to add at the first stage after cancellation.

Just try it, it's easy enough. Your answer should be BIT-ACCURATE to the cascasde of two filters. Make sure you try with full scale DC signals etc...

For a more formal description, this is discussed in this rather old paper, they call it the 'merged structure':

Multirate Filter Design Using Comb Filters

http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumbe...

Very good read.




[ - ]
Reply by flutekickApril 21, 2017

Tim,


Absolutely. I was thinking the same, the bit-widths need to be same between integrators/differentiators. Hence, in theory what I have shown might make sense probably but not from implementation?


[ - ]
Reply by Tim WescottApril 21, 2017
I think it's time to grab a pencil and paper and work it out.  Or do some simulations.
[ - ]
Reply by flutekickApril 21, 2017

It works perfectly fine, if I operate the first stage integrator also with the same bit-width as the last stage differentiator.


[ - ]
Reply by flutekickApril 21, 2017

Hi cfelton,

I am talking about the differentiators of the 1st stage and integrators of 2nd stage. Isn;t it 

(1-z^-1)^3/(1-z^-1)^4 ?

Krishna

[ - ]
Reply by cfeltonApril 21, 2017

No, your math is incomplete (prematurely simplified) you either need
to include the multirate polyphase decomposition or use the
non-multirate equations, which would be:

$$ \left[ \frac{1-z^{-R_1}}{1-z^{-1}} \right]^{N_1} \cdot \left[ \frac{1-z^{-R_2}}{1-z^{-1}} \right]^{N_2} $$


Regards,
Chris

[ - ]
Reply by flutekickApril 21, 2017

The second integrator operates at the same rate as the differentiator of the first stage. So, the 1/(1-z^-1) is infact 1/(1-z^-R1).

[ - ]
Reply by cfeltonApril 21, 2017

@flutekick

No, you are mixing your understanding of the structure of the filter and the math, you are trying to take a short cut with the math.  Start with the equations I posted and purely via the math get to your claim and you will see if it will work or not - how do you reduce 1-z^{-R} to 1-z^{-1}?

[ - ]
Reply by flutekickApril 21, 2017

Hi Chris,


Could you help me with what is wrong with the math? Atleast what i was referring to is given below with simplied diagram. Let me know what is wrong in the below diagram. Highlighted the portion which I am mentioning can be cancelled out.

cic2cic_20487.png


[ - ]
Reply by Tim WescottApril 21, 2017

Y'know, when I'm dealing with a smart person who I think is wrong, and the discussion isn't proceeding, I often just go dark while I scurry off and try stuff out on my own.  Then I know for sure, and I can either report positive findings or say "oh, on reflection, you seem to be right!"

It should be easy to simulate what you're talking about in just about any language of your choice.  Then you can let us know your results (see my reply about word width, though).

[ - ]
Reply by cfeltonApril 21, 2017

The OP did try and simulate (stated "conceptually it seems fine, I am not able to prove it right in Matlab").  I think the OP would like a step-by-step proof if it should or should not work.

I have not done the math to prove yes or no but it seems to me you can't simply pull out that middle blocks and arbitrary try to cancel them because, in the math, the comb sections rely on the decimation, mathematically you can't separate them (I think).  If you move the decimate by A to the end you have to change the comb sections back to \(1-z^{-A}\).

If I truly thought something was there, my approach would be to try and rearrange the original equations to a form that is similar to my filter structure. 

[ - ]
Reply by Tim WescottApril 21, 2017

For the combs and integrators that he's talking about, the sampling rate is the same -- so from that perspective I not only see no reason why they can't be optimized out, I see no possibility that they can't be optimized out.

However, see my comments on word widths elsewhere -- I think that would be the killer, unless there was some economical way to compensate.

[ - ]
Reply by cfeltonApril 21, 2017

Yes, I concede you should be able to do the cancelling (seems the OP proved this via simulation, this thread needs time tags since it gets reordered by thumbs up).  I was the one not appreciating (comprehending) the math to structure :)

[ - ]
Reply by cfeltonApril 21, 2017

Wowzers, I cannot get the inline math to work :(

[ - ]
Reply by Tim WescottApril 21, 2017

slash open-paren, math, slash close-paren.

This may work:

\(\frac{z - 1}{z}\)

and

\(\frac{z - 1}{z}\) 


[ - ]
Reply by stephanebApril 21, 2017

Hi Chris! For some reasons, you had some html code (spans) around one of your ')'.  I removed the tags by editing the code of your post and now it looks like the inline math is working.

[ - ]
Reply by cfeltonApril 21, 2017

Thanks, that probably occurred because I went to the tips post and "copied" the inlined example instead of just typing it.  Good tip for the future, if I am having issues look at the raw HTML.

[ - ]
Reply by napiermApril 21, 2017

Hello,

The simple answer is no.  As someone else pointed out, you need matching integrators and differentiators so that the poles and zeros for a filter stage line up.

You are correct about cascading CIC filters.  It can be done to get a particular shape on your output.  About that, one of my favorite designs is a CIC followed by a half-band decimating filter.  The half-band response can be shaped to cancel out the CIC droop.  Also, the CIC can have delays in the stages so that one of the attenuation poles notches out an adjacent channel.  The CIC/half-band combo can give a very sharp cutoff response with a small (0.05 dB or less) pass band deviation.

Cheers,

Mark Napier


[ - ]
Reply by Rick LyonsApril 21, 2017
Hi flutekick. Good for you for asking such a sensible question. 

Chris Felton’s advice is good!  To think more about your question, reduce your two filters from 3rd-order to 1st-order.  Next move the two downsample steps over to the extreme right side of your block diagram, this will cause the comb (differentiator) delay lines to be expanded in length.  Now look at your new simple block diagram and see if it looks like the comb delay line of first stage and the integrator of second stage can be removed.

[ - ]
Reply by flutekickApril 21, 2017

Hi Rick,

Wouldn't that be equivalent to (1-z^-AB)/(1-z^-1) from the simplied diagram I have posted earlier?

Krishna

[ - ]
Reply by stephanebApril 21, 2017

Hi Krishna,

it looks like your images didn't make it. Can you try to edit your post and upload them again?

Stephane

[ - ]
Reply by flutekickApril 21, 2017

Hi Stephane,

Thanks for pointing out. I have uploaded them now.

Krishna

[ - ]
Reply by dszaboApril 21, 2017
I may be in the minority here, but I don't see anything wrong with what you're suggesting (if I understand correctly).  I also mocked it up in a spreadsheet and it worked fine. 
[ - ]
Reply by cfeltonApril 21, 2017

@dszabo the tides might be changing :)

[ - ]
Reply by dszaboApril 21, 2017

Totally, I think most of this discussion was posted while I was still typing!