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 e49931e96a21654d8858ac39830149adf432b777..3142308739f4fb18c3fc04d41e88f80eda2b66a6 100644 --- a/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_pkg.vhd +++ b/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_pkg.vhd @@ -25,10 +25,12 @@ -- . This package contains specific constants, functions for sdp test benches. -- Description: ------------------------------------------------------------------------------- -library IEEE, common_lib, reorder_lib; +library IEEE, common_lib, dp_lib, reorder_lib; use IEEE.std_logic_1164.all; use common_lib.common_pkg.all; use common_lib.common_network_layers_pkg.all; +use common_lib.tb_common_pkg.all; +use dp_lib.dp_stream_pkg.all; use reorder_lib.reorder_pkg.all; use work.sdp_pkg.all; @@ -124,6 +126,17 @@ package tb_sdp_pkg is function func_sdp_bdo_transpose_packet(nof_blocks_per_packet : natural; nof_beamlets_per_block : natural; packet_list : t_sdp_beamlet_packet_list) return t_sdp_beamlet_packet_list; + + -- CEP Read Rx 10GbE Stream + procedure proc_sdp_cep_rx_beamlets( + signal clk : in std_logic; + signal rx_beamlet_sosi : in t_dp_sosi; + signal rx_beamlet_cnt : inout natural; + signal rx_beamlet_valid : out std_logic; + signal rx_beamlet_arr_re : out t_sdp_beamlet_part_arr; + signal rx_beamlet_arr_im : out t_sdp_beamlet_part_arr; + signal rx_packet_list_re : out t_sdp_beamlet_packet_list; + signal rx_packet_list_im : out t_sdp_beamlet_packet_list); end package tb_sdp_pkg; package body tb_sdp_pkg is @@ -524,4 +537,62 @@ package body tb_sdp_pkg is return v_list; end func_sdp_bdo_transpose_packet; + ----------------------------------------------------------------------------- + -- CEP Read Rx 10GbE Stream + ----------------------------------------------------------------------------- + -- Show received beamlets from 10GbE stream in Wave Window + -- . The packet header is 9.25 longwords wide. The dp_offload_rx has stripped + -- the header and has realigned the payload at a longword boundary. + -- . expect c_nof_block_per_sync / c_sdp_cep_nof_blocks_per_packet * + -- c_sdp_N_beamsets = 16 / 4 * 2 = 4 * 2 = 8 packets per sync interval + -- . expect c_sdp_cep_nof_beamlets_per_block = c_sdp_S_sub_bf = 488 dual pol + -- and complex beamlets per packet, so 2 dual pol beamlets/64b data word. + -- . Beamlets array is stored big endian in the data, so X.real index 0 first + -- in MSByte of rx_beamlet_sosi.data. + procedure proc_sdp_cep_rx_beamlets( + signal clk : in std_logic; + signal rx_beamlet_sosi : in t_dp_sosi; + signal rx_beamlet_cnt : inout natural; + signal rx_beamlet_valid : out std_logic; + signal rx_beamlet_arr_re : out t_sdp_beamlet_part_arr; + signal rx_beamlet_arr_im : out t_sdp_beamlet_part_arr; + signal rx_packet_list_re : out t_sdp_beamlet_packet_list; + signal rx_packet_list_im : out t_sdp_beamlet_packet_list) is + begin + rx_beamlet_cnt <= 0; + rx_beamlet_valid <= '0'; + -- Wait until start of a beamlet packet + proc_common_wait_until_high(clk, rx_beamlet_sosi.sop); + -- c_sdp_nof_beamlets_per_longword = 2 dual pol beamlets (= XY, XY) per 64b data word + for I in 0 to (c_sdp_cep_nof_beamlets_per_packet / c_sdp_nof_beamlets_per_longword) - 1 loop + proc_common_wait_until_high(clk, rx_beamlet_sosi.valid); + rx_beamlet_valid <= '1'; + -- Capture rx beamlets per longword in rx_beamlet_arr, for time series view in Wave window + rx_beamlet_arr_re(0) <= rx_beamlet_sosi.data(63 downto 56); -- X + rx_beamlet_arr_im(0) <= rx_beamlet_sosi.data(55 downto 48); + rx_beamlet_arr_re(1) <= rx_beamlet_sosi.data(47 downto 40); -- Y + rx_beamlet_arr_im(1) <= rx_beamlet_sosi.data(39 downto 32); + rx_beamlet_arr_re(2) <= rx_beamlet_sosi.data(31 downto 24); -- X + rx_beamlet_arr_im(2) <= rx_beamlet_sosi.data(23 downto 16); + rx_beamlet_arr_re(3) <= rx_beamlet_sosi.data(15 downto 8); -- Y + rx_beamlet_arr_im(3) <= rx_beamlet_sosi.data( 7 downto 0); + -- Capture the beamlets block of each packet in rx_packet_list + rx_packet_list_re(I * 4 + 0) <= rx_beamlet_sosi.data(63 downto 56); -- X + rx_packet_list_im(I * 4 + 0) <= rx_beamlet_sosi.data(55 downto 48); + rx_packet_list_re(I * 4 + 1) <= rx_beamlet_sosi.data(47 downto 40); -- Y + rx_packet_list_im(I * 4 + 1) <= rx_beamlet_sosi.data(39 downto 32); + rx_packet_list_re(I * 4 + 2) <= rx_beamlet_sosi.data(31 downto 24); -- X + rx_packet_list_im(I * 4 + 2) <= rx_beamlet_sosi.data(23 downto 16); + rx_packet_list_re(I * 4 + 3) <= rx_beamlet_sosi.data(15 downto 8); -- Y + rx_packet_list_im(I * 4 + 3) <= rx_beamlet_sosi.data( 7 downto 0); + proc_common_wait_until_high(clk, rx_beamlet_sosi.valid); + -- Use at least one WAIT instead of proc_common_wait_some_cycles() to + -- avoid Modelsim warning: (vcom-1090) Possible infinite loop: Process + -- contains no WAIT statement. + wait until rising_edge(clk); + rx_beamlet_valid <= '0'; + rx_beamlet_cnt <= (rx_beamlet_cnt + c_sdp_nof_beamlets_per_longword) mod c_sdp_cep_nof_beamlets_per_block; -- 4 blocks/packet + end loop; + end proc_sdp_cep_rx_beamlets; + end tb_sdp_pkg;