Skip to content
Snippets Groups Projects
Commit e13b6b5f authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Rename c_wpfb_lofar2_subbands_* constants. Added func_wpfb_sst_level().

parent 7b098970
No related branches found
No related tags found
1 merge request!231Use applications/lofar2/model/pfs_coeff_final.m to create FIR coefficients for...
......@@ -75,40 +75,55 @@ package wpfb_pkg is
-----------------------------------------------------------------------------
-- Fsub settings:
-- . Settings used until at least March 2022
constant c_wpfb_lofar2_subbands_2021 : t_wpfb := (1, 1024, 0, 6,
16, 0, 14, 17, 16,
true, false, true, 17, 18, 0, 22, 1, true, 54, 2, 195313,
c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline);
-- . Settings used on LTS and DTS until at least March 2022
constant c_wpfb_lofar2_subbands_lts_2021 : t_wpfb := (1, 1024, 0, 6,
16, 0, 14, 17, 16,
true, false, true, 17, 18, 0, 22, 1, true, 54, 2, 195313,
c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline);
constant c_wpfb_lofar2_subbands_2022 : t_wpfb := (1, 1024, 0, 6,
16, 1, 14, 0, 16,
true, false, true, 0, 19, 1, 24, 1, true, 56, 2, 195313,
c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline);
-- . Settings used on DTS in 2022 with fft_out_dat_w = 18b, to have same levels as with c_wpfb_lofar2_subbands_lts
-- - use fil_backoff_w to avoid overshoot and fft_out_gain_w = 1 to compensate to keep output level
-- - use stage_dat_w = 24 --> fil_out_dat_w = fft_in_dat_w = 23
constant c_wpfb_lofar2_subbands_dts_18b : t_wpfb := (1, 1024, 0, 6,
16, 1, 14, 23, 16,
true, false, true, 23, 18, 1, 24, 1, true, 54, 2, 195313,
c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline);
constant c_wpfb_lofar2_subbands : t_wpfb := c_wpfb_lofar2_subbands_2022;
-- . Settings used on DTS with fft_out_dat_w = 19b, to preserve FFT processing gain of 4.5 bits
-- - use stage_dat_w = 25 --> fil_out_dat_w = fft_in_dat_w = 24
-- - with fft_out_dat_w = 19 --> stat_data_w = 2*19 + 18 = 56 b
constant c_wpfb_lofar2_subbands_dts_19b : t_wpfb := (1, 1024, 0, 6,
16, 1, 14, 24, 16,
true, false, true, 24, 19, 1, 25, 1, true, 56, 2, 195313,
c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline);
-- DC gain of WPFB FIR filter with Coeffs16384Kaiser-quant.dat used in LOFAR1.
-- . Calculated with applications/lofar2/model/run_pfir_coef.m using application = 'lofar_subband'
-- . Not used in RTL, only used in test benches to verify expected subband levels
constant c_wpfb_lofar1_fir_filter_dc_gain : real := 0.994817;
constant c_wpfb_lofar2_subbands : t_wpfb := c_wpfb_lofar2_subbands_dts_18b;
-- The FFT output has more bits to be able to preserve the sensitivity of
-- the processing gain of the FFT. The FFT has a processing gain of
-- sqrt(N_sub = N_fft / 2 = 512), so 4.5 bits. Therefore choose
-- fft_out_dat_w = fil_in_dat_w + 5 = 14 + 5 = 19b. Using fft_out_gain_w =
-- 1 compensates for the fil_backoff_w = 1. The func_wpfb_subband_scale_w
-- then thus returns 19 + 1 - (14 + 1) = 5 bits.
-- 1 compensates for the fil_backoff_w = 1 of the FIR filter. The
-- func_wpfb_subband_scale_w then thus returns 19 + 1 - (14 + 1) = 5 bits.
function func_wpfb_subband_scale_w(wpfb : t_wpfb) return natural;
-- The WPFB subband gain is the expected factor between subband amplitude
-- and real signal input amplitude. The WPFB subband gain consists of:
-- . the FFT gain for a real input and
-- . the extra bits to preserve the sensitivity of the FFT processing gain.
-- A_sub and real signal input amplitude A_sp, so:
-- A_sub = A_sp * func_wpfb_subband_gain()
-- The WPFB subband gain consists of:
-- . DC gain of the FIR filter (= fir_filter_dc_gain ~= 1.0),
-- . the FFT gain for a real input (= c_fft_real_input_gain_sine = 0.5) and
-- . the extra bits to preserve the sensitivity of the FFT processing gain
-- (derived from wpfb).
-- For example:
-- . func_wpfb_subband_gain() = 8 for c_wpfb_lofar2_subbands_2021
-- . func_wpfb_subband_gain() = 16 for c_wpfb_lofar2_subbands_2022
function func_wpfb_subband_gain(wpfb : t_wpfb) return real;
-- . func_wpfb_subband_gain() ~= 8 for c_wpfb_lofar2_subbands_lts_2021 and
-- for c_wpfb_lofar2_subbands_dts_18b
-- . func_wpfb_subband_gain() ~= 16 for c_wpfb_lofar2_subbands_dts_19b
function func_wpfb_subband_gain(wpfb : t_wpfb; fir_filter_dc_gain : real) return real;
-- The expected WPFB SST level for subband amplitude A_sub and an integration
-- interval of N_int subband blocks (periods).
function func_wpfb_sst_level(A_sub : real; N_int : natural) return real;
-----------------------------------------------------------------------------
-- Apertif application specfic settings
......@@ -236,9 +251,14 @@ package body wpfb_pkg is
return wpfb.fft_out_dat_w + wpfb.fft_out_gain_w - (wpfb.fil_in_dat_w + wpfb.fil_backoff_w);
end;
function func_wpfb_subband_gain(wpfb : t_wpfb) return real is
function func_wpfb_subband_gain(wpfb : t_wpfb; fir_filter_dc_gain : real) return real is
begin
return fir_filter_dc_gain * c_fft_real_input_gain_sine * 2.0**real(func_wpfb_subband_scale_w(wpfb));
end;
function func_wpfb_sst_level(A_sub : real; N_int : natural) return real is
begin
return c_fft_real_input_gain * 2.0**real(func_wpfb_subband_scale_w(wpfb));
return A_sub ** 2.0 * REAL(N_int);
end;
function func_wpfb_maximum_sop_latency(wpfb : t_wpfb) return natural is
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment