% * See one_pfb.m for general description. This run_pfir.m is similar and
% also still includes the PFFT, but its main purpose to verify the HDL
% for the PFIR.
clearall;
closeall;
fig=0;
%% Selectable test bench settings
tb.model_filterbank='Free choice';% 'LOFAR' = use fixed settings of LOFAR subband filterbank, else use free choice of tb.nof_subbands and PFIR coefficients
%tb.model_filterbank = 'LOFAR';
ifstrcmp(tb.model_filterbank,'LOFAR')
tb.model_quantization='fixed point';
tb.nof_subbands=512;
else
tb.model_quantization='floating point';
tb.model_quantization='fixed point';
tb.nof_subbands=64;
end
% Input signal 'sinusoid' carrier frequency
tb.subband_wg=47;% subband range 0:tb.nof_subbands-1, can be fraction to have any sinusoid frequency
%tb.subband_wg = 1.55;
%tb.subband_wg = 12;
% Model a frequency sweep of the 'sinusoid'
tb.chirp=0;% 0 = use fixed tb.subband_wg frequency, else increment WG frequency every block to have chirp frequency sweep
tb.chirp=1;
iftb.chirp
tb.nof_tsub=200;% number of subband periods to simulate
else
tb.nof_tsub=100;% number of subband periods to simulate
end
tb.plot_per_block=0;% 1 = plot spectrum for each block in time, else skip this plot to save time
%tb.plot_per_block = 1;
%% Derived test bench settings
tb.nof_complex=2;
tb.subband_i=floor(tb.subband_wg);% natural subband index in range 0:tb.nof_subbands-1
tb.subband_I=tb.subband_i+1;% equivalent Matlab indexing for range 1:tb.nof_subbands
iftb.subband_i<tb.nof_subbands-1% determine index of next neighbour subband
tb.subband_iplus1=tb.subband_i+1;
else
tb.subband_iplus1=0;% wrap subband index tb.nof_subbands to subband index 0
end
tb.subband_Iplus1=tb.subband_iplus1+1;% equivalent Matlab index for next neighbour subband in range 1:tb.nof_subbands
tb.subband_fft_size=tb.nof_complex*tb.nof_subbands;% subband filterbank real FFT
fs=1;% normalized sample frequency
fsub=fs/tb.subband_fft_size;% subband frequency relative to fs
disp(sprintf(['Test bench settings:\n',...
'. Model filterbank = %s\n',...
'. Model coefficients and data = %s\n',...
'. Number of subbands = %d\n',...
'. Number of subband periods to simulate = %d\n',...