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..1636d93e870368688e8201051082670e6ef76d9b --- /dev/null +++ b/applications/lofar2/libraries/sdp/src/vhdl/node_sdp_beamformer.vhd @@ -0,0 +1,288 @@ +------------------------------------------------------------------------------- +-- +-- 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 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_gain_re_mosi : IN t_mem_mosi := c_mem_mosi_rst; + reg_gain_re_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(4 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); + + hdr_fields_out : OUT STD_LOGIC_VECTOR(1023 DOWNTO 0) + ); +END node_sdp_beamformer; + +ARCHITECTURE str OF node_sdp_beamformer IS + + CONSTANT c_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_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_gain_re_mosi, + reg_gain_re_miso => reg_gain_re_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;