From f033c5e4396108373862b7b416cc49c0dd68cd07 Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Mon, 25 Jan 2021 16:58:07 +0100
Subject: [PATCH] Use constants to improve and ease selection of sets of tb
 tests in tb_tb, and report procesing gain results in tb_tb.

---
 .../dsp/verify_pfb/tb_tb_verify_pfb_wg.vhd    | 754 ++++++++++++++----
 libraries/dsp/verify_pfb/tb_verify_pfb_wg.vhd | 122 +--
 2 files changed, 653 insertions(+), 223 deletions(-)

diff --git a/libraries/dsp/verify_pfb/tb_tb_verify_pfb_wg.vhd b/libraries/dsp/verify_pfb/tb_tb_verify_pfb_wg.vhd
index 49797b44cc..f0d10e41d1 100644
--- a/libraries/dsp/verify_pfb/tb_tb_verify_pfb_wg.vhd
+++ b/libraries/dsp/verify_pfb/tb_tb_verify_pfb_wg.vhd
@@ -39,9 +39,13 @@
 --   transcript window is acceptable.
 -- 
 -- Usage:
+--   > as 4
 --   > run -all
 --   > testbench is selftesting.
 --   > observe logging in transcript window
+--     . select logging and copy it to tb_verify_pfb_wg.txt, or temp.txt
+--     . use 'more temp.txt | grep wpfb_measured_proc_gain_a_dB' to extract
+--       the estimated SNR processing gain
 --
 
 LIBRARY IEEE;
@@ -58,10 +62,24 @@ ARCHITECTURE tb OF tb_tb_verify_pfb_wg IS
   SIGNAL tb_end : STD_LOGIC := '0';  -- tb_end is used to end a tb if it cannot end itself, but is not needed for tb_verify_pfb_wg
                                      -- however, do declare tb_end to avoid 'No objects found' error on 'when -label tb_end'
                                      
+  CONSTANT c_gen_ref                     : BOOLEAN := TRUE;
+  CONSTANT c_gen_g_fil_backoff_w_1       : BOOLEAN := FALSE;
+  CONSTANT c_gen_vary_g_fil_backoff_w    : BOOLEAN := FALSE;
+  CONSTANT c_gen_vary_g_fft_out_dat_w    : BOOLEAN := FALSE;
+  CONSTANT c_gen_2020_jan_18             : BOOLEAN := FALSE;
+  CONSTANT c_gen_vary_wg_integer_freq    : BOOLEAN := FALSE;
+  CONSTANT c_gen_vary_wg_fractional_freq : BOOLEAN := FALSE;
+  CONSTANT c_gen_vary_g_fft_stage_dat_w  : BOOLEAN := FALSE;
+  CONSTANT c_gen_vary_g_fil_in_dat_w     : BOOLEAN := FALSE;
+  CONSTANT c_gen_vary_g_amplitude_a      : BOOLEAN := FALSE;
+  CONSTANT c_gen_vary_c_twiddle_w        : BOOLEAN := FALSE;
+  CONSTANT c_gen_vary_extra_w            : BOOLEAN := FALSE;
+  CONSTANT c_gen_2020_dec                : BOOLEAN := FALSE;
+                                     
 BEGIN
 
 -- generics of tb_verify_pfb_wg
---   g_tb_index        : NATURAL := 0;   -- use g_tb_index to identify and separate print_str() loggings from multi tb 
+--   g_tb_index        : NATURAL := 0;   -- use g_tb_index to identify and separate print_str() loggings from multi tb
 --   g_sel_pfb         : STRING := "WPFB";  -- "WPFB" for APERTIF PFB, "PFB2" for LOFAR1 PBF
 --
 --   -- WG
@@ -114,183 +132,565 @@ BEGIN
 --   g_sepa_extra_w          : NATURAL := 2     -- = 2, extra LSbits in output of last rTwoSDFStage to improve two real separate requantization in fft_r2_pipe in wpfb_unit_dev
 
                              
-  --                                                g_tb_index
-  --                                                .      g_sel_pfb
-  --                                                .       .     g_subband_index_a
-  --                                                .       .     .     g_subband_index_b
-  --                                                .       .     .     .    g_amplitude_a
-  --                                                .       .     .     .    .    g_amplitude_b
-  --                                                .       .     .     .    .    .     g_phase_a
-  --                                                .       .     .     .    .    .     .     g_phase_b
-  --                                                .       .     .     .    .    .     .     .             g_fil_coefs_file_prefix
-  --                                                .       .     .     .    .    .     .     .             .   g_fil_coef_dat_w
-  --                                                .       .     .     .    .    .     .     .             .   .  g_fil_backoff_w
-  --                                                .       .     .     .    .    .     .     .             .   .  .   g_fil_in_dat_w
-  --                                                .       .     .     .    .    .     .     .             .   .  .   .   g_internal_dat_w
-  --                                                .       .     .     .    .    .     .     .             .   .  .   .   .   g_fft_out_dat_w
-  --                                                .       .     .     .    .    .     .     .             .   .  .   .   .   .  g_fft_out_gain_w
-  --                                                .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   g_fft_stage_dat_w
-  --                                                .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   .  g_fft_guard_w
-  --                                                .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   .  .    g_switch_en
-  --                                                .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   .  .    .  g_r2_mul_extra_w
-  --                                                .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   .  .    .  .  g_sepa_extra_w
-  --                                                .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   .  .    .  .  .
-
--- 18 jan 2021
-
--- WPFB settings u_0 asin lofar2_unb2b_filterbank in LTS 2020-11-23
---   --   . g_fil_backoff_w   = 1
---   --   . g_fil_in_dat_w    = 14 = W_adc
---   --   . g_internal_dat_w  = 16 = number of bits between fil and fft
---   --   . g_fft_out_dat_w   = 18 = W_subband
---   --   . g_fft_out_gain_w  = 1
---   --   . g_fft_stage_dat_w = 18 = c_dsp_mult_w
---   --   . g_fft_guard_w     = 2
-  u_0  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 0, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 16, 18, 1, 18, 2, '0', 0, 0);
-  u_1  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 1, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);
-  u_2  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 2, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 2, 0);
-  u_3  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 3, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 2, 2);
-  u_4  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 4, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 0);
-  u_5  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 5, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 2, 0);
-  u_6  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 6, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 2, 2);
-
--- vary g_fil_in_dat_w
---  u_0  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 0, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0,  8, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_1  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 1, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0,  9, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_2  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 2, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 10, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_3  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 3, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 11, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_4  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 4, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 12, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_5  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 5, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 13, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_6  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 6, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 0);
---
---  u_10 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (10, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0,  8, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_11 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (11, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0,  9, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_12 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (12, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 10, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_13 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (13, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 11, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_14 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (14, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 12, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_15 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (15, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 13, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_16 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (16, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 20, 1, '0', 0, 0);
+  --                                                                 g_tb_index
+  --                                                                 .      g_sel_pfb
+  --                                                                 .       .     g_subband_index_a
+  --                                                                 .       .     .     g_subband_index_b
+  --                                                                 .       .     .     .    g_amplitude_a
+  --                                                                 .       .     .     .    .    g_amplitude_b
+  --                                                                 .       .     .     .    .    .     g_phase_a
+  --                                                                 .       .     .     .    .    .     .     g_phase_b
+  --                                                                 .       .     .     .    .    .     .     .             g_fil_coefs_file_prefix
+  --                                                                 .       .     .     .    .    .     .     .             .   g_fil_coef_dat_w
+  --                                                                 .       .     .     .    .    .     .     .             .   .  g_fil_backoff_w
+  --                                                                 .       .     .     .    .    .     .     .             .   .  .   g_fil_in_dat_w
+  --                                                                 .       .     .     .    .    .     .     .             .   .  .   .   g_internal_dat_w
+  --                                                                 .       .     .     .    .    .     .     .             .   .  .   .   .   g_fft_out_dat_w
+  --                                                                 .       .     .     .    .    .     .     .             .   .  .   .   .   .  g_fft_out_gain_w
+  --                                                                 .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   g_fft_stage_dat_w
+  --                                                                 .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   .  g_fft_guard_w
+  --                                                                 .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   .  .    g_switch_en
+  --                                                                 .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   .  .    .  g_r2_mul_extra_w
+  --                                                                 .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   .  .    .  .  g_sepa_extra_w
+  --                                                                 .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   .  .    .  .  .
+gen_ref : IF c_gen_ref GENERATE  --                                  .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   .  .    .  .  .
+  -- WPFB                                                            .       .     .     .    .    .     .     .             .   .  .   .   .   .  .   .  .    .  .  .
+  u_apertif           : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1001, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1,  8, 16, 18, 1, 18, 2, '0', 0, 0);
+  u_lts_2020_11_23    : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1002, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 16, 18, 1, 18, 2, '0', 0, 0);
+  -- PFB2
+  u_lofar1_12b        : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1003, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 12, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_lofar1_14b        : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1004, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_lofar1_14b_22     : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1005, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 22, 0, '0', 0, 0);
+  u_lofar1_14b_24     : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1006, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 24, 0, '0', 0, 0);
+  -- WPFB
+  u_wpfb_stage18      : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1007, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);
+  u_wpfb_stage20      : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1008, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_wpfb_stage22      : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1009, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 22, 1, '0', 0, 0);
+  u_wpfb_stage23      : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1010, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 23, 1, '0', 0, 0);
+  u_wpfb_stage24      : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1011, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 24, 1, '0', 0, 0);
+-- Results:
+-- WPFB
+--tb-1001 . wpfb_measured_proc_gain_a_dB =   25.54 [dB]
+--tb-1002 . wpfb_measured_proc_gain_a_dB =   -0.80 [dB]
+-- PFB2
+--tb-1003 . wpfb_measured_proc_gain_a_dB =   23.18 [dB], = u_lofar1_12b
+--tb-1004 . wpfb_measured_proc_gain_a_dB =   15.24 [dB], = u_lofar1_14b
+--tb-1005 . wpfb_measured_proc_gain_a_dB =   17.03 [dB], = u_lofar1_14b_22, improvement is < 3 dB
+--tb-1006 . wpfb_measured_proc_gain_a_dB =   17.00 [dB], = u_lofar1_14b_24
+-- WPFB
+--tb-1007 . wpfb_measured_proc_gain_a_dB =    6.11 [dB], = u_wpfb_stage18
+--tb-1008 . wpfb_measured_proc_gain_a_dB =   12.38 [dB], = u_wpfb_stage20 : ~3.1 dB per extra g_fft_stage_dat_w bit
+--tb-1009 . wpfb_measured_proc_gain_a_dB =   18.79 [dB], = u_wpfb_stage22 : ~3.2 dB per extra g_fft_stage_dat_w bit
+--tb-1010 . wpfb_measured_proc_gain_a_dB =   19.86 [dB], = u_wpfb_stage23 : ~1.1 dB per extra g_fft_stage_dat_w bit
+--tb-1011 . wpfb_measured_proc_gain_a_dB =   20.08 [dB], = u_wpfb_stage24 : ~0.2 dB per extra g_fft_stage_dat_w bit
+--Conclusion:
+--* For g_fft_stage_dat_w <= 22 the processing gain increases ~3 dB per extra g_fft_stage_dat_w bit, therefore choose 22, 23 or 24, more than 24 bit has not benefit.
+END GENERATE;
+
+
+gen_g_fil_backoff_w_1 : IF c_gen_g_fil_backoff_w_1 GENERATE
+  -- g_subband_index_a = 60.4, to check that with g_fil_backoff_w = 1 there is no FIR filter overflow
+  u_149 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (149, "WPFB", 60.4, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 17, 18, 0, 18, 1, '0', 0, 0);
+  -- g_subband_index_a = 60, WG at center subband frequency to determine PFB processing gain
+  -- g_fft_guard_w = 1, check that no extra FFT backoff guard at first stage is needed when g_fil_backoff_w = 1
+  u_150 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (150, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 17, 18, 0, 18, 1, '0', 0, 0);
+  u_151 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (151, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_152 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (152, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 17, 18, 0, 22, 1, '0', 0, 0);
+  u_153 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (153, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 17, 18, 0, 23, 1, '0', 0, 0);
+  u_154 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (154, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 17, 18, 0, 24, 1, '0', 0, 0);
+  u_155 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (155, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 17, 18, 0, 25, 1, '0', 0, 0);
+  -- g_fft_guard_w = 2, use extra FFT backoff guard at first FFT stage, which is compensated by no guard at last FFT stage, intermediate stages have backoff guard 1 to compensate for stage gain of factor 2
+  u_156 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (156, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 16, 18, 0, 18, 2, '0', 0, 0);
+  u_157 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (157, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 16, 18, 0, 20, 2, '0', 0, 0);
+  u_158 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (158, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 16, 18, 0, 22, 2, '0', 0, 0);
+  u_159 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (159, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 16, 18, 0, 23, 2, '0', 0, 0);
+  u_160 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (160, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 16, 18, 0, 24, 2, '0', 0, 0);
+  u_161 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (161, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 16, 18, 0, 25, 2, '0', 0, 0);
+--Results:
+--g_fil_backoff_w = 1
+--             g_fft_stage_dat_w
+--               .                               g_fft_guard_w = 1    g_fft_guard_w = 2
+--tb-149        18 . wpfb_measured_proc_gain_a_dB =   25.56 [dB]                           -- so OK, because no overflow               
+--tb-150, 156   18 . wpfb_measured_proc_gain_a_dB =    1.05 [dB]           -0.80 [dB]      --  6.11 [dB] for u_wpfb_stage18
+--tb-151, 157   20 . wpfb_measured_proc_gain_a_dB =    9.05 [dB]            6.38 [dB]      -- 12.38 [dB] for u_wpfb_stage20
+--tb-152, 158   22 . wpfb_measured_proc_gain_a_dB =   16.13 [dB]           15.90 [dB]      -- 18.79 [dB] for u_wpfb_stage22
+--                                                    16.52                                -- g_r2_mul_extra_w = 2
+--                                                    16.13                                -- g_sepa_extra_w = 2
+--tb-153, 159   23 . wpfb_measured_proc_gain_a_dB =   17.22 [dB]           16.78 [dB]      -- 19.86 [dB] for u_wpfb_stage23
+--                                                    17.22 [dB]           16.64 [dB]      -- g_internal_dat_w = 16, 15 instead of 17, 16
+--                                                    17.22 [dB]           16.78 [dB]      -- g_internal_dat_w = 18, 17 instead of 17, 16
+--                                                    17.22 [dB]           16.51 [dB]      -- g_internal_dat_w = 20, 19 instead of 17, 16
+--tb-154, 160   24 . wpfb_measured_proc_gain_a_dB =   17.38 [dB]           17.22 [dB]      -- 20.08 [dB] for u_wpfb_stage24
+--tb-155, 161   25 . wpfb_measured_proc_gain_a_dB =   17.38 [dB]           17.55 [dB]      -- 20.39 [dB] for u_307
+--Conclusion:
+--* Using g_fil_backoff_w = 1 decreases the processing gain by ~3 dB (u_wpfb_stage24 - u_154 = 20.08 - 17.38 = 2.70 dB)
+--* Using g_fft_guard_w = 2 for the first stage does not decrease the processing gain when g_fft_stage_dat_w ~=> 22. However
+--  when g_fil_backoff_w = 1 then it is not necessary to use g_fft_guard_w > 1, because then the input to the FFT is already
+--  scaled down by the factor 2 of g_fil_backoff_w = 1.
+END GENERATE;
+
+
+gen_vary_g_fil_backoff_w : IF c_gen_vary_g_fil_backoff_w GENERATE
+  u_1000 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1000, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 22, 1, '0', 0, 0);  -- = u_wpfb_stage22
+  u_1001 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1001, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 17, 18, 0, 22, 0, '0', 0, 0);
+  u_1002 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1002, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 18, 19, 0, 22, 0, '0', 0, 0);
+  u_1003 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1003, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 18, 19, 1, 22, 0, '0', 0, 0);
+--Results:  
+-- . wpfb_measured_proc_gain_a_dB =   18.79 [dB]
+-- . wpfb_measured_proc_gain_a_dB =   16.64 [dB]
+-- . wpfb_measured_proc_gain_a_dB =   16.89 [dB]
+-- . wpfb_measured_proc_gain_a_dB =   15.89 [dB]
+END GENERATE;
+
+
+gen_vary_g_fft_out_dat_w : IF c_gen_vary_g_fft_out_dat_w GENERATE
+  -- WPFB
+  u_100 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (100, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 22, 1, '0', 0, 0);  -- = u_wpfb_stage22
+  u_101 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (101, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 19, 0, 22, 1, '0', 0, 0);
+  u_102 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (102, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 20, 0, 22, 1, '0', 0, 0);
+  -- PFB2
+  u_103 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (103, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 22, 0, '0', 0, 0);
+  u_104 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (104, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 19, 0, 22, 0, '0', 0, 0);
+  u_105 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (105, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 20, 0, 22, 0, '0', 0, 0);
+-- Results:
+--       g_fft_out_dat_w
+-- WPFB    .
+--tb-100  18 . wpfb_measured_proc_gain_a_dB =   18.79 [dB]
+--tb-101  19 . wpfb_measured_proc_gain_a_dB =   17.38 [dB]
+--tb-102  20 . wpfb_measured_proc_gain_a_dB =   17.42 [dB]
+-- PFB2
+--tb-103  18 . wpfb_measured_proc_gain_a_dB =   17.03 [dB]
+--tb-104  19 . wpfb_measured_proc_gain_a_dB =   15.70 [dB]
+--tb-105  20 . wpfb_measured_proc_gain_a_dB =   16.36 [dB]
+END GENERATE;
+
+
+gen_2020_jan_18 : IF c_gen_2020_jan_18 GENERATE
+  u_200  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (200, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 1, 14, 16, 18, 1, 18, 2, '0', 0, 0);  -- = u_lts_2020_11_23
+  u_201  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (201, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_202  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (202, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 2, 0);
+  u_203  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (203, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 2, 2);
+  u_204  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (204, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 0);  -- = u_wpfb_stage20
+  u_205  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (205, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 2, 0);
+  u_206  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (206, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 2, 2);
+
+-- Results:
+-- Table C: PFB processing gain for APERTIF WPFB quick improvements
 --
---  u_20 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (20, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0,  8, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_21 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (21, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0,  9, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_22 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (22, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 10, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_23 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (23, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 11, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_24 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (24, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 12, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_25 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (25, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 13, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_26 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (26, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 0);
+-- tb-200 . wpfb_measured_proc_gain_a_dB =   -0.80 [dB]  current lofar2_unb2b_filterbank settings 2020-11-23
+-- tb-201 . wpfb_measured_proc_gain_a_dB =    6.11 [dB]  + g_fil_backoff_w = 0 instead of 1,
+--                                                       + g_fft_guard_w = 1 instead of 2,
+--                                                       + g_internal_dat_w = 17 instead of 16
+-- tb-202 . wpfb_measured_proc_gain_a_dB =    6.53 [dB]  + g_r2_mul_extra_w = 2 instead of 0
+-- tb-203 . wpfb_measured_proc_gain_a_dB =    6.53 [dB]  + g_sepa_extra_w = 2 instead of 0
+-- tb-204 . wpfb_measured_proc_gain_a_dB =   12.38 [dB]  + g_fft_stage_dat_w = 20 instead of 18
+-- tb-205 . wpfb_measured_proc_gain_a_dB =   12.35 [dB]  + g_fft_stage_dat_w = 20 instead of 18, g_r2_mul_extra_w = 2
+-- tb-206 . wpfb_measured_proc_gain_a_dB =   14.62 [dB]  + g_fft_stage_dat_w = 20 instead of 18, g_r2_mul_extra_w = 2, g_sepa_extra_w = 2
+END GENERATE;
+
+
+gen_vary_wg_integer_freq : IF c_gen_vary_wg_integer_freq GENERATE
+  u_2001 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2001, "WPFB",  1.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2002 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2002, "WPFB",  2.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2003 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2003, "WPFB",  3.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2004 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2004, "WPFB",  4.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2008 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2008, "WPFB",  8.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2016 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2016, "WPFB", 16.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2032 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2032, "WPFB", 32.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2037 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2037, "WPFB", 37.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2061 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2061, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2064 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2064, "WPFB", 64.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2117 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2117, "WPFB",117.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2128 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2128, "WPFB",128.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2256 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2256, "WPFB",256.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2257 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2257, "WPFB",257.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2373 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2373, "WPFB",373.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_2503 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2503, "WPFB",503.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+
+-- Results:
+-- g_subband_index_a
+--   1 . wpfb_measured_proc_gain_a_dB =    6.95 [dB]
+--   2 . wpfb_measured_proc_gain_a_dB =    6.90 [dB]
+--   3 . wpfb_measured_proc_gain_a_dB =    6.89 [dB]
+--   4 . wpfb_measured_proc_gain_a_dB =    6.81 [dB]
+--   8 . wpfb_measured_proc_gain_a_dB =    7.79 [dB]
+--  16 . wpfb_measured_proc_gain_a_dB =    7.97 [dB]
+--  32 . wpfb_measured_proc_gain_a_dB =    8.29 [dB]
+--  37 . wpfb_measured_proc_gain_a_dB =    6.03 [dB]
+--  61 . wpfb_measured_proc_gain_a_dB =    6.11 [dB]
+--  64 . wpfb_measured_proc_gain_a_dB =    9.06 [dB]
+-- 117 . wpfb_measured_proc_gain_a_dB =    6.32 [dB]
+-- 128 . wpfb_measured_proc_gain_a_dB =   11.69 [dB], due to wrong wg_measured_snr_a_dB =  80.54 [dB], using c_wg_snr_a_dB = 86.05 [dB] and sst_measured_snr_a_dB = 92.24 [dB], yields 6.20 dB.
+-- 256 . wpfb_measured_proc_gain_a_dB = -153.35 [dB], due to wrong wg_measured_snr_a_dB = 246.87 [dB], using c_wg_snr_a_dB = 86.05 [dB] and sst_measured_snr_a_dB = 93.52 [dB], yields 7.47 dB.
+-- 257 . wpfb_measured_proc_gain_a_dB =    6.74 [dB]
+-- 373 . wpfb_measured_proc_gain_a_dB =    6.37 [dB]
+-- 503 . wpfb_measured_proc_gain_a_dB =    6.67 [dB]
+END GENERATE;
+
+
+gen_vary_wg_fractional_freq : IF c_gen_vary_wg_fractional_freq GENERATE
+  -- Use fractions that fit integer number of periods in sync interval c_N_blk = c_wpfb.nof_blk_per_sync = 10, so c_N_blk*fraction must be integer, to have stable SST value
+  -- Need to use g_amplitude_a = 0.9 ~< 0.95 to avoid overflow in PFS output, that occurs for some fractional g_subband_index_a
+  -- WG freq 60.0
+  u_600 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (600, "WPFB", 60.0, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_601 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (601, "WPFB", 60.1, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_602 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (602, "WPFB", 60.2, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_603 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (603, "WPFB", 60.3, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_604 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (604, "WPFB", 60.4, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_605 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (605, "WPFB", 60.5, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_606 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (606, "WPFB", 60.6, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_607 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (607, "WPFB", 60.7, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_608 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (608, "WPFB", 60.8, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_609 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (609, "WPFB", 60.9, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  -- WG freq 61.0
+  u_610 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (610, "WPFB", 61.0, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18 freq 61
+  u_611 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (611, "WPFB", 61.1, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_612 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (612, "WPFB", 61.2, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_613 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (613, "WPFB", 61.3, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_614 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (614, "WPFB", 61.4, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_615 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (615, "WPFB", 61.5, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_616 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (616, "WPFB", 61.6, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_617 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (617, "WPFB", 61.7, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_618 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (618, "WPFB", 61.8, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_619 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (619, "WPFB", 61.9, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  -- WG freq 62.0
+  u_620 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (620, "WPFB", 62.0, 61.0, 0.9, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  
+-- Note>:
+-- . For fractional subband frequencies the WG can only generate the average frequency, due to limited period accuracy of WG. This causes
+--   the WG SNR to be about 55.1 +- 0.1 dB for fractional subband frequencies, instead of 85.0 dB, so about 30 dB less. The WG quantization
+--   noise is not white noise, as can be seen by cw_noise_a in analogue format in the Modelsim Wave Window
+-- Results:
+-- g_subband_index_a
+-- 60.0 . wpfb_measured_proc_gain_a_dB =    6.09 [dB]
+-- 60.1 . wpfb_measured_proc_gain_a_dB =   26.57 [dB], the processing gain is higher due to that the WG input SNR is much lower for fractional subband frequencies
+-- 60.2 . wpfb_measured_proc_gain_a_dB =   25.58 [dB]
+-- 60.3 . wpfb_measured_proc_gain_a_dB =   26.55 [dB]
+-- 60.4 . wpfb_measured_proc_gain_a_dB =   26.52 [dB]
+-- 60.5 . wpfb_measured_proc_gain_a_dB =   25.73 [dB]
+-- 60.6 . wpfb_measured_proc_gain_a_dB =   26.51 [dB]
+-- 60.7 . wpfb_measured_proc_gain_a_dB =   26.66 [dB]
+-- 60.8 . wpfb_measured_proc_gain_a_dB =   25.70 [dB]
+-- 60.9 . wpfb_measured_proc_gain_a_dB =   26.67 [dB]
+-- 61.0 . wpfb_measured_proc_gain_a_dB =    6.43 [dB]
+-- 61.1 . wpfb_measured_proc_gain_a_dB =   26.64 [dB]
+-- 61.2 . wpfb_measured_proc_gain_a_dB =   25.65 [dB]
+-- 61.3 . wpfb_measured_proc_gain_a_dB =   26.59 [dB]
+-- 61.4 . wpfb_measured_proc_gain_a_dB =   26.45 [dB]
+-- 61.5 . wpfb_measured_proc_gain_a_dB =   25.73 [dB]
+-- 61.6 . wpfb_measured_proc_gain_a_dB =   26.47 [dB]
+-- 61.7 . wpfb_measured_proc_gain_a_dB =   26.56 [dB]
+-- 61.8 . wpfb_measured_proc_gain_a_dB =   25.59 [dB]
+-- 61.9 . wpfb_measured_proc_gain_a_dB =   26.57 [dB]
+-- 62.0 . wpfb_measured_proc_gain_a_dB =    6.06 [dB]
+END GENERATE;
+
+
+gen_vary_g_fft_stage_dat_w : IF c_gen_vary_g_fft_stage_dat_w GENERATE
+  -- g_internal_dat_w = constant
+  -- WPFB
+  u_300 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (300, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_301 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (301, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 19, 1, '0', 0, 0);
+  u_302 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (302, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 0);  -- = u_wpfb_stage20
+  u_303 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (303, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 21, 1, '0', 0, 0);
+  u_304 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (304, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 22, 1, '0', 0, 0);  -- = u_wpfb_stage22
+  u_305 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (305, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 23, 1, '0', 0, 0);  -- = u_wpfb_stage23
+  u_306 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (306, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 24, 1, '0', 0, 0);  -- = u_wpfb_stage24
+  u_307 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (307, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 25, 1, '0', 0, 0);
+
+  -- PFB2
+  u_310 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (310, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 18, 0, '0', 0, 0);
+  u_311 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (311, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 19, 0, '0', 0, 0);
+  u_312 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (312, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 20, 0, '0', 0, 0);  -- = u_lofar1_14b
+  u_313 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (313, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 21, 0, '0', 0, 0);
+  u_314 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (314, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 22, 0, '0', 0, 0);
+  u_315 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (315, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 23, 0, '0', 0, 0);
+  u_316 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (316, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 24, 0, '0', 0, 0);
+  u_317 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (317, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 25, 0, '0', 0, 0);
+
+  -- WPFB only FFT
+  u_320 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (320, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_321 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (321, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 19, 1, '0', 0, 0);
+  u_322 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (322, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_323 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (323, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 21, 1, '0', 0, 0);
+  u_324 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (324, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 22, 1, '0', 0, 0);
+  u_325 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (325, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 23, 1, '0', 0, 0);
+  u_326 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (326, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 24, 1, '0', 0, 0);
+  u_327 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (327, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 25, 1, '0', 0, 0);
+  
+  -- PFB2 only FFT
+  u_330 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (330, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 18, 0, '0', 0, 0);
+  u_331 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (331, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 19, 0, '0', 0, 0);
+  u_332 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (332, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_333 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (333, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 21, 0, '0', 0, 0);
+  u_334 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (334, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 22, 0, '0', 0, 0);
+  u_335 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (335, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 23, 0, '0', 0, 0);
+  u_336 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (336, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 24, 0, '0', 0, 0);
+  u_337 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (337, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 25, 0, '0', 0, 0);
+
+  -- g_internal_dat_w = incrementing with g_fft_stage_dat_w
+  -- WPFB
+  u_340 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (340, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_341 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (341, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 19, 1, '0', 0, 0);
+  u_342 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (342, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 19, 18, 0, 20, 1, '0', 0, 0);
+  u_343 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (343, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 20, 18, 0, 21, 1, '0', 0, 0);
+  u_344 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (344, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 21, 18, 0, 22, 1, '0', 0, 0);
+  u_345 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (345, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 22, 18, 0, 23, 1, '0', 0, 0);
+  u_346 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (346, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 23, 18, 0, 24, 1, '0', 0, 0);
+  u_347 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (347, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 24, 18, 0, 25, 1, '0', 0, 0);
+
+  -- PFB2
+  u_350 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (350, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 18, 0, '0', 0, 0);
+  u_351 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (351, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 19, 18, 0, 19, 0, '0', 0, 0);
+  u_352 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (352, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 20, 18, 0, 20, 0, '0', 0, 0);
+  u_353 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (353, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 21, 18, 0, 21, 0, '0', 0, 0);
+  u_354 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (354, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 22, 18, 0, 22, 0, '0', 0, 0);
+  u_355 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (355, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 23, 18, 0, 23, 0, '0', 0, 0);
+  u_356 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (356, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 24, 18, 0, 24, 0, '0', 0, 0);
+  u_357 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (357, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 25, 18, 0, 25, 0, '0', 0, 0);
+  
+-- Results:
+-- Table A: PFB processing gain for increasing internal data width
+-- 
+-- g_fil_in_dat_w = 14 ADC data (full scale sinus)
+--   g_fft_stage_dat_w
+--    .                                   Coeffs16384Kaiser-quant                                 Only FFT (bypass FIR)
+--    .               g_internal_dat_w :  Constant     Incrementing  Constant     Incrementing    Constant     Constant                     
+--    .                                   APERTIF                    LOFAR1                       APERTIF      LOFAR1
+--    .                                   WPFB                       PBF2                         WPFB         PBF2
+--   18. wpfb_measured_proc_gain_a_dB =    6.11 [dB]    6.11 [dB]    12.07 [dB]   12.07  [dB]      9.97 [dB]   19.56 [dB]
+--   19. wpfb_measured_proc_gain_a_dB =    7.49 [dB]    7.61 [dB]    14.27 [dB]   14.81  [dB]     11.17 [dB]   21.43 [dB]
+--   20. wpfb_measured_proc_gain_a_dB =   12.38 [dB]   12.58 [dB]    15.24 [dB]   15.95  [dB]     16.36 [dB]   22.11 [dB]
+--   21. wpfb_measured_proc_gain_a_dB =   15.84 [dB]   15.93 [dB]    16.82 [dB]   16.92  [dB]     20.69 [dB]   23.17 [dB]
+--   22. wpfb_measured_proc_gain_a_dB =   18.79 [dB]   18.79 [dB]    17.03 [dB]   16.92  [dB]     23.96 [dB]   24.05 [dB]
+--   23. wpfb_measured_proc_gain_a_dB =   19.86 [dB]   19.93 [dB]    17.03 [dB]   17.18  [dB]     26.00 [dB]   24.00 [dB]
+--   24. wpfb_measured_proc_gain_a_dB =   20.08 [dB]   20.16 [dB]    17.00 [dB]   17.00  [dB]     28.22 [dB]   23.96 [dB]
+--   25. wpfb_measured_proc_gain_a_dB =   20.39 [dB]   20.23 [dB]    17.00 [dB]   17.07  [dB]     28.22 [dB]   24.19 [dB]
+--                                                                                          
+--   . c_twiddle_w                    =   18           18            16           16              18           16
+END GENERATE;
+
+
+gen_vary_g_fil_in_dat_w : IF c_gen_vary_g_fil_in_dat_w GENERATE
+  u_400 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (400, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0,  8, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_401 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (401, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0,  9, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_402 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (402, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 10, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_403 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (403, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 11, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_404 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (404, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 12, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_405 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (405, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 13, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_406 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (406, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 0);  -- u_wpfb_stage20
+
+  u_410 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (410, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0,  8, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_411 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (411, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0,  9, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_412 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (412, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 10, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_413 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (413, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 11, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_414 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (414, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 12, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_415 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (415, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 13, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_416 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (416, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 20, 0, '0', 0, 0);  -- u_lofar1_14b
+
+  u_420 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (420, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0,  8, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_421 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (421, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0,  9, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_422 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (422, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 10, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_423 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (423, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 11, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_424 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (424, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 12, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_425 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (425, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 13, 17, 18, 0, 20, 1, '0', 0, 0);
+  u_426 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (426, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 0);
+
+  u_430 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (430, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0,  8, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_431 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (431, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0,  9, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_432 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (432, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 10, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_433 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (433, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 11, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_434 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (434, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 12, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_435 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (435, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 13, 18, 18, 0, 20, 0, '0', 0, 0);
+  u_436 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (436, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 20, 0, '0', 0, 0);
+
+-- Results:
+-- The table B) shows the processing gain for different internal ADC input width between 8b and 14b. Conclusions:
+-- 
+-- g_fft_stage_dat_w = 20
+--   g_fil_in_dat_w ADC data (full scale sinus)
+--    .                                   Coeffs16384Kaiser-quant    Only FFT (bypass FIR)
+--    .                                   APERTIF      LOFAR1        APERTIF      LOFAR1
+--    .                                   WPFB         PBF2          WPFB         PBF2
+--    8. wpfb_measured_proc_gain_a_dB =   26.90 [dB]   26.96 [dB]    26.90 [dB]   27.01 [dB]
+--    9. wpfb_measured_proc_gain_a_dB =   26.59 [dB]   26.76 [dB]    26.69 [dB]   26.96 [dB]
+--   10. wpfb_measured_proc_gain_a_dB =   26.10 [dB]   26.50 [dB]    26.29 [dB]   26.87 [dB]
+--   11. wpfb_measured_proc_gain_a_dB =   24.63 [dB]   25.38 [dB]    25.44 [dB]   26.57 [dB]
+--   12. wpfb_measured_proc_gain_a_dB =   22.12 [dB]   23.18 [dB]    24.01 [dB]   25.65 [dB]
+--   13. wpfb_measured_proc_gain_a_dB =   17.66 [dB]   19.51 [dB]    20.82 [dB]   23.52 [dB]
+--   14. wpfb_measured_proc_gain_a_dB =   12.38 [dB]   15.24 [dB]    16.36 [dB]   22.11 [dB]
+END GENERATE;
+
+
+-- 2021_jan_11
+gen_vary_g_amplitude_a : IF c_gen_vary_g_amplitude_a GENERATE
+  u_760 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (760, "WPFB", 61.0, 61.0, 1.0     , 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18, 1.0
+  u_761 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (761, "WPFB", 61.0, 61.0, 0.5     , 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_762 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (762, "WPFB", 61.0, 61.0, 0.25    , 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_763 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (763, "WPFB", 61.0, 61.0, 0.125   , 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_764 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (764, "WPFB", 61.0, 61.0, 0.0625  , 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_765 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (765, "WPFB", 61.0, 61.0, 0.03125 , 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+  u_766 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (766, "WPFB", 61.0, 61.0, 0.015625, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- = u_wpfb_stage18
+--Results:
+--tb-761 . wpfb_measured_proc_gain_a_dB =    6.11 [dB]
+--tb-762 . wpfb_measured_proc_gain_a_dB =    6.15 [dB]
+--tb-763 . wpfb_measured_proc_gain_a_dB =    7.05 [dB]
+--tb-760 . wpfb_measured_proc_gain_a_dB =    6.73 [dB]
+--tb-764 . wpfb_measured_proc_gain_a_dB =    7.18 [dB]
+--tb-765 . wpfb_measured_proc_gain_a_dB =    6.79 [dB]
+--tb-766 . wpfb_measured_proc_gain_a_dB =    7.03 [dB]
+END GENERATE;
+
+
+gen_vary_c_twiddle_w : IF c_gen_vary_c_twiddle_w GENERATE
+  -- WPFB only FFT
+  u_0 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (0, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 22, 1, '0', 0, 0);  -- = u_324
+  u_1 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 24, 1, '0', 0, 0);  -- = u_326
+  
+-- Rerun the simulation per c_twiddle_w setting ## by first manually doing:
+-- > cp libraries/dsp/rTwoSDF/src/vhdl/pkg/twiddlesPkg_w##.vhd libraries/dsp/rTwoSDF/src/vhdl/twiddlesPkg.vhd
+-- > mk all
+-- and then collect the results from the transcript window:
 --
---  u_30 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (30, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0,  8, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_31 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (31, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0,  9, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_32 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (32, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 10, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_33 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (33, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 11, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_34 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (34, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 12, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_35 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (35, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 13, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_36 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (36, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 20, 1, '0', 0, 0);
-
--- vary g_fft_stage_dat_w
---  u_0  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 0, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_1  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 1, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 19, 1, '0', 0, 0);
---  u_2  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 2, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_3  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 3, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 21, 1, '0', 0, 0);
---  u_4  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 4, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 22, 1, '0', 0, 0);
---  u_5  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 5, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 23, 1, '0', 0, 0);
---  u_6  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 6, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 24, 1, '0', 0, 0);
-
---  u_10 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (10, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 18, 1, '0', 0, 0);
---  u_11 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (11, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 19, 1, '0', 0, 0);
---  u_12 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (12, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_13 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (13, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 21, 1, '0', 0, 0);
---  u_14 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (14, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 22, 1, '0', 0, 0);
---  u_15 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (15, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 23, 1, '0', 0, 0);
---  u_16 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (16, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 24, 1, '0', 0, 0);
-
---  u_20 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (20, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_21 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (21, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 19, 1, '0', 0, 0);
---  u_22 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (22, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_23 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (23, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 21, 1, '0', 0, 0);
---  u_24 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (24, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 22, 1, '0', 0, 0);
---  u_25 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (25, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 23, 1, '0', 0, 0);
---  u_26 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (26, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 24, 1, '0', 0, 0);
-
---  u_30 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (30, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 18, 1, '0', 0, 0);
---  u_31 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (31, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 19, 1, '0', 0, 0);
---  u_32 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (32, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 20, 1, '0', 0, 0);
---  u_33 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (33, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 21, 1, '0', 0, 0);
---  u_34 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (34, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 22, 1, '0', 0, 0);
---  u_35 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (35, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 23, 1, '0', 0, 0);
---  u_36 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (36, "PFB2", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 18, 18, 0, 24, 1, '0', 0, 0);
-
--- 11 jan 2021
---  u_0  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (0, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_1  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (1, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 19, 1, '0', 0, 0);
---  u_2  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (2, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 0);
---  u_3  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (3, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 21, 1, '0', 0, 0);
---  u_4  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (4, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 22, 1, '0', 0, 0);
---  u_5  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (5, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 23, 1, '0', 0, 0);
---  u_6  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (6, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 24, 1, '0', 0, 0);
---  u_7  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (7, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 25, 1, '0', 0, 0);
---  u_8  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (8, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 26, 1, '0', 0, 0);
---  u_9  : ENTITY work.tb_verify_pfb_wg GENERIC MAP (9, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 27, 1, '0', 0, 0);
+-- Results:
+-- c_twiddle_w                            g_stage_dat_w
+--   .                                           22            24
+--  13 : wpfb_measured_proc_gain_a_dB =    8.49 [dB]     8.76 [dB]
+--  14 : wpfb_measured_proc_gain_a_dB =   13.15 [dB]    13.83 [dB]
+--  15 : wpfb_measured_proc_gain_a_dB =   18.08 [dB]    19.19 [dB]
+--  16 : wpfb_measured_proc_gain_a_dB =   21.53 [dB]    22.85 [dB]
+--  17 : wpfb_measured_proc_gain_a_dB =   23.29 [dB]    26.62 [dB]
+--  18 : wpfb_measured_proc_gain_a_dB =   23.96 [dB]    28.22 [dB]  -- = u_324, u_326  ==> Choose c_twiddle_w >= g_fft_out_dat_w
+--  19 : wpfb_measured_proc_gain_a_dB =   24.54 [dB]    27.76 [dB]
+--  20 : wpfb_measured_proc_gain_a_dB =   24.97 [dB]    28.22 [dB]
+--  21 : wpfb_measured_proc_gain_a_dB =   24.75 [dB]    28.22 [dB]
+END GENERATE;
+
+
+gen_vary_extra_w : IF c_gen_vary_extra_w GENERATE
+  u_900 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (900, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);  -- u_wpfb_stage18
+  u_901 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (901, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 1, 0);
+  u_902 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (902, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 1);
+  u_903 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (903, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 1, 1);
+
+  u_910 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (910, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 0);  -- u_wpfb_stage20
+  u_911 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (911, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 1, 0);
+  u_912 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (912, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 1);
+  u_913 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (913, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 20, 1, '0', 1, 1);
+  
+  u_920 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (920, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 22, 1, '0', 0, 0);  -- u_wpfb_stage22
+  u_921 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (921, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 22, 1, '0', 1, 0);
+  u_922 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (922, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 22, 1, '0', 0, 1);
+  u_923 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (923, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 22, 1, '0', 1, 1);
   
---  u_20 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (20, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 8);
---  u_21 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (21, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 19, 1, '0', 0, 8);
---  u_22 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (22, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 20, 1, '0', 0, 8);
---  u_23 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (23, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 21, 1, '0', 0, 8);
---  u_24 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (24, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 22, 1, '0', 0, 8);
---  u_25 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (25, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 23, 1, '0', 0, 8);
---  u_26 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (26, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 24, 1, '0', 0, 8);
---  u_27 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (27, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 25, 1, '0', 2, 2);
---  u_28 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (28, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 26, 1, '0', 2, 2);
---  u_29 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (29, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0, c_fil_bypass, 16, 0, 14, 17, 18, 0, 27, 1, '0', 2, 2);
-
---  u_0  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 0, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0,  6, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_1  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 1, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0,  7, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_0  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 0, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0,  8, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_1  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 1, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0,  9, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_2  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 2, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 10, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_3  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 3, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 11, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_4  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 4, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 12, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_5  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 5, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 13, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_6  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 6, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_61 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (61, "WPFB", 61.0, 61.0, 0.5, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_62 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (62, "WPFB", 61.0, 61.0, 0.25, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_63 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (63, "WPFB", 61.0, 61.0, 0.125, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_64 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (64, "WPFB", 61.0, 61.0, 0.0625, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_65 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (65, "WPFB", 61.0, 61.0, 0.03125, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);
---  u_66 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (66, "WPFB", 61.0, 61.0, 0.015625, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 0, 0);
-
--- dec 2020 
---  u_0  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 0, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 2, 2);
---  u_1  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 1, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 19, 1, '0', 2, 2);
---  u_2  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 2, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 19, 18, 0, 20, 1, '0', 2, 2);
---  u_3  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 3, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 20, 18, 0, 21, 1, '0', 2, 2);
---  u_4  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 4, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 21, 18, 0, 22, 1, '0', 2, 2);
---  u_5  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 5, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 22, 18, 0, 23, 1, '0', 2, 2);
---  u_6  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 6, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 23, 18, 0, 24, 1, '0', 2, 2);
---  u_7  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 7, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 24, 18, 0, 25, 1, '0', 2, 2);
---  u_8  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 8, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 25, 18, 0, 26, 1, '0', 2, 2);
---  u_9  : ENTITY work.tb_verify_pfb_wg GENERIC MAP ( 9, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 26, 18, 0, 27, 1, '0', 2, 2);
-
---  u_10 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (10, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 19, 0, 18, 1, '0', 2, 2);
---  u_11 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (11, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 19, 0, 19, 1, '0', 2, 2);
---  u_12 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (12, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 19, 19, 0, 20, 1, '0', 2, 2);
---  u_13 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (13, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 20, 19, 0, 21, 1, '0', 2, 2);
---  u_14 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (14, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 21, 19, 0, 22, 1, '0', 2, 2);
---  u_15 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (15, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 22, 19, 0, 23, 1, '0', 2, 2);
---  u_16 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (16, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 23, 19, 0, 24, 1, '0', 2, 2);
---  u_17 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (17, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 24, 19, 0, 25, 1, '0', 2, 2);
---  u_18 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (18, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 25, 19, 0, 26, 1, '0', 2, 2);
---  u_19 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (19, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 26, 19, 0, 27, 1, '0', 2, 2);
-
---  u_20 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (20, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 20, 0, 18, 1, '0', 2, 2);
---  u_21 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (21, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 20, 0, 19, 1, '0', 2, 2);
---  u_22 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (22, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 19, 20, 0, 20, 1, '0', 2, 2);
---  u_23 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (23, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 20, 20, 0, 21, 1, '0', 2, 2);
---  u_24 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (24, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 21, 20, 0, 22, 1, '0', 2, 2);
---  u_25 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (25, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 22, 20, 0, 23, 1, '0', 2, 2);
---  u_26 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (26, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 23, 20, 0, 24, 1, '0', 2, 2);
---  u_27 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (27, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 24, 20, 0, 25, 1, '0', 2, 2);
---  u_28 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (28, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 25, 20, 0, 26, 1, '0', 2, 2);
---  u_29 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (29, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 26, 20, 0, 27, 1, '0', 2, 2);
+  u_930 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (930, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 24, 1, '0', 0, 0);  -- u_wpfb_stage24
+  u_931 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (931, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 24, 1, '0', 1, 0);
+  u_932 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (932, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 24, 1, '0', 0, 1);
+  u_933 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (933, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 24, 1, '0', 1, 1);
+--Results:
+--        g_fft_stage_dat_w
+--         .  g_r2_mul_extra_w
+--         .  .  g_sepa_extra_w
+--         .  .  .
+--tb-900  18, 0, 0 . wpfb_measured_proc_gain_a_dB =    6.11 [dB]  -- u_wpfb_stage18
+--            1, 0 .                                   6.09 [dB]
+--tb-901  18, 2, 0 .                                   6.53 [dB]
+--
+--            0, 0 . wpfb_measured_proc_gain_a_dB =    6.11 [dB]  -- u_wpfb_stage18
+--            0, 1 .                                   5.09 [dB]
+--tb-902  18, 0, 2 .                                   5.26 [dB]
+--
+--            0, 0 . wpfb_measured_proc_gain_a_dB =    6.11 [dB]  -- u_wpfb_stage18
+--            1, 1 .                                   6.09 [dB]
+--tb-903  18, 2, 2 .                                   6.53 [dB]
+--            3, 3 .                                   6.70 [dB]
+--
+--tb-910  20, 0, 0 . wpfb_measured_proc_gain_a_dB =   12.38 [dB]  -- u_wpfb_stage20
+--            1, 0 .                                  12.31 [dB]
+--tb-911  20, 2, 0 .                                  12.35 [dB]
+--
+--            0, 0 . wpfb_measured_proc_gain_a_dB =   12.38 [dB]  -- u_wpfb_stage20
+--            0, 1 .                                  13.42 [dB]
+--tb-912  20, 0, 2 .                                  13.42 [dB]
+--
+--            0, 0 . wpfb_measured_proc_gain_a_dB =   12.38 [dB]  -- u_wpfb_stage20
+--            1, 1 .                                  14.49 [dB]
+--tb-913  20, 2, 2 .                                  14.62 [dB]
+--            3, 3 .                                  14.97 [dB]
+--
+--tb-920  22, 0, 0 . wpfb_measured_proc_gain_a_dB =   18.79 [dB]  -- u_wpfb_stage22
+--            1, 0 .                                  18.97 [dB]
+--tb-921  22, 2, 0 .                                  19.20 [dB]
+--
+--            0, 0 . wpfb_measured_proc_gain_a_dB =   18.79 [dB]  -- u_wpfb_stage22
+--            0, 1 .                                  18.97 [dB]
+--tb-922  22, 0, 2 .                                  18.97 [dB]
+--
+--            0, 0 . wpfb_measured_proc_gain_a_dB =   18.79 [dB]  -- u_wpfb_stage22
+--            1, 1 .                                  19.59 [dB]
+--tb-923  22, 2, 2 .                                  19.52 [dB]
+--            3, 3 .                                  19.59 [dB]
+--
+--tb-930  24, 0, 0 . wpfb_measured_proc_gain_a_dB =   20.08 [dB]  -- u_wpfb_stage24
+--            1, 0 .                                  20.08 [dB]
+--tb-931  24, 2, 0 .                                  20.08 [dB]
+--
+--            0, 0 . wpfb_measured_proc_gain_a_dB =   20.08 [dB]  -- u_wpfb_stage24
+--            0, 1 .                                  20.16 [dB]
+--tb-932  24, 0, 2 .                                  20.16 [dB]
+--
+--            0, 0 . wpfb_measured_proc_gain_a_dB =   20.08 [dB]  -- u_wpfb_stage24
+--            1, 1 .                                  20.31 [dB]
+--tb-933  24, 2, 2 .                                  20.23 [dB]
+--            3, 3 .                                  20.23 [dB]
+--
+--Conclusion:
+--* If g_fft_stage_dat_w is large enough (~=> 24), then using extra_w has no benefit (as expected)
+--* Combination of using both g_r2_mul_extra_w and g_sepa_extra_w has most benefit, for 
+--  g_fft_stage_dat_w ~=> 22 it is sufficient to use 1, 1.
+--* Using g_fft_stage_dat_w = 22 with extra_w 1, 1 yields 19.59 [dB],
+--  using g_fft_stage_dat_w = 24 with extra_w 0, 0 yields 20.08 [dB] so ~= 0.49 dB better
+--  using g_fft_stage_dat_w = 24 with extra_w 1, 1 yields 20.31 [dB] so ~= 0.72 dB better, but with 2, 2 it is even slightly less.
+END GENERATE;
+
+
+gen_2020_dec : IF c_gen_2020_dec GENERATE
+  -- g_internal_dat_w = g_fft_stage_dat_w - g_fft_guard_w
+  -- g_fft_out_dat_w = 18
+  u_800 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (800, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 18, 0, 18, 1, '0', 2, 2);
+  u_801 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (801, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 18, 0, 19, 1, '0', 2, 2);
+  u_802 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (802, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 19, 18, 0, 20, 1, '0', 2, 2);
+  u_803 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (803, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 20, 18, 0, 21, 1, '0', 2, 2);
+  u_804 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (804, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 21, 18, 0, 22, 1, '0', 2, 2);
+  u_805 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (805, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 22, 18, 0, 23, 1, '0', 2, 2);
+  u_806 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (806, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 23, 18, 0, 24, 1, '0', 2, 2);
+  u_807 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (807, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 24, 18, 0, 25, 1, '0', 2, 2);
+  u_808 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (808, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 25, 18, 0, 26, 1, '0', 2, 2);
+  u_809 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (809, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 26, 18, 0, 27, 1, '0', 2, 2);
+
+  -- g_fft_out_dat_w = 19
+  u_810 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (810, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 19, 0, 18, 1, '0', 2, 2);
+  u_811 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (811, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 19, 0, 19, 1, '0', 2, 2);
+  u_812 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (812, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 19, 19, 0, 20, 1, '0', 2, 2);
+  u_813 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (813, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 20, 19, 0, 21, 1, '0', 2, 2);
+  u_814 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (814, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 21, 19, 0, 22, 1, '0', 2, 2);
+  u_815 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (815, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 22, 19, 0, 23, 1, '0', 2, 2);
+  u_816 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (816, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 23, 19, 0, 24, 1, '0', 2, 2);
+  u_817 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (817, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 24, 19, 0, 25, 1, '0', 2, 2);
+  u_818 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (818, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 25, 19, 0, 26, 1, '0', 2, 2);
+  u_819 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (819, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 26, 19, 0, 27, 1, '0', 2, 2);
+
+  -- g_fft_out_dat_w = 20
+  u_820 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (820, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 17, 20, 0, 18, 1, '0', 2, 2);
+  u_821 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (821, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 18, 20, 0, 19, 1, '0', 2, 2);
+  u_822 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (822, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 19, 20, 0, 20, 1, '0', 2, 2);
+  u_823 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (823, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 20, 20, 0, 21, 1, '0', 2, 2);
+  u_824 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (824, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 21, 20, 0, 22, 1, '0', 2, 2);
+  u_825 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (825, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 22, 20, 0, 23, 1, '0', 2, 2);
+  u_826 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (826, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 23, 20, 0, 24, 1, '0', 2, 2);
+  u_827 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (827, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 24, 20, 0, 25, 1, '0', 2, 2);
+  u_828 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (828, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 25, 20, 0, 26, 1, '0', 2, 2);
+  u_829 : ENTITY work.tb_verify_pfb_wg GENERIC MAP (829, "WPFB", 61.0, 61.0, 1.0, 0.0,  0.0,  0.0,  c_fil_coefs, 16, 0, 14, 26, 20, 0, 27, 1, '0', 2, 2);
+END GENERATE;
   
-end tb;
+END tb;
diff --git a/libraries/dsp/verify_pfb/tb_verify_pfb_wg.vhd b/libraries/dsp/verify_pfb/tb_verify_pfb_wg.vhd
index 072756d629..0868b4a345 100644
--- a/libraries/dsp/verify_pfb/tb_verify_pfb_wg.vhd
+++ b/libraries/dsp/verify_pfb/tb_verify_pfb_wg.vhd
@@ -21,25 +21,35 @@
 -------------------------------------------------------------------------------
 --
 -- Author: E. Kooistra
--- Purpose: Test bench to investigate quantization in poly phase filterbank (PFB) using WG.
+-- Purpose: Test bench to investigate quantization in poly phase filterbank (PFB) using WG. The main goal is to 
+--          verify that the PFB achieves the expected processing gain between input SNR and subband output SNR.
 -- Description:
---   . Use g_sel_pfb to select: APERTIF wpfb_unit_dev.vhd or LOFAR1 pfb2_unit.vhd
---   . This tb assumes two real input and wb_factor = 1 and nof_chan = 0.
+--   . Use g_sel_pfb to select the APERTIF wpfb_unit_dev.vhd or LOFAR1 pfb2_unit.vhd as device under test (DUT).
+--   . This tb assumes two real input and wb_factor = 1 and nof_chan = 0 (as for LOFAR2.0).
 --   . The tb measures the signal to noise ratio (SNR) at several stages:
 --     - WG output
 --     - FIR filter output
 --     - SST
 --     The SNR is use to determine the performance of the WPFB:
---     - the implementation loss due to quantization should be at least a factor 10 less than the input quantization
+--     - The implementation loss due to quantization should be at least a factor 10 less than the input quantization
 --       noise of the ADC. If the noise power increases by a factor 1.1, then the SNR will reduce by 10*log10(1.0/1.1)
 --       = 0.4 dB.
---     - the FFT achieves the processing gain for the WG signal at the specific subband. The subband filterbank has
+--     - The FFT achieves the processing gain for the WG signal at the specific subband. The subband filterbank has
 --       N_sub = N_fft/2 = 512 subbands, so the expected processing gain of the FFT (for a real input) is
 --       20*log10(sqrt(N_sub) = 27.1 dB.
 --     - The expected SNR of a subband in the SST is processing gain - implementation loss = 27.1 - 0.4 = 26.7 dB
 --       higher than the SNR of the WG input signal.
+--     - The polyphase FIR filter of the PFB uses the same Coeffs16384Kaiser-quant.dat coefficients as in LOFAR1.
+--       From run_pfir_coeff.m it follows that the equivaluent nois bandwidth of a subband with this filter is
+--       0.96 bins, so for the PFB the expected processing gain increases by about 10*log10(0.96) = 0.17 dB compared
+--       to for the FFT, so about 27.3 dB.
 --   . The WG does not produce a perfect sampled sine. Therefore the SNR of the WG input will be somewhat
---     less than the theoretical SNR of an ADC (SNR = W_adc * 6.02 + 1.76 dB).
+--     less than the theoretical SNR of an ADC (SNR = W_adc * 6.02 + 1.76 dB). Hence for W_adc = 14 the SNR of
+--     the generated carrier wave (CW) sine is SNR = c_wg_snr_a_dB = 86 dB.
+--   . For fractional WG frequencies for which the period does not fit the WG internal buffer size of
+--     g_buf_addr_w, the SNR of the carrier wave (CW) is limited to SNR = (g_buf_addr_w-1) * 6.02 + 1.76 dB
+--     (see diag_wg.vhd). The g_buf_addr_w = 10. Therefore for fractional g_subband_index_a,b the effective SNR
+--     of the generated CW sine is SNR ~= 56 dB, even when W_adc = 14 > 9 bit.
 --   . The SNR of the WG and the FIR filter output is measured by estimating first the amplitude and 
 --     phase of the input sine. These estimated amplitude and phase are then used to create a local CW
 --     (carrier wave) and subtract that from the input sine to get the equivalent noise. The SNR is then
@@ -47,29 +57,35 @@
 --   . The SNR of the SST is measured by using the power in the subband that corresponds to the WG
 --     frequency as signal power, and the power in the other subbands as noise power.
 --   . The tb does support using WG phase /= 0, this should yield same SNR results as phase = 0
---   . The tb does support using and using WG frequencies that fall fractionally between subbands, proivided that
+--   . The tb does support using and using WG frequencies that fall fractionally between subbands, provided that
 --     the fraction is a multiple of 1/c_N_blk, because then the WG sine will have DC = 0 over the sync interval
 --     of c_N_blk blocks.
---   . The FIR output SNR cannot be measured for fractional WG frequencies, because then the FIR filter output is
---     discontinuous after every block of c_N_fft samples, due to that it is a polyphase FIR filter. This makes that
---     the amplitude and phase of the FIR filter output cannot be determined, so then the FIR filter output noise
---     estimate is also not valid. Therefore FIR output SNR estimation and logging is disabled when fractional
---     subband frequencies are used.
 --   . For the SNR measurements it is sufficient to use WG frequencies at the subband center.
 --
+-- Remark:
+-- . In retrospect it would have been better to use quantized REAL SIN() in testbench as carrier wave (CW)
+--   waveform source, instead of using the WG, because the WG is not good enough for fractional subband
+--   frequencies and because SIN() is easier to use in the test bench. 
+-- . Using quantized REAL also allows defining other input signals, like noise or combination of SIN() and 
+--   noise, although such tests are better done in MATLAB. Purpose of this tb is only to verify the 
+--   implementation losses.
+-- . The WG frequency resolution can be improved by using a longer reference waveform in the WG buffer RAM.
+--   Fractional subband frequencies of 0.1 can be supported accurately by using a reference waveform that
+--   has a factor 1/0.1 = 10 more resolution.
+--
 -- Usage:
 --   > as 3 default, or as 12 for details
 --   > run -all
 --   > testbench is partially selftesting.
---   > observe the *_scope signals as radix decimal, format analogue format
---     signals in the Wave window
+--   > observe the *_scope signals as radix decimal, format analogue format signals in the Wave window.
+--     default use analogue(automatic), if necessary zoom in using right click analogue(custom).
 --
 -- Note:
 -- . Must use ABS() with **2.0 of negative REAL, because (negative)**2.0 yields error and value 0.0,
 -- . Must use brackets (ABS()) to avoid compile error
 
 LIBRARY ieee, common_lib, dp_lib, diag_lib, filter_lib, rTwoSDF_lib, fft_lib, wpfb_lib;
-LIBRARY pft2_lib, pfb2_lib;
+LIBRARY pfs_lib, pft2_lib, pfb2_lib;
 USE IEEE.std_logic_1164.ALL;
 USE IEEE.numeric_std.ALL;
 USE IEEE.std_logic_textio.ALL;
@@ -83,12 +99,15 @@ USE common_lib.tb_common_mem_pkg.ALL;
 USE diag_lib.diag_pkg.ALL;
 USE diag_lib.tb_diag_pkg.ALL;
 USE dp_lib.dp_stream_pkg.ALL;
+-- APERTIF WPFB:
 USE filter_lib.fil_pkg.ALL; 
 USE rTwoSDF_lib.rTwoSDFPkg.ALL;
 USE rTwoSDF_lib.twiddlesPkg.ALL;
 USE fft_lib.fft_pkg.ALL;
 USE fft_lib.tb_fft_pkg.ALL;
 USE wpfb_lib.wpfb_pkg.ALL;
+-- LOFAR1 PFB2:
+USE pfs_lib.pfs_pkg.ALL;
 USE pft2_lib.pft_pkg.ALL;
 
 ENTITY tb_verify_pfb_wg IS
@@ -98,7 +117,7 @@ ENTITY tb_verify_pfb_wg IS
     --g_sel_pfb         : STRING := "PFB2";
   
     -- WG
-    g_subband_index_a : REAL := 61.0;   -- 0:511
+    g_subband_index_a : REAL := 61.1;   -- 0:511
     g_subband_index_b : REAL := 61.0;   -- 0:511
     g_amplitude_a     : REAL := 1.0;    -- 1.0 is full scale
     g_amplitude_b     : REAL := 0.0;    -- 1.0 is full scale
@@ -143,8 +162,8 @@ ENTITY tb_verify_pfb_wg IS
     g_fft_stage_dat_w       : NATURAL := 18;   -- = c_dsp_mult_w = 18, number of bits that are used inter-stage
     g_fft_guard_w           : NATURAL := 1;    -- = 2
     g_switch_en             : STD_LOGIC := '0';  -- two real input decorrelation option in PFB2
-    g_r2_mul_extra_w        : NATURAL := 0;    -- = 2, extra bits at rTwoWMul output in rTwoSDFStage to improve rTwoSDFStage output requantization in fft_r2_pipe in wpfb_unit_dev
-    g_sepa_extra_w          : NATURAL := 8     -- = 2, extra LSbits in output of last rTwoSDFStage to improve two real separate requantization in fft_r2_pipe in wpfb_unit_dev
+    g_r2_mul_extra_w        : NATURAL := 0;    -- = 2, WPFB extra bits at rTwoWMul output in rTwoSDFStage to improve rTwoSDFStage output requantization in fft_r2_pipe in wpfb_unit_dev
+    g_sepa_extra_w          : NATURAL := 0     -- = 2, WPFB extra LSbits in output of last rTwoSDFStage to improve two real separate requantization in fft_r2_pipe in wpfb_unit_dev
   );
 END ENTITY tb_verify_pfb_wg;
 
@@ -162,6 +181,7 @@ ARCHITECTURE tb OF tb_verify_pfb_wg IS
 
   -- Determine PFIR coefficient width for WPFB and PFB2
   CONSTANT c_pfir_coef_w       : NATURAL := sel_a_b(g_sel_pfb="WPFB", g_fil_coef_dat_w, 16);
+  CONSTANT c_pfir_coefs_file   : STRING := c_pfs_coefs_file;  -- PFB2 "data/pfs_coefsbuf_1024.hex" default from pfs_pkg.vhd
   
   -- Determine internal data width between PFIR and PFT for WPFB and PFB2, use default if g_internal_dat_w=0
   CONSTANT c_internal_dat_w    : NATURAL := sel_a_b(g_sel_pfb="WPFB",
@@ -225,7 +245,9 @@ ARCHITECTURE tb OF tb_verify_pfb_wg IS
   CONSTANT c_N_samples               : NATURAL := c_N_fft * c_N_blk;        -- nof samples per sync interval
   CONSTANT c_nof_channels            : NATURAL := 2**c_wpfb.nof_chan;       -- = 2**0 = 1, so no time multiplexing of inputs
   CONSTANT c_nof_sync                : NATURAL := 5;                        -- nof sync intervals to simulate
-    
+  
+  CONSTANT c_pfb_sub_scaling         : REAL := 2.0**REAL(g_fft_out_dat_w - g_fil_in_dat_w - 1);  -- expected subband amplitude gain relative to input WG amplitude
+                                                                                                 -- -1 for divide by 2 in two real input separate (Ampl --> Ampl/2)    
   -- Subband at WG frequency
   CONSTANT c_bin_a                   : NATURAL := NATURAL(FLOOR(g_subband_index_a));
   CONSTANT c_bin_a_frac_en           : BOOLEAN := g_subband_index_a > REAL(c_bin_a);
@@ -311,13 +333,17 @@ ARCHITECTURE tb OF tb_verify_pfb_wg IS
   
   SIGNAL sub_a_re               : INTEGER := 0;
   SIGNAL sub_a_im               : INTEGER := 0;
+  SIGNAL sub_a_ampl             : REAL := 0.0;
   SIGNAL sub_a_re_frac          : INTEGER := 0;
   SIGNAL sub_a_im_frac          : INTEGER := 0;
+  SIGNAL sub_a_ampl_frac        : REAL := 0.0;
   
   SIGNAL sub_b_re               : INTEGER := 0;
   SIGNAL sub_b_im               : INTEGER := 0;
+  SIGNAL sub_b_ampl             : REAL := 0.0;
   SIGNAL sub_b_re_frac          : INTEGER := 0;
   SIGNAL sub_b_im_frac          : INTEGER := 0;
+  SIGNAL sub_b_ampl_frac        : REAL := 0.0;
   
   -- Input power measurement
   -- . signal input A
@@ -768,6 +794,13 @@ BEGIN
   sub_b_re_frac <= out_re WHEN rising_edge(dp_clk) AND out_bin = c_bin_b + 1 AND out_val_b = '1';
   sub_b_im_frac <= out_im WHEN rising_edge(dp_clk) AND out_bin = c_bin_b + 1 AND out_val_b = '1';
   
+  -- Must use ABS() with ** of real, because (negative)**2.0 yields error and value 0.0, also must use brackets (ABS()) to avoid compile error
+  sub_a_ampl      <= SQRT((ABS(REAL(sub_a_re)))**2.0      + (ABS(REAL(sub_a_im)))**2.0);
+  sub_a_ampl_frac <= SQRT((ABS(REAL(sub_a_re_frac)))**2.0 + (ABS(REAL(sub_a_im_frac)))**2.0);
+
+  sub_b_ampl      <= SQRT((ABS(REAL(sub_b_re)))**2.0      + (ABS(REAL(sub_b_im)))**2.0);
+  sub_b_ampl_frac <= SQRT((ABS(REAL(sub_b_re_frac)))**2.0 + (ABS(REAL(sub_b_im_frac)))**2.0);
+  
   ---------------------------------------------------------------------------
   -- Measure ADC/WG input mean (DC) and power, and determine sine amplitude
   ---------------------------------------------------------------------------
@@ -800,7 +833,7 @@ BEGIN
   ---------------------------------------------------------------------------
   -- Measure FIR filter output amplitude and phase using local I = sin and Q = cos
   ---------------------------------------------------------------------------
-  gen_measure_fil_iq_a : IF NOT c_bin_a_frac_en GENERATE
+  --gen_measure_fil_iq_a : IF NOT c_bin_a_frac_en GENERATE
     proc_diag_measure_cw_ampl_and_phase(c_N_samples, c_N_fft, g_subband_index_a, dp_clk, fil_sosi.re, fil_sosi.sync, fil_sosi.valid, fil_val_cnt_per_sync, fil_ref_I_a, fil_ref_Q_a, fil_accum_I_a, fil_accum_Q_a, fil_ampl_a, fil_phase_a, fil_phase_Ts_a);
     
     fil_power_a <= (fil_ampl_a**2.0) / 2.0;
@@ -809,9 +842,9 @@ BEGIN
     
     fil_measured_snr_a    <= fil_power_a / (fil_noise_power_a + c_eps);
     fil_measured_snr_a_dB <= 10.0 * LOG10(fil_measured_snr_a + c_eps);
-  END GENERATE;
+  --END GENERATE;
 
-  gen_measure_fil_iq_b : IF NOT c_bin_b_frac_en GENERATE
+  --gen_measure_fil_iq_b : IF NOT c_bin_b_frac_en GENERATE
     proc_diag_measure_cw_ampl_and_phase(c_N_samples, c_N_fft, g_subband_index_b, dp_clk, fil_sosi.im, fil_sosi.sync, fil_sosi.valid, fil_val_cnt_per_sync, fil_ref_I_b, fil_ref_Q_b, fil_accum_I_b, fil_accum_Q_b, fil_ampl_b, fil_phase_b, fil_phase_Ts_b);
 
     fil_power_b <= (fil_ampl_b**2.0) / 2.0;
@@ -820,7 +853,7 @@ BEGIN
 
     fil_measured_snr_b    <= fil_power_b / (fil_noise_power_b + c_eps);
     fil_measured_snr_b_dB <= 10.0 * LOG10(fil_measured_snr_b + c_eps);
-  END GENERATE;
+  --END GENERATE;
   
   ---------------------------------------------------------------------------
   -- Read subband statistics (SST)
@@ -829,6 +862,7 @@ BEGIN
   p_read_sst : PROCESS
     VARIABLE v_W, v_T, v_U, v_S, v_B : NATURAL;  -- array indicies
     VARIABLE v_sst_noise             : REAL;
+    VARIABLE v_gain                  : REAL;
   BEGIN
     -- Wait for stimuli to finish
     proc_common_wait_until_high(dp_clk, bs_end);
@@ -948,7 +982,7 @@ BEGIN
       print_str("-------------------------------------------------------------");
       print_str(". c_pfs_bypass                 = " & bool_to_str(c_pfs_bypass));
       IF c_pfs_bypass=FALSE THEN
-        print_str(". g_fil_coefs_file_prefix      = " & "pfs_coefsbuf_1024 = Coeffs16384Kaiser-quant");
+        print_str(". c_pfir_coefs_file          = " & c_pfir_coefs_file & " (pfs_coefsbuf_1024 = Coeffs16384Kaiser-quant)");
       END IF;
       print_str(". c_pfir_coef_w                = " & int_to_str(c_pfir_coef_w));
       print_str(". g_fil_in_dat_w               = " & int_to_str(g_fil_in_dat_w));
@@ -977,20 +1011,19 @@ BEGIN
       print_str(". c_wg_ampl_a                  = " & int_to_str(NATURAL(c_wg_ampl_a)));
       print_str(". input_ampl_a                 = " & real_to_str(input_ampl_a, 10, 3));
       print_str(". cw_ampl_a                    = " & real_to_str(cw_ampl_a, 10, 3));
-      IF NOT c_bin_a_frac_en THEN
-        print_str(". fir_ampl_a                   = " & real_to_str(fir_ampl_a, 10, 3));
-        print_str(". fil_ampl_a                   = " & real_to_str(fil_ampl_a, 10, 3));
-      END IF;
+      print_str(". fir_ampl_a                   = " & real_to_str(fir_ampl_a, 10, 3));
+      print_str(". fil_ampl_a                   = " & real_to_str(fil_ampl_a, 10, 3));
       print_str(". sub_a_re                     = " & int_to_str(sub_a_re));
       print_str(". sub_a_im                     = " & int_to_str(sub_a_im));
+      print_str(". sub_a_ampl                   = " & real_to_str(sub_a_ampl, 10, 3));
       print_str(". sub_a_re_frac                = " & int_to_str(sub_a_re_frac));
       print_str(". sub_a_im_frac                = " & int_to_str(sub_a_im_frac));
+      print_str(". sub_a_ampl_frac              = " & real_to_str(sub_a_ampl_frac, 10, 3));
       print_str("");
       print_str("Phases [Ts]:");
       print_str(". cw_phase_Ts_a                = " & real_to_str(cw_phase_Ts_a, 10, 3));
-      IF NOT c_bin_a_frac_en THEN
-        print_str(". fil_phase_Ts_a               = " & real_to_str(fil_phase_Ts_a, 10, 3));
-      END IF;
+      print_str(". fil_phase_Ts_a               = " & real_to_str(fil_phase_Ts_a, 10, 3));
+      print_str("");
       print_str("Powers:");
       print_str(". sst_wg_power_a               = " & real_to_str(sst_wg_power_a, 15, 3));
       print_str(". sst_noise_a                  = " & real_to_str(sst_noise_a, 15, 3));
@@ -999,9 +1032,7 @@ BEGIN
       print_str("SNR and WPFB processing gain:");
       print_str(". c_wg_snr_a_dB                = " & real_to_str(c_wg_snr_a_dB, 7, 2) & " [dB]");
       print_str(". wg_measured_snr_a_dB         = " & real_to_str(wg_measured_snr_a_dB, 7, 2) & " [dB]");
-      IF NOT c_bin_a_frac_en THEN
-        print_str(". fil_measured_snr_a_dB        = " & real_to_str(fil_measured_snr_a_dB, 7, 2) & " [dB]");
-      END IF;
+      print_str(". fil_measured_snr_a_dB        = " & real_to_str(fil_measured_snr_a_dB, 7, 2) & " [dB]");
       print_str(". sst_measured_snr_a_dB        = " & real_to_str(sst_measured_snr_a_dB, 7, 2) & " [dB]");
       print_str(". wpfb_measured_proc_gain_a_dB = " & real_to_str(wpfb_measured_proc_gain_a_dB, 7, 2) & " [dB]");
       print_str("");
@@ -1023,20 +1054,18 @@ BEGIN
       print_str(". c_wg_ampl_b                  = " & int_to_str(NATURAL(c_wg_ampl_b)));
       print_str(". input_ampl_b                 = " & real_to_str(input_ampl_b, 10, 3));
       print_str(". cw_ampl_b                    = " & real_to_str(cw_ampl_b, 10, 3));
-      IF NOT c_bin_b_frac_en THEN
-        print_str(". fir_ampl_b                   = " & real_to_str(fir_ampl_b, 10, 3));
-        print_str(". fil_ampl_b                   = " & real_to_str(fil_ampl_b, 10, 3));
-      END IF;
+      print_str(". fir_ampl_b                   = " & real_to_str(fir_ampl_b, 10, 3));
+      print_str(". fil_ampl_b                   = " & real_to_str(fil_ampl_b, 10, 3));
       print_str(". sub_b_re                     = " & int_to_str(sub_b_re));
       print_str(". sub_b_im                     = " & int_to_str(sub_b_im));
+      print_str(". sub_b_ampl                   = " & real_to_str(sub_b_ampl, 10, 3));
       print_str(". sub_b_re_frac                = " & int_to_str(sub_b_re_frac));
       print_str(". sub_b_im_frac                = " & int_to_str(sub_b_im_frac));
+      print_str(". sub_b_ampl_frac              = " & real_to_str(sub_b_ampl_frac, 10, 3));
       print_str("");
       print_str("Phases [Ts]:");
       print_str(". cw_phase_Ts_b                = " & real_to_str(cw_phase_Ts_b, 10, 3));
-      IF NOT c_bin_a_frac_en THEN
-        print_str(". fil_phase_Ts_b               = " & real_to_str(fil_phase_Ts_b, 10, 3));
-      END IF;
+      print_str(". fil_phase_Ts_b               = " & real_to_str(fil_phase_Ts_b, 10, 3));
       print_str("Powers:");
       print_str(". sst_wg_power_b               = " & real_to_str(sst_wg_power_b, 15, 3));
       print_str(". sst_noise_b                  = " & real_to_str(sst_noise_b, 15, 3));
@@ -1045,9 +1074,7 @@ BEGIN
       print_str("SNR and WPFB processing gain:");
       print_str(". c_wg_snr_b_dB                = " & real_to_str(c_wg_snr_b_dB, 7, 2) & " [dB]");
       print_str(". wg_measured_snr_b_dB         = " & real_to_str(wg_measured_snr_b_dB, 7, 2) & " [dB]");
-      IF NOT c_bin_b_frac_en THEN
-        print_str(". fil_measured_snr_b_dB        = " & real_to_str(fil_measured_snr_b_dB, 7, 2) & " [dB]");
-      END IF;
+      print_str(". fil_measured_snr_b_dB        = " & real_to_str(fil_measured_snr_b_dB, 7, 2) & " [dB]");
       print_str(". sst_measured_snr_b_dB        = " & real_to_str(sst_measured_snr_b_dB, 7, 2) & " [dB]");
       print_str(". wpfb_measured_proc_gain_b_dB = " & real_to_str(wpfb_measured_proc_gain_b_dB, 7, 2) & " [dB]");
       print_str("");
@@ -1057,11 +1084,13 @@ BEGIN
     -- Verify
     ---------------------------------------------------------------------------
     ASSERT almost_equal(input_ampl_a, c_wg_ampl_a, 1.0)   REPORT "Wrong amplitude for WG input a, "  & real_to_str(input_ampl_a, 7, 0) & " /~= " & real_to_str(c_wg_ampl_a, 7, 0) SEVERITY ERROR;
-    ASSERT almost_equal(input_ampl_a, cw_ampl_a, 0.01)    REPORT "Wrong estimated amplitude for WG input a, " & real_to_str(input_ampl_a, 7, 0) & " /~= " & real_to_str(cw_ampl_a, 7, 0) SEVERITY ERROR;
+    ASSERT almost_equal(input_ampl_a, cw_ampl_a, 0.02)    REPORT "Wrong estimated amplitude for WG input a, " & real_to_str(input_ampl_a, 7, 0) & " /~= " & real_to_str(cw_ampl_a, 7, 0) SEVERITY ERROR;
     ASSERT almost_zero(input_mean_a, 0.01)                REPORT "Wrong estimated DC mean for WG input a, " & real_to_str(input_mean_a, 7, 0) & " /~= 0.0" SEVERITY ERROR;
     ASSERT almost_zero(fir_mean_a, 0.01)                  REPORT "Wrong estimated DC mean for FIR filter output a, " & real_to_str(fir_mean_a, 7, 0) & " /~= 0.0" SEVERITY ERROR;
     IF NOT c_bin_a_frac_en THEN
       ASSERT almost_equal(fir_ampl_a, fil_ampl_a, 10.0)   REPORT "Wrong estimated amplitude for FIR filter output a, " & real_to_str(fir_ampl_a, 7, 0) & " /~= " & real_to_str(fil_ampl_a, 7, 0) SEVERITY ERROR;
+      ASSERT almost_equal(sub_a_ampl/cw_ampl_a/c_pfb_sub_scaling, 1.0, 0.01)
+                                                          REPORT "Wrong measured scaling for PFB subband output a, " & real_to_str(sub_a_ampl/cw_ampl_a, 7, 0) & " /~= " & real_to_str(c_pfb_sub_scaling, 7, 0) SEVERITY ERROR;
     END IF;
     tb_end <= '1';
     WAIT;
@@ -1108,7 +1137,8 @@ BEGIN
       g_pfs_nof_taps    => c_wpfb.nof_taps,
       g_pfs_in_dat_w    => c_wpfb.fil_in_dat_w,
       g_pfs_out_dat_w   => c_internal_dat_w,
-      g_pfs_coef_dat_w  => c_wpfb.coef_dat_w,
+      g_pfs_coef_dat_w  => c_pfir_coef_w,
+      g_pfs_coefs_file  => c_pfir_coefs_file,
     
       -- pft2
       g_pft_mode        => PFT_MODE_REAL2,
-- 
GitLab