From 041b1d70138918a3f6f673ece4594fe678db9b5c Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Tue, 4 Oct 2022 15:16:05 +0200
Subject: [PATCH] Improve comments.

---
 .../tb_lofar2_unb2c_sdp_station_bf.vhd        | 21 +++++++++++--------
 1 file changed, 12 insertions(+), 9 deletions(-)

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 bbb36ddf3b..0776bbb1f2 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
@@ -26,8 +26,8 @@
 --
 -- Description:
 --   This tb is a balance between verification coverage and keeping it simple:
---   - Use only one signal input (g_sp). Put same remnant WG signal on the
---     other signal inputs.
+--   - Use only one signal input (g_sp) with strong WG. Put same remnant weak
+--     WG signal on the other signal inputs.
 --   - Use different BF weight for the two beamlet polarizations (g_bf_x_gain,
 --     g_bf_x_phase and g_bf_y_phase, g_bf_y_phase) of signal input g_sp.
 --     Using different BF weights for the N_pol_bf = 2 BF polarizations allows
@@ -36,9 +36,9 @@
 --     The remnant signal inputs and BF weights allow verifying the BF sum if
 --     they are not 0. Using the same settings for all remnant SP simplyfies
 --     the tb, while still testing the BF sum.
---   - Select one beamlet for the subband (g_beamlet). Selecting one beamlet
---     other than the default beamlet for the subband is sufficient to verify
---     the beamlet subband select.
+--   - Select one beamlet (g_beamlet) for the subband (g_subband). Selecting
+--     one beamlet other than the default beamlet for the subband is sufficient
+--     to verify the beamlet subband select.
 --   - Use same stimuli for both beamsets.
 --
 --   MM control actions:
@@ -93,7 +93,6 @@
 --                          \----------------|---> beamlet_x
 --                                            \--> beamlet_y
 --
---
 --   6) Read and verify beamlet statistics (BST)
 --        View sp_sst in Wave window
 --        View bst_x_arr, bst_y_arr in Wave window
@@ -109,7 +108,7 @@
 -- Usage:
 --   > as 7    # default
 --   > as 12   # for detailed debugging
---   # Manually add missing signal
+--   # Manually add missing signals and constants using objects in GUI
 --   > add wave -position insertpoint  \
 --     sim:/tb_lofar2_unb2c_sdp_station_bf/sp_ssts_arr2 \
 --     sim:/tb_lofar2_unb2c_sdp_station_bf/bsts_arr2
@@ -154,8 +153,8 @@ ENTITY tb_lofar2_unb2c_sdp_station_bf IS
     g_bf_y_phase         : REAL := 40.0;      -- g_beamlet Y BF weight phase rotation in degrees for g_sp
     g_bf_remnant_x_gain  : REAL := 0.05;       -- g_beamlet X BF weight normalized gain for remnant sp
     g_bf_remnant_y_gain  : REAL := 0.04;       -- g_beamlet Y BF weight normalized gain for remnant sp
-    g_bf_remnant_x_phase : REAL := 170.0;       -- g_beamlet X BF weight phase rotation in degrees for g_sp
-    g_bf_remnant_y_phase : REAL := -135.0;       -- g_beamlet Y BF weight phase rotation in degrees for g_sp
+    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_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
   );
@@ -856,11 +855,13 @@ BEGIN
     FOR S IN 0 TO c_sdp_S_pn-1 LOOP
       v_offset := S * c_mm_span_reg_diag_wg;
       IF S = g_sp THEN
+        -- Strong WG signal at g_sp
         mmf_mm_bus_wr(c_mm_file_reg_diag_wg, v_offset + 0, 1024*2**16 + 1, tb_clk);  -- nof_samples, mode calc
         mmf_mm_bus_wr(c_mm_file_reg_diag_wg, v_offset + 1, INTEGER(c_wg_phase * c_diag_wg_phase_unit), tb_clk);  -- phase offset in degrees
         mmf_mm_bus_wr(c_mm_file_reg_diag_wg, v_offset + 2, INTEGER(REAL(g_subband) * c_sdp_wg_subband_freq_unit), tb_clk);  -- freq
         mmf_mm_bus_wr(c_mm_file_reg_diag_wg, v_offset + 3, INTEGER(REAL(c_wg_ampl) * c_sdp_wg_ampl_lsb), tb_clk);  -- ampl
       ELSE
+        -- Weak WG signal on all other (remnant) SP
         mmf_mm_bus_wr(c_mm_file_reg_diag_wg, v_offset + 0, 1024*2**16 + 1, tb_clk);  -- nof_samples, mode calc
         mmf_mm_bus_wr(c_mm_file_reg_diag_wg, v_offset + 1, INTEGER(c_wg_remnant_phase * c_diag_wg_phase_unit), tb_clk);  -- phase offset in degrees
         mmf_mm_bus_wr(c_mm_file_reg_diag_wg, v_offset + 2, INTEGER(REAL(g_subband) * c_sdp_wg_subband_freq_unit), tb_clk);  -- freq
@@ -955,6 +956,7 @@ BEGIN
         FOR A IN 0 TO c_sdp_A_pn-1 LOOP
           FOR P IN 0 TO c_sdp_N_pol-1 LOOP
             v_S := A * c_sdp_N_pol + P;
+            -- Different BF weights for g_sp and the remnant sp
             IF v_S = g_sp THEN
               -- use generic BF weight for g_sp in g_beamlet
               IF PB = 0 THEN
@@ -970,6 +972,7 @@ 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.
             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
-- 
GitLab