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 eed8f4c2c283dc2757eb0b8e8ef693cfbf5a2d85..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; @@ -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;