From c51ad02df50451359d74ac3ad0930f9df375d2e2 Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Thu, 23 Feb 2023 17:35:47 +0100
Subject: [PATCH] Capture rx beamlets per longword in big endian order.

---
 .../tb_lofar2_unb2c_sdp_station_bf.vhd        | 32 +++++++++----------
 .../tb_lofar2_unb2c_sdp_station_bf_ring.vhd   | 32 +++++++++----------
 2 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf/tb_lofar2_unb2c_sdp_station_bf.vhd b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf/tb_lofar2_unb2c_sdp_station_bf.vhd
index 465d40a409..821bd58d57 100644
--- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf/tb_lofar2_unb2c_sdp_station_bf.vhd
+++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf/tb_lofar2_unb2c_sdp_station_bf.vhd
@@ -1296,24 +1296,24 @@ BEGIN
       proc_common_wait_until_high(ext_clk, rx_beamlet_sosi.valid);
       rx_beamlet_valid <= '1';
       -- Capture rx beamlets per longword in rx_beamlet_arr, for time series view in Wave window
-      rx_beamlet_arr_re(0) <= rx_beamlet_sosi.data(55 DOWNTO 48);  -- X
-      rx_beamlet_arr_im(0) <= rx_beamlet_sosi.data(63 DOWNTO 56);
-      rx_beamlet_arr_re(1) <= rx_beamlet_sosi.data(39 DOWNTO 32);  -- Y
-      rx_beamlet_arr_im(1) <= rx_beamlet_sosi.data(47 DOWNTO 40);
-      rx_beamlet_arr_re(2) <= rx_beamlet_sosi.data(23 DOWNTO 16);  -- X
-      rx_beamlet_arr_im(2) <= rx_beamlet_sosi.data(31 DOWNTO 24);
-      rx_beamlet_arr_re(3) <= rx_beamlet_sosi.data( 7 DOWNTO 0);   -- Y
-      rx_beamlet_arr_im(3) <= rx_beamlet_sosi.data(15 DOWNTO 8);
+      rx_beamlet_arr_im(0) <= rx_beamlet_sosi.data(63 DOWNTO 56);  -- X
+      rx_beamlet_arr_re(0) <= rx_beamlet_sosi.data(55 DOWNTO 48);
+      rx_beamlet_arr_im(1) <= rx_beamlet_sosi.data(47 DOWNTO 40);  -- Y
+      rx_beamlet_arr_re(1) <= rx_beamlet_sosi.data(39 DOWNTO 32);
+      rx_beamlet_arr_im(2) <= rx_beamlet_sosi.data(31 DOWNTO 24);  -- X
+      rx_beamlet_arr_re(2) <= rx_beamlet_sosi.data(23 DOWNTO 16);
+      rx_beamlet_arr_im(3) <= rx_beamlet_sosi.data(15 DOWNTO 8);   -- Y
+      rx_beamlet_arr_re(3) <= rx_beamlet_sosi.data( 7 DOWNTO 0);
       IF I < c_sdp_cep_nof_beamlets_per_block / c_nof_beamlets_per_data THEN
         -- Only capture the first beamlets block of each packet in rx_beamlet_list
-        rx_beamlet_list_re(I*4 + 0) <= rx_beamlet_sosi.data(55 DOWNTO 48);  -- X
-        rx_beamlet_list_im(I*4 + 0) <= rx_beamlet_sosi.data(63 DOWNTO 56);
-        rx_beamlet_list_re(I*4 + 1) <= rx_beamlet_sosi.data(39 DOWNTO 32);  -- Y
-        rx_beamlet_list_im(I*4 + 1) <= rx_beamlet_sosi.data(47 DOWNTO 40);
-        rx_beamlet_list_re(I*4 + 2) <= rx_beamlet_sosi.data(23 DOWNTO 16);  -- X
-        rx_beamlet_list_im(I*4 + 2) <= rx_beamlet_sosi.data(31 DOWNTO 24);
-        rx_beamlet_list_re(I*4 + 3) <= rx_beamlet_sosi.data( 7 DOWNTO 0);   -- Y
-        rx_beamlet_list_im(I*4 + 3) <= rx_beamlet_sosi.data(15 DOWNTO 8);
+        rx_beamlet_list_im(I*4 + 0) <= rx_beamlet_sosi.data(63 DOWNTO 56);  -- X
+        rx_beamlet_list_re(I*4 + 0) <= rx_beamlet_sosi.data(55 DOWNTO 48);
+        rx_beamlet_list_im(I*4 + 1) <= rx_beamlet_sosi.data(47 DOWNTO 40);  -- Y
+        rx_beamlet_list_re(I*4 + 1) <= rx_beamlet_sosi.data(39 DOWNTO 32);
+        rx_beamlet_list_im(I*4 + 2) <= rx_beamlet_sosi.data(31 DOWNTO 24);  -- X
+        rx_beamlet_list_re(I*4 + 2) <= rx_beamlet_sosi.data(23 DOWNTO 16);
+        rx_beamlet_list_im(I*4 + 3) <= rx_beamlet_sosi.data(15 DOWNTO 8);   -- Y
+        rx_beamlet_list_re(I*4 + 3) <= rx_beamlet_sosi.data( 7 DOWNTO 0);
       END IF;
       proc_common_wait_until_high(ext_clk, rx_beamlet_sosi.valid);
       -- Use at least one WAIT instead of proc_common_wait_some_cycles() to
diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf_ring/tb_lofar2_unb2c_sdp_station_bf_ring.vhd b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf_ring/tb_lofar2_unb2c_sdp_station_bf_ring.vhd
index e9acb89284..a54b08c9df 100644
--- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf_ring/tb_lofar2_unb2c_sdp_station_bf_ring.vhd
+++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_bf_ring/tb_lofar2_unb2c_sdp_station_bf_ring.vhd
@@ -1414,24 +1414,24 @@ BEGIN
       proc_common_wait_until_high(ext_clk, rx_beamlet_sosi.valid);
       rx_beamlet_valid <= '1';
       -- Capture rx beamlets per longword in rx_beamlet_arr, for time series view in Wave window
-      rx_beamlet_arr_re(0) <= rx_beamlet_sosi.data(55 DOWNTO 48);  -- X
-      rx_beamlet_arr_im(0) <= rx_beamlet_sosi.data(63 DOWNTO 56);
-      rx_beamlet_arr_re(1) <= rx_beamlet_sosi.data(39 DOWNTO 32);  -- Y
-      rx_beamlet_arr_im(1) <= rx_beamlet_sosi.data(47 DOWNTO 40);
-      rx_beamlet_arr_re(2) <= rx_beamlet_sosi.data(23 DOWNTO 16);  -- X
-      rx_beamlet_arr_im(2) <= rx_beamlet_sosi.data(31 DOWNTO 24);
-      rx_beamlet_arr_re(3) <= rx_beamlet_sosi.data( 7 DOWNTO 0);   -- Y
-      rx_beamlet_arr_im(3) <= rx_beamlet_sosi.data(15 DOWNTO 8);
+      rx_beamlet_arr_im(0) <= rx_beamlet_sosi.data(63 DOWNTO 56);  -- X
+      rx_beamlet_arr_re(0) <= rx_beamlet_sosi.data(55 DOWNTO 48);
+      rx_beamlet_arr_im(1) <= rx_beamlet_sosi.data(47 DOWNTO 40);  -- Y
+      rx_beamlet_arr_re(1) <= rx_beamlet_sosi.data(39 DOWNTO 32);
+      rx_beamlet_arr_im(2) <= rx_beamlet_sosi.data(31 DOWNTO 24);  -- X
+      rx_beamlet_arr_re(2) <= rx_beamlet_sosi.data(23 DOWNTO 16);
+      rx_beamlet_arr_im(3) <= rx_beamlet_sosi.data(15 DOWNTO 8);   -- Y
+      rx_beamlet_arr_re(3) <= rx_beamlet_sosi.data( 7 DOWNTO 0);
       IF I < c_sdp_cep_nof_beamlets_per_block / c_nof_beamlets_per_data THEN
         -- Only capture the first beamlets block of each packet in rx_beamlet_list
-        rx_beamlet_list_re(I*4 + 0) <= rx_beamlet_sosi.data(55 DOWNTO 48);  -- X
-        rx_beamlet_list_im(I*4 + 0) <= rx_beamlet_sosi.data(63 DOWNTO 56);
-        rx_beamlet_list_re(I*4 + 1) <= rx_beamlet_sosi.data(39 DOWNTO 32);  -- Y
-        rx_beamlet_list_im(I*4 + 1) <= rx_beamlet_sosi.data(47 DOWNTO 40);
-        rx_beamlet_list_re(I*4 + 2) <= rx_beamlet_sosi.data(23 DOWNTO 16);  -- X
-        rx_beamlet_list_im(I*4 + 2) <= rx_beamlet_sosi.data(31 DOWNTO 24);
-        rx_beamlet_list_re(I*4 + 3) <= rx_beamlet_sosi.data( 7 DOWNTO 0);   -- Y
-        rx_beamlet_list_im(I*4 + 3) <= rx_beamlet_sosi.data(15 DOWNTO 8);
+        rx_beamlet_list_im(I*4 + 0) <= rx_beamlet_sosi.data(63 DOWNTO 56);  -- X
+        rx_beamlet_list_re(I*4 + 0) <= rx_beamlet_sosi.data(55 DOWNTO 48);
+        rx_beamlet_list_im(I*4 + 1) <= rx_beamlet_sosi.data(47 DOWNTO 40);  -- Y
+        rx_beamlet_list_re(I*4 + 1) <= rx_beamlet_sosi.data(39 DOWNTO 32);
+        rx_beamlet_list_im(I*4 + 2) <= rx_beamlet_sosi.data(31 DOWNTO 24);  -- X
+        rx_beamlet_list_re(I*4 + 2) <= rx_beamlet_sosi.data(23 DOWNTO 16);
+        rx_beamlet_list_im(I*4 + 3) <= rx_beamlet_sosi.data(15 DOWNTO 8);   -- Y
+        rx_beamlet_list_re(I*4 + 3) <= rx_beamlet_sosi.data( 7 DOWNTO 0);
       END IF;
       proc_common_wait_until_high(ext_clk, rx_beamlet_sosi.valid);
       -- Use at least one WAIT instead of proc_common_wait_some_cycles() to
-- 
GitLab