From 8b61140f382b6ccb24749c9609ab270840250b66 Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Fri, 24 Feb 2023 09:00:05 +0100
Subject: [PATCH] Account for +-1 factor in os beamlet value verification.

---
 .../tb_disturb2_unb2b_sdp_station_full_wg.vhd             | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

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 ef0db39baf..e87e209540 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
@@ -516,10 +516,14 @@ BEGIN
     print_str(". c_exp_beamlet_im_sp_0     = " & int_to_str(INTEGER(c_exp_beamlet_im_sp_0)));
     print_str(". c_exp_beamlet_im_sp_2     = " & int_to_str(INTEGER(c_exp_beamlet_im_sp_2)));
 
+    -- WG at subband center will yield same subband value in every subband period
     ASSERT SIGNED(beamlet_arr2_re(c_exp_beamlet_index)) = c_exp_beamlet_re_sp_0 REPORT "Wrong 10GbE beamlet output /= c_exp_beamlet_re_sp_0 in beamset 0" SEVERITY ERROR;
     ASSERT SIGNED(beamlet_arr2_im(c_exp_beamlet_index)) = c_exp_beamlet_im_sp_0 REPORT "Wrong 10GbE beamlet output /= c_exp_beamlet_im_sp_0 in beamset 0" SEVERITY ERROR;
-    ASSERT SIGNED(beamlet_arr2_re(c_exp_beamlet_index_os)) = c_exp_beamlet_re_sp_2 REPORT "Wrong 10GbE beamlet output /= c_exp_beamlet_re_sp_2 in beamset 1 (shifted subbands)" SEVERITY ERROR;
-    ASSERT SIGNED(beamlet_arr2_im(c_exp_beamlet_index_os)) = c_exp_beamlet_im_sp_2 REPORT "Wrong 10GbE beamlet output /= c_exp_beamlet_im_sp_2 in beamset 1 (shifted subbands)" SEVERITY ERROR;
+    -- WG at subband edge will change phase 180 degrees in every subband period, so expect factor +-1
+    ASSERT SIGNED(beamlet_arr2_re(c_exp_beamlet_index_os)) = c_exp_beamlet_re_sp_2 OR
+           SIGNED(beamlet_arr2_re(c_exp_beamlet_index_os)) = -c_exp_beamlet_re_sp_2 REPORT "Wrong 10GbE beamlet output /= c_exp_beamlet_re_sp_2 in beamset 1 (shifted subbands)" SEVERITY ERROR;
+    ASSERT SIGNED(beamlet_arr2_im(c_exp_beamlet_index_os)) = c_exp_beamlet_im_sp_2 OR
+           SIGNED(beamlet_arr2_im(c_exp_beamlet_index_os)) = -c_exp_beamlet_im_sp_2 REPORT "Wrong 10GbE beamlet output /= c_exp_beamlet_im_sp_2 in beamset 1 (shifted subbands)" SEVERITY ERROR;
 
     ---------------------------------------------------------------------------
     -- End Simulation 
-- 
GitLab