diff --git a/applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/lofar2_unb2b_sdp_station_bf/tb_lofar2_unb2b_sdp_station_bf.vhd b/applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/lofar2_unb2b_sdp_station_bf/tb_lofar2_unb2b_sdp_station_bf.vhd index f08e35128f8adad22a976e147e41aa21ac2684cc..c8614845fb78c196b93ba64c9d0654c6e5567946 100644 --- a/applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/lofar2_unb2b_sdp_station_bf/tb_lofar2_unb2b_sdp_station_bf.vhd +++ b/applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/lofar2_unb2b_sdp_station_bf/tb_lofar2_unb2b_sdp_station_bf.vhd @@ -1110,14 +1110,14 @@ begin -- 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. - proc_sdp_cep_rx_beamlets(ext_clk, - rx_beamlet_sosi, - rx_beamlet_cnt, - rx_beamlet_valid, - rx_beamlet_arr_re, - rx_beamlet_arr_im, - rx_packet_list_re, - rx_packet_list_im); + proc_sdp_rx_beamlet_octets(ext_clk, + rx_beamlet_sosi, + rx_beamlet_cnt, + rx_beamlet_valid, + rx_beamlet_arr_re, + rx_beamlet_arr_im, + rx_packet_list_re, + rx_packet_list_im); -- To view the 64 bit 10GbE offload data more easily in the Wave window rx_beamlet_data <= rx_beamlet_sosi.data(c_longword_w - 1 downto 0); diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf/tb_lofar2_unb2c_sdp_station_bf.vhd b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf/tb_lofar2_unb2c_sdp_station_bf.vhd index 14d00d4ca86f98610a77ebcb43dcc92e7c4f80c3..0e6167477ddb76d0a8d3921ad585908e4aa30fce 100644 --- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf/tb_lofar2_unb2c_sdp_station_bf.vhd +++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf/tb_lofar2_unb2c_sdp_station_bf.vhd @@ -246,9 +246,9 @@ architecture tb of tb_lofar2_unb2c_sdp_station_bf is x"1400" -- block_period = 5120 ); - -- Expected transposed indices order by func_sdp_bdo_transpose_packet(). + -- Expected transposed indices order by func_sdp_undo_transpose_beamlet_packet(). -- Yields same c_transpose_indices order as func_reorder_transpose_packet(): - -- > python applications/lofar2/libraries/sdp/src/python/test_func_sdp_bdo_transpose_packet.py + -- > python applications/lofar2/libraries/sdp/src/python/test_func_sdp_transpose_packet.py constant c_nof_ch : natural := c_sdp_cep_nof_beamlets_per_packet * c_sdp_N_pol_bf; -- Use c_transpose_indices and c_transpose_indices_inv for view in Objects window. -- The c_transpose_indices is used in sdp_beamformer_output, therefore use @@ -490,8 +490,9 @@ architecture tb of tb_lofar2_unb2c_sdp_station_bf is signal rx_reordered_list_re : t_sdp_beamlet_packet_list; signal rx_reordered_list_im : t_sdp_beamlet_packet_list; - -- Recover original beamlet order per block, either by using c_use_bdo_transpose - -- = false or by using c_use_bdo_transpose and func_sdp_bdo_transpose_packet(). + -- Recover original beamlet order per block, either by using + -- c_use_bdo_transpose = false or by using c_use_bdo_transpose = true + -- and func_sdp_undo_transpose_beamlet_packet(). -- List: [0 : 488 * 2 - 1] = [0 : 975] -- . X part at even indices -- . Y part at odd indices @@ -1361,20 +1362,20 @@ begin -- 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 + -- . 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. - proc_sdp_cep_rx_beamlets(ext_clk, - rx_beamlet_sosi, - rx_beamlet_cnt, - rx_beamlet_valid, - rx_beamlet_arr_re, - rx_beamlet_arr_im, - rx_packet_list_re, - rx_packet_list_im); + -- . 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 + proc_sdp_rx_beamlet_octets(ext_clk, + rx_beamlet_sosi, + rx_beamlet_cnt, + rx_beamlet_valid, + rx_beamlet_arr_re, + rx_beamlet_arr_im, + rx_packet_list_re, + rx_packet_list_im); -- Undo the beamlet output transpose, to have original beamlet order p_rx_reordered_list : process @@ -1383,12 +1384,8 @@ begin wait until rising_edge(ext_clk); -- to avoid Modelsim warning: (vcom-1090) proc_common_wait_until_hi_lo(ext_clk, rx_beamlet_sosi.eop); -- to reduce simulation effort -- Inverse tranpose - rx_reordered_list_re <= func_sdp_bdo_transpose_packet(c_sdp_cep_nof_beamlets_per_block, - c_sdp_cep_nof_blocks_per_packet, - rx_packet_list_re); - rx_reordered_list_im <= func_sdp_bdo_transpose_packet(c_sdp_cep_nof_beamlets_per_block, - c_sdp_cep_nof_blocks_per_packet, - rx_packet_list_im); + rx_reordered_list_re <= func_sdp_undo_transpose_beamlet_packet(rx_packet_list_re); + rx_reordered_list_im <= func_sdp_undo_transpose_beamlet_packet(rx_packet_list_im); end process; p_rx_beamlet_list : process diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf_ring/tb_lofar2_unb2c_sdp_station_bf_ring.vhd b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf_ring/tb_lofar2_unb2c_sdp_station_bf_ring.vhd index 46ff829e23b2a2377901e8cb07177b7bf700da80..f4ada61682a5443c7be855ec9c9ad6a42fd86828 100644 --- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf_ring/tb_lofar2_unb2c_sdp_station_bf_ring.vhd +++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf_ring/tb_lofar2_unb2c_sdp_station_bf_ring.vhd @@ -260,7 +260,7 @@ architecture tb of tb_lofar2_unb2c_sdp_station_bf_ring is -- Expected transposed indices order by func_reorder_transpose_packet(). -- Yields same c_reorder_transpose_indices order as: - -- > python applications/lofar2/libraries/sdp/src/python/test_func_sdp_bdo_transpose_packet.py + -- > python applications/lofar2/libraries/sdp/src/python/test_func_sdp_transpose_packet.py constant c_nof_ch : natural := c_sdp_cep_nof_beamlets_per_packet * c_sdp_N_pol_bf; constant c_reorder_transpose_indices : t_natural_arr(0 to c_nof_ch - 1) := func_reorder_transpose_indices(c_sdp_cep_nof_blocks_per_packet, @@ -493,8 +493,9 @@ architecture tb of tb_lofar2_unb2c_sdp_station_bf_ring is signal rx_reordered_list_re : t_sdp_beamlet_packet_list; signal rx_reordered_list_im : t_sdp_beamlet_packet_list; - -- Recover original beamlet order per block, either by using c_use_bdo_transpose - -- = false or by using c_use_bdo_transpose and func_sdp_bdo_transpose_packet(). + -- Recover original beamlet order per block, either by using + -- c_use_bdo_transpose = false or by using c_use_bdo_transpose = true + -- and func_sdp_undo_transpose_beamlet_packet(). -- List: [0 : 488 * 2 - 1] = [0 : 975] -- . X part at even indices -- . Y part at odd indices @@ -1502,12 +1503,8 @@ begin -- Wait until end of a beamlet packet wait until rising_edge(ext_clk); -- to avoid Modelsim warning: (vcom-1090) proc_common_wait_until_hi_lo(ext_clk, rx_beamlet_sosi.eop); -- to reduce simulation effort - rx_reordered_list_re <= func_sdp_bdo_transpose_packet(c_sdp_cep_nof_blocks_per_packet, - c_sdp_cep_nof_beamlets_per_block, - rx_packet_list_re); - rx_reordered_list_im <= func_sdp_bdo_transpose_packet(c_sdp_cep_nof_blocks_per_packet, - c_sdp_cep_nof_beamlets_per_block, - rx_packet_list_im); + rx_reordered_list_re <= func_sdp_undo_transpose_beamlet_packet(rx_packet_list_re); + rx_reordered_list_im <= func_sdp_undo_transpose_beamlet_packet(rx_packet_list_im); end process; p_rx_beamlet_list : process diff --git a/applications/lofar2/libraries/sdp/src/python/test_func_sdp_transpose_packet.py b/applications/lofar2/libraries/sdp/src/python/test_func_sdp_transpose_packet.py index f1063a7473a9f5c5d8787fed11282d6698937ead..a659504a4201fa5cc10509113231b80c698e9438 100644 --- a/applications/lofar2/libraries/sdp/src/python/test_func_sdp_transpose_packet.py +++ b/applications/lofar2/libraries/sdp/src/python/test_func_sdp_transpose_packet.py @@ -21,16 +21,18 @@ # Author: Eric Kooistra # Date: Aug 2023 # Purpose: -# Use Python to verify equivalent VHDL function func_sdp_bdo_transpose_packet() +# Use Python to verify equivalent VHDL functions +# func_sdp_transpose_beamlet_packet() and +# func_sdp_undo_transpose_beamlet_packet() and # in tb_sdp_pkg.vhd # Usage: -# > python test_func_sdp_bdo_transpose_packet.py > x +# > python test_func_sdp_transpose_packet.py > x # > more x # > tail -n 50 x c_sdp_N_pol_bf = 2 -def func_sdp_bdo_transpose_packet(nof_blocks_per_packet, nof_beamlets_per_block, packet_list): +def func_sdp_transpose_packet(nof_blocks_per_packet, nof_beamlets_per_block, packet_list): v_list = [0] * len(packet_list) for blk in range(nof_blocks_per_packet): for blet in range(nof_beamlets_per_block): @@ -43,6 +45,6 @@ def func_sdp_bdo_transpose_packet(nof_blocks_per_packet, nof_beamlets_per_block, nof_blocks_per_packet = 4 nof_beamlets_per_block = 488 packet_list = list(range(0, nof_beamlets_per_block * nof_blocks_per_packet * c_sdp_N_pol_bf)) -out_list = func_sdp_bdo_transpose_packet(nof_blocks_per_packet, nof_beamlets_per_block, packet_list) +out_list = func_sdp_transpose_packet(nof_blocks_per_packet, nof_beamlets_per_block, packet_list) for d in out_list: print('%d' % d) diff --git a/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_beamformer_output.vhd b/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_beamformer_output.vhd index b534ef665d6fa67947659b94d34daab6946bf1f6..69a52466c91568dcba64d3f57a69f03f22648822 100644 --- a/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_beamformer_output.vhd +++ b/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_beamformer_output.vhd @@ -44,7 +44,7 @@ entity tb_sdp_beamformer_output is generic ( g_nof_repeat : natural := 50; g_beamset_id : natural := 0; - g_use_transpose : boolean := false; + g_use_transpose : boolean := true; g_use_multiple_destinations : boolean := false ); end tb_sdp_beamformer_output; @@ -328,14 +328,14 @@ begin -- To view the 64 bit 10GbE offload data more easily in the Wave window rx_beamlet_data <= rx_beamlet_sosi.data(c_longword_w - 1 downto 0); - proc_sdp_cep_rx_beamlets(dp_clk, - rx_beamlet_sosi, - rx_beamlet_cnt, - rx_beamlet_valid, - rx_beamlet_arr_re, - rx_beamlet_arr_im, - rx_packet_list_re, - rx_packet_list_im); + proc_sdp_rx_beamlet_octets(dp_clk, + rx_beamlet_sosi, + rx_beamlet_cnt, + rx_beamlet_valid, + rx_beamlet_arr_re, + rx_beamlet_arr_im, + rx_packet_list_re, + rx_packet_list_im); p_verify_rx_beamlet_list : process -- Nof complex (= nof re = nof im = c_N) values in t_sdp_beamlet_packet_list @@ -349,12 +349,8 @@ begin proc_common_wait_until_hi_lo(dp_clk, rx_beamlet_sosi.eop); if g_use_transpose then -- Undo the beamlet output transpose, to have original beamlet order - rx_beamlet_list_re <= func_sdp_bdo_transpose_packet(c_sdp_cep_nof_beamlets_per_block, - c_sdp_cep_nof_blocks_per_packet, - rx_packet_list_re); - rx_beamlet_list_im <= func_sdp_bdo_transpose_packet(c_sdp_cep_nof_beamlets_per_block, - c_sdp_cep_nof_blocks_per_packet, - rx_packet_list_im); + rx_beamlet_list_re <= func_sdp_undo_transpose_beamlet_packet(rx_packet_list_re); + rx_beamlet_list_im <= func_sdp_undo_transpose_beamlet_packet(rx_packet_list_im); else -- Copy identity beamlet output order rx_beamlet_list_re <= rx_packet_list_re; 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 3142308739f4fb18c3fc04d41e88f80eda2b66a6..63ca0848374b7becbbf893c94cc36fdd8ba8a019 100644 --- a/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_pkg.vhd +++ b/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_pkg.vhd @@ -123,12 +123,11 @@ package tb_sdp_pkg is -- . use separate list for re and for im subtype t_sdp_beamlet_block_list is t_slv_8_arr(0 to c_sdp_cep_nof_beamlets_per_block * c_sdp_N_pol_bf - 1); - 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; + function func_sdp_transpose_beamlet_packet( packet_list : t_sdp_beamlet_packet_list) return t_sdp_beamlet_packet_list; + function func_sdp_undo_transpose_beamlet_packet(packet_list : t_sdp_beamlet_packet_list) return t_sdp_beamlet_packet_list; - -- CEP Read Rx 10GbE Stream - procedure proc_sdp_cep_rx_beamlets( + -- Read beamlet packet octets per re and im parts + procedure proc_sdp_rx_beamlet_octets( signal clk : in std_logic; signal rx_beamlet_sosi : in t_dp_sosi; signal rx_beamlet_cnt : inout natural; @@ -505,12 +504,13 @@ package body tb_sdp_pkg is end; -- BDO transpose: - -- . See sdp/src/python/test_func_sdp_bdo_transpose_packet.py to verify that - -- v_out = func_sdp_bdo_transpose_packet(4, 488, v_in) yields the expected v_out. + -- . See sdp/src/python/test_func_sdp_transpose_packet.py to verify that + -- v_out = func_sdp_transpose_beamlet_packet(v_in) yields the expected v_out. -- . See data repacking section in: -- https://support.astron.nl/confluence/pages/viewpage.action?spaceKey=L2M&title=L4+SDPFW+Decision%3A+Multiple+beamlet+output+destinations - -- . Use separate packet_list for re and im. The list contain 4 * 488 * 2 = 3904 - -- beamlet part octet values. + -- . Use separate t_sdp_beamlet_packet_list for re and im. The packet_list + -- contains nof_blocks_per_packet * nof_beamlets_per_block * c_sdp_N_pol_bf + -- = 4 * 488 * 2 = 3904 beamlet part octet values. -- input packet_list: -- . blk 0, 1, 2, 3, for nof_blocks_per_packet = 4 -- . blet 0, ... 487, 0, ... 487, 0, ... 487, 0, ... 487, for nof_beamlets_per_block = 488 @@ -525,17 +525,26 @@ package body tb_sdp_pkg is -- ..., ..., ..., ..., -- 972,973, 1948,1949, 2924,2925, 3900,3901, -- 974,775, 1950,1951, 2926,2927, 3902,3903, output list index - 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 is + function func_sdp_transpose_beamlet_packet(packet_list : t_sdp_beamlet_packet_list) return t_sdp_beamlet_packet_list is + variable v_list : t_sdp_beamlet_packet_list; + begin + v_list := func_reorder_transpose_packet(c_sdp_cep_nof_blocks_per_packet, + c_sdp_cep_nof_beamlets_per_block, + c_sdp_N_pol_bf, + packet_list); + return v_list; + end func_sdp_transpose_beamlet_packet; + + -- Reverse argument order nof_beamlets_per_block and nof_blocks_per_packet to undo transpose + function func_sdp_undo_transpose_beamlet_packet(packet_list : t_sdp_beamlet_packet_list) return t_sdp_beamlet_packet_list is variable v_list : t_sdp_beamlet_packet_list; begin - v_list := func_reorder_transpose_packet(nof_blocks_per_packet, - nof_beamlets_per_block, + v_list := func_reorder_transpose_packet(c_sdp_cep_nof_beamlets_per_block, + c_sdp_cep_nof_blocks_per_packet, c_sdp_N_pol_bf, packet_list); return v_list; - end func_sdp_bdo_transpose_packet; + end func_sdp_undo_transpose_beamlet_packet; ----------------------------------------------------------------------------- -- CEP Read Rx 10GbE Stream @@ -543,13 +552,11 @@ package body tb_sdp_pkg is -- 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 + -- . 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( + procedure proc_sdp_rx_beamlet_octets( signal clk : in std_logic; signal rx_beamlet_sosi : in t_dp_sosi; signal rx_beamlet_cnt : inout natural; @@ -593,6 +600,6 @@ package body tb_sdp_pkg is 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 proc_sdp_rx_beamlet_octets; end tb_sdp_pkg;