Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 22, 2024, 10:07:30 22:07


Login with username, password and session length


Pages: [1]
Print
Author Topic: FPGA Fractional Interpolator ...  (Read 6008 times)
0 Members and 1 Guest are viewing this topic.
debugasm
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 37
-Receive: 298


« on: December 03, 2017, 08:04:28 08:04 »

Hello friends,

I need a little help, if someone is able. I have to design a "Fractional Interpolator Filter" for interpolate signal from "1.0 to 2.0" to bring Fsymbol to Fdac. Naturally with the use of minimum hardware resources.

I have Spartan 6 LX 150 with 100 MHz clock. I have just read and test "XAPP936 - Continuously Variable Fractional Rate Decimator" that which also offers interpolator, but it does not work as I would have expected. I also took a look at Altera but uses the same techniques. I have read many PDFs but I have not yet figured out how to do it.

I also found an interesting link but it is paid :

A practical design of digital fractional sample rate conversion

I would like to do something like this, with same resource :

Upsampler

If someone gave me help I would be very happy.

Thanks very much.

debugasm
Logged

Friends see each other at the time of the reboot.
Gallymimu
Hero Member
*****
Offline Offline

Posts: 704

Thank You
-Given: 152
-Receive: 214


« Reply #1 on: December 03, 2017, 08:44:23 08:44 »

What are your requirements?  Dynamic range/resolution? speed? input range? what end accuracy do you need? Can you describe mathematically what you are trying to do?  Does this need to be fixed point or floating point, or q16, q32?
Logged
debugasm
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 37
-Receive: 298


« Reply #2 on: December 03, 2017, 09:53:17 09:53 »

Here is what is required :

Quote
What are your requirements ?

Interpolation from 1.0 to 2.0, variable or fixed.

Code:
DVB-T example (Fdac = 100 MHz)

9.142857143 MHz ---> x2 ---> 18.28571429 MHz ---> x2 ---> 36.57142857 MHz ---> x2 ---> 73.14285714 MHz ---> x1.367187500 ---> 100 MHz
8.000000000 MHz ---> x2 ---> 16.00000000 MHz ---> x2 ---> 32.00000000 MHz ---> x2 ---> 64.00000000 MHz ---> x1.562500000 ---> 100 MHz

Half-Band interpolation x8 plus "Fractional rate" of 1.367187500 or 1.562500000

Quote
Dynamic range/resolution

At least 60dB with I/O at 14 or 16 bit.

Quote
Speed

Fdac (output sample) 100 MHz.

Quote
Input range

Fixed Point 16.15 or 14.13 (-1.0 / +0.999...)

Quote
Can you describe mathematically what you are trying to do

Fractional interpolation. Fractional Delay, Farrow Filter, change input sample rate at fixed ratio to other sample rate with not integer interpolation.

Quote
Does this need to be fixed point or floating point, or q16, q32

Fixed Point 16.15, 15.14 or 14.13, I'd rather 16.15.

Did I forget anything ?

Thanks very much.
« Last Edit: December 03, 2017, 09:55:26 09:55 by debugasm » Logged

Friends see each other at the time of the reboot.
Signal
Active Member
***
Offline Offline

Posts: 200

Thank You
-Given: 113
-Receive: 81



« Reply #3 on: December 04, 2017, 02:46:49 14:46 »

I need a little help, if someone is able.
It depends on what kind of "a little help" do you need? Do you suppose to find ready to integrate solution for your chip?

Quote
I have read many PDFs but I have not yet figured out how to do it.
Share with us the current state of your understanding of theory behind interpolator you are going to implement. It would help to optimize our efforts.

For me that theory is quite straightforward. The same is true for implementation. When I needed interpolation I just did not bother with sources made by someone else for tasks that were not mine and wrote just another one that fitted my case from the beginning. That is the activity engineers are naturally supposed to, isn't it?

I'd like (and ready) to talk about theory of interpolation and to clarify practical moments shaded for you because I like this mathematics. But I need to know the current state of understanding. Just not to receive "I already know that stuff!" ;).

Logged

Give a right name to a right game and play it right
debugasm
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 37
-Receive: 298


« Reply #4 on: December 04, 2017, 04:18:53 16:18 »

Quote
... integrate solution for your chip ...

We are not in Alice world, but finding an ipcore already done would be great.

Quote
... your understanding of theory behind interpolator you are going to implement ...

Really be very limited, I've never needed to build one so I ignored the existence.

Quote
For me that theory is quite straightforward. The same is true for implementation. When I needed interpolation I just did not bother with sources made by someone else for tasks that were not mine and wrote just another one that fitted my case from the beginning. That is the activity engineers are naturally supposed to, isn't it?

In fact it is as you say. I have given the example for a practical application, but the fractional interpolator should be generic and therefore interpolate from x1.0 to x2.0.

My starting point is this:

Continuously Variable Fractional Rate Decimator Application Note

Example

The document only explains the decimator, but the interpolator is also present in the package.

Any help is very welcome: both theoretical and practical above all.

Thanks very much.
Logged

Friends see each other at the time of the reboot.
Signal
Active Member
***
Offline Offline

Posts: 200

Thank You
-Given: 113
-Receive: 81



« Reply #5 on: December 05, 2017, 06:59:23 18:59 »

Really be very limited, I've never needed to build one so I ignored the existence.
You answer me nothing, don't you think?

I have given the example for a practical application, but the fractional interpolator should be generic and therefore interpolate from x1.0 to x2.0.
Generic is not practical, because generic has no specifics, and without specifics all we can get is very impractical or only theoretical at the best.

There are different applications of interpolators. Some of them requires minimal delay, some - only precise linear phase.
For some implementations an amount of memory or multiplications could be main constraints, while for others - amount of noise is more important.
Do you need sinc to "generically" "reproduce" whole frequency range of original signal or your useful signal is inside 0:0.4Fs range?
Especially after first stage of interpolation (2 times for example) your "generic" interpolator has to interpolate significantly lower-frequency signal (relatively) that is easier (many times). Different combinations of stages are optimal for different criterions.
I expect that some of above statements are out of your understanding. It's ok. I have just gave some examples of specifics - you can not get working something without them. In other words - general is not real.
(For your case I think linear phase FIR is what you need.)

My starting point is this:
This document is not suited for complete newbie.
Do you understand Figure 1 or Summary causes difficulties?

"In general" any interpolator is a low pass filter after upsampler as shown on Figure 6 in mentioned document. Do we need to talk about it deeper or should we move further?
Can you imagine how signal looks in frequency domain after upsampler? and in time domain?

Without meaningful answer all I can is to give lectures or search for list of literature. Lectures - too much efforts, composing list - boring, especially if your are not going to read ;).

If you like here is the short review. That could be useful but also requires some background.
http://users.spa.aalto.fi/vpv/publications/icassp00-fd-slides.pdf

if a background is completely missing then you should plan to spend couple of days (or maybe some more) reading a book with unhurried thinkings. After problem becomes clear from theoretical point of view an implementation will be obvious.

Your turn if you like



Logged

Give a right name to a right game and play it right
debugasm
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 37
-Receive: 298


« Reply #6 on: December 06, 2017, 08:03:15 08:03 »

Sorry for my poor english.

Quote
You answer me nothing, don't you think?

Actually you're right. Unfortunately I am not an engineer and many mathematical aspects that perhaps need to understand this thing I do not know them and I am not master of them. Normally in these cases I get a lot of good will and determination to reach the goal. Many times I can but in this case I need a little shove from people, maybe engineers, who understand more than me.

Quote
Generic is not practical, because generic has no specifics, and without specifics all we can get is very impractical or only theoretical at the best.

I perfectly agree with you, the thing must be well specified, as I did in some previous post.

Quote
Do you need sinc to "generically" "reproduce" whole frequency range of original signal or your useful signal is inside 0:0.4Fs range?

My signal is in the range 0:0.4Fs, more exactly 0:0.42Fs.

Quote
Especially after first stage of interpolation (2 times for example) your "generic" interpolator has to interpolate significantly lower-frequency signal (relatively) that is easier (many times).

I start with a symbol rate of "64MHz / 7" (Fs) and I have to reach 64 MHz or 100 MHz that is a frequency of DAC (Fdac). My first step is to reach an interpolated Fs frequency that allows me to reach the Fdac frequency with fractional interpolation from 1.0 to 2.0.

For 64 MHz Fdac do an x4 interpolation using two Half-Band filters subsequently I therefore need a fractional interpolation of 1.75
For 100 MHz Fdac do an x8 interpolation using two Half-Band filters subsequently I therefore need a fractional interpolation of 1.3671875

Quote
I expect that some of above statements are out of your understanding.

Exactly.

Quote
(For your case I think linear phase FIR is what you need.)

I trust your assessment blindly.

Quote
This document is not suited for complete newbie.

I am not a complete beginner, as I said, I am quite in this field. To give you an example I read these articles in depth and I think I understand 80% of what is written, leaving out the inversion of matrices or other obscure mathematical aspects for me.

Digital resampling by using polynomial interpolation. Farrow filter
Using Farrow filter on the basis of piecewise cubic polynomial interpolation for digital signal resampling
Farrow Filter of Signal Digital Resampling on the Basis of Spline Interpolation
Using Farrow Filter of Signal Digital Resampling on the Basis of Spline Interpolation

Quote
Do you understand Figure 1 or Summary causes difficulties ?

I understand very well the figure, but of all this figure I'm interested only in the central part: "Fractional Resampler".

Quote
"In general" any interpolator is a low pass filter after upsampler as shown on Figure 6 in mentioned document. Do we need to talk about it deeper or should we move further?

Being very clear, up to this point I have no problems, you can proceed safely.



Quote
Can you imagine how signal looks in frequency domain after upsampler?

In the frequency domain I have many replicated "Base Bands" at intervals of the sampling rate.

Quote
and in time domain?

In the time domain, between a sample of the main signal and the next, I have so many "Zeros" how much interpolation I have adopted.



Thank you very much for the short review, I read many of them beyond this.

Quote
if a background is completely missing then you should plan to spend couple of days (or maybe some more) reading a book with unhurried thinkings. After problem becomes clear from theoretical point of view an implementation will be obvious.

I bought and read this : The Scientist and Engineer's Guide to Digital Signal Processing

I should not be very far.

I read you very willingly, if you want to continue and have time to dedicate I would be happy. One day or the other I will know how to return the favor.

Thanks very much.
Logged

Friends see each other at the time of the reboot.
Signal
Active Member
***
Offline Offline

Posts: 200

Thank You
-Given: 113
-Receive: 81



« Reply #7 on: December 06, 2017, 10:56:28 10:56 »

I read you very willingly, if you want to continue and have time to dedicate I would be happy. One day or the other I will know how to return the favor.
Great. I still do not know exactly (only guesses) what problem do you have in understanding, but it seems that you are very close to complete mission. Lately today I will try to move the edge further. The only favor I wait is a successful cooperation (in current thread) in studying the thing that I love. I mean the interpolation thing Wink
Logged

Give a right name to a right game and play it right
debugasm
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 37
-Receive: 298


« Reply #8 on: December 06, 2017, 01:02:41 13:02 »

Quote
...but it seems that you are very close to complete mission.

Excuse me but it does not seem to me at all ...  Shocked ...

Quote
The only favor I wait is a successful cooperation (in current thread) in studying the thing that I love.

So guys cooperate, thank you ...  Grin ...

Thanks again for all the help.
Logged

Friends see each other at the time of the reboot.
Signal
Active Member
***
Offline Offline

Posts: 200

Thank You
-Given: 113
-Receive: 81



« Reply #9 on: December 06, 2017, 09:31:14 21:31 »

debugasm, in order to find the exact point that is not clear for you I offer the following quiz that will narrow uncertainty.

Do you understand what is on this figure? Can you explain it?


What good news do you see in green line from figure above in connection with frequency response of Farrow filter on figure below?

Why these curves (above) are so fancy? (the answer could be in one sentence)

Can you name what is depicted on the following figure by a) black stems; b) red stem; c) dashed curve?


What happened between с and d?


And the last two questions for today.

Do you know what is the difference between and possible connection of interpolation of signal samples and interpolation of FIR filter coefficients?

I see that interpolation by 2 times is clear for you. How about interpolation by 1.5 (3/2)? Is it still easy? Can you draw the corresponding figure for that case like the first one in this post?
(You can open my png file in draw.io as a template if it helps)
« Last Edit: December 07, 2017, 12:56:52 12:56 by Signal » Logged

Give a right name to a right game and play it right
debugasm
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 37
-Receive: 298


« Reply #10 on: December 07, 2017, 08:45:28 08:45 »

Signal, give me some time ...  Embarrassed
Logged

Friends see each other at the time of the reboot.
Signal
Active Member
***
Offline Offline

Posts: 200

Thank You
-Given: 113
-Receive: 81



« Reply #11 on: December 07, 2017, 10:00:08 22:00 »

I start with a symbol rate of "64MHz / 7" (Fs) and I have to reach 64 MHz or 100 MHz that is a frequency of DAC (Fdac). My first step is to reach an interpolated Fs frequency that allows me to reach the Fdac frequency with fractional interpolation from 1.0 to 2.0.

I do not see strong requirements for Farrow filter here - any fractions with the same structure. Additional benefit of that structure - less constants (for filter coefficients) to store.

You can consider another way reffered as Polyphase filters. I expect that you do not know yet what "phase" are about. "Polyphase" is not about core concept but about the way of optimizing calculations. For now let start from concept.

Right now you need two interpolators with rational factors:
a) 64/(64/7) = 7 = 175/25,
b) 100/(64/7) = 175/16.

Filter for variant a):


For both variants a) and b):


It is worth to know that both filters looks the same in time domain. "Red" one is interpolated "blue" or the same way - "blue" is decimated "red".


Both interpolators can share the same filter coefficients ("a" uses only 25th part of them):



To reduce number of FIR coefficients to store there are two ways.
First - to ease task for filter by passing part of burden to another stage:


Then "green" filter becomes shorter than "red" but have two times more input data.


Second way - to interpolate filter coefficients for each output sample. That trades calculation for memory.

Interesting note:
in Farrow structure there also are hidden recalculations of coefficients of very short filter (4 input samples) for each output sample. That somehow similar result was obtained developing from different point of view.

The remaining step is to describe "phases" as approach of handling many regular zeros at filter's input in combination with throwing away most of samples from filter's output by followed decimator.

I still wait for your turn ...
Logged

Give a right name to a right game and play it right
debugasm
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 37
-Receive: 298


« Reply #12 on: December 08, 2017, 12:47:09 12:47 »

Answer the previous post.

Quote
... in order to find the exact point that is not clear for you I offer the following quiz that will narrow uncertainty ...

Definitely the best way to learn, thanks for your help.

Quote
Do you understand what is on this figure ? Can you explain it ?



I think understand it with reasonable security. You can see the base band frequency spectrum (in green) with the respective possible Half-Band filter : x2 in blue, x4 in red and x8 in green.

Quote
What good news do you see in green line from figure above in connection with frequency response of Farrow filter on figure below ?



The good news is about magnitude and group delay, that is very good, up to 0.4 (the band of our interest) at all interpolation rates from 0.0 to 1.0.

Quote
Why these curves (above) are so fancy? (the answer could be in one sentence)

It's fantastic.

Quote
Can you name what is depicted on the following figure by a) black stems; b) red stem; c) dashed curve ?



(a) black stems is original sample point
(b) red stem is sample of signal I want to get on reconstructed signal that is not present
(c) dashed curve is the reconstructed signal from original sample point

Quote
What happened between с and d ?



The distance of the sample points in "black" is fixed, as is the distance of the sample points on the "red". The red points are slower than those in blacks and two black samples have passed without any red samples.

Quote
Do you know what is the difference between and possible connection of interpolation of signal samples and interpolation of FIR filter coefficients ?

Honestly, the answer is not immediate as it could be for you. You can explain it to me simply ?

Quote
How about interpolation by 1.5 (3/2)? Is it still easy?

No, not easy. It is not yet clear.

Quote
Can you draw the corresponding figure for that case like the first one in this post ?

I can draw it in the time domain, but for me it is not clear in the frequency domain.



Signal, your last post is definitely interesting ...  Shocked ...

What is most obscure remains is how to interpolate 175 times !!!!



With input sample of 64/7 MHz (9.142857... MHz) and an interpolation of 175 would get a frequency of 1600 MHz ... Shocked ... the real device can not work at this speed ... this is what I still do not understand clearly.



Could you dwell more on this point ? The fact of reaching this frequency is only mathematically but practically how do you proceed ?

If I later wanted to change the interpolation ratio without modifying the interpolator structure, is it possible to do it simply ?

Two working mode (either one or the other not both):

First with 64 MHz (select two mode):

a1) 64/7 MHz ----> 64 MHz
a2) 64/8 MHz ----> 64 MHz

Second with 100 MHz (select two mode):

a1) 64/7 MHz ----> 100 MHz
a2) 64/8 MHz ----> 100 MHz

The thing is becoming very interesting but I still have no clear how to continue.

debugasm
Logged

Friends see each other at the time of the reboot.
Signal
Active Member
***
Offline Offline

Posts: 200

Thank You
-Given: 113
-Receive: 81



« Reply #13 on: December 08, 2017, 07:50:27 19:50 »

> Do you understand what is on this figure ? Can you explain it ?
I think understand it with reasonable security. You can see the base band frequency spectrum (in green) with the respective possible Half-Band filter : x2 in blue, x4 in red and x8 in green.
Here is more verbose version of the same figure. It illustrates three cascades of interpolators by 2:


You need to note two things:
1) Interpolator by two does not have to use Halfband filter. Moreover Halfband filter is not always the optimal choice (another story). The only advantage of Halfband filter - half or its coefficients are zeros. Even from computational point of view that does not always mean that it will be more efficient for your certain requirements. For further information: https://se.mathworks.com/help/dsp/examples/fir-halfband-filter-design.html?requestedDomain=www.mathworks.com
2) Filters on different cascades could be different - and even should be different for efficiency.

>Why these curves (above) are so fancy? (the answer could be in one sentence)
It's fantastic.
Polynomial interpolation is suitable for slow changing signal inside observed scope.

>What happened between с and d ?

The distance of the sample points in "black" is fixed, as is the distance of the sample points on the "red". The red points are slower than those in blacks and two black samples have passed without any red samples.
To get an "a" an interpolation filter uses x0, x1, x2, x3,
for "b" it uses x1, x2, x3, x4,
for "c" - x2, x3, x4, x5,
for "d" - x4, x5, x6, x7,
for "e" - x5, x6, x7, x8.
It could be said that for next output sample "d" an accumulator used for calculation of "x" indexes overflows over corresponding modulus.

> Do you know what is the difference between and possible connection of interpolation of signal samples and interpolation of FIR filter coefficients ?
Honestly, the answer is not immediate as it could be for you. You can explain it to me simply ?
I expected a short answer that could be a sign of understanding. Much more words are required to reach that understanding. It is not optimal to spend time for it right now. Especially because I think that it is somehow cumulative understanding that will become clear itself later on this way.

> How about interpolation by 1.5 (3/2)? Is it still easy?
No, not easy. It is not yet clear.
> Can you draw the corresponding figure for that case like the first one in this post ?
I can draw it in the time domain, but for me it is not clear in the frequency domain.

I hope that the following figure will help:


You should practice in drawing such diagrams if you want to get it. How about interpolator with factor 5/3?

What is most obscure remains is how to interpolate 175 times !!!!
With input sample of 64/7 MHz (9.142857... MHz) and an interpolation of 175 would get a frequency of 1600 MHz ... Shocked ... the real device can not work at this speed ... this is what I still do not understand clearly.
Could you dwell more on this point ? The fact of reaching this frequency is only mathematically but practically how do you proceed ?

Aha! We finally catch it!
I suppose that you are programmer. Imagine that you have a stream of data (samples) where only one of each 175 samples is not zero. How do you think, do you need to allocate memory to store all these zeros and perform actual computations upon them? I am curious is this clue enough for you?

If I later wanted to change the interpolation ratio without modifying the interpolator structure, is it possible to do it simply ?
It depends on what do you mean as structure. For example polyphase interpolator that uses one upsampler, one filter and one decimator could be coded as "one function" implementation for any factors:
Code:
out_samples_num = Resampler(
    internal_resampler_context,
      up_factor,
      down_factor,
      filter_coefficients,
      filter_length,
      filter_memory,
    input_data,
    input_data_size,
    output_data_buf);
In that case for different factors you need different filters, but the same code.

Posted on: December 08, 2017, 08:26:43 20:26 - Automerged

Two working mode (either one or the other not both):
First with 64 MHz (select two mode):
a1) 64/7 MHz ----> 64 MHz
a2) 64/8 MHz ----> 64 MHz
Second with 100 MHz (select two mode):
a1) 64/7 MHz ----> 100 MHz
a2) 64/8 MHz ----> 100 MHz

(64/7) * (25/16) * 7 = 100
(64/8) * (25/16) * 8 = 100
(64/7) * 2 * (25/32) * 7 = 100
(64/8) * 2 * (25/32) * 8 = 100
(64/7) * 2 * (25/16) * (7/2) = 100
(64/8) * 2 * (25/16) * (8/2) = 100
(64/7) * 2 * (7/2) = 64
(64/8) * 2 * (8/2) = 64
(64/7) * 7 = 64
(64/8) * 8 = 64

Interpolators by 7/2 and 8/2 (and maybe 7 and 8) could share the same filter (the filter that passband is determined by factor 7 case while stopband - by factor 8 case). I expect non-significant compromise comparing with specialized filters for 7/2 and 8/2 factors. The wider gap between passband and stopband - the less tradeoff.

Note that interpolators with the same factor but in different lines above has different filters because of different input signals because of different processing stages before.

And I did not say that you can not use Farrow filter or other type of polynomial interpolation on last stage. The choice has to be done after careful comparison of all variants under given target restrictions.
Logged

Give a right name to a right game and play it right
debugasm
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 37
-Receive: 298


« Reply #14 on: December 09, 2017, 11:13:46 11:13 »

Signal your knowledge of the subject is surprising. I envy you very much. I feel very well your passion in this matter and I consider myself lucky to hear you speak. I have a lot, a lot to learn and I'm glad I met you. I promise you that I will try to annoy you as little as possible. I apologize in advance for any stupid question I do. Thanks so much.

First of all I have to say that you are also very good at drawing graphics and making the idea very well with drawing. I'm not as good as I am. The graphs are very clear and simple.

Perhaps I should start from this point: draw my idea in a simple and clear way, maybe 50% of the work takes place at this point.

We come to the point.

Quote
1) Interpolator by two does not have to use Halfband filter. Moreover Halfband filter is not always the optimal choice (another story). The only advantage of Halfband filter - half or its coefficients are zeros. Even from computational point of view that does not always mean that it will be more efficient for your certain requirements. For further information: https://se.mathworks.com/help/dsp/examples/fir-halfband-filter-design.html?requestedDomain=www.mathworks.com

Most of the time I use the Half-Band filter, because for its structure it uses much less resources than another type of filter. Half of the coefficients is zero and the are symmetric, therefore it needs half of the multipliers. This was the main reason.

Quote
2) Filters on different cascades could be different - and even should be different for efficiency.

I agree, but until now efficiency was the least of my problems.

Quote
Polynomial interpolation is suitable for slow changing signal inside observed scope.

If I understand correctly it turns out to be good up to 0.4 * Fs. This is considered a slow signal. I am wrong ?

Quote
What happened between с and d ?



Quote
To get an "a" an interpolation filter uses x0, x1, x2, x3,
for "b" it uses x1, x2, x3, x4,
for "c" - x2, x3, x4, x5,
for "d" - x4, x5, x6, x7,
for "e" - x5, x6, x7, x8.

Excuse me so much but I misunderstood the question. I had just missed this thing, if I had grasped the question I would have arrived at the right answer. Now I notice the phenomenon perfectly.

Quote
   
Quote
   Do you know what is the difference between and possible connection of interpolation of signal samples and interpolation of FIR filter coefficients ?
   Honestly, the answer is not immediate as it could be for you. You can explain it to me simply ?
   
I expected a short answer that could be a sign of understanding. Much more words are required to reach that understanding. It is not optimal to spend time for it right now. Especially because I think that it is somehow cumulative understanding that will become clear itself later on this way.


Excuse me but still many things are obscure. Imagine yourself the first time you've heard of this subject. I am that person who knows even less than you at that moment.

Quote
You should practice in drawing such diagrams if you want to get it. How about interpolator with factor 5/3?

Thanks for the 3/2 diagrams example, now it's more clearer.

The diagram for 5/3 is this ?



Quote
Aha! We finally catch it!
I suppose that you are programmer.

Caught and sunk. Good boy. Actually I was born as a programmer. I started with the PIC16F84 a long time ago when it was not yet "Flash" but ROMless (PIC16C84), what good memories. Looking back on it now it was all much much simpler even though for the time it was the future. I then switched to PIC larger "PIC18" series starting to learn the "C" and then program them at a high level. All of a sudden I had to readjusted as an FPGA programmer (Xilinx) starting from less than zero, without even knowing what an FPGA was. So learning a bit of VHDL and even less of Verilog though it was very similar to "C", but I prefer VHDL. Continuing with a bit of VisualBasic, HTML, PHP, ASP, Python, Perl, SQL, Java, JavaScript, Bootstrap, Matlab, Linux, Linux Driver, to get up to C #. Surely I've forgotten someone. But among all these languages FPGA first and then the Signal Processing for me remain the ones I prefer. The complicated things fascinate me a lot and I try in every way to understand them despite being aware of my limitations. I never stop. So here I am trying to understand the Signal Processing associated with FPGA, one of the things that fascinates me and intrigues me the most. Thanks to you of course.

Quote
Imagine that you have a stream of data (samples) where only one of each 175 samples is not zero. How do you think, do you need to allocate memory to store all these zeros and perform actual computations upon them? I am curious is this clue enough for you?

Now that you make me think, excuse the term, it looks like a "bullshit". A very simple thing. I certainly do not need to memorize 175 zero values that I do not need at all, especially with a multiplication that will result is "zero".

Quote
It depends on what do you mean as structure. For example polyphase interpolator that uses one upsampler, one filter and one decimator could be coded as "one function" implementation for any factors:
Code:
out_samples_num = Resampler(
    internal_resampler_context,
      up_factor,
      down_factor,
      filter_coefficients,
      filter_length,
      filter_memory,
    input_data,
    input_data_size,
    output_data_buf);
In that case for different factors you need different filters, but the same code.

Can the same value for a logical / hardware implementation in an FPGA ? I should keep the same hardware structure, at worst the main structure, and change the coefficients and/or the counter for the input/output samples.

Quote
(64/7) * (25/16) * 7 = 100
(64/8) * (25/16) * 8 = 100
(64/7) * 2 * (25/32) * 7 = 100
(64/8) * 2 * (25/32) * 8 = 100
(64/7) * 2 * (25/16) * (7/2) = 100
(64/8) * 2 * (25/16) * (8/2) = 100
(64/7) * 2 * (7/2) = 64
(64/8) * 2 * (8/2) = 64
(64/7) * 7 = 64
(64/8) * 8 = 64

Interpolators by 7/2 and 8/2 (and maybe 7 and 8 ) could share the same filter (the filter that passband is determined by factor 7 case while stopband - by factor 8 case). I expect non-significant compromise comparing with specialized filters for 7/2 and 8/2 factors. The wider gap between passband and stopband - the less tradeoff.

Note that interpolators with the same factor but in different lines above has different filters because of different input signals because of different processing stages before.

Sharing the same filter would be perfect. The structure for "7/2" could be used, where the band is wider. The passband and the stopband will be sufficient even for "8/2" where the band is narrower. I am wrong ?

By selecting this configuration

Code:
(64/7) * 2 * (25/16) * (7/2) = 100
(64/8) * 2 * (25/16) * (8/2) = 100

The useful max signal band is : 0.417 * Fs

[First half-band x 2]

"64/7"

9.142857 MHz ---> Fs/2 ---> 4.571428 MHz

Passband is 3.81 MHz (0.01 dB ripple) then Stopband is at 5.33 MHz (at least -60 dB)

"64/8"

8.000000 MHz ---> Fs/2 ---> 4.000000 MHz

Passband is 3.34 MHz (0.01 dB ripple) then Stopband is at 4.66 MHz (at least -60 dB)

The filter structure and coeffients is the same, use passband at 3.81 MHz and stop band at 5.33 MHz.

[Second half-band x 25/16]

18.285714 MHz ---> Fs/(25/16) ---> 28.571428 MHz

Passband is 3.81 MHz (0.01 dB ripple) then Stopband is at 24.76 MHz (at least -60 dB)

16.000000 MHz ---> Fs/(25/16) ---> 25.000000 MHz

Passband is 3.34 MHz (0.01 dB ripple) then Stopband is at 21.66 MHz (at least -60 dB)

The filter structure and coeffients is the same, use passband at 3.81 MHz and stop band at 21.66 MHz.

[Third selectable filter "7/2" or "8/2"]

28.571428 MHz ---> Fs/(7/2) ---> 100.000000 MHz

Passband is 3.81 MHz (0.01 dB ripple) then Stopband is at 96.19 MHz (at least -60 dB)

25.000000 MHz ---> Fs/(8/2) ---> 100.000000 MHz

Passband is 3.34 MHz (0.01 dB ripple) then Stopband is at 96.66 MHz (at least -60 dB)

For this filter I must use passband at 3.81 MHz and stop band at 96.19 MHz, however, the filter must be configurable according to the band selection.

In the last section, a polynomial interpolation could be used.

Did I understand well ?

Quote
And I did not say that you can not use Farrow filter or other type of polynomial interpolation on last stage. The choice has to be done after careful comparison of all variants under given target restrictions.

As you said precisely, I have restrictions mostly on the amount of multipliers to use. The maximum number should be 4 multipliers across the interpolation line, using a 200/250 MHz frequency, I do not think I can reach the 300 MHz frequency the device is very congested.

Patiently waiting ...
« Last Edit: December 09, 2017, 11:19:35 11:19 by debugasm » Logged

Friends see each other at the time of the reboot.
Signal
Active Member
***
Offline Offline

Posts: 200

Thank You
-Given: 113
-Receive: 81



« Reply #15 on: December 09, 2017, 07:19:32 19:19 »

I agree, but until now efficiency was the least of my problems.
and now ...
The maximum number should be 4 multipliers across the interpolation line, using a 200/250 MHz frequency
8 multipliers at 100MHz
Lets consider the case "(64/8) * (2) * (25/16) * (8/2) = 100"
as a first approximation:
If "8/2" takes  4 multipliers at 100 MHz    {filter length 32}
then "25/16" can take 6 multipliers at 25Mhz   {filter length 150}
and 15.5 multiplications remains for "2" at 16MHz that is  {filter length 124 for Halfband and 62 for asymmetric frequency response}
Could work. What do you think?

If I understand correctly it turns out to be good up to 0.4 * Fs. This is considered a slow signal. I am wrong ?
I'd say up to 0.2π that corresponds to 0.1FS or 0.2FN
Quote
Passband is 3.81 MHz (0.01 dB ripple) then Stopband is at 5.33 MHz (at least -60 dB)
Especially if you need 0.01dB a passband of Farrow filter becomes even narrower - you should check it explicitly.

Quote
The diagram for 5/3 is this ?
You got it perfectly!

I'd like to add more details:



Note the incoherent sum of nonlinear components after decimator. That is why I prefer LS optimization of stopband for interpolators rather than equiripple.

Quote
Can the same value for a logical / hardware implementation in an FPGA ? I should keep the same hardware structure, at worst the main structure, and change the coefficients and/or the counter for the input/output samples.
I am not familiar with FPGA. Only general considerations. You should know the answer much better than me.
For example I do not know how conditional break of loop is handled in FPGA, while expect that loops naturally are unrolled there.
Another "problem": can FPGA effectively calculate the following formula without need of composing phases from filter coefficients?
  yⱼ = ∑hₙᵢ₊ₖxₘ₋ᵢ,
where n, k and m are invariants:
  n is nominator of fractional factor (7 or 8 in your case),
  k =(j*d)(mod n), where d is denominator (2 in this case),
  m also depends on j, n and d (it's your part to find how).

Quote
Sharing the same filter would be perfect. The structure for "7/2" could be used, where the band is wider. The passband and the stopband will be sufficient even for "8/2" where the band is narrower. I am wrong ?
Let see...
   (64/7) * 2 * (25/16) * (7/2) = 100
   (64/8) * 2 * (25/16) * (8/2) = 100
for frequencies normalized by FN:
   fpass,"8" = 0.834*(8/25)/8 =  0.033
   fstop,"8" = ((25/4) - 0.834)*(8/25)/8 =0.217
   fpass,"7" = 0.834*(8/25)/7 = 0.038
   fstop,"7" = ((25/4) - 0.834)*(8/25)/7 =0.248

so you need a filter with
   fpass = max(0.033, 0.038) = 0.038
   fstop = min(0.217, 0.248) = 0.217

...thus you were wrong.

Quote
Did I understand well ?
Edit:
Mostly. (The truth is - I did not check all this numbers carefully - just estimated them in general)
But I prefer to switch to normalized frequency range as soon as possible to make things more clear.
Let P = fmax/FN = 0.834.
Then first stage filter:
   fpass = P/2;
   fstop = (2 - P)/2.
Second stage filter:
   fpass = (P/2)/25;
   fstop = 1- (P/2)/25 (2 - (P/2))/25.
Third stage filter:
   fpass = ((P/2)/(25/16))/7;
   fstop = 1 - ((P/2)/(25/16))/8 (2 - ((P/2)/(25/16)))/8.

« Last Edit: December 10, 2017, 04:15:32 16:15 by Signal » Logged

Give a right name to a right game and play it right
Signal
Active Member
***
Offline Offline

Posts: 200

Thank You
-Given: 113
-Receive: 81



« Reply #16 on: December 09, 2017, 08:53:51 20:53 »

I'd like to add some food for thought. Here is the example of decomposition that is optimal regarding filter's order.



Decomposition of filters as reflection of decomposition of interpolator by several multipliers has several targets.

First - filters become "shorter". While sum of orders of two sequential filters remains the same, one of the filter has sparse coefficients that is connected with its frequency response (see blue line above).

Second - interpolator by 2 allows two tricks.
  a) filter coefficients for both phases are symmetric. (And still could be a part of optimal decomposition in above illustrated sense)
  b) halfband filter has no multipliers in one of the phase. That is great but sometimes does not worth. For example Halfband filter with 0.01 dB ripple in passband and 60 dB in stopband could be 3 times (too lazy to check it now) longer than filter with 3dB at passband edge and 60 dB stopband. Also take into account the picture above - Halfband filter will not cooperate with next cascade that way.

Another consideration. Imagine passband without ripples like Chebyshev2, Bessel or Batterworth filters have. Most likely a non ideal AFC of such passband will be corrected by line equalizer of receiver. But nonlinear components that are result of resampling are not cleanable. Add to this that ripple in passband as linear mistake is not multiplied as nonlinear background at decimation. That could be a reason to have different requirements for passband and stopband and that is not the case for Halfband filter.
« Last Edit: December 09, 2017, 09:21:51 21:21 by Signal » Logged

Give a right name to a right game and play it right
debugasm
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 37
-Receive: 298


« Reply #17 on: December 10, 2017, 09:55:39 09:55 »

Quote
8 multipliers at 100MHz
Lets consider the case "(64/8) * (2) * (25/16) * (8/2) = 100"
as a first approximation:
If "8/2" takes  4 multipliers at 100 MHz    {filter length 32}
then "25/16" can take 6 multipliers at 25Mhz   {filter length 150}
and 15.5 multiplications remains for "2" at 16MHz that is  {filter length 124 for Halfband and 62 for asymmetric frequency response}
Could work. What do you think?

I think it would be wonderful to be able to create a filter chain in this way, maybe with the last filter that selects the two configurations. I make some more elaborate calculations.

Quote
For example I do not know how conditional break of loop is handled in FPGA, while expect that loops naturally are unrolled there.

A loop is not synthesizable, only this form is valid:

Code:
for S in 1 to 8 loop
    S_index(S) := S * S;
    S_index(S) := S_index(S) * S;
end loop;

Quote
Another "problem": can FPGA effectively calculate the following formula without need of composing phases from filter coefficients?
  yⱼ = ∑hₙᵢ₊ₖxₘ₋ᵢ,
where n, k and m are invariants:
  n is nominator of fractional factor (7 or 8 in your case),
  k =(j*d)(mod n), where d is denominator (2 in this case),
  m also depends on j, n and d (it's your part to find how).

For me it is not very clear, the study better.

Quote
  (64/7) * 2 * (25/16) * (7/2) = 100
   (64/8) * 2 * (25/16) * (8/2) = 100

for frequencies normalized by FN:

   fpass,"8" = 0.834*(8/25)/8 =  0.033
   fstop,"8" = ((25/4) - 0.834)*(8/25)/8 =0.217
   fpass,"7" = 0.834*(8/25)/7 = 0.038
   fstop,"7" = ((25/4) - 0.834)*(8/25)/7 =0.248

so you need a filter with

   fpass = max(0.033, 0.038) = 0.038
   fstop = min(0.217, 0.248) = 0.217

Where fmax/FN = 0.834, just for clarity:

(64/7) ---> fmax = 3.81 ---> Fn = 4.571428 ---> fmax/FN = 0.834
(64/8) ---> fmax = 3.34 ---> Fn = 4.000000 ---> fmax/FN = 0.834

Quote
Let P = fmax/FN = 0.834.

Then first stage filter:
   fpass = P/2;
   fstop = 1 - P/2.

Second stage filter:
   fpass = (P/2)/25;
   fstop = 1 - (P/2)/25.

Third stage filter:
   fpass = ((P/2)/(25/16))/7;
   fstop = 1 - ((P/2)/(25/16))/8.

It is actually much clearer, thanks.

Quote


First - filters become "shorter". While sum of orders of two sequential filters remains the same, one of the filter has sparse coefficients that is connected with its frequency response (see blue line above).

Second - interpolator by 2 allows two tricks.
  a) filter coefficients for both phases are symmetric. (And still could be a part of optimal decomposition in above illustrated sense)
  b) halfband filter has no multipliers in one of the phase. That is great but sometimes does not worth. For example Halfband filter with 0.01 dB ripple in passband and 60 dB in stopband could be 3 times (too lazy to check it now) longer than filter with 3dB at passband edge and 60 dB stopband. Also take into account the picture above - Halfband filter will not cooperate with next cascade that way.

You notice very well the contribution of the two filters H1 and H2 to get the "red" filter that is perfect. Where at first glance H1 and H2 suffer from a lot of ripple in passband.

Quote
b) halfband filter has no multipliers in one of the phase. That is great but sometimes does not worth. For example Halfband filter with 0.01 dB ripple in passband and 60 dB in stopband could be 3 times (too lazy to check it now) longer than filter with 3dB at passband edge and 60 dB stopband.

It's exactly as you say. Half-Band that does have a passband edge at -3dB is much shorter than any other Custom Half-Band.

Quote
Another consideration. Imagine passband without ripples like Chebyshev2, Bessel or Batterworth filters have. Most likely a non ideal AFC of such passband will be corrected by line equalizer of receiver. But nonlinear components that are result of resampling are not cleanable. Add to this that ripple in passband as linear mistake is not multiplied as nonlinear background at decimation.

It's something I never thought of. Indeed with very weak signals the problem of a bandwidth with ripples could increase the difficulty in reception, worsening the conditions unlike what could be imagined.

Thanks again for the magnificent contribution.

Now I'll do another quiz, just to complicate things, I add two more configurations :

a) 64/7 MHz ----> 100 MHz
b) 64/8 MHz ----> 100 MHz
c) 48/7 MHz ----> 100 MHz
d) 40/7 MHz ----> 100 MHz

To contribute I have already set up a series of equations

Code:
a) 64/7 * 2 * x * a = 100
b) 64/8 * 2 * x * b = 100
c) 48/7 * 2 * x * c = 100
d) 40/7 * 2 * x * d = 100

x = 35 / (4 * d)

a = (5 * d) / 8
b = (5 * d) / 7
c = (5 * d) / 6
d ~ 0

Just to complete the mess.

 Roll Eyes
Logged

Friends see each other at the time of the reboot.
Signal
Active Member
***
Offline Offline

Posts: 200

Thank You
-Given: 113
-Receive: 81



« Reply #18 on: December 10, 2017, 04:36:01 16:36 »

It is actually much clearer, thanks.
You are welcome. Note however that making these formulas without graphical support I easily made mistakes (see corrections in post above).

Quote
It's exactly as you say. Half-Band that does have a passband edge at -3dB is much shorter than any other Custom Half-Band.
Lost in translation. I implied quite opposite. Maybe sometime I shall refresh my impression comparing specific filters, to be more confident in arguments.

Quote
A loop is not synthesizable
I can not help here. FPGA is not in my current focus. But when you finish, share with us how. It is interesting.
« Last Edit: December 11, 2017, 02:31:37 14:31 by Signal » Logged

Give a right name to a right game and play it right
debugasm
Junior Member
**
Offline Offline

Posts: 75

Thank You
-Given: 37
-Receive: 298


« Reply #19 on: December 11, 2017, 01:21:26 13:21 »

Quote
You are welcome. Note however that making these formulas without graphical support I easily made mistakes (see corrections in post above).

I noticed the corrections, thanks.

Quote
I can not help here. FPGA is not in my current focus. But when you finish, share with us how. It is interesting.

You already gave me a lot of help. As soon as I'm at a good point I update the post.

As soon as I have any other doubts or news, I'll keep you updated.

Thank you so much Signal.
Logged

Friends see each other at the time of the reboot.
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC