From e50cc87ac5ab7b9f2a9a297d0caec2617e370aec Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Tue, 5 Apr 2022 14:47:48 +0200
Subject: [PATCH] Define expected subband bin amplitude relative to real input
 amplitude, for DC and for sine.

---
 libraries/dsp/fft/src/vhdl/fft_pkg.vhd | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libraries/dsp/fft/src/vhdl/fft_pkg.vhd b/libraries/dsp/fft/src/vhdl/fft_pkg.vhd
index 84f1eef69f..a177c9b236 100644
--- a/libraries/dsp/fft/src/vhdl/fft_pkg.vhd
+++ b/libraries/dsp/fft/src/vhdl/fft_pkg.vhd
@@ -37,8 +37,10 @@ package fft_pkg is
   -- A/2, one at -f_bin and one at +f_bin. The power stays the same, because
   -- the power of an real input sinus is A**2 / 2 and the power of the f_bin
   -- signal complex phasors is (A/2)**2 + (A/2)**2 = A**2 / 2.
-  CONSTANT c_fft_real_input_gain_w  : INTEGER := -1;
-  CONSTANT c_fft_real_input_gain    : REAL := 2.0**REAL(c_fft_real_input_gain_w);
+  -- For DC at bin 0 the real input gain is 1.0, because DC has only one
+  -- phasor component of frequency 0.
+  CONSTANT c_fft_real_input_gain_sine : REAL := 0.5;
+  CONSTANT c_fft_real_input_gain_dc   : REAL := 1.0;
 
   -- FFT parameters for pipelined FFT (fft_pipe), parallel FFT (fft_par) and wideband FFT (fft_wide)
   type t_fft is record
-- 
GitLab