diff --git a/applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/disturb2_unb2b_sdp_station_full_wg/tb_disturb2_unb2b_sdp_station_full_wg.vhd b/applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/disturb2_unb2b_sdp_station_full_wg/tb_disturb2_unb2b_sdp_station_full_wg.vhd index e87e209540427f98bad1b4cb0a240f4b46909bef..cf0582ec724b16246629eb4e6a0b434f3e440914 100644 --- a/applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/disturb2_unb2b_sdp_station_full_wg/tb_disturb2_unb2b_sdp_station_full_wg.vhd +++ b/applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/disturb2_unb2b_sdp_station_full_wg/tb_disturb2_unb2b_sdp_station_full_wg.vhd @@ -57,6 +57,7 @@ -- index signals to have a more compact view of the relevant indices. -- . If c_subband_phase = 0.0 then beamlet_arr2_re entries are 0. -- . manually add top level generics/constants to wave window. +-- Takes about 1h. -- -- Remark: TB is based on tb_lofar2_unb2c_sdp_station_bf. ------------------------------------------------------------------------------- @@ -443,37 +444,37 @@ BEGIN -- . First word contains 1 header part of two bytes and 3 beamlets [0:2]. -- . 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 index 0 first in - -- MSByte of tr_10GbE_src_out.data. + -- . Beamlets array is stored big endian in the data, so X.real index 0 first + -- in MSByte of tr_10GbE_src_out.data. rx_beamlet_blk <= blk; rx_beamlet_cnt <= 0; rx_beamlet_valid <= '1'; rx_beamlet_sop <= '1'; - beamlet_arr2_im(v_beamlet_index_offset + 0) <= tr_10GbE_src_out.data(47 DOWNTO 40); - beamlet_arr2_re(v_beamlet_index_offset + 0) <= tr_10GbE_src_out.data(39 DOWNTO 32); - beamlet_arr2_im(v_beamlet_index_offset + 1) <= tr_10GbE_src_out.data(31 DOWNTO 24); - beamlet_arr2_re(v_beamlet_index_offset + 1) <= tr_10GbE_src_out.data(23 DOWNTO 16); - beamlet_arr2_im(v_beamlet_index_offset + 2) <= tr_10GbE_src_out.data(15 DOWNTO 8); - beamlet_arr2_re(v_beamlet_index_offset + 2) <= tr_10GbE_src_out.data(7 DOWNTO 0); + beamlet_arr2_re(v_beamlet_index_offset + 0) <= tr_10GbE_src_out.data(47 DOWNTO 40); + beamlet_arr2_im(v_beamlet_index_offset + 0) <= tr_10GbE_src_out.data(39 DOWNTO 32); + beamlet_arr2_re(v_beamlet_index_offset + 1) <= tr_10GbE_src_out.data(31 DOWNTO 24); + beamlet_arr2_im(v_beamlet_index_offset + 1) <= tr_10GbE_src_out.data(23 DOWNTO 16); + beamlet_arr2_re(v_beamlet_index_offset + 2) <= tr_10GbE_src_out.data(15 DOWNTO 8); + beamlet_arr2_im(v_beamlet_index_offset + 2) <= tr_10GbE_src_out.data(7 DOWNTO 0); proc_common_wait_until_clk_and_high(ext_clk, tr_10GbE_src_out.valid); rx_beamlet_cnt <= rx_beamlet_cnt + 1; rx_beamlet_sop <= '0'; -- . get beamlets during block, there are 4 complex beamlets per 64b word FOR I IN 1 TO (c_sdp_N_pol_bf * c_sdp_cep_nof_beamlets_per_block/4)-1 LOOP - beamlet_arr2_im(v_beamlet_index_offset + I*4 -1) <= tr_10GbE_src_out.data(63 DOWNTO 56); - beamlet_arr2_re(v_beamlet_index_offset + I*4 -1) <= tr_10GbE_src_out.data(55 DOWNTO 48); - beamlet_arr2_im(v_beamlet_index_offset + I*4 +0) <= tr_10GbE_src_out.data(47 DOWNTO 40); - beamlet_arr2_re(v_beamlet_index_offset + I*4 +0) <= tr_10GbE_src_out.data(39 DOWNTO 32); - beamlet_arr2_im(v_beamlet_index_offset + I*4 +1) <= tr_10GbE_src_out.data(31 DOWNTO 24); - beamlet_arr2_re(v_beamlet_index_offset + I*4 +1) <= tr_10GbE_src_out.data(23 DOWNTO 16); - beamlet_arr2_im(v_beamlet_index_offset + I*4 +2) <= tr_10GbE_src_out.data(15 DOWNTO 8); - beamlet_arr2_re(v_beamlet_index_offset + I*4 +2) <= tr_10GbE_src_out.data(7 DOWNTO 0); + beamlet_arr2_re(v_beamlet_index_offset + I*4 -1) <= tr_10GbE_src_out.data(63 DOWNTO 56); + beamlet_arr2_im(v_beamlet_index_offset + I*4 -1) <= tr_10GbE_src_out.data(55 DOWNTO 48); + beamlet_arr2_re(v_beamlet_index_offset + I*4 +0) <= tr_10GbE_src_out.data(47 DOWNTO 40); + beamlet_arr2_im(v_beamlet_index_offset + I*4 +0) <= tr_10GbE_src_out.data(39 DOWNTO 32); + beamlet_arr2_re(v_beamlet_index_offset + I*4 +1) <= tr_10GbE_src_out.data(31 DOWNTO 24); + beamlet_arr2_im(v_beamlet_index_offset + I*4 +1) <= tr_10GbE_src_out.data(23 DOWNTO 16); + beamlet_arr2_re(v_beamlet_index_offset + I*4 +2) <= tr_10GbE_src_out.data(15 DOWNTO 8); + beamlet_arr2_im(v_beamlet_index_offset + I*4 +2) <= tr_10GbE_src_out.data(7 DOWNTO 0); proc_common_wait_until_clk_and_high(ext_clk, tr_10GbE_src_out.valid); rx_beamlet_cnt <= rx_beamlet_cnt + 1; END LOOP; -- . get last beamlet of block - beamlet_arr2_im(v_beamlet_index_offset + c_sdp_N_pol_bf * c_sdp_cep_nof_beamlets_per_block-1) <= tr_10GbE_src_out.data(63 DOWNTO 56); - beamlet_arr2_re(v_beamlet_index_offset + c_sdp_N_pol_bf * c_sdp_cep_nof_beamlets_per_block-1) <= tr_10GbE_src_out.data(55 DOWNTO 48); + beamlet_arr2_re(v_beamlet_index_offset + c_sdp_N_pol_bf * c_sdp_cep_nof_beamlets_per_block-1) <= tr_10GbE_src_out.data(63 DOWNTO 56); + beamlet_arr2_im(v_beamlet_index_offset + c_sdp_N_pol_bf * c_sdp_cep_nof_beamlets_per_block-1) <= tr_10GbE_src_out.data(55 DOWNTO 48); -- Loop for next block in packet END LOOP; -- Make rx_beamlet_valid low for next header or after loop during verify. 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 cd248d7e351ced7521fa26e311745417213de0a3..f8e42b7389b990d2215d3bf6ebfefc666c933ae2 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 @@ -1129,8 +1129,8 @@ BEGIN -- 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 index 0 first in - -- MSByte of test_offload_sosi.data. + -- . Beamlets array is stored big endian in the data, so X.real index 0 first + -- in MSByte of test_offload_sosi.data. p_rx_cep_beamlets : PROCESS BEGIN rx_beamlet_cnt <= 0; @@ -1142,24 +1142,24 @@ BEGIN proc_common_wait_until_high(ext_clk, test_offload_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) <= test_offload_sosi.data(55 DOWNTO 48); -- X - rx_beamlet_arr_im(0) <= test_offload_sosi.data(63 DOWNTO 56); - rx_beamlet_arr_re(1) <= test_offload_sosi.data(39 DOWNTO 32); -- Y - rx_beamlet_arr_im(1) <= test_offload_sosi.data(47 DOWNTO 40); - rx_beamlet_arr_re(2) <= test_offload_sosi.data(23 DOWNTO 16); -- X - rx_beamlet_arr_im(2) <= test_offload_sosi.data(31 DOWNTO 24); - rx_beamlet_arr_re(3) <= test_offload_sosi.data( 7 DOWNTO 0); -- Y - rx_beamlet_arr_im(3) <= test_offload_sosi.data(15 DOWNTO 8); + rx_beamlet_arr_re(0) <= test_offload_sosi.data(63 DOWNTO 56); -- X + rx_beamlet_arr_im(0) <= test_offload_sosi.data(55 DOWNTO 48); + rx_beamlet_arr_re(1) <= test_offload_sosi.data(47 DOWNTO 40); -- Y + rx_beamlet_arr_im(1) <= test_offload_sosi.data(39 DOWNTO 32); + rx_beamlet_arr_re(2) <= test_offload_sosi.data(31 DOWNTO 24); -- X + rx_beamlet_arr_im(2) <= test_offload_sosi.data(23 DOWNTO 16); + rx_beamlet_arr_re(3) <= test_offload_sosi.data(15 DOWNTO 8); -- Y + rx_beamlet_arr_im(3) <= test_offload_sosi.data( 7 DOWNTO 0); IF I < c_sdp_cep_nof_beamlets_per_block/2 THEN -- Only capture the first beamlets block of each packet in rx_beamlet_list - rx_beamlet_list_re(I*4 + 0) <= test_offload_sosi.data(55 DOWNTO 48); -- X - rx_beamlet_list_im(I*4 + 0) <= test_offload_sosi.data(63 DOWNTO 56); - rx_beamlet_list_re(I*4 + 1) <= test_offload_sosi.data(39 DOWNTO 32); -- Y - rx_beamlet_list_im(I*4 + 1) <= test_offload_sosi.data(47 DOWNTO 40); - rx_beamlet_list_re(I*4 + 2) <= test_offload_sosi.data(23 DOWNTO 16); -- X - rx_beamlet_list_im(I*4 + 2) <= test_offload_sosi.data(31 DOWNTO 24); - rx_beamlet_list_re(I*4 + 3) <= test_offload_sosi.data( 7 DOWNTO 0); -- Y - rx_beamlet_list_im(I*4 + 3) <= test_offload_sosi.data(15 DOWNTO 8); + rx_beamlet_list_re(I*4 + 0) <= test_offload_sosi.data(63 DOWNTO 56); -- X + rx_beamlet_list_im(I*4 + 0) <= test_offload_sosi.data(55 DOWNTO 48); + rx_beamlet_list_re(I*4 + 1) <= test_offload_sosi.data(47 DOWNTO 40); -- Y + rx_beamlet_list_im(I*4 + 1) <= test_offload_sosi.data(39 DOWNTO 32); + rx_beamlet_list_re(I*4 + 2) <= test_offload_sosi.data(31 DOWNTO 24); -- X + rx_beamlet_list_im(I*4 + 2) <= test_offload_sosi.data(23 DOWNTO 16); + rx_beamlet_list_re(I*4 + 3) <= test_offload_sosi.data(15 DOWNTO 8); -- Y + rx_beamlet_list_im(I*4 + 3) <= test_offload_sosi.data( 7 DOWNTO 0); END IF; proc_common_wait_until_high(ext_clk, test_offload_sosi.valid); -- Use at least one WAIT instead of proc_common_wait_some_cycles() to 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 958e4725ffa2349a4acb750a4cd9a13e4a7dfde5..f77bfa92cf67e6d2555b5c7604f8a21313360f53 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 @@ -105,6 +105,12 @@ -- * The c_wg_phase_offset and c_subband_phase_offset are used to tune the WG -- phase reference to 0.0 degrees at the start (sop) -- * Use g_beamlet_scale = 2**10, for full scale WG and N_ant = 1, see [1] +-- * Using g_beamlet = c_sdp_S_sub_bf-1 = 487 puts g_subband = 102 at the last +-- beamlet in the beamset, so at index 974,975 of rx_beamlet_list_re/im. +-- * Default beamlet 102 also contains g_subband = 102. On HW the BF weights +-- are default 0, but in sim the BF weights in node_sdp_beamformer.vhd +-- are default unit weights. Therefore also write the BF weight for default +-- beamlet 102 to define it value, in case g_beamlet /= 102. -- -- Usage: -- > as 7 # default @@ -113,7 +119,8 @@ -- > add wave -position insertpoint \ -- sim:/tb_lofar2_unb2c_sdp_station_bf/sp_ssts_arr2 \ -- sim:/tb_lofar2_unb2c_sdp_station_bf/bsts_arr2 --- > run -a +-- > run -a +-- View beamlet output as radix-decimal -- Takes about 1h 1 m when g_read_all_* = FALSE -- Takes about 1h 30 m when g_read_all_* = TRUE -- @@ -161,8 +168,8 @@ ENTITY tb_lofar2_unb2c_sdp_station_bf IS g_bf_remnant_x_phase : REAL := 170.0; -- g_beamlet X BF weight phase rotation in degrees for remnant sp g_bf_remnant_y_phase : REAL := -135.0; -- g_beamlet Y BF weight phase rotation in degrees for remnant sp g_read_all_sub_sel : BOOLEAN := FALSE; -- when FALSE only read subband selection for g_beamlet, to save sim time - g_read_all_SST : BOOLEAN := TRUE; -- when FALSE only read SST for g_subband, to save sim time - g_read_all_BST : BOOLEAN := TRUE -- when FALSE only read BST for g_beamlet, to save sim time + g_read_all_SST : BOOLEAN := FALSE; -- when FALSE only read SST for g_subband, to save sim time + g_read_all_BST : BOOLEAN := FALSE -- when FALSE only read BST for g_beamlet, to save sim time ); END tb_lofar2_unb2c_sdp_station_bf; @@ -444,6 +451,11 @@ ARCHITECTURE tb OF tb_lofar2_unb2c_sdp_station_bf IS SIGNAL rx_beamlet_list_re : t_slv_8_arr(c_sdp_cep_nof_beamlets_per_block * c_sdp_N_pol_bf-1 DOWNTO 0); -- [488 * 2-1:0] = [975:0] SIGNAL rx_beamlet_list_im : t_slv_8_arr(c_sdp_cep_nof_beamlets_per_block * c_sdp_N_pol_bf-1 DOWNTO 0); -- [488 * 2-1:0] = [975:0] + SIGNAL rx_beamlet_x_output_re : INTEGER; + SIGNAL rx_beamlet_x_output_im : INTEGER; + SIGNAL rx_beamlet_y_output_re : INTEGER; + SIGNAL rx_beamlet_y_output_im : INTEGER; + -- DUT SIGNAL ext_clk : STD_LOGIC := '0'; SIGNAL ext_pps : STD_LOGIC := '0'; @@ -625,39 +637,6 @@ BEGIN -- Wait for DUT power up after reset WAIT FOR 1 us; - print_str(""); - print_str("WG:"); - print_str(". c_wg_ampl = " & int_to_str(c_wg_ampl)); - print_str(". c_exp_sp_power = " & real_to_str(c_exp_sp_power, 20, 1)); - print_str(". c_exp_sp_ast = " & real_to_str(c_exp_sp_ast, 20, 1)); - - print_str(""); - print_str("Subband weight:"); - print_str(". sp_subband_weight_gain = " & real_to_str(sp_subband_weight_gain, 20, 6)); - print_str(". sp_subband_weight_phase = " & real_to_str(sp_subband_weight_phase, 20, 6)); - - print_str(""); - print_str("SST results:"); - print_str(". sst_weighted_subbands_flag = " & sl_to_str(sst_weighted_subbands_flag)); - print_str(""); - print_str(". c_exp_subband_ampl = " & int_to_str(NATURAL(c_exp_subband_ampl))); - print_str(". c_exp_subband_power = " & real_to_str(c_exp_subband_power, 20, 1)); - print_str(". c_exp_subband_sst = " & real_to_str(c_exp_subband_sst, 20, 1)); - print_str(""); - print_str(". sp_sst = " & real_to_str(sp_sst, 20, 1)); - print_str(". sp_sst / c_exp_subband_sst = " & real_to_str(sp_sst / c_exp_subband_sst, 20, 6)); - - print_str(""); - print_str("BST results:"); - print_str(". c_exp_beamlet_x_ampl = " & int_to_str(NATURAL(c_exp_beamlet_x_ampl))); - print_str(". c_exp_beamlet_x_power = " & real_to_str(c_exp_beamlet_x_power, 20, 1)); - print_str(". c_exp_beamlet_x_bst = " & real_to_str(c_exp_beamlet_x_bst, 20, 1)); - print_str(""); - print_str(". c_exp_beamlet_y_ampl = " & int_to_str(NATURAL(c_exp_beamlet_y_ampl))); - print_str(". c_exp_beamlet_y_power = " & real_to_str(c_exp_beamlet_y_power, 20, 1)); - print_str(". c_exp_beamlet_y_bst = " & real_to_str(c_exp_beamlet_y_bst, 20, 1)); - print_str(""); - ---------------------------------------------------------------------------- -- Set and check SDP info ---------------------------------------------------------------------------- @@ -963,13 +942,26 @@ BEGIN v_weight := pack_complex(re => c_bf_remnant_y_weight_re, im => c_bf_remnant_y_weight_im, w => c_sdp_W_bf_weight); END IF; END IF; - -- Only need to set BF weight for g_beamlet, keep other beamlet BF weights at zero rst default. + -- Only need to set BF weight for g_beamlet, keep other beamlet BF weights at rst + -- default (= unit weight in sim). v_addr := g_beamlet; -- beamlet index v_addr := v_addr + P * c_sdp_S_sub_bf; -- antenna input polarization address offset v_addr := v_addr + A * v_span; -- antenna input address offset v_addr := v_addr + PB * c_sdp_A_pn * v_span; -- beamlet polarization address offset v_addr := v_addr + U * c_mm_span_ram_bf_weights; -- beamset address offset mmf_mm_bus_wr(c_mm_file_ram_bf_weights, v_addr, v_weight, tb_clk); + + -- Use v_weight = 0 for default beamlet subband selection at g_subband to force beamlet to 0, + -- or comment v_weight = 0 line to use same v_weight as for g_beamlet. + IF g_beamlet /= g_subband THEN + v_weight := 0; + v_addr := g_subband; -- beamlet index + v_addr := v_addr + P * c_sdp_S_sub_bf; -- antenna input polarization address offset + v_addr := v_addr + A * v_span; -- antenna input address offset + v_addr := v_addr + PB * c_sdp_A_pn * v_span; -- beamlet polarization address offset + v_addr := v_addr + U * c_mm_span_ram_bf_weights; -- beamset address offset + mmf_mm_bus_wr(c_mm_file_ram_bf_weights, v_addr, v_weight, tb_clk); + END IF; END LOOP; END LOOP; END LOOP; @@ -1115,62 +1107,71 @@ BEGIN --------------------------------------------------------------------------- print_str(""); - print_str("WG:"); - print_str(". c_wg_ampl = " & int_to_str(c_wg_ampl)); - print_str(". c_exp_sp_power = " & real_to_str(c_exp_sp_power, 20, 1)); - print_str(". c_exp_sp_ast = " & real_to_str(c_exp_sp_ast, 20, 1)); + print_str("* WG:"); + print_str(" . c_wg_ampl = " & int_to_str(c_wg_ampl)); + print_str(" . c_exp_sp_power = " & real_to_str(c_exp_sp_power, 20, 1)); + print_str(" . c_exp_sp_ast = " & real_to_str(c_exp_sp_ast, 20, 1)); print_str(""); - print_str("Subband weight:"); - print_str(". sp_subband_weight_gain = " & real_to_str(sp_subband_weight_gain, 20, 6)); - print_str(". sp_subband_weight_phase = " & real_to_str(sp_subband_weight_phase, 20, 6)); + print_str("* Subband weight:"); + print_str(" . sp_subband_weight_gain = " & real_to_str(sp_subband_weight_gain, 20, 6)); + print_str(" . sp_subband_weight_phase = " & real_to_str(sp_subband_weight_phase, 20, 6)); print_str(""); - print_str("SST results:"); - print_str(". sst_weighted_subbands_flag = " & sl_to_str(sst_weighted_subbands_flag)); + print_str("* SST results:"); + print_str(" . sst_weighted_subbands_flag = " & sl_to_str(sst_weighted_subbands_flag)); print_str(""); - print_str(". c_exp_subband_ampl = " & int_to_str(NATURAL(c_exp_subband_ampl))); - print_str(". c_exp_subband_power = " & real_to_str(c_exp_subband_power, 20, 1)); - print_str(". c_exp_subband_sst = " & real_to_str(c_exp_subband_sst, 20, 1)); + print_str(" . c_exp_subband_ampl = " & int_to_str(NATURAL(c_exp_subband_ampl))); + print_str(" . c_exp_subband_power = " & real_to_str(c_exp_subband_power, 20, 1)); + print_str(" . c_exp_subband_sst = " & real_to_str(c_exp_subband_sst, 20, 1)); print_str(""); - print_str(". sp_sst = " & real_to_str(sp_sst, 20, 1)); - print_str(". sp_sst / c_exp_subband_sst = " & real_to_str(sp_sst / c_exp_subband_sst, 20, 6)); + print_str(" . sp_sst = " & real_to_str(sp_sst, 20, 1)); + print_str(" . sp_sst / c_exp_subband_sst = " & real_to_str(sp_sst / c_exp_subband_sst, 20, 6)); print_str(""); - print_str("BST results:"); - print_str(". c_exp_beamlet_x_ampl = " & int_to_str(NATURAL(c_exp_beamlet_x_ampl))); - print_str(". c_exp_beamlet_x_power = " & real_to_str(c_exp_beamlet_x_power, 20, 1)); - print_str(". c_exp_beamlet_x_bst = " & real_to_str(c_exp_beamlet_x_bst, 20, 1)); + print_str("* BST results:"); + print_str(" . c_exp_beamlet_x_ampl = " & int_to_str(NATURAL(c_exp_beamlet_x_ampl))); + print_str(" . c_exp_beamlet_x_power = " & real_to_str(c_exp_beamlet_x_power, 20, 1)); + print_str(" . c_exp_beamlet_x_bst = " & real_to_str(c_exp_beamlet_x_bst, 20, 1)); print_str(""); - print_str(". c_exp_beamlet_y_ampl = " & int_to_str(NATURAL(c_exp_beamlet_y_ampl))); - print_str(". c_exp_beamlet_y_power = " & real_to_str(c_exp_beamlet_y_power, 20, 1)); - print_str(". c_exp_beamlet_y_bst = " & real_to_str(c_exp_beamlet_y_bst, 20, 1)); + print_str(" . c_exp_beamlet_y_ampl = " & int_to_str(NATURAL(c_exp_beamlet_y_ampl))); + print_str(" . c_exp_beamlet_y_power = " & real_to_str(c_exp_beamlet_y_power, 20, 1)); + print_str(" . c_exp_beamlet_y_bst = " & real_to_str(c_exp_beamlet_y_bst, 20, 1)); print_str(""); FOR U IN 0 TO c_sdp_N_beamsets-1 LOOP v_G := g_beamlet + U * c_sdp_S_sub_bf; -- global beamlet index, range(c_sdp_N_beamlets_sdp) - print_str(". bst_x_arr(" & INTEGER'IMAGE(v_G) & ") = " & real_to_str(bst_x_arr(U), 20, 1)); - print_str(". bst_y_arr(" & INTEGER'IMAGE(v_G) & ") = " & real_to_str(bst_y_arr(U), 20, 1)); + print_str(" . bst_x_arr(" & INTEGER'IMAGE(v_G) & ") = " & real_to_str(bst_x_arr(U), 20, 1)); + print_str(" . bst_y_arr(" & INTEGER'IMAGE(v_G) & ") = " & real_to_str(bst_y_arr(U), 20, 1)); END LOOP; + print_str(""); FOR U IN 0 TO c_sdp_N_beamsets-1 LOOP v_G := g_beamlet + U * c_sdp_S_sub_bf; -- global beamlet index, range(c_sdp_N_beamlets_sdp) - print_str(". bst_x_arr(" & INTEGER'IMAGE(v_G) & ") / c_exp_beamlet_x_bst = " & real_to_str(bst_x_arr(U) / c_exp_beamlet_x_bst, 20, 6)); - print_str(". bst_y_arr(" & INTEGER'IMAGE(v_G) & ") / c_exp_beamlet_y_bst = " & real_to_str(bst_y_arr(U) / c_exp_beamlet_y_bst, 20, 6)); + print_str(" . bst_x_arr(" & INTEGER'IMAGE(v_G) & ") / c_exp_beamlet_x_bst = " & real_to_str(bst_x_arr(U) / c_exp_beamlet_x_bst, 20, 6)); + print_str(" . bst_y_arr(" & INTEGER'IMAGE(v_G) & ") / c_exp_beamlet_y_bst = " & real_to_str(bst_y_arr(U) / c_exp_beamlet_y_bst, 20, 6)); END LOOP; print_str(""); - print_str("Beamlet output:"); - print_str(". rd_beamlet_scale = " & int_to_str(TO_UINT(rd_beamlet_scale))); - print_str(". c_exp_beamlet_scale = " & int_to_str(c_exp_beamlet_scale)); + print_str("* Beamlet scale:"); + print_str(" . rd_beamlet_scale = " & int_to_str(TO_UINT(rd_beamlet_scale))); + print_str(" . c_exp_beamlet_scale = " & int_to_str(c_exp_beamlet_scale)); + print_str(""); + print_str("* Beamlet output:"); + print_str(" . c_exp_beamlet_x_output_ampl = " & int_to_str(NATURAL(c_exp_beamlet_x_output_ampl))); + print_str(" . c_exp_beamlet_x_output_phase = " & int_to_str(INTEGER(c_exp_beamlet_x_output_phase))); + print_str(" . rx_beamlet_x_output_re = " & int_to_str(rx_beamlet_x_output_re)); + print_str(" . c_exp_beamlet_x_output_re = " & int_to_str(INTEGER(c_exp_beamlet_x_output_re))); + print_str(" . rx_beamlet_x_output_im = " & int_to_str(rx_beamlet_x_output_im)); + print_str(" . c_exp_beamlet_x_output_im = " & int_to_str(INTEGER(c_exp_beamlet_x_output_im))); print_str(""); - print_str(". c_exp_beamlet_x_output_ampl = " & int_to_str(NATURAL(c_exp_beamlet_x_output_ampl))); - print_str(". c_exp_beamlet_x_output_phase = " & int_to_str(INTEGER(c_exp_beamlet_x_output_phase))); - print_str(". c_exp_beamlet_x_output_re = " & int_to_str(INTEGER(c_exp_beamlet_x_output_re))); - print_str(". c_exp_beamlet_x_output_im = " & int_to_str(INTEGER(c_exp_beamlet_x_output_im))); + print_str(" . c_exp_beamlet_y_output_ampl = " & int_to_str(NATURAL(c_exp_beamlet_y_output_ampl))); + print_str(" . c_exp_beamlet_y_output_phase = " & int_to_str(INTEGER(c_exp_beamlet_y_output_phase))); + print_str(" . rx_beamlet_y_output_re = " & int_to_str(rx_beamlet_y_output_re)); + print_str(" . c_exp_beamlet_y_output_re = " & int_to_str(INTEGER(c_exp_beamlet_y_output_re))); + print_str(" . rx_beamlet_y_output_im = " & int_to_str(rx_beamlet_y_output_im)); + print_str(" . c_exp_beamlet_y_output_im = " & int_to_str(INTEGER(c_exp_beamlet_y_output_im))); + print_str(""); + print_str(" . c_beamlet_output_delta (+- margin) = " & int_to_str(INTEGER(c_beamlet_output_delta))); print_str(""); - print_str(". c_exp_beamlet_y_output_ampl = " & int_to_str(NATURAL(c_exp_beamlet_y_output_ampl))); - print_str(". c_exp_beamlet_y_output_phase = " & int_to_str(INTEGER(c_exp_beamlet_y_output_phase))); - print_str(". c_exp_beamlet_y_output_re = " & int_to_str(INTEGER(c_exp_beamlet_y_output_re))); - print_str(". c_exp_beamlet_y_output_im = " & int_to_str(INTEGER(c_exp_beamlet_y_output_im))); --------------------------------------------------------------------------- -- Verify SST @@ -1196,15 +1197,15 @@ BEGIN -- Verify beamlet output in 10GbE UDP offload --------------------------------------------------------------------------- -- X-pol - v_re := TO_SINT(rx_beamlet_list_re(c_exp_beamlet_x_index)); v_re_exp := c_exp_beamlet_x_output_re; - v_im := TO_SINT(rx_beamlet_list_im(c_exp_beamlet_x_index)); v_im_exp := c_exp_beamlet_x_output_im; + v_re := rx_beamlet_x_output_re; v_re_exp := c_exp_beamlet_x_output_re; + v_im := rx_beamlet_x_output_im; v_im_exp := c_exp_beamlet_x_output_im; ASSERT v_re > INTEGER(v_re_exp) - c_beamlet_output_delta REPORT "Wrong beamlet X output (re) " & INTEGER'IMAGE(v_re) & " != " & REAL'IMAGE(v_re_exp) SEVERITY ERROR; ASSERT v_re < INTEGER(v_re_exp) + c_beamlet_output_delta REPORT "Wrong beamlet X output (re) " & INTEGER'IMAGE(v_re) & " != " & REAL'IMAGE(v_re_exp) SEVERITY ERROR; ASSERT v_im > INTEGER(v_im_exp) - c_beamlet_output_delta REPORT "Wrong beamlet X output (im) " & INTEGER'IMAGE(v_im) & " != " & REAL'IMAGE(v_im_exp) SEVERITY ERROR; ASSERT v_im < INTEGER(v_im_exp) + c_beamlet_output_delta REPORT "Wrong beamlet X output (im) " & INTEGER'IMAGE(v_im) & " != " & REAL'IMAGE(v_im_exp) SEVERITY ERROR; -- Y-pol - v_re := TO_SINT(rx_beamlet_list_re(c_exp_beamlet_y_index)); v_re_exp := c_exp_beamlet_y_output_re; - v_im := TO_SINT(rx_beamlet_list_im(c_exp_beamlet_y_index)); v_im_exp := c_exp_beamlet_y_output_im; + v_re := rx_beamlet_y_output_re; v_re_exp := c_exp_beamlet_y_output_re; + v_im := rx_beamlet_y_output_im; v_im_exp := c_exp_beamlet_y_output_im; ASSERT v_re > INTEGER(v_re_exp) - c_beamlet_output_delta REPORT "Wrong beamlet Y output (re) " & INTEGER'IMAGE(v_re) & " != " & REAL'IMAGE(v_re_exp) SEVERITY ERROR; ASSERT v_re < INTEGER(v_re_exp) + c_beamlet_output_delta REPORT "Wrong beamlet Y output (re) " & INTEGER'IMAGE(v_re) & " != " & REAL'IMAGE(v_re_exp) SEVERITY ERROR; ASSERT v_im > INTEGER(v_im_exp) - c_beamlet_output_delta REPORT "Wrong beamlet Y output (im) " & INTEGER'IMAGE(v_im) & " != " & REAL'IMAGE(v_im_exp) SEVERITY ERROR; @@ -1286,8 +1287,8 @@ BEGIN -- 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 index 0 first in - -- MSByte of rx_beamlet_sosi.data. + -- . Beamlets array is stored big endian in the data, so X.real index 0 first + -- in MSByte of rx_beamlet_sosi.data. p_rx_cep_beamlets : PROCESS BEGIN rx_beamlet_cnt <= 0; @@ -1299,24 +1300,24 @@ BEGIN proc_common_wait_until_high(ext_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_im(0) <= rx_beamlet_sosi.data(63 DOWNTO 56); -- X - rx_beamlet_arr_re(0) <= rx_beamlet_sosi.data(55 DOWNTO 48); - rx_beamlet_arr_im(1) <= rx_beamlet_sosi.data(47 DOWNTO 40); -- Y - rx_beamlet_arr_re(1) <= rx_beamlet_sosi.data(39 DOWNTO 32); - rx_beamlet_arr_im(2) <= rx_beamlet_sosi.data(31 DOWNTO 24); -- X - rx_beamlet_arr_re(2) <= rx_beamlet_sosi.data(23 DOWNTO 16); - rx_beamlet_arr_im(3) <= rx_beamlet_sosi.data(15 DOWNTO 8); -- Y - rx_beamlet_arr_re(3) <= rx_beamlet_sosi.data( 7 DOWNTO 0); + 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); IF I < c_sdp_cep_nof_beamlets_per_block / c_nof_beamlets_per_data THEN -- Only capture the first beamlets block of each packet in rx_beamlet_list - rx_beamlet_list_im(I*4 + 0) <= rx_beamlet_sosi.data(63 DOWNTO 56); -- X - rx_beamlet_list_re(I*4 + 0) <= rx_beamlet_sosi.data(55 DOWNTO 48); - rx_beamlet_list_im(I*4 + 1) <= rx_beamlet_sosi.data(47 DOWNTO 40); -- Y - rx_beamlet_list_re(I*4 + 1) <= rx_beamlet_sosi.data(39 DOWNTO 32); - rx_beamlet_list_im(I*4 + 2) <= rx_beamlet_sosi.data(31 DOWNTO 24); -- X - rx_beamlet_list_re(I*4 + 2) <= rx_beamlet_sosi.data(23 DOWNTO 16); - rx_beamlet_list_im(I*4 + 3) <= rx_beamlet_sosi.data(15 DOWNTO 8); -- Y - rx_beamlet_list_re(I*4 + 3) <= rx_beamlet_sosi.data( 7 DOWNTO 0); + rx_beamlet_list_re(I*4 + 0) <= rx_beamlet_sosi.data(63 DOWNTO 56); -- X + rx_beamlet_list_im(I*4 + 0) <= rx_beamlet_sosi.data(55 DOWNTO 48); + rx_beamlet_list_re(I*4 + 1) <= rx_beamlet_sosi.data(47 DOWNTO 40); -- Y + rx_beamlet_list_im(I*4 + 1) <= rx_beamlet_sosi.data(39 DOWNTO 32); + rx_beamlet_list_re(I*4 + 2) <= rx_beamlet_sosi.data(31 DOWNTO 24); -- X + rx_beamlet_list_im(I*4 + 2) <= rx_beamlet_sosi.data(23 DOWNTO 16); + rx_beamlet_list_re(I*4 + 3) <= rx_beamlet_sosi.data(15 DOWNTO 8); -- Y + rx_beamlet_list_im(I*4 + 3) <= rx_beamlet_sosi.data( 7 DOWNTO 0); END IF; proc_common_wait_until_high(ext_clk, rx_beamlet_sosi.valid); -- Use at least one WAIT instead of proc_common_wait_some_cycles() to @@ -1328,6 +1329,12 @@ BEGIN END LOOP; END PROCESS; + -- get rx_beamlet for comparision with c_exp_beamlet + rx_beamlet_x_output_re <= TO_SINT(rx_beamlet_list_re(c_exp_beamlet_x_index)); + rx_beamlet_x_output_im <= TO_SINT(rx_beamlet_list_im(c_exp_beamlet_x_index)); + rx_beamlet_y_output_re <= TO_SINT(rx_beamlet_list_re(c_exp_beamlet_y_index)); + rx_beamlet_y_output_im <= TO_SINT(rx_beamlet_list_im(c_exp_beamlet_y_index)); + -- 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); END tb; 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 d12d26fef306914e11c2e631e4b8c5629582d038..ed581a501adff51764e9fb989dd00e3575f0ff3f 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 @@ -1404,8 +1404,8 @@ BEGIN -- 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 index 0 first in - -- MSByte of rx_beamlet_sosi.data. + -- . Beamlets array is stored big endian in the data, so X.real index 0 first + -- in MSByte of rx_beamlet_sosi.data. p_rx_cep_beamlets : PROCESS BEGIN rx_beamlet_cnt <= 0; @@ -1417,24 +1417,24 @@ BEGIN proc_common_wait_until_high(ext_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_im(0) <= rx_beamlet_sosi.data(63 DOWNTO 56); -- X - rx_beamlet_arr_re(0) <= rx_beamlet_sosi.data(55 DOWNTO 48); - rx_beamlet_arr_im(1) <= rx_beamlet_sosi.data(47 DOWNTO 40); -- Y - rx_beamlet_arr_re(1) <= rx_beamlet_sosi.data(39 DOWNTO 32); - rx_beamlet_arr_im(2) <= rx_beamlet_sosi.data(31 DOWNTO 24); -- X - rx_beamlet_arr_re(2) <= rx_beamlet_sosi.data(23 DOWNTO 16); - rx_beamlet_arr_im(3) <= rx_beamlet_sosi.data(15 DOWNTO 8); -- Y - rx_beamlet_arr_re(3) <= rx_beamlet_sosi.data( 7 DOWNTO 0); + 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); IF I < c_sdp_cep_nof_beamlets_per_block / c_nof_beamlets_per_data THEN -- Only capture the first beamlets block of each packet in rx_beamlet_list - rx_beamlet_list_im(I*4 + 0) <= rx_beamlet_sosi.data(63 DOWNTO 56); -- X - rx_beamlet_list_re(I*4 + 0) <= rx_beamlet_sosi.data(55 DOWNTO 48); - rx_beamlet_list_im(I*4 + 1) <= rx_beamlet_sosi.data(47 DOWNTO 40); -- Y - rx_beamlet_list_re(I*4 + 1) <= rx_beamlet_sosi.data(39 DOWNTO 32); - rx_beamlet_list_im(I*4 + 2) <= rx_beamlet_sosi.data(31 DOWNTO 24); -- X - rx_beamlet_list_re(I*4 + 2) <= rx_beamlet_sosi.data(23 DOWNTO 16); - rx_beamlet_list_im(I*4 + 3) <= rx_beamlet_sosi.data(15 DOWNTO 8); -- Y - rx_beamlet_list_re(I*4 + 3) <= rx_beamlet_sosi.data( 7 DOWNTO 0); + rx_beamlet_list_re(I*4 + 0) <= rx_beamlet_sosi.data(63 DOWNTO 56); -- X + rx_beamlet_list_im(I*4 + 0) <= rx_beamlet_sosi.data(55 DOWNTO 48); + rx_beamlet_list_re(I*4 + 1) <= rx_beamlet_sosi.data(47 DOWNTO 40); -- Y + rx_beamlet_list_im(I*4 + 1) <= rx_beamlet_sosi.data(39 DOWNTO 32); + rx_beamlet_list_re(I*4 + 2) <= rx_beamlet_sosi.data(31 DOWNTO 24); -- X + rx_beamlet_list_im(I*4 + 2) <= rx_beamlet_sosi.data(23 DOWNTO 16); + rx_beamlet_list_re(I*4 + 3) <= rx_beamlet_sosi.data(15 DOWNTO 8); -- Y + rx_beamlet_list_im(I*4 + 3) <= rx_beamlet_sosi.data( 7 DOWNTO 0); END IF; proc_common_wait_until_high(ext_clk, rx_beamlet_sosi.valid); -- Use at least one WAIT instead of proc_common_wait_some_cycles() to 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 7d8fce510baeed5cdba71520c4802bd765271309..3455cb7950c4f0cbb064817b741b39259ae96ff0 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd @@ -108,11 +108,12 @@ BEGIN ------------------------------------------------------------------------------- -- Input rewiring: concatenate input complex fields to data field -- . dp_repack_data works with data fields only + -- . send beamlet data big endian with X.re part first, then X.im, Y.re, Y.im ------------------------------------------------------------------------------- p_snk_in_arr : PROCESS(in_sosi) BEGIN snk_in_concat <= in_sosi; - snk_in_concat.data(c_data_w-1 DOWNTO 0) <= in_sosi.im(c_sdp_W_beamlet-1 DOWNTO 0) & in_sosi.re(c_sdp_W_beamlet-1 DOWNTO 0); + snk_in_concat.data(c_data_w-1 DOWNTO 0) <= in_sosi.re(c_sdp_W_beamlet-1 DOWNTO 0) & in_sosi.im(c_sdp_W_beamlet-1 DOWNTO 0); END PROCESS; ------------------------------------------------------------------------------- diff --git a/applications/lofar2/libraries/sdp/src/vhdl/sdp_pkg.vhd b/applications/lofar2/libraries/sdp/src/vhdl/sdp_pkg.vhd index d5b3ab93d7e3f36cf4b408de83a670e2b4b451be..fee6a698c7229321bb56ef849bb03f265ea94579 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_pkg.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_pkg.vhd @@ -399,7 +399,7 @@ PACKAGE sdp_pkg is CONSTANT c_sdp_cep_ip_src_addr_31_16 : STD_LOGIC_VECTOR(15 DOWNTO 0) := x"C0A8"; -- 31:16, 15:8 = backplane, 7:0 = node + 1 = 192.168.xx.yy CONSTANT c_sdp_cep_ip_total_length : STD_LOGIC_VECTOR(15 DOWNTO 0) := TO_UVEC(7868, 16); -- see ICD STAT-CEP CONSTANT c_sdp_cep_udp_total_length : STD_LOGIC_VECTOR(15 DOWNTO 0) := TO_UVEC(7848, 16); -- see ICD STAT-CEP - CONSTANT c_sdp_cep_udp_dst_port : STD_LOGIC_VECTOR(15 DOWNTO 0) := TO_UVEC(5000, 16); -- 0x1380 = 5000 + CONSTANT c_sdp_cep_udp_dst_port : STD_LOGIC_VECTOR(15 DOWNTO 0) := TO_UVEC(5000, 16); -- 0x1388 = 5000 CONSTANT c_sdp_cep_udp_src_port_15_8 : STD_LOGIC_VECTOR( 7 DOWNTO 0) := x"D0"; -- 15:8, 7:0 = gn_id (= ID[7:0] = backplane[5:0] & node[1:0]) CONSTANT c_sdp_cep_app_header_len : NATURAL := 32; -- octets, see ICD STAT-CEP