diff --git a/matlab/one_pfb.m b/matlab/one_pfb.m index 80bd7dc07a9dd35d9d7674e6b0bc3785b7daa038..b24198eceb0e5d3b5df5413e7b1453bdadf411b2 100644 --- a/matlab/one_pfb.m +++ b/matlab/one_pfb.m @@ -113,8 +113,8 @@ % 0 -1023 1023 2047 3071 4095 --> + --> -1023 % . . . . . % . . . . . -% -2 2 . . . -2 -% -1 1 . . . -1 +% -2 2 . . . --> + --> -2 +% -1 1 . . . --> + --> -1 % 1023 0 0 1024 2048 3072 --> + --> 0 % d h h h h d % @@ -124,15 +124,30 @@ % and the older samples are multiplied by the subsequent coefficients, % because it is a convolution. Therefore the FIR coefficients need to be % flipped up/down per column, to allow doing the filter as a d .* h vector -% multiply in pfir.m. The FFT operates on blocks of data with same index and -% time range as the WG. The data output of the FIR filter fits this input -% range of the FFT. Therefore no data flipping is needed. +% multiply in pfir.m. The FIR filter sums the rows for the N_taps = 16 to +% yield the input for the FFT. The FFT operates on blocks of data with same +% index and time range as the WG. The data output of the FIR filter fits +% this input range of the FFT. Therefore no data flipping is needed. +% +% In summary: +% * The WG data and FFT input data is processed in blocks with the newest +% sample at the bottom and the oldest sample at the top. In the FIR filter +% the newest block is at the left and the oldest at the rigth. Therefor +% the FIR filter coefficients also have to be ordered from bottom left to +% top right. +% * The column size is determined by N_fft of the FFT. The FFT is calculated +% each time a block is shifted in. For a critically sampled PFB the block +% size is N_blk = N_fft, so then it also looks like the blocks only shift +% from left to right. Using N_blk < N_fft would yield an oversampled PFB +% with oversampling factor R_os = N_fft/N_blk. Then the blocks shift from +% top to bottom in each column and from left to right. % % In the tb_verify_pfb_response.vhd the input stimuli is a block of N_fft = % 1024 ones followed by N_taps-1 blocks with zeros. In time the oldest data % will appear first in the simulator Wave Window, so therefore the % fil_re_scope signal in the tb_verify_pfb_response.vhd will show the FIR -% coefficients h[] in order 1023:0, 2047:1024, ..., so flipped per block. +% coefficients h[0:16383] in order h[1023:0], h[2047:1024], ..., +% h[16383:15360], so flipped per block. % clear all; close all;