diff --git a/applications/lofar2/libraries/sdp/src/vhdl/node_sdp_oversampled_filterbank.vhd b/applications/lofar2/libraries/sdp/src/vhdl/node_sdp_oversampled_filterbank.vhd index a19b0e20e7e776410b3f3ca99d4eddad8009836a..ba60b1a643442c72a7c36dfd9b392ca03b55485c 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/node_sdp_oversampled_filterbank.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/node_sdp_oversampled_filterbank.vhd @@ -109,9 +109,13 @@ ARCHITECTURE str OF node_sdp_oversampled_filterbank IS NATURAL'IMAGE(c_sdp_W_sub_weight) & "b" & NATURAL'IMAGE(c_sdp_W_sub_weight_fraction) & "f_unit"; - CONSTANT c_fft : t_fft := func_wpfb_map_wpfb_parameters_to_fft(g_wpfb); - CONSTANT c_subband_raw_dat_w : NATURAL := func_fft_raw_dat_w(c_fft); - CONSTANT c_subband_raw_fraction_w : NATURAL := func_fft_raw_fraction_w(c_fft); + CONSTANT c_fft : t_fft := func_wpfb_map_wpfb_parameters_to_fft(g_wpfb); + CONSTANT c_fft_complex : t_fft := func_wpfb_map_wpfb_parameters_to_fft(g_wpfb_complex); + CONSTANT c_subband_raw_dat_w : NATURAL := func_fft_raw_dat_w(c_fft); + CONSTANT c_subband_raw_fraction_w : NATURAL := func_fft_raw_fraction_w(c_fft); + CONSTANT c_complex_subband_raw_dat_w : NATURAL := func_fft_raw_dat_w(c_fft_complex); + CONSTANT c_complex_subband_raw_fraction_w : NATURAL := func_fft_raw_fraction_w(c_fft_complex); + CONSTANT c_dat_w_diff : INTEGER := c_complex_subband_raw_dat_w - c_subband_raw_dat_w; -- = -1 which is used to shift 1 bit to the left. CONSTANT c_nof_masters : POSITIVE := 2; @@ -187,10 +191,11 @@ ARCHITECTURE str OF node_sdp_oversampled_filterbank IS SIGNAL wpfb_complex_out_resized_sosi_arr : t_dp_sosi_arr(c_sdp_S_pn-1 DOWNTO 0) := (OTHERS => c_dp_sosi_rst); -- Interleave positive frequencies per factor Q_fft = 2, like with output of real input FFT - SIGNAL wpfb_complex_out_fifo_sosi_arr : t_dp_sosi_arr(c_sdp_S_pn-1 DOWNTO 0) := (OTHERS => c_dp_sosi_rst); - SIGNAL wpfb_complex_out_fifo_siso_arr : t_dp_siso_arr(c_sdp_S_pn-1 DOWNTO 0) := (OTHERS => c_dp_siso_rst); - SIGNAL wpfb_complex_out_resized_sosi_2arr : t_dp_sosi_2arr_2(c_sdp_P_pfb-1 DOWNTO 0) := (OTHERS => (OTHERS => c_dp_sosi_rst)); - SIGNAL wpfb_complex_out_resized_siso_2arr : t_dp_siso_2arr_2(c_sdp_P_pfb-1 DOWNTO 0) := (OTHERS => (OTHERS => c_dp_siso_rst)); + SIGNAL wpfb_complex_out_fifo_sosi_arr : t_dp_sosi_arr(c_sdp_S_pn-1 DOWNTO 0) := (OTHERS => c_dp_sosi_rst); + SIGNAL wpfb_complex_out_fifo_siso_arr : t_dp_siso_arr(c_sdp_S_pn-1 DOWNTO 0) := (OTHERS => c_dp_siso_rst); + SIGNAL wpfb_complex_out_resized_sosi_2arr : t_dp_sosi_2arr_2(c_sdp_P_pfb-1 DOWNTO 0) := (OTHERS => (OTHERS => c_dp_sosi_rst)); + SIGNAL wpfb_complex_out_resized_siso_2arr : t_dp_siso_2arr_2(c_sdp_P_pfb-1 DOWNTO 0) := (OTHERS => (OTHERS => c_dp_siso_rst)); + SIGNAL wpfb_complex_out_interleaved_sosi_arr : t_dp_sosi_arr(c_sdp_P_pfb-1 DOWNTO 0) := (OTHERS => c_dp_sosi_rst); SIGNAL subband_equalizer_in_sosi_arr : t_dp_sosi_arr(c_sdp_R_os * c_sdp_P_pfb-1 DOWNTO 0) := (OTHERS => c_dp_sosi_rst); SIGNAL subband_equalizer_quant_sosi_arr : t_dp_sosi_arr(c_sdp_R_os * c_sdp_P_pfb-1 DOWNTO 0) := (OTHERS => c_dp_sosi_rst); @@ -479,7 +484,7 @@ BEGIN gen_dp_fifo: FOR I IN 0 TO c_sdp_S_pn-1 GENERATE u_dp_fifo_sc : ENTITY dp_lib.dp_fifo_sc GENERIC MAP( - g_data_w => c_nof_complex * c_subband_raw_dat_w, + g_data_w => c_nof_complex * c_complex_subband_raw_dat_w, g_bsn_w => c_dp_stream_bsn_w, g_use_bsn => TRUE, g_use_sync => TRUE, @@ -503,8 +508,8 @@ BEGIN wpfb_complex_out_fifo_siso_arr(2*I + 1) <= wpfb_complex_out_resized_siso_2arr(I)(1); END GENERATE; - -- Interleave 2 to 1 for all S_pn signals. - gen_interleave: FOR I IN 0 TO c_sdp_P_pfb-1 GENERATE + gen_align: FOR I IN 0 TO c_sdp_P_pfb-1 GENERATE + -- Interleave 2 to 1 for all S_pn signals. u_dp_interleave_n_to_one : ENTITY dp_lib.dp_interleave_n_to_one GENERIC MAP( g_nof_inputs => c_sdp_Q_fft @@ -514,11 +519,22 @@ BEGIN clk => dp_clk, snk_in_arr => wpfb_complex_out_resized_sosi_2arr(I), snk_out_arr => wpfb_complex_out_resized_siso_2arr(I), - src_out => subband_equalizer_in_sosi_arr(c_sdp_P_pfb + I) + src_out => wpfb_complex_out_interleaved_sosi_arr(I) ); + + -- Align data width of wpfb_complex output with wpfb_real output as the real wpfb + -- has an extra bit that is used for the FFT seperate function which the complex FFT + -- does not have. Here we add that extra bit to the output of the complex FFT aswell + -- to maintain the same scale and data width. + p_add_bit : PROCESS(wpfb_complex_out_interleaved_sosi_arr) + BEGIN + subband_equalizer_in_sosi_arr(c_sdp_P_pfb + I) <= wpfb_complex_out_interleaved_sosi_arr(I); + subband_equalizer_in_sosi_arr(c_sdp_P_pfb + I).re <= SHIFT_SVEC(wpfb_complex_out_interleaved_sosi_arr(I).re, c_dat_w_diff); + subband_equalizer_in_sosi_arr(c_sdp_P_pfb + I).im <= SHIFT_SVEC(wpfb_complex_out_interleaved_sosi_arr(I).im, c_dat_w_diff); + END PROCESS; + END GENERATE; - -- Pipeline to compensate for longer latency of the complex PFB. u_dp_pipeline_arr : ENTITY dp_lib.dp_pipeline_arr GENERIC MAP ( @@ -580,7 +596,6 @@ BEGIN fsub_quant_sosi_arr <= subband_equalizer_quant_sosi_arr; fsub_raw_sosi_arr <= subband_equalizer_raw_sosi_arr; - --------------------------------------------------------------- -- DP REQUANTIZE for SST --------------------------------------------------------------- diff --git a/applications/lofar2/libraries/sdp/src/vhdl/sdp_station.vhd b/applications/lofar2/libraries/sdp/src/vhdl/sdp_station.vhd index b8ab99213b731e70385df866f4fff050f96ecaf7..d8af2c9bfa6589447b951177e03f116700b48d27 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_station.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_station.vhd @@ -391,8 +391,8 @@ ARCHITECTURE str OF sdp_station IS CONSTANT c_fft_raw_dat_w : NATURAL := func_fft_raw_dat_w(c_fft); CONSTANT c_fft_raw_fraction_w : NATURAL := func_fft_raw_fraction_w(c_fft); - CONSTANT c_subband_raw_dat_w : NATURAL := sel_a_b(g_use_oversample, c_sdp_W_subband, c_fft_raw_dat_w); - CONSTANT c_subband_raw_fraction_w : NATURAL := sel_a_b(g_use_oversample, 0, c_fft_raw_fraction_w); + CONSTANT c_subband_raw_dat_w : NATURAL := c_fft_raw_dat_w; + CONSTANT c_subband_raw_fraction_w : NATURAL := c_fft_raw_fraction_w; -- Make Tx FIFOs at least c_fifo_tx_fill_margin larger than needed to fit the largest Tx packet CONSTANT c_fifo_tx_fill_margin : NATURAL := 10; -- >= c_fifo_fill_margin = 6 that is used in dp_fifo_fill_eop @@ -539,7 +539,7 @@ ARCHITECTURE str OF sdp_station IS SIGNAL ait_sosi_arr : t_dp_sosi_arr(c_sdp_S_pn-1 DOWNTO 0); SIGNAL fsub_raw_sosi_arr : t_dp_sosi_arr(c_sdp_P_pfb-1 DOWNTO 0); - SIGNAL fsub_oversampled_raw_sosi_arr : t_dp_sosi_arr(c_sdp_R_os * c_sdp_P_pfb-1 DOWNTO 0); + SIGNAL fsub_oversampled_raw_sosi_arr : t_dp_sosi_arr(c_sdp_R_os * c_sdp_P_pfb-1 DOWNTO 0); SIGNAL fsub_raw_sosi_2arr : t_dp_sosi_2arr_pfb(c_sdp_N_beamsets-1 DOWNTO 0); SIGNAL xst_bs_sosi : t_dp_sosi; -- block sync reference for Xsub ring latency monitor