diff --git a/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_pkg.vhd b/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_pkg.vhd index 63ca0848374b7becbbf893c94cc36fdd8ba8a019..b2160e3ac4fc414a0bf0f0b4698365b583de9701 100644 --- a/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_pkg.vhd +++ b/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_pkg.vhd @@ -62,22 +62,43 @@ package tb_sdp_pkg is ----------------------------------------------------------------------------- -- Beamlet output via 10GbE to CEP (= central processor) ----------------------------------------------------------------------------- - function func_sdp_compose_cep_header(ip_src_addr : std_logic_vector; - ip_header_checksum : natural; - sdp_info : t_sdp_info; -- app header - gn_index : natural; - payload_error : std_logic; - beamlet_scale : natural; - beamlet_index : natural; - dp_bsn : natural) return t_sdp_cep_header; - - function func_sdp_compose_cep_header(ip_header_checksum : natural; - sdp_info : t_sdp_info; -- app header - gn_index : natural; - payload_error : std_logic; - beamlet_scale : natural; - beamlet_index : natural; - dp_bsn : natural) return t_sdp_cep_header; + function func_sdp_compose_cep_header(ip_src_addr : std_logic_vector; + ip_header_checksum : natural; + sdp_info : t_sdp_info; -- app header + gn_index : natural; + payload_error : std_logic; + beamlet_scale : natural; + beamlet_index : natural; + nof_blocks_per_packet : natural; + nof_beamlets_per_block : natural; + dp_bsn : natural) return t_sdp_cep_header; + + function func_sdp_compose_cep_header(ip_header_checksum : natural; + sdp_info : t_sdp_info; -- app header + gn_index : natural; + payload_error : std_logic; + beamlet_scale : natural; + beamlet_index : natural; + nof_blocks_per_packet : natural; + nof_beamlets_per_block : natural; + dp_bsn : natural) return t_sdp_cep_header; + + function func_sdp_compose_cep_header(ip_src_addr : std_logic_vector; + ip_header_checksum : natural; + sdp_info : t_sdp_info; -- app header + gn_index : natural; + payload_error : std_logic; + beamlet_scale : natural; + beamlet_index : natural; + dp_bsn : natural) return t_sdp_cep_header; + + function func_sdp_compose_cep_header(ip_header_checksum : natural; + sdp_info : t_sdp_info; -- app header + gn_index : natural; + payload_error : std_logic; + beamlet_scale : natural; + beamlet_index : natural; + dp_bsn : natural) return t_sdp_cep_header; function func_sdp_verify_cep_header(in_hdr, exp_hdr : t_sdp_cep_header) return boolean; @@ -109,8 +130,8 @@ package tb_sdp_pkg is ----------------------------------------------------------------------------- -- Beamlet output packet ----------------------------------------------------------------------------- - -- beamlet part index [0 : 3] of X, Y, X, Y in network longword: - -- - use separate array for re and for im: + -- beamlet complex part index [0 : 3] of X, Y, X, Y in network longword: + -- - use separate array for re part and for im part: -- . re[0 : 3] at 0, 2, 4, 6 in longword -- . im[0 : 3] at 1, 3, 5, 7 in longword subtype t_sdp_beamlet_part_arr is t_slv_8_arr(0 to c_sdp_nof_beamlets_per_longword * c_sdp_N_pol_bf - 1); @@ -311,14 +332,16 @@ package body tb_sdp_pkg is return true; end func_sdp_verify_stat_header; - function func_sdp_compose_cep_header(ip_src_addr : std_logic_vector; - ip_header_checksum : natural; - sdp_info : t_sdp_info; -- app header - gn_index : natural; - payload_error : std_logic; - beamlet_scale : natural; - beamlet_index : natural; - dp_bsn : natural) return t_sdp_cep_header is + function func_sdp_compose_cep_header(ip_src_addr : std_logic_vector; + ip_header_checksum : natural; + sdp_info : t_sdp_info; -- app header + gn_index : natural; + payload_error : std_logic; + beamlet_scale : natural; + beamlet_index : natural; + nof_blocks_per_packet : natural; + nof_beamlets_per_block : natural; + dp_bsn : natural) return t_sdp_cep_header is -- Use sim default dst and src MAC, IP, UDP port from sdp_pkg.vhd and based on gn_index constant c_mac_15_0 : std_logic_vector(15 downto 0) := func_sdp_gn_index_to_mac_15_0(gn_index); variable v_hdr : t_sdp_cep_header; @@ -367,14 +390,60 @@ package body tb_sdp_pkg is v_hdr.app.sdp_reserved := TO_UVEC(0, 32); v_hdr.app.sdp_beamlet_scale := TO_UVEC(beamlet_scale, 16); v_hdr.app.sdp_beamlet_index := TO_UVEC(beamlet_index, 16); - v_hdr.app.sdp_nof_blocks_per_packet := TO_UVEC(c_sdp_cep_nof_blocks_per_packet, 8); - v_hdr.app.sdp_nof_beamlets_per_block := TO_UVEC(c_sdp_cep_nof_beamlets_per_block, 16); + v_hdr.app.sdp_nof_blocks_per_packet := TO_UVEC(nof_blocks_per_packet, 8); + v_hdr.app.sdp_nof_beamlets_per_block := TO_UVEC(nof_beamlets_per_block, 16); v_hdr.app.sdp_block_period := sdp_info.block_period; v_hdr.app.dp_bsn := TO_UVEC(dp_bsn, 64); return v_hdr; end func_sdp_compose_cep_header; + function func_sdp_compose_cep_header(ip_header_checksum : natural; + sdp_info : t_sdp_info; -- app header + gn_index : natural; + payload_error : std_logic; + beamlet_scale : natural; + beamlet_index : natural; + nof_blocks_per_packet : natural; + nof_beamlets_per_block : natural; + dp_bsn : natural) return t_sdp_cep_header is + -- Use sim default dst and src MAC, IP, UDP port from sdp_pkg.vhd and based on gn_index + constant c_ip_15_0 : std_logic_vector(15 downto 0) := func_sdp_gn_index_to_ip_15_0(gn_index); + constant c_ip_src_addr : std_logic_vector(31 downto 0) := c_sdp_cep_ip_src_addr_31_16 & c_ip_15_0; + begin + return func_sdp_compose_cep_header(c_ip_src_addr, + ip_header_checksum, + sdp_info, + gn_index, + payload_error, + beamlet_scale, + beamlet_index, + nof_blocks_per_packet, + nof_beamlets_per_block, + dp_bsn); + end func_sdp_compose_cep_header; + + function func_sdp_compose_cep_header(ip_src_addr : std_logic_vector; + ip_header_checksum : natural; + sdp_info : t_sdp_info; -- app header + gn_index : natural; + payload_error : std_logic; + beamlet_scale : natural; + beamlet_index : natural; + dp_bsn : natural) return t_sdp_cep_header is + begin + return func_sdp_compose_cep_header(ip_src_addr, + ip_header_checksum, + sdp_info, + gn_index, + payload_error, + beamlet_scale, + beamlet_index, + c_sdp_cep_nof_blocks_per_packet, + c_sdp_cep_nof_beamlets_per_block, + dp_bsn); + end func_sdp_compose_cep_header; + function func_sdp_compose_cep_header(ip_header_checksum : natural; sdp_info : t_sdp_info; -- app header gn_index : natural; @@ -393,6 +462,8 @@ package body tb_sdp_pkg is payload_error, beamlet_scale, beamlet_index, + c_sdp_cep_nof_blocks_per_packet, + c_sdp_cep_nof_beamlets_per_block, dp_bsn); end func_sdp_compose_cep_header;