diff --git a/applications/lofar2/libraries/sdp/hdllib.cfg b/applications/lofar2/libraries/sdp/hdllib.cfg index cdabca45cfaf7e7098d52eeb503da66aab334798..864b6aa6cf50a8286b9ba04da91560d776eb096a 100644 --- a/applications/lofar2/libraries/sdp/hdllib.cfg +++ b/applications/lofar2/libraries/sdp/hdllib.cfg @@ -1,6 +1,6 @@ hdl_lib_name = lofar2_sdp hdl_library_clause_name = lofar2_sdp_lib -hdl_lib_uses_synth = common dp wpfb rTwoSDF filter si st technology mm dp diag aduh tech_jesd204b tr_10GbE +hdl_lib_uses_synth = common dp wpfb rTwoSDF filter si st reorder technology mm dp diag aduh tech_jesd204b tr_10GbE hdl_lib_uses_sim = hdl_lib_technology = @@ -13,6 +13,7 @@ synth_files = src/vhdl/sdp_beamformer_output.vhd src/vhdl/node_sdp_adc_input_and_timing.vhd src/vhdl/node_sdp_filterbank.vhd + src/vhdl/node_sdp_beamformer.vhd test_bench_files = regression_test_vhdl = diff --git a/applications/lofar2/libraries/sdp/src/vhdl/node_sdp_beamformer.vhd b/applications/lofar2/libraries/sdp/src/vhdl/node_sdp_beamformer.vhd new file mode 100644 index 0000000000000000000000000000000000000000..4c4bd88c7607440d142fce92ede8fd914e6b301f --- /dev/null +++ b/applications/lofar2/libraries/sdp/src/vhdl/node_sdp_beamformer.vhd @@ -0,0 +1,289 @@ +------------------------------------------------------------------------------- +-- +-- Copyright 2020 +-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> +-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +-- +-- Author: R. van der Walle +-- Purpose: +-- . Implements the functionality of the Beamformer (BF) in the +-- LOFAR2 SDPFW design. +-- Description: +-- Remark: +-- . +------------------------------------------------------------------------------- + +LIBRARY IEEE, common_lib, dp_lib, reorder_lib, st_lib; +USE IEEE.STD_LOGIC_1164.ALL; +USE common_lib.common_pkg.ALL; +USE common_lib.common_mem_pkg.ALL; +USE common_lib.common_network_layers_pkg.ALL; +USE dp_lib.dp_stream_pkg.ALL; +USE work.sdp_pkg.ALL; + +ENTITY node_sdp_beamformer IS + GENERIC ( + g_sim : BOOLEAN := FALSE; + g_beamset_id : NATURAL := 0; + g_scope_selected_beamlet : NATURAL := 0 + ); + PORT ( + dp_clk : IN STD_LOGIC; + dp_rst : IN STD_LOGIC; + + in_sosi_arr : IN t_dp_sosi_arr(c_sdp_P_pfb-1 DOWNTO 0); + bf_udp_sosi : OUT t_dp_sosi; + bf_udp_siso : IN t_dp_siso; + bst_udp_sosi : OUT t_dp_sosi; + + mm_rst : IN STD_LOGIC; + mm_clk : IN STD_LOGIC; + + ram_ss_ss_wide_mosi : IN t_mem_mosi := c_mem_mosi_rst; + ram_ss_ss_wide_miso : OUT t_mem_miso; + ram_bf_weights_mosi : IN t_mem_mosi := c_mem_mosi_rst; + ram_bf_weights_miso : OUT t_mem_miso; + reg_bf_scale_mosi : IN t_mem_mosi := c_mem_mosi_rst; + reg_bf_scale_miso : OUT t_mem_miso; + reg_hdr_dat_mosi : IN t_mem_mosi := c_mem_mosi_rst; + reg_hdr_dat_miso : OUT t_mem_miso; + reg_dp_xonoff_mosi : IN t_mem_mosi := c_mem_mosi_rst; + reg_dp_xonoff_miso : OUT t_mem_miso; + ram_st_sst_mosi : IN t_mem_mosi := c_mem_mosi_rst; + ram_st_sst_miso : OUT t_mem_miso; + + sdp_info : IN t_sdp_info; + gn_id : IN STD_LOGIC_VECTOR(c_sdp_W_gn_id-1 DOWNTO 0); + + eth_src_mac : IN STD_LOGIC_VECTOR(c_network_eth_mac_addr_w-1 DOWNTO 0); + ip_src_addr : IN STD_LOGIC_VECTOR(c_network_ip_addr_w-1 DOWNTO 0); + udp_src_port : IN STD_LOGIC_VECTOR(c_network_udp_port_w-1 DOWNTO 0); + + hdr_fields_out : OUT STD_LOGIC_VECTOR(1023 DOWNTO 0) + ); +END node_sdp_beamformer; + +ARCHITECTURE str OF node_sdp_beamformer IS + + CONSTANT c_bf_select_file_prefix : STRING := "UNUSED"; + CONSTANT c_bf_weights_file_name : STRING := "UNUSED"; + + SIGNAL bsel_sosi_arr : t_dp_sosi_arr(c_sdp_P_pfb-1 DOWNTO 0) := (OTHERS => c_dp_sosi_rst); + SIGNAL local_bf_sosi : t_dp_sosi := c_dp_sosi_rst; + SIGNAL bf_sum_sosi : t_dp_sosi := c_dp_sosi_rst; + SIGNAL bf_out_sosi : t_dp_sosi := c_dp_sosi_rst; + SIGNAL scope_local_bf_sosi_arr : t_dp_sosi_integer_arr(c_sdp_N_pol-1 DOWNTO 0); + SIGNAL scope_bf_sum_sosi_arr : t_dp_sosi_integer_arr(c_sdp_N_pol-1 DOWNTO 0); + SIGNAL scope_bf_out_sosi_arr : t_dp_sosi_integer_arr(c_sdp_N_pol-1 DOWNTO 0); +BEGIN + --------------------------------------------------------------- + -- Beamlet Subband Select + --------------------------------------------------------------- + u_reorder_col_wide : ENTITY reorder_lib.reorder_col_wide + GENERIC MAP ( + g_wb_factor => c_sdp_P_pfb, -- g_wb_factor is only used for number of parallel streams + g_dsp_data_w => c_sdp_W_subband, + g_nof_ch_in => c_sdp_N_sub * c_sdp_Q_fft, + g_nof_ch_sel => c_sdp_S_sub_bf * c_sdp_Q_fft, + g_select_file_prefix => c_bf_select_file_prefix, + g_use_complex => TRUE + ) + PORT MAP( + input_sosi_arr => in_sosi_arr, + output_sosi_arr => bsel_sosi_arr, + + ram_ss_ss_wide_mosi => ram_ss_ss_wide_mosi, + ram_ss_ss_wide_miso => ram_ss_ss_wide_miso, + + mm_rst => mm_rst, + mm_clk => mm_clk, + dp_clk => dp_clk, + dp_rst => dp_rst + ); + + --------------------------------------------------------------- + -- Local BF + --------------------------------------------------------------- + u_sdp_beamformer_local : ENTITY work.sdp_beamformer_local + GENERIC MAP ( + g_bf_weights_file_name => c_bf_weights_file_name + ) + PORT MAP ( + dp_rst => dp_rst, + dp_clk => dp_clk, + mm_rst => mm_rst, + mm_clk => mm_clk, + + ram_bf_weights_mosi => ram_bf_weights_mosi, + ram_bf_weights_miso => ram_bf_weights_miso, + + in_sosi_arr => bsel_sosi_arr, + out_sosi => local_bf_sosi + ); + + --------------------------------------------------------------- + -- Remote BF + --------------------------------------------------------------- + -- Not yet implemented + bf_sum_sosi <= local_bf_sosi; + + --------------------------------------------------------------- + -- Scale Beamlets + --------------------------------------------------------------- + u_mms_dp_scale : ENTITY dp_lib.mms_dp_scale + GENERIC MAP ( + g_complex_data => TRUE, + g_complex_gain => FALSE, + g_gain_init_re => 2**(c_sdp_W_beamlet_scale-1), + g_gain_w => c_sdp_W_beamlet_scale, + g_in_dat_w => c_sdp_W_beamlet_sum, + g_out_dat_w => c_sdp_W_beamlet, + g_lsb_w => c_sdp_W_beamlet_scale-1, + g_lsb_round => TRUE, + g_lsb_round_clip => FALSE, + g_msb_clip => TRUE, + g_msb_clip_symmetric => TRUE + ) + PORT MAP( + dp_clk => dp_clk, + dp_rst => dp_rst, + + in_sosi => bf_sum_sosi, + out_sosi => bf_out_sosi, + + mm_rst => mm_rst, + mm_clk => mm_clk, + + reg_gain_re_mosi => reg_bf_scale_mosi, + reg_gain_re_miso => reg_bf_scale_miso + ); + + --------------------------------------------------------------- + -- Beamlet Data Output (BDO) + --------------------------------------------------------------- + u_sdp_beamformer_output : ENTITY work.sdp_beamformer_output + GENERIC MAP( + g_beamset_id => g_beamset_id + ) + PORT MAP ( + mm_rst => mm_rst, + mm_clk => mm_clk, + dp_rst => dp_rst, + dp_clk => dp_clk, + + in_sosi => bf_out_sosi, + out_sosi => bf_udp_sosi, + src_in => bf_udp_siso, + + sdp_info => sdp_info, + gn_id => gn_id, + + eth_src_mac => eth_src_mac, + ip_src_addr => ip_src_addr, + udp_src_port => udp_src_port, + + hdr_fields_out => hdr_fields_out, + + reg_hdr_dat_mosi => reg_hdr_dat_mosi, + reg_hdr_dat_miso => reg_hdr_dat_miso, + reg_dp_xonoff_mosi => reg_dp_xonoff_mosi, + reg_dp_xonoff_miso => reg_dp_xonoff_miso + ); + + --------------------------------------------------------------- + -- Beamlet Statistics (BST) + --------------------------------------------------------------- + u_beamlet_stats : ENTITY st_lib.st_sst + GENERIC MAP( + g_nof_stat => c_sdp_S_sub_bf*c_sdp_N_pol, + g_in_data_w => c_sdp_W_beamlet_sum, + g_stat_data_w => c_longword_w, + g_stat_data_sz => c_longword_sz/c_word_sz + ) + PORT MAP ( + mm_rst => mm_rst, + mm_clk => mm_clk, + dp_rst => dp_rst, + dp_clk => dp_clk, + in_complex => bf_sum_sosi, + ram_st_sst_mosi => ram_st_sst_mosi, + ram_st_sst_miso => ram_st_sst_miso + ); + + --------------------------------------------------------------- + -- MM master multiplexer + --------------------------------------------------------------- + -- Not yet implemented + + --------------------------------------------------------------- + -- BST UDP offload + --------------------------------------------------------------- + -- Not yet implemented + + --------------------------------------------------------------- + -- SIGNAL SCOPES + --------------------------------------------------------------- + u_sdp_scope_local_bf : ENTITY work.sdp_scope + GENERIC MAP ( + g_sim => g_sim, + g_selection => g_scope_selected_beamlet, + g_nof_input => 1, + g_n_deinterleave => c_sdp_N_pol, + g_dat_w => c_sdp_W_beamlet_sum + ) + PORT MAP ( + clk => dp_clk, + rst => dp_rst, + sp_sosi_arr(0) => local_bf_sosi, + scope_sosi_arr => scope_local_bf_sosi_arr + ); + + u_sdp_scope_bf_sum : ENTITY work.sdp_scope + GENERIC MAP ( + g_sim => g_sim, + g_selection => g_scope_selected_beamlet, + g_nof_input => 1, + g_n_deinterleave => c_sdp_N_pol, + g_dat_w => c_sdp_W_beamlet_sum + + ) + PORT MAP ( + clk => dp_clk, + rst => dp_rst, + sp_sosi_arr(0) => bf_sum_sosi, + scope_sosi_arr => scope_bf_sum_sosi_arr + ); + + u_sdp_scope_bf_out : ENTITY work.sdp_scope + GENERIC MAP ( + g_sim => g_sim, + g_selection => g_scope_selected_beamlet, + g_nof_input => 1, + g_n_deinterleave => c_sdp_N_pol, + g_dat_w => c_sdp_W_beamlet + + ) + PORT MAP ( + clk => dp_clk, + rst => dp_rst, + sp_sosi_arr(0) => bf_out_sosi, + scope_sosi_arr => scope_bf_out_sosi_arr + ); + +END str; diff --git a/applications/lofar2/libraries/sdp/src/vhdl/node_sdp_filterbank.vhd b/applications/lofar2/libraries/sdp/src/vhdl/node_sdp_filterbank.vhd index cde5cee218ab7188f87b4a6bbdcf26cb9e51d8b2..d8c90a54662260b2af8f72c5cf10f1f87136d3f2 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/node_sdp_filterbank.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/node_sdp_filterbank.vhd @@ -245,8 +245,11 @@ BEGIN --------------------------------------------------------------- u_sdp_scope : ENTITY work.sdp_scope GENERIC MAP ( - g_sim => g_sim, - g_selected_subband => g_scope_selected_subband + g_sim => g_sim, + g_selection => g_scope_selected_subband, + g_nof_input => c_sdp_P_pfb, + g_n_deinterleave => c_sdp_Q_fft, + g_dat_w => c_sdp_W_subband ) PORT MAP ( clk => dp_clk, diff --git a/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd b/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd index c94d2fc0473fa4bc0d20651897c0f35851eca65e..3ebcd050063a8c918064f19bb45c1cbe14556d19 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd @@ -34,6 +34,7 @@ USE IEEE.NUMERIC_STD.ALL; USE common_lib.common_pkg.ALL; USE common_lib.common_field_pkg.ALL; USE common_lib.common_mem_pkg.ALL; +USE common_lib.common_network_layers_pkg.ALL; USE dp_lib.dp_stream_pkg.ALL; USE work.sdp_pkg.ALL; @@ -60,11 +61,11 @@ ENTITY sdp_beamformer_output IS src_in : IN t_dp_siso; sdp_info : IN t_sdp_info; - gn_id : IN STD_LOGIC_VECTOR(4 DOWNTO 0); + gn_id : IN STD_LOGIC_VECTOR(c_sdp_W_gn_id-1 DOWNTO 0); - eth_src_mac : IN STD_LOGIC_VECTOR(47 DOWNTO 0); - ip_src_addr : IN STD_LOGIC_VECTOR(31 DOWNTO 0); - udp_src_port : IN STD_LOGIC_VECTOR(15 DOWNTO 0); + eth_src_mac : IN STD_LOGIC_VECTOR(c_network_eth_mac_addr_w-1 DOWNTO 0); + ip_src_addr : IN STD_LOGIC_VECTOR(c_network_ip_addr_w-1 DOWNTO 0); + udp_src_port : IN STD_LOGIC_VECTOR(c_network_udp_port_w-1 DOWNTO 0); hdr_fields_out : OUT STD_LOGIC_VECTOR(1023 DOWNTO 0) ); diff --git a/applications/lofar2/libraries/sdp/src/vhdl/sdp_pkg.vhd b/applications/lofar2/libraries/sdp/src/vhdl/sdp_pkg.vhd index 95aad8a84a09e0d7b6870788e619255466c49762..3977e21a40a61fb9dd378e2a91ff1eec711e7b61 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_pkg.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_pkg.vhd @@ -1,133 +1,135 @@ -------------------------------------------------------------------------------- --- --- Copyright 2020 --- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- --- --- Author: R. van der Walle --- Purpose: --- . This package contains sdp specific constants. --- Description: --- Remark: --- . See Document: L3 SDP Decision: SDP Parameter definitions. -------------------------------------------------------------------------------- -LIBRARY ieee, common_lib, rTwoSDF_lib, fft_lib, filter_lib, wpfb_lib; -USE IEEE.std_logic_1164.ALL; -USE common_lib.common_pkg.ALL; -USE rTwoSDF_lib.rTwoSDFPkg.ALL; -USE fft_lib.fft_pkg.ALL; -USE filter_lib.fil_pkg.ALL; -USE wpfb_lib.wpfb_pkg.ALL; - -PACKAGE sdp_pkg is - ------------------------------------------------- - -- SDP info record as defined in: - -- LOFAR2-9258-SDP info per antenna band - ------------------------------------------------- - TYPE t_sdp_info IS RECORD - station_id : STD_LOGIC_VECTOR(15 DOWNTO 0); - antenna_band_index : STD_LOGIC; - observation_id : STD_LOGIC_VECTOR(31 DOWNTO 0); - nyquist_zone_index : STD_LOGIC_VECTOR(1 DOWNTO 0); - f_adc : STD_LOGIC; - fsub_type : STD_LOGIC; - beam_repositioning_flag : STD_LOGIC; - subband_calibrated_flag : STD_LOGIC; - O_si : STD_LOGIC_VECTOR(7 DOWNTO 0); - N_si : STD_LOGIC_VECTOR(7 DOWNTO 0); - O_rn : STD_LOGIC_VECTOR(7 DOWNTO 0); - N_rn : STD_LOGIC_VECTOR(7 DOWNTO 0); - block_period : STD_LOGIC_VECTOR(15 DOWNTO 0); - beamlet_scale : STD_LOGIC_VECTOR(15 DOWNTO 0); - END RECORD; - - ------------------------------------------------- - -- SDP specific parameters as defined in: - -- L3 SDP Decision: SDP Parameter definitions - ------------------------------------------------- - CONSTANT c_sdp_N_pol : NATURAL := 2; - CONSTANT c_sdp_N_sub : NATURAL := 512; - CONSTANT c_sdp_N_fft : NATURAL := 1024; - CONSTANT c_sdp_S_pn : NATURAL := 12; - CONSTANT c_sdp_Q_fft : NATURAL := 2; - CONSTANT c_sdp_N_taps : NATURAL := 16; - CONSTANT c_sdp_W_adc : NATURAL := 14; - CONSTANT c_sdp_W_fir_coef : NATURAL := 16; - CONSTANT c_sdp_W_subband : NATURAL := 18; - CONSTANT c_sdp_P_pfb : NATURAL := c_sdp_S_pn/c_sdp_Q_fft; - CONSTANT c_sdp_S_sub_bf : NATURAL := 488; - CONSTANT c_sdp_f_adc_MHz : NATURAL := 200; - CONSTANT c_sdp_T_adc : TIME := (10**6/c_sdp_f_adc_MHz) * 1 ps; - CONSTANT c_sdp_T_sub : TIME := c_sdp_N_fft * c_sdp_T_adc; - CONSTANT c_sdp_W_sub_weight : NATURAL := 16; - CONSTANT c_sdp_W_sub_magnitude : NATURAL := 2; - CONSTANT c_sdp_W_sub_fraction : NATURAL := c_sdp_W_sub_weight - c_sdp_W_sub_magnitude -1; - CONSTANT c_sdp_W_bf_weight : NATURAL := 16; - CONSTANT c_sdp_W_bf_magnitude : NATURAL := 1; - CONSTANT c_sdp_W_bf_fraction : NATURAL := c_sdp_W_bf_weight - c_sdp_W_bf_magnitude -1; - CONSTANT c_sdp_W_bf_product : NATURAL := c_sdp_W_subband + c_sdp_W_bf_weight -1; - CONSTANT c_sdp_W_beamlet_sum : NATURAL := 18; - CONSTANT c_sdp_W_beamlet : NATURAL := 8; - - -- AIT constants - CONSTANT c_sdp_ait_buf_nof_data_jesd : NATURAL := 1024; -- 1024 14 bit samples fit in one M20k BRAM - CONSTANT c_sdp_ait_buf_nof_data_bsn : NATURAL := 1024; -- 1024 14 bit samples fit in one M20k BRAM - - -- In SDP c_nof_channels = 2**nof_chan = 1 and wb_factor = 1, - -- therefore these parameters are not explicitly used in calculation of derived constants - 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, 16, c_sdp_W_fir_coef, - true, false, true, 16, c_sdp_W_subband, 1, 18, 2, - true, 54, 2, 195313, c_fft_pipeline, c_fft_pipeline, - c_fil_ppf_pipeline); - - -- JESD204 - CONSTANT c_sdp_jesd204b_bus_w : NATURAL := 12; - CONSTANT c_sdp_jesd204b_nof_bus : NATURAL := 1; - - - -- AIT MM address widths - CONSTANT c_sdp_jesd204b_addr_w : NATURAL := 8 + ceil_log2(c_sdp_S_pn); - CONSTANT c_sdp_reg_bsn_monitor_input_addr_w : NATURAL := 8; - CONSTANT c_sdp_reg_wg_addr_w : NATURAL := 2 + ceil_log2(c_sdp_S_pn); - CONSTANT c_sdp_ram_wg_addr_w : NATURAL := 10 + ceil_log2(c_sdp_S_pn); - CONSTANT c_sdp_reg_dp_shiftram_addr_w : NATURAL := 1 + ceil_log2(c_sdp_S_pn); - CONSTANT c_sdp_reg_bsn_source_addr_w : NATURAL := 2; - CONSTANT c_sdp_reg_bsn_scheduler_addr_w : NATURAL := 1; - CONSTANT c_sdp_ram_diag_data_buf_jesd_addr_w : NATURAL := ceil_log2(2*c_sdp_ait_buf_nof_data_jesd); - CONSTANT c_sdp_reg_diag_data_buf_jesd_addr_w : NATURAL := 1 + ceil_log2(2); - CONSTANT c_sdp_ram_diag_data_buf_bsn_addr_w : NATURAL := ceil_log2(c_sdp_S_pn*c_sdp_ait_buf_nof_data_bsn); - CONSTANT c_sdp_reg_diag_data_buf_bsn_addr_w : NATURAL := 1 + ceil_log2(c_sdp_S_pn); - CONSTANT c_sdp_reg_aduh_monitor_addr_w : NATURAL := 2 + ceil_log2(c_sdp_S_pn); - - -- FSUB MM address widths - CONSTANT c_sdp_ram_fil_coefs_addr_w : NATURAL := ceil_log2(c_sdp_N_fft * c_sdp_N_taps); - CONSTANT c_sdp_ram_st_sst_addr_w : NATURAL := ceil_log2(c_sdp_P_pfb*c_sdp_N_sub*c_sdp_Q_fft*c_sdp_wpfb_subbands.stat_data_sz); - CONSTANT c_sdp_reg_si_addr_w : NATURAL := 1; --enable/disable - CONSTANT c_sdp_ram_equalizer_gains_addr_w : NATURAL := ceil_log2(c_sdp_P_pfb*c_sdp_N_sub*c_sdp_Q_fft); - CONSTANT c_sdp_reg_dp_selector_addr_w : NATURAL := 1; --Select input 0 or 1. - -END PACKAGE sdp_pkg; - -PACKAGE BODY sdp_pkg IS - - -END sdp_pkg; - +------------------------------------------------------------------------------- +-- +-- Copyright 2020 +-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> +-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +-- +-- Author: R. van der Walle +-- Purpose: +-- . This package contains sdp specific constants. +-- Description: +-- Remark: +-- . See Document: L3 SDP Decision: SDP Parameter definitions. +------------------------------------------------------------------------------- +LIBRARY ieee, common_lib, rTwoSDF_lib, fft_lib, filter_lib, wpfb_lib; +USE IEEE.std_logic_1164.ALL; +USE common_lib.common_pkg.ALL; +USE rTwoSDF_lib.rTwoSDFPkg.ALL; +USE fft_lib.fft_pkg.ALL; +USE filter_lib.fil_pkg.ALL; +USE wpfb_lib.wpfb_pkg.ALL; + +PACKAGE sdp_pkg is + ------------------------------------------------- + -- SDP info record as defined in: + -- LOFAR2-9258-SDP info per antenna band + ------------------------------------------------- + TYPE t_sdp_info IS RECORD + station_id : STD_LOGIC_VECTOR(15 DOWNTO 0); + antenna_band_index : STD_LOGIC; + observation_id : STD_LOGIC_VECTOR(31 DOWNTO 0); + nyquist_zone_index : STD_LOGIC_VECTOR(1 DOWNTO 0); + f_adc : STD_LOGIC; + fsub_type : STD_LOGIC; + beam_repositioning_flag : STD_LOGIC; + subband_calibrated_flag : STD_LOGIC; + O_si : STD_LOGIC_VECTOR(7 DOWNTO 0); + N_si : STD_LOGIC_VECTOR(7 DOWNTO 0); + O_rn : STD_LOGIC_VECTOR(7 DOWNTO 0); + N_rn : STD_LOGIC_VECTOR(7 DOWNTO 0); + block_period : STD_LOGIC_VECTOR(15 DOWNTO 0); + beamlet_scale : STD_LOGIC_VECTOR(15 DOWNTO 0); + END RECORD; + + ------------------------------------------------- + -- SDP specific parameters as defined in: + -- L3 SDP Decision: SDP Parameter definitions + ------------------------------------------------- + CONSTANT c_sdp_N_pol : NATURAL := 2; + CONSTANT c_sdp_N_sub : NATURAL := 512; + CONSTANT c_sdp_N_fft : NATURAL := 1024; + CONSTANT c_sdp_S_pn : NATURAL := 12; + CONSTANT c_sdp_Q_fft : NATURAL := 2; + CONSTANT c_sdp_N_taps : NATURAL := 16; + CONSTANT c_sdp_W_adc : NATURAL := 14; + CONSTANT c_sdp_W_fir_coef : NATURAL := 16; + CONSTANT c_sdp_W_subband : NATURAL := 18; + CONSTANT c_sdp_P_pfb : NATURAL := c_sdp_S_pn/c_sdp_Q_fft; + CONSTANT c_sdp_S_sub_bf : NATURAL := 488; + CONSTANT c_sdp_f_adc_MHz : NATURAL := 200; + CONSTANT c_sdp_T_adc : TIME := (10**6/c_sdp_f_adc_MHz) * 1 ps; + CONSTANT c_sdp_T_sub : TIME := c_sdp_N_fft * c_sdp_T_adc; + CONSTANT c_sdp_W_sub_weight : NATURAL := 16; + CONSTANT c_sdp_W_sub_magnitude : NATURAL := 2; + CONSTANT c_sdp_W_sub_fraction : NATURAL := c_sdp_W_sub_weight - c_sdp_W_sub_magnitude -1; + CONSTANT c_sdp_W_bf_weight : NATURAL := 16; + CONSTANT c_sdp_W_bf_magnitude : NATURAL := 1; + CONSTANT c_sdp_W_bf_fraction : NATURAL := c_sdp_W_bf_weight - c_sdp_W_bf_magnitude -1; + CONSTANT c_sdp_W_bf_product : NATURAL := c_sdp_W_subband + c_sdp_W_bf_weight -1; + CONSTANT c_sdp_W_beamlet_sum : NATURAL := 18; + CONSTANT c_sdp_W_beamlet : NATURAL := 8; + CONSTANT c_sdp_W_beamlet_scale : NATURAL := 16; + CONSTANT c_sdp_W_gn_id : NATURAL := 5; + + -- AIT constants + CONSTANT c_sdp_ait_buf_nof_data_jesd : NATURAL := 1024; -- 1024 14 bit samples fit in one M20k BRAM + CONSTANT c_sdp_ait_buf_nof_data_bsn : NATURAL := 1024; -- 1024 14 bit samples fit in one M20k BRAM + + -- In SDP c_nof_channels = 2**nof_chan = 1 and wb_factor = 1, + -- therefore these parameters are not explicitly used in calculation of derived constants + 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, 16, c_sdp_W_fir_coef, + true, false, true, 16, c_sdp_W_subband, 1, 18, 2, + true, 54, 2, 195313, c_fft_pipeline, c_fft_pipeline, + c_fil_ppf_pipeline); + + -- JESD204 + CONSTANT c_sdp_jesd204b_bus_w : NATURAL := 12; + CONSTANT c_sdp_jesd204b_nof_bus : NATURAL := 1; + + + -- AIT MM address widths + CONSTANT c_sdp_jesd204b_addr_w : NATURAL := 8 + ceil_log2(c_sdp_S_pn); + CONSTANT c_sdp_reg_bsn_monitor_input_addr_w : NATURAL := 8; + CONSTANT c_sdp_reg_wg_addr_w : NATURAL := 2 + ceil_log2(c_sdp_S_pn); + CONSTANT c_sdp_ram_wg_addr_w : NATURAL := 10 + ceil_log2(c_sdp_S_pn); + CONSTANT c_sdp_reg_dp_shiftram_addr_w : NATURAL := 1 + ceil_log2(c_sdp_S_pn); + CONSTANT c_sdp_reg_bsn_source_addr_w : NATURAL := 2; + CONSTANT c_sdp_reg_bsn_scheduler_addr_w : NATURAL := 1; + CONSTANT c_sdp_ram_diag_data_buf_jesd_addr_w : NATURAL := ceil_log2(2*c_sdp_ait_buf_nof_data_jesd); + CONSTANT c_sdp_reg_diag_data_buf_jesd_addr_w : NATURAL := 1 + ceil_log2(2); + CONSTANT c_sdp_ram_diag_data_buf_bsn_addr_w : NATURAL := ceil_log2(c_sdp_S_pn*c_sdp_ait_buf_nof_data_bsn); + CONSTANT c_sdp_reg_diag_data_buf_bsn_addr_w : NATURAL := 1 + ceil_log2(c_sdp_S_pn); + CONSTANT c_sdp_reg_aduh_monitor_addr_w : NATURAL := 2 + ceil_log2(c_sdp_S_pn); + + -- FSUB MM address widths + CONSTANT c_sdp_ram_fil_coefs_addr_w : NATURAL := ceil_log2(c_sdp_N_fft * c_sdp_N_taps); + CONSTANT c_sdp_ram_st_sst_addr_w : NATURAL := ceil_log2(c_sdp_P_pfb*c_sdp_N_sub*c_sdp_Q_fft*c_sdp_wpfb_subbands.stat_data_sz); + CONSTANT c_sdp_reg_si_addr_w : NATURAL := 1; --enable/disable + CONSTANT c_sdp_ram_equalizer_gains_addr_w : NATURAL := ceil_log2(c_sdp_P_pfb*c_sdp_N_sub*c_sdp_Q_fft); + CONSTANT c_sdp_reg_dp_selector_addr_w : NATURAL := 1; --Select input 0 or 1. + +END PACKAGE sdp_pkg; + +PACKAGE BODY sdp_pkg IS + + +END sdp_pkg; + diff --git a/applications/lofar2/libraries/sdp/src/vhdl/sdp_scope.vhd b/applications/lofar2/libraries/sdp/src/vhdl/sdp_scope.vhd index ace7425094185772a6addeb3769c373a061eff09..0f8c1ae119a929ce54325aa3eddbc6a45d9abf81 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_scope.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_scope.vhd @@ -23,12 +23,12 @@ -- Author: R. van der Walle -- Purpose: --- . Scope component to show the desired subband from the PFB output in the wave --- window. +-- . Scope component to show the desired time index (beamlet/subband) from +-- the sp_sosi_arr input in the wave window based on g_selection. -- Description: +-- First deinterleaves the input then feed that to dp_wideband_sp_arr_scope. -- Remark: -- . Only for simulation. --- . g_selected_subband can be 0 - 511. ------------------------------------------------------------------------------- LIBRARY IEEE, common_lib, dp_lib; @@ -40,45 +40,54 @@ USE work.sdp_pkg.ALL; ENTITY sdp_scope IS GENERIC ( g_sim : BOOLEAN := FALSE; - g_selected_subband : NATURAL := 0 + g_selection : NATURAL := 0; -- Time index selection (subband/beamlet) + g_nof_input : NATURAL := 2; -- nof input streams + g_n_deinterleave : NATURAL := 2; -- deinterleave factor for each input stream + g_dat_w : NATURAL := 18 -- Data width ); PORT ( clk : IN STD_LOGIC; rst : IN STD_LOGIC; - -- Streaming input for P_pfb complex streams - sp_sosi_arr : IN t_dp_sosi_arr(c_sdp_P_pfb-1 DOWNTO 0); + -- Streaming input for complex streams + sp_sosi_arr : IN t_dp_sosi_arr(g_nof_input-1 DOWNTO 0); - -- Scope output for S_pn streams - scope_sosi_arr : OUT t_dp_sosi_integer_arr(c_sdp_S_pn-1 DOWNTO 0) + -- Scope output for deinterleaved streams + scope_sosi_arr : OUT t_dp_sosi_integer_arr(g_nof_input*g_n_deinterleave-1 DOWNTO 0) ); END sdp_scope; ARCHITECTURE str OF sdp_scope IS - SIGNAL cnt : NATURAL; - SIGNAL deinterleaved_sosi_arr : t_dp_sosi_arr(c_sdp_S_pn-1 DOWNTO 0); - SIGNAL subband_sosi_arr : t_dp_sosi_arr(c_sdp_S_pn-1 DOWNTO 0) := (OTHERS=>c_dp_sosi_rst); + TYPE t_dp_sosi_2arr_n IS ARRAY (INTEGER RANGE <>) OF t_dp_sosi_arr(g_n_deinterleave-1 DOWNTO 0); + + SIGNAL cnt : NATURAL; + SIGNAL deinterleaved_sosi_2arr_n : t_dp_sosi_2arr_n(g_nof_input-1 DOWNTO 0); + SIGNAL deinterleaved_sosi_arr : t_dp_sosi_arr(g_nof_input*g_n_deinterleave-1 DOWNTO 0); + SIGNAL selected_sosi_arr : t_dp_sosi_arr(g_nof_input*g_n_deinterleave-1 DOWNTO 0) := (OTHERS=>c_dp_sosi_rst); BEGIN sim_only : IF g_sim=TRUE GENERATE - gen_deinterleave : FOR I IN 0 TO c_sdp_P_pfb-1 GENERATE + gen_deinterleave : FOR I IN 0 TO g_nof_input-1 GENERATE u_dp_deinterleave : ENTITY dp_lib.dp_deinterleave_one_to_n GENERIC MAP( g_pipeline => 0, - g_nof_outputs => c_sdp_Q_fft + g_nof_outputs => g_n_deinterleave ) PORT MAP( rst => rst, clk => clk, snk_in => sp_sosi_arr(I), - src_out_arr(0) => deinterleaved_sosi_arr(2*I), - src_out_arr(1) => deinterleaved_sosi_arr(2*I+1) + src_out_arr => deinterleaved_sosi_2arr_n(I) ); + + gen_flat : FOR J IN 0 TO g_n_deinterleave-1 GENERATE + deinterleaved_sosi_arr(g_n_deinterleave*I+J) <= deinterleaved_sosi_2arr_n(I)(J); + END GENERATE; END GENERATE; p_cnt : PROCESS(rst, clk) @@ -96,25 +105,25 @@ BEGIN END IF; END PROCESS; - -- Select subband - subband_sosi_arr <= deinterleaved_sosi_arr WHEN cnt = g_selected_subband; + -- Select desired index. + selected_sosi_arr <= deinterleaved_sosi_arr WHEN cnt = g_selection; --------------------------------------------------------------- -- SIGNAL SCOPE --------------------------------------------------------------- u_dp_wideband_sp_arr_scope : ENTITY dp_lib.dp_wideband_sp_arr_scope - GENERIC MAP ( - g_sim => g_sim, - g_use_sclk => FALSE, - g_complex => TRUE, - g_nof_streams => c_sdp_S_pn, - g_wideband_factor => 1, - g_dat_w => c_sdp_W_subband - ) - PORT MAP ( - DCLK => clk, - sp_sosi_arr => subband_sosi_arr, - scope_sosi_arr => scope_sosi_arr - ); + GENERIC MAP ( + g_sim => g_sim, + g_use_sclk => FALSE, + g_complex => TRUE, + g_nof_streams => g_nof_input*g_n_deinterleave, + g_wideband_factor => 1, + g_dat_w => g_dat_w + ) + PORT MAP ( + DCLK => clk, + sp_sosi_arr => selected_sosi_arr, + scope_sosi_arr => scope_sosi_arr + ); END GENERATE; END str;