diff --git a/applications/apertif/designs/apertif_unb1_correlator/src/vhdl/apertif_unb1_correlator.vhd b/applications/apertif/designs/apertif_unb1_correlator/src/vhdl/apertif_unb1_correlator.vhd index bcefd3ba6c33b12d5c0b7bd620178675441219fb..fe54479020e12b3c6796c646f98f52b071cee4a8 100644 --- a/applications/apertif/designs/apertif_unb1_correlator/src/vhdl/apertif_unb1_correlator.vhd +++ b/applications/apertif/designs/apertif_unb1_correlator/src/vhdl/apertif_unb1_correlator.vhd @@ -161,6 +161,7 @@ ARCHITECTURE str OF apertif_unb1_correlator IS CONSTANT c_nof_channels : NATURAL := 64; CONSTANT c_integration_period : NATURAL := c_nof_blocks_per_sync/c_nof_channels; --12207; CONSTANT c_nof_visibilities : NATURAL := (c_nof_inputs*(c_nof_inputs+1))/2; + CONSTANT c_cor_in_dat_w : NATURAL := 9; -- 9-bit input data for the correlator: 9b -> mult -> 18b -> accu -> 32b at the corr output. -- . Inter Channel Delay: -- . With no inter channel output delay, channels are output back-to-back, creating a short full valid burst of 64 channels (12.8 Gbps burst, 158Mbps on average). -- We need to set an appropriate number of inter-channel delay cycles for a constant visibility buffer output rate. @@ -176,9 +177,9 @@ ARCHITECTURE str OF apertif_unb1_correlator IS CONSTANT c_wpfb_nof_chan : NATURAL := 1; -- = default 0, defines the number of channels (=time-m CONSTANT c_wpfb_nof_points : NATURAL := 64; -- = 1024, N point FFT CONSTANT c_wpfb_nof_taps : NATURAL := 8; -- = 8 nof taps n the filter - CONSTANT c_wpfb_coef_w : NATURAL := 18; --FIXME: 9b does not work; needs updated coefficient files. + CONSTANT c_wpfb_coef_w : NATURAL := 16; --FIXME: 9b does not work; needs updated coefficient files. CONSTANT c_wpfb_in_dat_w : NATURAL := 8; --FIXME: should be 6b at some point - CONSTANT c_wpfb_out_dat_w : NATURAL := 9; --FIXME: Could be wider but is currently 9b to avoid the need for quantization: 9b -> mult -> 18b -> accu -> 32b at the corr output. + CONSTANT c_wpfb_out_dat_w : NATURAL := 16; --FIXME: Could be wider but is currently 9b to avoid the need for quantization: 9b -> mult -> 18b -> accu -> 32b at the corr output. CONSTANT c_wpfb_use_separate : BOOLEAN := FALSE; -- = false for complex input, true for two real inputs CONSTANT c_wpfb_use_reorder : BOOLEAN := FALSE; @@ -186,6 +187,37 @@ ARCHITECTURE str OF apertif_unb1_correlator IS c_wpfb_nof_taps, c_wpfb_in_dat_w, 16, c_wpfb_coef_w, c_wpfb_use_reorder, c_wpfb_use_separate, 16, c_wpfb_out_dat_w, 18, 2, true, 56, 2, c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline); +-- type t_wpfb is record +-- -- General parameters for the wideband poly phase filter +-- wb_factor : natural; -- = default 4, wideband factor +-- nof_points : natural; -- = 1024, N point FFT (Also the number of subbands for the filter part) +-- nof_chan : natural; -- = default 0, defines the number of channels (=time-multiplexed input signals): nof channels = 2**nof_chan +-- nof_wb_streams : natural; -- = 1, the number of parallel wideband streams. The filter coefficients are shared on every wb-stream. +-- +-- -- Parameters for the poly phase filter +-- nof_taps : natural; -- = 16, the number of FIR taps per subband +-- fil_in_dat_w : natural; -- = 8, number of input bits +-- fil_out_dat_w : natural; -- = 16, number of output bits +-- coef_dat_w : natural; -- = 16, data width of the FIR coefficients +-- +-- -- Parameters for the FFT +-- use_reorder : boolean; -- = false for bit-reversed output, true for normal output +-- use_separate : boolean; -- = false for complex input, true for two real inputs +-- fft_in_dat_w : natural; -- = 16, number of input bits +-- fft_out_dat_w : natural; -- = 16, number of output bits >= (fil_in_dat_w=8) + log2(nof_points=1024)/2 = 13 +-- stage_dat_w : natural; -- = 18, number of bits that are used inter-stage +-- guard_w : natural; -- = 2 +-- guard_enable : boolean; -- = true +-- stat_data_w : positive; -- = 56 +-- stat_data_sz : positive; -- = 2 +-- +-- -- Pipeline parameters for both poly phase filter and FFT. These are heritaged from the filter and fft libraries. +-- pft_pipeline : t_fft_pipeline; -- Pipeline settings for the pipelined FFT +-- fft_pipeline : t_fft_pipeline; -- Pipeline settings for the parallel FFT +-- fil_pipeline : t_fil_ppf_pipeline; -- Pipeline settings for the filter units +-- +-- end record; + CONSTANT c_wpfb_coefs_file_prefix : STRING := "mif/coefs_wide1_p64_t8"; @@ -331,6 +363,8 @@ ARCHITECTURE str OF apertif_unb1_correlator IS SIGNAL wpfb_snk_in_ctrl : t_dp_sosi; SIGNAL wpfb_snk_in_arr : t_dp_sosi_arr(c_nof_input_streams-1 DOWNTO 0); SIGNAL wpfb_src_out_arr : t_dp_sosi_arr(c_nof_input_streams-1 DOWNTO 0); + SIGNAL requantize_snk_in_arr : t_dp_sosi_arr(c_nof_input_streams-1 DOWNTO 0); + SIGNAL requantize_src_out_arr : t_dp_sosi_arr(1-1 DOWNTO 0); SIGNAL correlator_snk_in_arr : t_dp_sosi_arr(c_nof_input_streams-1 DOWNTO 0); SIGNAL correlator_src_out_arr : t_dp_sosi_arr(1-1 DOWNTO 0); @@ -958,9 +992,9 @@ BEGIN ----------------------------------------------------------------------------- p_bsn_filter : PROCESS(wpfb_src_out_arr) BEGIN - correlator_snk_in_arr <= (OTHERS=>c_dp_sosi_rst); + requantize_snk_in_arr <= (OTHERS=>c_dp_sosi_rst); IF TO_UINT(wpfb_src_out_arr(0).bsn)>=5 THEN - correlator_snk_in_arr <= wpfb_src_out_arr; + requantize_snk_in_arr <= wpfb_src_out_arr; END IF; END PROCESS; @@ -982,7 +1016,35 @@ BEGIN src_out => OPEN, src_in => c_dp_siso_rdy ); - + + ----------------------------------------------------------------------------- + -- Requantize output of wpfb for correlator input + ----------------------------------------------------------------------------- + gen_requantizer : FOR I IN 0 TO c_nof_input_streams-1 GENERATE + u_dp_requantize_out : ENTITY dp_lib.dp_requantize + GENERIC MAP ( + g_complex => TRUE, + g_representation => "SIGNED", + g_lsb_w => c_wpfb_out_dat_w-c_cor_in_dat_w, + g_lsb_round => FALSE, + g_lsb_round_clip => FALSE, + g_msb_clip => FALSE, + g_msb_clip_symmetric => FALSE, + g_gain_w => 0, + g_pipeline_remove_lsb => 1, + g_pipeline_remove_msb => 0, + g_in_dat_w => c_wpfb_out_dat_w, + g_out_dat_w => c_cor_in_dat_w + ) + PORT MAP ( + rst => dp_rst, + clk => dp_clk, + snk_in => requantize_snk_in_arr(I), + src_out => correlator_snk_in_arr(I), + out_ovr => OPEN + ); + END GENERATE; + ----------------------------------------------------------------------------- -- Correlator ----------------------------------------------------------------------------- @@ -992,7 +1054,7 @@ BEGIN g_nof_input_streams => c_nof_input_streams, g_input_unfold_factor => c_nof_input_folds, g_nof_pre_mult_folds => c_nof_pre_mult_folds, - g_data_w => c_wpfb_out_dat_w, + g_data_w => c_cor_in_dat_w, g_conjugate => c_conjugate, g_nof_channels => c_nof_channels, g_integration_period => c_integration_period,