From 951121d2c9b82e50b4918eed058b68dedf184915 Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Thu, 28 Sep 2023 17:21:38 +0200
Subject: [PATCH] Support g_nof_destinations via MM.

---
 .../libraries/sdp/tb/vhdl/tb_sdp_beamformer_output.vhd    | 8 +++++++-
 .../libraries/sdp/tb/vhdl/tb_tb_sdp_beamformer_output.vhd | 5 +++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_beamformer_output.vhd b/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_beamformer_output.vhd
index 74ac050335..8f27b9b8b2 100644
--- a/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_beamformer_output.vhd
+++ b/applications/lofar2/libraries/sdp/tb/vhdl/tb_sdp_beamformer_output.vhd
@@ -45,7 +45,8 @@ entity tb_sdp_beamformer_output is
     g_nof_repeat            : natural := 50;
     g_beamset_id            : natural := 0;
     g_use_transpose         : boolean := false;
-    g_nof_destinations_max  : natural := 1
+    g_nof_destinations_max  : natural := 16;
+    g_nof_destinations      : natural := 16
   );
 end tb_sdp_beamformer_output;
 
@@ -152,6 +153,11 @@ begin
     proc_common_wait_until_low(dp_clk, mm_rst);
     proc_common_wait_some_cycles(mm_clk, 10);
 
+    ----------------------------------------------------------------------------
+    -- BDO nof destinations
+    ----------------------------------------------------------------------------
+    proc_mem_mm_bus_wr(128, g_nof_destinations, mm_clk, reg_destinations_cipo, reg_destinations_copi);
+
     ----------------------------------------------------------------------------
     -- BDO header fields
     ----------------------------------------------------------------------------
diff --git a/applications/lofar2/libraries/sdp/tb/vhdl/tb_tb_sdp_beamformer_output.vhd b/applications/lofar2/libraries/sdp/tb/vhdl/tb_tb_sdp_beamformer_output.vhd
index dfedeb7a55..60deb2ee5f 100644
--- a/applications/lofar2/libraries/sdp/tb/vhdl/tb_tb_sdp_beamformer_output.vhd
+++ b/applications/lofar2/libraries/sdp/tb/vhdl/tb_tb_sdp_beamformer_output.vhd
@@ -40,7 +40,8 @@ begin
   -- g_beamset_id            : natural := 0;
   -- g_use_transpose         : boolean := false;
   -- g_nof_destinations_max  : natural := 1;
+  -- g_nof_destinations      : natural := 1
 
-  u_one_identity   : entity work.tb_sdp_beamformer_output generic map( 50, 0, false, 1);
-  u_one_transpose  : entity work.tb_sdp_beamformer_output generic map( 50, 0,  true, 1);
+  u_one_identity   : entity work.tb_sdp_beamformer_output generic map( 50, 0, false, 1, 1);
+  u_one_transpose  : entity work.tb_sdp_beamformer_output generic map( 50, 0,  true, 1, 1);
 end tb;
-- 
GitLab