cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jlhx
Observer
Observer
733 Views
Registered: ‎05-20-2014

FIR Compiler 7.2 - erratic behavior as decimator

Jump to solution

Hi,

I'm using the FIR Compiler to realize multiple filters with different decimation rates R. While the block generates the expected results for a "Single_Rate" realisation, the first value of the filtered signal used for the downsampled signal varies based on R. Also depending on the value of R a varying number of zero samples are added at the beginning. I can not deduce any regularity or logic to these changes and could not find any information regarding this issue in the product guide (PG 149).

I'm trying to compare the results to Matlab and would expect the following behavior:

signalFir = filter(B,A,signal);
signalDown = downsample(signalFir,R);

In actuality it is:

signalFir = filter(B,A,signal);
signalFir = signalFir(1+startOffset:end);
signalDown = downsample(signalFir,R);
leadingZeros = zeros(1,numberOfZeros);
signalDown = [leadingZeros, signalDown];

But startOffset and numberOffset both depend on the value of R.

In fact I checked for different values and got the following results via try and error:

RstartOffsetnumberOfZeros
101
202
420
640
821
1620

 

As I want to synchronise the results of multiple FIR decimators and verify the results in Matlab I have to consider the group delay and processing delay, but it's difficult to find the values for startOffset and numberOfZeros empirically. Surely there must be a logic to this?

Attached as images is the configuration of the FIR Compiler. A symmetric 69-Coefficients lowpass is used. The following parameters differ from the default configuration:

ParameterValue
Filter TypeDecimation
Decimation Rate1,2,4,6,8,16
Hardware Oversampling: FormatInput_Sample_Period
Hardware Oversampling: Sample Period4
Coefficient Options: QuantizationInteger_Coefficients
Coefficient Options: Coefficient Width17

 

Just for clarification:

  • As the value of 4 for the sample period suggests I'm feeding the block a new sample every 4 cycles and get a result all 4*R cycles
  • To compare the results of the block with Matlab I only consider samples where the output data_tvalid is true
fir1.png
fir2.png
fir3.png
fir4.png
fir5.png
0 Kudos
1 Solution

Accepted Solutions
nathanx
Moderator
Moderator
468 Views
Registered: ‎08-01-2007

The answer is already documented on PG149, which is copied below.

nathanx_0-1611544761862.png

 

View solution in original post

0 Kudos
3 Replies
nathanx
Moderator
Moderator
628 Views
Registered: ‎08-01-2007

What's your question? Can you clarify it? Xilinx FIR Compiler IP provides C-Model, which can used to run simulation.

0 Kudos
jlhx
Observer
Observer
561 Views
Registered: ‎05-20-2014

Let me try to put it another way. Assume the fir filtered but not yet downsampled signal has the sample sequence f[0], f[1],... , f[N] (which would be the result of the FIR Compiler if no downsampling had been selected).

The downsampled signal has the samples d[0], d[1],... ,d[N/R].

The question is: What is the formula to determine which sample of d is based on which sample of f in regards to R?

 

For R = 1:

downsampling resultexpected sampleactual FIR Compiler result
d[0]f[0]0
d[1]f[1]f[1]
d[2]f[2]f[2]
d[3]f[3]f[3]
d[4]f[4]f[4]

 

For R = 2:

downsampling resultexpected sampleactual FIR Compiler result
d[0]f[0]0
d[1]f[2]0
d[2]f[4]f[0]
d[3]f[6]f[2]
d[4]f[8]f[4]

 

For R = 4:

downsampling resultexpected sampleactual FIR Compiler result
d[0]f[0]f[2]
d[1]f[4]f[6]
d[2]f[8]f[10]
d[3]f[12]f[14]
d[4]f[16]f[16]

 

As you can see there are a varying amount of leading, valid marked zeros and the first actual sample is not always f[0], but could also be f[2] or f[4] and the index offset remains for all following samples. I guess the reason is the internal structure derived for the desired FIR Compiler configuration. This behavior is fine as long it is deterministic and there is a way to calculate the amount of leading zeros and index offset. Is there?

0 Kudos
nathanx
Moderator
Moderator
469 Views
Registered: ‎08-01-2007

The answer is already documented on PG149, which is copied below.

nathanx_0-1611544761862.png

 

View solution in original post

0 Kudos