From 47109d713cc90eda263973580233a16f3990f96d Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Thu, 27 Jul 2023 11:47:25 +0200
Subject: [PATCH] Read sst_offload_weighted_subbands.

---
 .../tb_lofar2_unb2c_sdp_station_fsub_sst_offload.vhd | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_lofar2_unb2c_sdp_station_fsub_sst_offload.vhd b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_lofar2_unb2c_sdp_station_fsub_sst_offload.vhd
index 7df2f9ef67..9803806bb7 100644
--- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_lofar2_unb2c_sdp_station_fsub_sst_offload.vhd
+++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_lofar2_unb2c_sdp_station_fsub_sst_offload.vhd
@@ -30,6 +30,7 @@
 --
 --   2) Verify ethernet statistics using eth_statistics, it checks the number of
 --      received packets and the total number of valid data. The content of the packets is not verified.
+--      Manually check rx_sdp_stat_header in Wave window.
 --
 -- Usage:
 --   > as 7    # default
@@ -78,6 +79,7 @@ architecture tb of tb_lofar2_unb2c_sdp_station_fsub_sst_offload is
 
   -- MM
   constant c_mm_file_reg_bsn_source_v2    : string := mmf_unb_file_prefix(c_unb_nr, c_node_nr) & "REG_BSN_SOURCE_V2";
+  constant c_mm_file_reg_dp_selector      : string := mmf_unb_file_prefix(c_unb_nr, c_node_nr) & "REG_DP_SELECTOR";
   constant c_mm_file_reg_stat_enable_sst  : string := mmf_unb_file_prefix(c_unb_nr, c_node_nr) & "REG_STAT_ENABLE_SST";
 
   -- Tb
@@ -111,6 +113,9 @@ architecture tb of tb_lofar2_unb2c_sdp_station_fsub_sst_offload is
   signal eth_txp             : std_logic_vector(c_unb2c_board_nof_eth - 1 downto 0) := (others => '0');
   signal eth_rxp             : std_logic_vector(c_unb2c_board_nof_eth - 1 downto 0) := (others => '0');
 
+  -- SST offload weigted subbands selector
+  signal sst_offload_weighted_subbands : std_logic;
+
   -- Rx packets
   signal eth_rx_sosi         : t_dp_sosi;
   signal eth_rx_data         : std_logic_vector(c_32 - 1 downto 0);
@@ -209,6 +214,13 @@ begin
     mmf_mm_bus_wr(c_mm_file_reg_bsn_source_v2, 1,   c_nof_clk_per_sync, tb_clk);  -- nof_block_per_sync
     mmf_mm_bus_wr(c_mm_file_reg_bsn_source_v2, 0,         16#00000001#, tb_clk);  -- Enable BSN immediately
 
+    ----------------------------------------------------------------------------
+    -- Read weighted subband selector
+    ----------------------------------------------------------------------------
+    mmf_mm_bus_rd(c_mm_file_reg_dp_selector, 0, rd_data, tb_clk);
+    proc_common_wait_some_cycles(tb_clk, 1);
+    sst_offload_weighted_subbands <= not rd_data(0);
+
     ----------------------------------------------------------------------------
     -- Offload enable
     ----------------------------------------------------------------------------
-- 
GitLab