From 6df6d679704ec09b93af96a057aca43a45987f81 Mon Sep 17 00:00:00 2001
From: Reinier van der Walle <walle@astron.nl>
Date: Wed, 24 Aug 2022 11:23:09 +0200
Subject: [PATCH] added missing peripheral span

---
 .../disturb2_unb2b_station.fpga.yaml                  | 10 ++++++++++
 .../lofar2_unb2b_beamformer.fpga.yaml                 |  5 +++++
 .../lofar2_unb2b_ring/lofar2_unb2b_ring.fpga.yaml     |  7 +++++++
 .../lofar2_unb2b_sdp_station.fpga.yaml                | 11 +++++++++++
 .../lofar2_unb2c_ring/lofar2_unb2c_ring.fpga.yaml     |  7 +++++++
 .../lofar2_unb2c_sdp_station.fpga.yaml                | 10 ++++++++++
 6 files changed, 50 insertions(+)

diff --git a/applications/disturb2/designs/disturb2_unb2b_station/disturb2_unb2b_station.fpga.yaml b/applications/disturb2/designs/disturb2_unb2b_station/disturb2_unb2b_station.fpga.yaml
index 26742d9c16..2a10dfa4f6 100644
--- a/applications/disturb2/designs/disturb2_unb2b_station/disturb2_unb2b_station.fpga.yaml
+++ b/applications/disturb2/designs/disturb2_unb2b_station/disturb2_unb2b_station.fpga.yaml
@@ -368,6 +368,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_align_v2
     peripheral_group: bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: ceil_pow2(c_P_sum) * 2 * MM_BUS_SIZE  # number_of_ports = c_P_sum, mm_port_span = 2 words
     parameter_overrides:
       - { name: g_nof_streams, value: 2 }
     mm_port_names:
@@ -376,6 +377,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: rx_align_bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: ceil_pow2(c_P_sum) * 8 * MM_BUS_SIZE  # number_of_ports = c_P_sum, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 2 }
     mm_port_names:
@@ -384,6 +386,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: aligned_bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
@@ -392,12 +395,14 @@ peripherals:
   - peripheral_name: ring/ring_lane_info
     peripheral_group: bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 2 * MM_BUS_SIZE
     mm_port_names:
       - REG_RING_LANE_INFO_BF
    
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: ring_rx_bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
@@ -406,6 +411,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: ring_tx_bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
@@ -414,6 +420,7 @@ peripherals:
   - peripheral_name: dp/dp_block_validate_err
     peripheral_group: bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: ceil_pow2(c_lane_nof_err_counts + 3) * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = ceil_pow2(g_nof_err_counts + 3) words
     parameter_overrides:
       - { name: g_nof_err_counts, value: c_lane_nof_err_counts }
     mm_port_names:
@@ -422,6 +429,7 @@ peripherals:
   - peripheral_name: dp/dp_block_validate_bsn_at_sync
     peripheral_group: bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 4 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 4 words
     mm_port_names:
       - REG_DP_BLOCK_VALIDATE_BSN_AT_SYNC_BF
 
@@ -472,6 +480,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: bst_udp
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
@@ -480,6 +489,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: beamlet_output
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
diff --git a/applications/lofar2/designs/lofar2_unb2b_beamformer/lofar2_unb2b_beamformer.fpga.yaml b/applications/lofar2/designs/lofar2_unb2b_beamformer/lofar2_unb2b_beamformer.fpga.yaml
index 657960c434..4a7691e673 100644
--- a/applications/lofar2/designs/lofar2_unb2b_beamformer/lofar2_unb2b_beamformer.fpga.yaml
+++ b/applications/lofar2/designs/lofar2_unb2b_beamformer/lofar2_unb2b_beamformer.fpga.yaml
@@ -221,6 +221,7 @@ peripherals:
   
   - peripheral_name: reorder/reorder_col_wide
     number_of_peripherals: c_N_beamsets  # lofar2_unb2b_beamformer.vhd
+    peripheral_span: ceil_pow2(c_P_pfb) * ceil_pow2(c_S_sub_bf * c_Q_fft) * MM_BUS_SIZE  # number_of_ports = c_P_pfb, mm_port_span = ceil_pow2(c_S_sub_bf * c_Q_fft) words
     parameter_overrides:
       - { name: g_wb_factor, value: c_P_pfb }
       - { name: g_nof_ch_in, value: c_N_sub * c_Q_fft }
@@ -230,6 +231,7 @@ peripherals:
 
   - peripheral_name: sdp/sdp_bf_weights
     number_of_peripherals: c_N_beamsets  # lofar2_unb2b_beamformer.vhd
+    peripheral_span: ceil_pow2(c_N_pol_bf * c_P_pfb) * ceil_pow2(c_Q_fft * c_S_sub_bf) * MM_BUS_SIZE  # number_of_ports = c_N_pol_bf * c_P_pfb, mm_port_span = ceil_pow2(c_Q_fft * c_S_sub_bf) words
     parameter_overrides:
       - { name: g_nof_instances, value: c_N_pol_bf * c_A_pn }  # A_pn = P_pfb = 6
       - { name: g_nof_gains, value: c_N_pol * c_S_sub_bf }  # N_pol = Q_fft = 2
@@ -238,6 +240,7 @@ peripherals:
 
   - peripheral_name: sdp/sdp_bf_scale
     number_of_peripherals: c_N_beamsets  # lofar2_unb2b_beamformer.vhd
+    peripheral_span: 2 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 2 words
     parameter_overrides:
       - { name: g_gain_w, value: c_W_beamlet_scale }
       - { name: g_lsb_w, value: 0 - c_W_beamlet_resolution}
@@ -246,11 +249,13 @@ peripherals:
 
   - peripheral_name: sdp/sdp_beamformer_output_hdr_dat
     number_of_peripherals: c_N_beamsets  # lofar2_unb2b_beamformer.vhd
+    peripheral_span: 64 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 64 words
     mm_port_names:
       - REG_HDR_DAT
 
   - peripheral_name: dp/dp_xonoff
     number_of_peripherals: c_N_beamsets  # lofar2_unb2b_beamformer.vhd
+    peripheral_span: 2 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 2 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
       - { name: g_combine_streams, value: False }
diff --git a/applications/lofar2/designs/lofar2_unb2b_ring/lofar2_unb2b_ring.fpga.yaml b/applications/lofar2/designs/lofar2_unb2b_ring/lofar2_unb2b_ring.fpga.yaml
index 953084dfb1..3a814a4657 100644
--- a/applications/lofar2/designs/lofar2_unb2b_ring/lofar2_unb2b_ring.fpga.yaml
+++ b/applications/lofar2/designs/lofar2_unb2b_ring/lofar2_unb2b_ring.fpga.yaml
@@ -74,6 +74,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: ring_rx
     number_of_peripherals: c_nof_lanes
+    peripheral_span: ceil_pow2(c_nof_rx_monitors) * 8 * MM_BUS_SIZE 
     parameter_overrides:
       - { name: g_nof_streams, value: c_nof_rx_monitors }
     mm_port_names:
@@ -82,6 +83,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: ring_tx
     number_of_peripherals: c_nof_lanes
+    peripheral_span: ceil_pow2(c_nof_tx_monitors) * 8 * MM_BUS_SIZE 
     parameter_overrides:
       - { name: g_nof_streams, value: c_nof_tx_monitors }
     mm_port_names:
@@ -89,23 +91,27 @@ peripherals:
 
   - peripheral_name: ring/ring_lane_info
     number_of_peripherals: c_nof_lanes
+    peripheral_span: 2 * MM_BUS_SIZE
     mm_port_names:
       - REG_RING_LANE_INFO
 
   - peripheral_name: dp/dp_xonoff
     peripheral_group: lane
     number_of_peripherals: c_nof_lanes
+    peripheral_span: 2 * MM_BUS_SIZE
     mm_port_names:
       - REG_DP_XONOFF_LANE
 
   - peripheral_name: dp/dp_xonoff
     peripheral_group: local
     number_of_peripherals: c_nof_lanes
+    peripheral_span: 2 * MM_BUS_SIZE
     mm_port_names:
       - REG_DP_XONOFF_LOCAL
 
   - peripheral_name: dp/dp_block_validate_err
     number_of_peripherals: c_nof_lanes
+    peripheral_span: ceil_pow2(c_nof_err_counts + 3) * MM_BUS_SIZE
     parameter_overrides:
       - { name: g_nof_err_counts, value: c_nof_err_counts }
     mm_port_names:
@@ -113,6 +119,7 @@ peripherals:
 
   - peripheral_name: dp/dp_block_validate_bsn_at_sync
     number_of_peripherals: c_nof_lanes
+    peripheral_span: 4 * MM_BUS_SIZE
     mm_port_names:
       - REG_DP_BLOCK_VALIDATE_BSN_AT_SYNC
 
diff --git a/applications/lofar2/designs/lofar2_unb2b_sdp_station/lofar2_unb2b_sdp_station.fpga.yaml b/applications/lofar2/designs/lofar2_unb2b_sdp_station/lofar2_unb2b_sdp_station.fpga.yaml
index c8ed157e25..0e7f017663 100644
--- a/applications/lofar2/designs/lofar2_unb2b_sdp_station/lofar2_unb2b_sdp_station.fpga.yaml
+++ b/applications/lofar2/designs/lofar2_unb2b_sdp_station/lofar2_unb2b_sdp_station.fpga.yaml
@@ -367,6 +367,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_align_v2
     peripheral_group: bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: ceil_pow2(c_P_sum) * 2 * MM_BUS_SIZE  # number_of_ports = c_P_sum, mm_port_span = 2 words
     parameter_overrides:
       - { name: g_nof_streams, value: c_P_sum }
     mm_port_names:
@@ -375,6 +376,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: rx_align_bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: ceil_pow2(c_P_sum) * 8 * MM_BUS_SIZE  # number_of_ports = c_P_sum, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: c_P_sum }
     mm_port_names:
@@ -383,6 +385,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: aligned_bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
@@ -391,12 +394,15 @@ peripherals:
   - peripheral_name: ring/ring_lane_info
     peripheral_group: bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 2 * MM_BUS_SIZE
     mm_port_names:
       - REG_RING_LANE_INFO_BF
    
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: ring_rx_bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
+
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
@@ -405,6 +411,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: ring_tx_bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
@@ -413,6 +420,7 @@ peripherals:
   - peripheral_name: dp/dp_block_validate_err
     peripheral_group: bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: ceil_pow2(c_lane_nof_err_counts + 3) * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = ceil_pow2(g_nof_err_counts + 3) words
     parameter_overrides:
       - { name: g_nof_err_counts, value: c_lane_nof_err_counts }
     mm_port_names:
@@ -421,6 +429,7 @@ peripherals:
   - peripheral_name: dp/dp_block_validate_bsn_at_sync
     peripheral_group: bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 4 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 4 words
     mm_port_names:
       - REG_DP_BLOCK_VALIDATE_BSN_AT_SYNC_BF
 
@@ -471,6 +480,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: bst_udp
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
@@ -479,6 +489,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: beamlet_output
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
diff --git a/applications/lofar2/designs/lofar2_unb2c_ring/lofar2_unb2c_ring.fpga.yaml b/applications/lofar2/designs/lofar2_unb2c_ring/lofar2_unb2c_ring.fpga.yaml
index da16eb0270..37037abf09 100644
--- a/applications/lofar2/designs/lofar2_unb2c_ring/lofar2_unb2c_ring.fpga.yaml
+++ b/applications/lofar2/designs/lofar2_unb2c_ring/lofar2_unb2c_ring.fpga.yaml
@@ -74,6 +74,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: ring_rx
     number_of_peripherals: c_nof_lanes
+    peripheral_span: ceil_pow2(c_nof_rx_monitors) * 8 * MM_BUS_SIZE 
     parameter_overrides:
       - { name: g_nof_streams, value: c_nof_rx_monitors }
     mm_port_names:
@@ -82,6 +83,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: ring_tx
     number_of_peripherals: c_nof_lanes
+    peripheral_span: ceil_pow2(c_nof_tx_monitors) * 8 * MM_BUS_SIZE 
     parameter_overrides:
       - { name: g_nof_streams, value: c_nof_tx_monitors }
     mm_port_names:
@@ -89,23 +91,27 @@ peripherals:
 
   - peripheral_name: ring/ring_lane_info
     number_of_peripherals: c_nof_lanes
+    peripheral_span: 2 * MM_BUS_SIZE
     mm_port_names:
       - REG_RING_LANE_INFO
 
   - peripheral_name: dp/dp_xonoff
     peripheral_group: lane
     number_of_peripherals: c_nof_lanes
+    peripheral_span: 2 * MM_BUS_SIZE
     mm_port_names:
       - REG_DP_XONOFF_LANE
 
   - peripheral_name: dp/dp_xonoff
     peripheral_group: local
     number_of_peripherals: c_nof_lanes
+    peripheral_span: 2 * MM_BUS_SIZE
     mm_port_names:
       - REG_DP_XONOFF_LOCAL
 
   - peripheral_name: dp/dp_block_validate_err
     number_of_peripherals: c_nof_lanes
+    peripheral_span: ceil_pow2(c_nof_err_counts + 3) * MM_BUS_SIZE
     parameter_overrides:
       - { name: g_nof_err_counts, value: c_nof_err_counts }
     mm_port_names:
@@ -113,6 +119,7 @@ peripherals:
 
   - peripheral_name: dp/dp_block_validate_bsn_at_sync
     number_of_peripherals: c_nof_lanes
+    peripheral_span: 4 * MM_BUS_SIZE
     mm_port_names:
       - REG_DP_BLOCK_VALIDATE_BSN_AT_SYNC
 
diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/lofar2_unb2c_sdp_station.fpga.yaml b/applications/lofar2/designs/lofar2_unb2c_sdp_station/lofar2_unb2c_sdp_station.fpga.yaml
index 6f9cb187f8..1b3fae928a 100644
--- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/lofar2_unb2c_sdp_station.fpga.yaml
+++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/lofar2_unb2c_sdp_station.fpga.yaml
@@ -367,6 +367,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_align_v2
     peripheral_group: bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: ceil_pow2(c_P_sum) * 2 * MM_BUS_SIZE  # number_of_ports = c_P_sum, mm_port_span = 2 words
     parameter_overrides:
       - { name: g_nof_streams, value: c_P_sum }
     mm_port_names:
@@ -375,6 +376,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: rx_align_bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: ceil_pow2(c_P_sum) * 8 * MM_BUS_SIZE  # number_of_ports = c_P_sum, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: c_P_sum }
     mm_port_names:
@@ -383,6 +385,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: aligned_bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
@@ -391,12 +394,14 @@ peripherals:
   - peripheral_name: ring/ring_lane_info
     peripheral_group: bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 2 * MM_BUS_SIZE
     mm_port_names:
       - REG_RING_LANE_INFO_BF
    
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: ring_rx_bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
@@ -405,6 +410,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: ring_tx_bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
@@ -413,6 +419,7 @@ peripherals:
   - peripheral_name: dp/dp_block_validate_err
     peripheral_group: bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: ceil_pow2(c_lane_nof_err_counts + 3) * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = ceil_pow2(g_nof_err_counts + 3) words
     parameter_overrides:
       - { name: g_nof_err_counts, value: c_lane_nof_err_counts }
     mm_port_names:
@@ -421,6 +428,7 @@ peripherals:
   - peripheral_name: dp/dp_block_validate_bsn_at_sync
     peripheral_group: bf
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 4 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 4 words
     mm_port_names:
       - REG_DP_BLOCK_VALIDATE_BSN_AT_SYNC_BF
 
@@ -471,6 +479,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: bst_udp
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
@@ -479,6 +488,7 @@ peripherals:
   - peripheral_name: dp/dp_bsn_monitor_v2
     peripheral_group: beamlet_output
     number_of_peripherals: c_N_beamsets
+    peripheral_span: 8 * MM_BUS_SIZE  # number_of_ports = 1, mm_port_span = 8 words
     parameter_overrides:
       - { name: g_nof_streams, value: 1 }
     mm_port_names:
-- 
GitLab