From 3b39076482d31ab8d90e283e8432d765e0230134 Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Tue, 26 Sep 2023 15:16:24 +0200
Subject: [PATCH] Correct c_exp_beamlet_index for header field.

---
 .../tb_lofar2_unb2b_sdp_station_bf.vhd                     | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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 7954aaa40d..f08e35128f 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
@@ -140,6 +140,7 @@ architecture tb of tb_lofar2_unb2b_sdp_station_bf is
   constant c_exp_ip_header_checksum : natural := 16#5BDE#;  -- value obtained from rx_sdp_cep_header.ip.header_checksum in wave window
 
   constant c_exp_beamlet_scale   : natural := natural(g_beamlet_scale * real(c_sdp_unit_beamlet_scale));  -- c_sdp_unit_beamlet_scale = 2**15;
+  constant c_exp_beamlet_index   : natural := 0;  -- depends on beamset bset * c_sdp_S_sub_bf
 
   constant c_exp_sdp_info        : t_sdp_info := (
                                      TO_UVEC(3, 6),  -- antenna_field_index
@@ -182,7 +183,7 @@ architecture tb of tb_lofar2_unb2b_sdp_station_bf is
 
   -- BF
   -- . select
-  constant c_exp_beamlet_index        : natural := g_beamlet * c_sdp_N_pol_bf;  -- in beamset 0
+  constant c_exp_g_beamlet_index        : natural := g_beamlet * c_sdp_N_pol_bf;  -- in beamset 0
   -- . Beamlet weights for selected g_sp
   constant c_bf_weight_re             : integer := integer(g_bf_gain * real(c_sdp_unit_bf_weight) * COS(g_bf_phase * MATH_2_PI / 360.0));
   constant c_bf_weight_im             : integer := integer(g_bf_gain * real(c_sdp_unit_bf_weight) * SIN(g_bf_phase * MATH_2_PI / 360.0));
@@ -1000,8 +1001,8 @@ begin
     ---------------------------------------------------------------------------
     -- Verify beamlet output in 10GbE UDP offload
     ---------------------------------------------------------------------------
-    v_re := TO_SINT(rx_packet_list_re(c_exp_beamlet_index)); v_re_exp := c_exp_beamlet_output_re;
-    v_im := TO_SINT(rx_packet_list_im(c_exp_beamlet_index)); v_im_exp := c_exp_beamlet_output_im;
+    v_re := TO_SINT(rx_packet_list_re(c_exp_g_beamlet_index)); v_re_exp := c_exp_beamlet_output_re;
+    v_im := TO_SINT(rx_packet_list_im(c_exp_g_beamlet_index)); v_im_exp := c_exp_beamlet_output_im;
     assert v_re > integer(v_re_exp) - c_beamlet_output_delta report "Wrong 10GbE 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 10GbE 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 10GbE output (im) " & integer'image(v_im) & " != " & real'image(v_im_exp) severity ERROR;
-- 
GitLab