diff --git a/applications/lofar2/libraries/sdp/src/vhdl/sdp_pkg.vhd b/applications/lofar2/libraries/sdp/src/vhdl/sdp_pkg.vhd index c9f096d4373b1a15b4e268450f41c62cd1237d65..07d8faf127d097bf9ae4baf1df430ee42c4e84da 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_pkg.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_pkg.vhd @@ -100,7 +100,7 @@ PACKAGE sdp_pkg is CONSTANT c_sdp_W_statistic_sz : NATURAL := 2; -- = c_sdp_W_statistic / c_word_w CONSTANT c_sdp_W_sub_weight : NATURAL := 16; -- = w in s(w, p), s = signed CONSTANT c_sdp_W_sub_weight_fraction : NATURAL := 14; -- = p in s(w, p) - CONSTANT c_sdp_W_sub_weight_magnitude : NATURAL := c_sdp_W_sub_weight - c_sdp_W_sub_weight_fraction - 1; -- = 2 + CONSTANT c_sdp_W_sub_weight_magnitude : NATURAL := c_sdp_W_sub_weight - c_sdp_W_sub_weight_fraction - 1; -- = 1 CONSTANT c_sdp_W_beamlet_scale : NATURAL := 16; -- = w in u(w, p), u = unsigned CONSTANT c_sdp_W_beamlet_scale_fraction : NATURAL := 15; -- = p in u(w, p) CONSTANT c_sdp_W_beamlet_scale_magnitude : NATURAL := c_sdp_W_beamlet_scale - c_sdp_W_beamlet_scale_fraction; -- = 1 @@ -159,9 +159,11 @@ PACKAGE sdp_pkg is -- . g_fft_guard_w = 1 (was 2) --CONSTANT c_sdp_wpfb_subbands : t_wpfb := -- (1, c_sdp_N_fft, 0, c_sdp_P_pfb, - -- c_sdp_N_taps, 0, c_sdp_W_adc, 17, c_sdp_W_fir_coef, - -- true, false, true, 17, c_sdp_W_subband, 0, 22, 1, true, 54, c_sdp_W_statistic_sz, 195313, - -- c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline); -- = c_wpfb_lofar2_subbands_lts_2021 + -- c_sdp_N_taps, 0, c_sdp_W_adc, 17, c_sdp_W_fir_coef, + -- true, false, true, + -- 17, c_sdp_W_subband, 0, 22, 1, true, + -- 54, c_sdp_W_statistic_sz, 195313, + -- c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline); -- = c_wpfb_lofar2_subbands_lts_2021 -- DTS 2022-04-04, changes based on results from in tb_tb_verify_pfb_wg.vhd: -- . fil_backoff_w = 1 @@ -171,16 +173,43 @@ PACKAGE sdp_pkg is -- . g_fft_guard_w = 1 --CONSTANT c_sdp_wpfb_subbands : t_wpfb := -- (1, c_sdp_N_fft, 0, c_sdp_P_pfb, - -- c_sdp_N_taps, 1, c_sdp_W_adc, 23, c_sdp_W_fir_coef, - -- true, false, true, 23, c_sdp_W_subband, 1, 24, 1, true, 54, c_sdp_W_statistic_sz, 195313, - -- c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline); -- = c_wpfb_lofar2_subbands_dts_18b + -- c_sdp_N_taps, 1, c_sdp_W_adc, 23, c_sdp_W_fir_coef, + -- true, false, true, + -- 23, c_sdp_W_subband, 1, 24, 1, true, + -- 54, c_sdp_W_statistic_sz, 195313, + -- c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline); -- = c_wpfb_lofar2_subbands_dts_18b -- L2TS + -- . Use fft_guard_w = 1, instead of 2 to avoid overflow in first FFT stage, + -- because fil_backoff_w = 1 already provides sufficient FFT input margin + -- . Use fft_out_gain_w = 1 + 1 = 2. One to compensate for fil_backoff_w + -- = 1 and one to preserve the W_fft_proc = 5b while using fft_out_dat_w + -- = c_sdp_W_subband = 18b instead of 19b, to fit a 18x19 multiplier for + -- SST. + -- . From hdl/libraries/base/common/python/try_round_weight.py it follows + -- that using -r = 6 extra internal bits per stage is sufficient to have + -- < 1% disturbance on the sigma of the subband noise. The disturbance + -- on the sigma is about proportional to 1/2**r, so with -r = 4 it is + -- about < 4%. Therefore use fft_stage_dat_w = fft_out_dat_w + + -- fft_out_gain_w + 6b = 26b. + -- . The raw_dat_w for FFT output of real input is fft_stage_dat_w + 1, + -- because the use_separate in the FFT feature does not divide by 2. + -- This implies that preferrably fft_stage_dat_w <= 26, to fit the 18x27 + -- multiplier resources. + CONSTANT c_sdp_W_fil_backoff : NATURAL := 1; + CONSTANT c_sdp_W_fft_guard : NATURAL := 1; + CONSTANT c_sdp_W_fft_stage_dat : NATURAL := 24; -- TODO try 26b, compare synthesis results + CONSTANT c_sdp_W_fft_in_dat : NATURAL := c_sdp_W_fft_stage_dat - c_sdp_W_fft_guard; + CONSTANT c_sdp_W_fft_out_gain : NATURAL := 2; + CONSTANT c_sdp_W_stat_data : NATURAL := c_sdp_W_subband * 2 + ceil_log2(c_sdp_N_int_sub_hi); -- = 54 + CONSTANT c_sdp_wpfb_subbands : t_wpfb := (1, c_sdp_N_fft, 0, c_sdp_P_pfb, - c_sdp_N_taps, 1, c_sdp_W_adc, 23, c_sdp_W_fir_coef, - true, false, true, 23, c_sdp_W_subband, 2, 24, 1, true, 54, c_sdp_W_statistic_sz, 195313, - c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline); -- = c_wpfb_lofar2_subbands_l2ts_18b + c_sdp_N_taps, c_sdp_W_fil_backoff, c_sdp_W_adc, c_sdp_W_fft_in_dat, c_sdp_W_fir_coef, + true, false, true, + c_sdp_W_fft_in_dat, c_sdp_W_subband, c_sdp_W_fft_out_gain, c_sdp_W_fft_stage_dat, c_sdp_W_fft_guard, true, + c_sdp_W_stat_data, c_sdp_W_statistic_sz, c_sdp_N_int_sub_hi, + c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline); -- = c_wpfb_lofar2_subbands_l2ts_18b CONSTANT c_sdp_wpfb_complex_subbands : t_wpfb := func_wpfb_map_real_input_wpfb_parameters_to_complex_input(c_sdp_wpfb_subbands);