From a05ea2b9e652e7b22097a6a56e4fb863ec643d92 Mon Sep 17 00:00:00 2001
From: Reinier van der Walle <walle@astron.nl>
Date: Tue, 8 Dec 2020 16:27:38 +0100
Subject: [PATCH] Processed review comments

---
 .../tb/vhdl/tb_lofar2_unb2b_beamformer.vhd    | 33 ++++++++++++-------
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/applications/lofar2/designs/lofar2_unb2b_beamformer/tb/vhdl/tb_lofar2_unb2b_beamformer.vhd b/applications/lofar2/designs/lofar2_unb2b_beamformer/tb/vhdl/tb_lofar2_unb2b_beamformer.vhd
index 33d323da64..2835898c6e 100644
--- a/applications/lofar2/designs/lofar2_unb2b_beamformer/tb/vhdl/tb_lofar2_unb2b_beamformer.vhd
+++ b/applications/lofar2/designs/lofar2_unb2b_beamformer/tb/vhdl/tb_lofar2_unb2b_beamformer.vhd
@@ -152,9 +152,11 @@ ARCHITECTURE tb OF tb_lofar2_unb2b_beamformer IS
 
   -- 10GbE
   CONSTANT c_exp_beamlet_index : NATURAL := NATURAL(c_subband_sp_0) * c_sdp_N_pol;
-  CONSTANT c_exp_beamlet : STD_LOGIC_VECTOR(15 DOWNTO 0) := x"7F81"; --Derived from simulation
+  CONSTANT c_exp_beamlet_re : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"81"; --Derived from simulation
+  CONSTANT c_exp_beamlet_im : STD_LOGIC_VECTOR(7 DOWNTO 0) := x"7F"; --Derived from simulation
 
-  SIGNAL beamlet_arr2 : t_slv_16_arr(c_sdp_cep_nof_beamlets_per_block-1 DOWNTO 0);
+  SIGNAL beamlet_arr2_re : t_slv_8_arr(c_sdp_cep_nof_beamlets_per_block-1 DOWNTO 0);
+  SIGNAL beamlet_arr2_im : t_slv_8_arr(c_sdp_cep_nof_beamlets_per_block-1 DOWNTO 0);
 
   SIGNAL tr_10GbE_src_out       : t_dp_sosi;
   SIGNAL tr_ref_clk_312         : STD_LOGIC := '0';
@@ -462,21 +464,29 @@ BEGIN
     END LOOP;
   
     -- First word contains 3 beamlets + 1 header part
-    beamlet_arr2(0) <= tr_10GbE_src_out.data(15 DOWNTO 0);
-    beamlet_arr2(1) <= tr_10GbE_src_out.data(31 DOWNTO 16);
-    beamlet_arr2(2) <= tr_10GbE_src_out.data(47 DOWNTO 32);
+    beamlet_arr2_re(0) <= tr_10GbE_src_out.data(7 DOWNTO 0);
+    beamlet_arr2_im(0) <= tr_10GbE_src_out.data(15 DOWNTO 8);
+    beamlet_arr2_re(1) <= tr_10GbE_src_out.data(23 DOWNTO 16);
+    beamlet_arr2_im(1) <= tr_10GbE_src_out.data(31 DOWNTO 24);
+    beamlet_arr2_re(2) <= tr_10GbE_src_out.data(39 DOWNTO 32);
+    beamlet_arr2_im(2) <= tr_10GbE_src_out.data(47 DOWNTO 40);
     proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
     proc_common_wait_some_cycles(ext_clk, 1);
     FOR I IN 1 TO (c_sdp_cep_nof_beamlets_per_block/4)-1 LOOP
-      beamlet_arr2(I*4 -1) <= tr_10GbE_src_out.data(15 DOWNTO 0);
-      beamlet_arr2(I*4 +0) <= tr_10GbE_src_out.data(31 DOWNTO 16);
-      beamlet_arr2(I*4 +1) <= tr_10GbE_src_out.data(47 DOWNTO 32);
-      beamlet_arr2(I*4 +2) <= tr_10GbE_src_out.data(63 DOWNTO 48);
+      beamlet_arr2_re(I*4 -1) <= tr_10GbE_src_out.data(7 DOWNTO 0);
+      beamlet_arr2_im(I*4 -1) <= tr_10GbE_src_out.data(15 DOWNTO 8);
+      beamlet_arr2_re(I*4 +0) <= tr_10GbE_src_out.data(23 DOWNTO 16);
+      beamlet_arr2_im(I*4 +0) <= tr_10GbE_src_out.data(31 DOWNTO 24);
+      beamlet_arr2_re(I*4 +1) <= tr_10GbE_src_out.data(39 DOWNTO 32);
+      beamlet_arr2_im(I*4 +1) <= tr_10GbE_src_out.data(47 DOWNTO 40);
+      beamlet_arr2_re(I*4 +2) <= tr_10GbE_src_out.data(55 DOWNTO 48);
+      beamlet_arr2_im(I*4 +2) <= tr_10GbE_src_out.data(63 DOWNTO 56);
       proc_common_wait_until_high(ext_clk, tr_10GbE_src_out.valid);
       proc_common_wait_some_cycles(ext_clk, 1);
     END LOOP;
 
-    beamlet_arr2(c_sdp_cep_nof_beamlets_per_block-1) <= tr_10GbE_src_out.data(63 DOWNTO 48);
+    beamlet_arr2_re(c_sdp_cep_nof_beamlets_per_block-1) <= tr_10GbE_src_out.data(55 DOWNTO 48);
+    beamlet_arr2_im(c_sdp_cep_nof_beamlets_per_block-1) <= tr_10GbE_src_out.data(63 DOWNTO 56);
 
     ---------------------------------------------------------------------------
     -- Verify subband statistics
@@ -522,7 +532,8 @@ BEGIN
     ---------------------------------------------------------------------------
     -- Verify 10GbE UDP offload
     --------------------------------------------------------------------------- 
-    ASSERT beamlet_arr2(c_exp_beamlet_index) = c_exp_beamlet REPORT "Wrong 10GbE output" SEVERITY ERROR;
+    ASSERT beamlet_arr2_re(c_exp_beamlet_index) = c_exp_beamlet_re REPORT "Wrong 10GbE output (re)" SEVERITY ERROR;
+    ASSERT beamlet_arr2_im(c_exp_beamlet_index) = c_exp_beamlet_im REPORT "Wrong 10GbE output (im)" SEVERITY ERROR;
 
     ---------------------------------------------------------------------------
     -- End Simulation 
-- 
GitLab