From 6efa58afd3c89e318b81dce3ca0c2d183391fbc2 Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Mon, 23 Jan 2023 15:14:43 +0100
Subject: [PATCH] Clarify that complex signal power is A**2.

---
 .../tb_lofar2_unb2c_sdp_station_bf.vhd                        | 2 +-
 .../tb_lofar2_unb2c_sdp_station_fsub.vhd                      | 4 ++--
 .../tb_lofar2_unb2c_sdp_station_xsub_one.vhd                  | 2 +-
 .../tb_lofar2_unb2c_sdp_station_xsub_one_xst_offload.vhd      | 2 +-
 4 files changed, 5 insertions(+), 5 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 1106196967..3a05229ad5 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
@@ -242,7 +242,7 @@ ARCHITECTURE tb OF tb_lofar2_unb2c_sdp_station_bf IS
   CONSTANT c_subband_weight_phase         : REAL := 0.0;  -- use default unit subband weights
   CONSTANT c_exp_subband_phase            : REAL := g_sp_phase + c_subband_phase_offset + c_subband_weight_phase;
   CONSTANT c_exp_subband_ampl             : REAL := REAL(c_wg_ampl) * c_sdp_wpfb_subband_sp_ampl_ratio * c_subband_weight_gain;
-  CONSTANT c_exp_subband_power            : REAL := c_exp_subband_ampl**2.0;  -- complex signal ampl, so no divide by 2
+  CONSTANT c_exp_subband_power            : REAL := c_exp_subband_ampl**2.0;  -- complex signal ampl, so power is A**2 (not A**2 / 2 as for real)
   CONSTANT c_exp_subband_sst              : REAL := c_exp_subband_power * REAL(c_nof_block_per_sync);
 
   CONSTANT c_exp_remnant_subband_phase    : REAL := g_sp_remnant_phase + c_subband_phase_offset + c_subband_weight_phase;
diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_lofar2_unb2c_sdp_station_fsub.vhd b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_lofar2_unb2c_sdp_station_fsub.vhd
index 4d70659aa3..a22fd834f9 100644
--- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_lofar2_unb2c_sdp_station_fsub.vhd
+++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_lofar2_unb2c_sdp_station_fsub.vhd
@@ -130,8 +130,8 @@ ARCHITECTURE tb OF tb_lofar2_unb2c_sdp_station_fsub IS
   CONSTANT c_pfb_index                      : NATURAL := g_sp / c_sdp_Q_fft;  -- only read used WPFB unit out of range(c_sdp_P_pfb = 6)
   CONSTANT c_exp_subband_ampl_raw           : REAL := REAL(c_wg_ampl) * c_sdp_wpfb_subband_sp_ampl_ratio;
   CONSTANT c_exp_subband_ampl_weighted      : REAL := c_exp_subband_ampl_raw * g_subband_weight_gain;
-  CONSTANT c_exp_subband_power_raw          : REAL := c_exp_subband_ampl_raw**2.0;  -- complex, so no divide by 2
-  CONSTANT c_exp_subband_power_weighted     : REAL := c_exp_subband_ampl_weighted**2.0;  -- complex, so no divide by 2
+  CONSTANT c_exp_subband_power_raw          : REAL := c_exp_subband_ampl_raw**2.0;  -- complex signal ampl, so power is A**2 (not A**2 / 2 as for real)
+  CONSTANT c_exp_subband_power_weighted     : REAL := c_exp_subband_ampl_weighted**2.0;  -- complex signal ampl, so power is A**2 (not A**2 / 2 as for real)
   CONSTANT c_exp_subband_sst_raw            : REAL := c_exp_subband_power_raw * REAL(c_nof_block_per_sync);
   CONSTANT c_exp_subband_sst_weighted       : REAL := c_exp_subband_power_weighted * REAL(c_nof_block_per_sync);
 
diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_xsub_one/tb_lofar2_unb2c_sdp_station_xsub_one.vhd b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_xsub_one/tb_lofar2_unb2c_sdp_station_xsub_one.vhd
index 2774f8ae02..77778e6256 100644
--- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_xsub_one/tb_lofar2_unb2c_sdp_station_xsub_one.vhd
+++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_xsub_one/tb_lofar2_unb2c_sdp_station_xsub_one.vhd
@@ -96,7 +96,7 @@ ARCHITECTURE tb OF tb_lofar2_unb2c_sdp_station_xsub_one IS
 
   -- WPFB
   CONSTANT c_exp_subband_ampl     : REAL := REAL(c_wg_ampl) * c_sdp_wpfb_subband_sp_ampl_ratio;
-  CONSTANT c_exp_subband_power    : REAL := c_exp_subband_ampl**2.0;  -- complex, so no divide by 2
+  CONSTANT c_exp_subband_power    : REAL := c_exp_subband_ampl**2.0;  -- complex signal ampl, so power is A**2 (not A**2 / 2 as for real)
   CONSTANT c_exp_subband_sst      : REAL := c_exp_subband_power * REAL(c_nof_block_per_sync);
   CONSTANT c_exp_subband_xst      : REAL := c_exp_subband_sst;  -- all signal inputs use same WG, and auto correlation XST = SST
 
diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_xsub_one/tb_lofar2_unb2c_sdp_station_xsub_one_xst_offload.vhd b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_xsub_one/tb_lofar2_unb2c_sdp_station_xsub_one_xst_offload.vhd
index 62b37144b7..7500ba0157 100644
--- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_xsub_one/tb_lofar2_unb2c_sdp_station_xsub_one_xst_offload.vhd
+++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_xsub_one/tb_lofar2_unb2c_sdp_station_xsub_one_xst_offload.vhd
@@ -109,7 +109,7 @@ ARCHITECTURE tb OF tb_lofar2_unb2c_sdp_station_xsub_one_xst_offload IS
 
   -- WPFB
   CONSTANT c_exp_subband_ampl     : REAL := REAL(c_wg_ampl) * c_sdp_wpfb_subband_sp_ampl_ratio;  -- = c_wg_ampl * 0.994817 * 8
-  CONSTANT c_exp_subband_power    : REAL := c_exp_subband_ampl**2.0;  -- complex, so no divide by 2
+  CONSTANT c_exp_subband_power    : REAL := c_exp_subband_ampl**2.0;  -- complex signal ampl, so power is A**2 (not A**2 / 2 as for real)
   CONSTANT c_exp_subband_sst      : REAL := c_exp_subband_power * REAL(c_nof_block_per_sync);
   CONSTANT c_exp_subband_xst      : REAL := c_exp_subband_sst;  -- all signal inputs use same WG, and auto correlation XST = SST
 
-- 
GitLab