From 583cfe5d30ee86e21b2fab078c687780a862d413 Mon Sep 17 00:00:00 2001
From: Erik Kooistra <kooistra@astron.nl>
Date: Thu, 20 Oct 2016 15:21:46 +0000
Subject: [PATCH] Corrected v_index and out_channel for flipped complex data
 when wb_factor>1 and nof_chan > 0

---
 libraries/dsp/fft/tb/vhdl/tb_fft_pkg.vhd | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libraries/dsp/fft/tb/vhdl/tb_fft_pkg.vhd b/libraries/dsp/fft/tb/vhdl/tb_fft_pkg.vhd
index 1b26c17686..0921436678 100644
--- a/libraries/dsp/fft/tb/vhdl/tb_fft_pkg.vhd
+++ b/libraries/dsp/fft/tb/vhdl/tb_fft_pkg.vhd
@@ -427,10 +427,11 @@ PACKAGE BODY tb_fft_pkg IS
       end if;
     else
       -- Complex input data
-      v_blk_index := out_val_cnt / nof_points / nof_channels;   -- each block has nof_channels*nof_points
-      out_channel <= out_val_cnt mod nof_channels;              -- the nof_channels are interleaved per sample
+      v_blk_index := out_val_cnt / nof_points / nof_channels;     -- each block has nof_channels*nof_points
+      out_channel <= (out_val_cnt / wb_factor) mod nof_channels;  -- the nof_channels are interleaved per wb_factor number of samples
       
-      v_index := (out_val_cnt / nof_channels) mod nof_points;   -- index within a block independent of nof_channels
+      v_index := ((out_val_cnt / wb_factor / nof_channels) * wb_factor +
+                  (out_val_cnt MOD wb_factor)) mod nof_points;     -- index within a block independent of nof_channels
       
       v_bin := fft_index_to_bin_frequency(wb_factor, nof_points, v_index, use_reorder, use_fft_shift, use_separate);
       
-- 
GitLab