From 55ba5f27ec107a4691adbf2c63a6beac1ed58242 Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Mon, 25 Sep 2023 16:21:29 +0200
Subject: [PATCH] Add g_beamset_id for sdp_bdo_multiple_destinations.

---
 .../sdp/src/vhdl/sdp_bdo_multiple_destinations.vhd       | 9 +++++++--
 .../libraries/sdp/src/vhdl/sdp_beamformer_output.vhd     | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/applications/lofar2/libraries/sdp/src/vhdl/sdp_bdo_multiple_destinations.vhd b/applications/lofar2/libraries/sdp/src/vhdl/sdp_bdo_multiple_destinations.vhd
index 92652bd524..33e2fc12e0 100644
--- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_bdo_multiple_destinations.vhd
+++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_bdo_multiple_destinations.vhd
@@ -48,6 +48,7 @@ library IEEE, common_lib, dp_lib, reorder_lib;
 
 entity sdp_bdo_multiple_destinations is
   generic (
+    g_beamset_id    : natural := 0;
     g_use_transpose : boolean := false
   );
   port (
@@ -68,6 +69,8 @@ entity sdp_bdo_multiple_destinations is
 end sdp_bdo_multiple_destinations;
 
 architecture str of sdp_bdo_multiple_destinations is
+  constant c_beamlet_index  : natural := g_beamset_id * c_sdp_S_sub_bf;
+
   -- Reorder c_nof_ch = c_nof_ch_sel = c_nof_ch_in
   constant c_reorder_nof_blocks_max : natural := c_sdp_bdo_reorder_nof_blocks_max;  -- = 16
   constant c_reorder_nof_blocks_w   : natural := ceil_log2(c_reorder_nof_blocks_max + 1);
@@ -108,7 +111,8 @@ architecture str of sdp_bdo_multiple_destinations is
   signal nof_ch_per_packet_slv                    : std_logic_vector(c_nof_ch_per_packet_w - 1 downto 0);
 
   -- . default use values for N_destinations = 1 and destination index = 0
-  signal beamlet_index_per_destination            : natural := c_beamlet_index_per_destination_mat(1, 0);
+  signal beamlet_index_per_destination_bset_0     : natural := c_beamlet_index_per_destination_mat(1, 0);
+  signal beamlet_index_per_destination            : natural := c_beamlet_index + c_beamlet_index_per_destination_mat(1, 0);
 
   signal select_copi            : t_mem_copi := c_mem_copi_rst;
   signal select_cipo            : t_mem_cipo := c_mem_cipo_rst;
@@ -164,7 +168,8 @@ begin
       nof_beamlets_per_block_first_destination <= c_nof_beamlets_per_block_first_destination_arr(v_DN);
       nof_beamlets_per_block_last_destination  <= c_nof_beamlets_per_block_last_destination_arr(v_DN);
       v_DI := 0;
-      beamlet_index_per_destination            <= c_beamlet_index_per_destination_mat(v_DN, v_DI);
+      beamlet_index_per_destination_bset_0     <= c_beamlet_index_per_destination_mat(v_DN, v_DI);
+      beamlet_index_per_destination            <= c_beamlet_index + beamlet_index_per_destination_bset_0;
     end if;
   end process;
 
diff --git a/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd b/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd
index 3d12337c51..cff23d0f59 100644
--- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd
+++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_output.vhd
@@ -264,6 +264,7 @@ begin
     -----------------------------------------------------------------------------
     u_sdp_bdo_multiple_destinations : entity work.sdp_bdo_multiple_destinations
       generic map (
+        g_beamset_id    => g_beamset_id,
         g_use_transpose => g_use_transpose
       )
       port map (
-- 
GitLab