Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
sdp_pkg.vhd 6.48 KiB
-------------------------------------------------------------------------------
--
-- Copyright 2020
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
--     http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--
-- Author: R. van der Walle
-- Purpose: 
-- . This package contains sdp specific constants.
-- Description:
-- Remark:
-- . See Document: L3 SDP Decision: SDP Parameter definitions.
-------------------------------------------------------------------------------
LIBRARY ieee, common_lib, rTwoSDF_lib, fft_lib, filter_lib, wpfb_lib;
USE IEEE.std_logic_1164.ALL;
USE common_lib.common_pkg.ALL;
USE rTwoSDF_lib.rTwoSDFPkg.ALL;
USE fft_lib.fft_pkg.ALL; 
USE filter_lib.fil_pkg.ALL; 
USE wpfb_lib.wpfb_pkg.ALL;

PACKAGE sdp_pkg is
  -------------------------------------------------
  -- SDP info record as defined in:
  --  LOFAR2-9258-SDP info per antenna band 
  -------------------------------------------------
  TYPE t_sdp_info IS RECORD
    station_id              : STD_LOGIC_VECTOR(15 DOWNTO 0);
    antenna_band_index      : STD_LOGIC;
    observation_id          : STD_LOGIC_VECTOR(31 DOWNTO 0); 
    nyquist_zone_index      : STD_LOGIC_VECTOR(1 DOWNTO 0);   
    f_adc                   : STD_LOGIC;     
    fsub_type               : STD_LOGIC;  
    beam_repositioning_flag : STD_LOGIC; 
    subband_calibrated_flag : STD_LOGIC; 
    O_si                    : STD_LOGIC_VECTOR(7 DOWNTO 0);    
    N_si                    : STD_LOGIC_VECTOR(7 DOWNTO 0);    
    O_rn                    : STD_LOGIC_VECTOR(7 DOWNTO 0);    
    N_rn                    : STD_LOGIC_VECTOR(7 DOWNTO 0);   
    block_period            : STD_LOGIC_VECTOR(15 DOWNTO 0);      
    beamlet_scale           : STD_LOGIC_VECTOR(15 DOWNTO 0);   
  END RECORD;    

  -------------------------------------------------
  -- SDP specific parameters as defined in:
  --  L3 SDP Decision: SDP Parameter definitions 
  -------------------------------------------------
  CONSTANT c_sdp_N_pol           : NATURAL := 2;
  CONSTANT c_sdp_N_sub           : NATURAL := 512;
  CONSTANT c_sdp_N_fft           : NATURAL := 1024;
  CONSTANT c_sdp_S_pn            : NATURAL := 12;    
  CONSTANT c_sdp_Q_fft           : NATURAL := 2;         
  CONSTANT c_sdp_N_taps          : NATURAL := 16;  
  CONSTANT c_sdp_W_adc           : NATURAL := 14;  
  CONSTANT c_sdp_W_fir_coef      : NATURAL := 16;  
  CONSTANT c_sdp_W_subband       : NATURAL := 18; 
  CONSTANT c_sdp_P_pfb           : NATURAL := c_sdp_S_pn/c_sdp_Q_fft;  
  CONSTANT c_sdp_S_sub_bf        : NATURAL := 488;
  CONSTANT c_sdp_f_adc_MHz       : NATURAL := 200;
  CONSTANT c_sdp_T_adc           : TIME    := (10**6/c_sdp_f_adc_MHz) * 1 ps;
  CONSTANT c_sdp_T_sub           : TIME    := c_sdp_N_fft * c_sdp_T_adc;
  CONSTANT c_sdp_W_sub_weight    : NATURAL := 16;
  CONSTANT c_sdp_W_sub_magnitude : NATURAL := 2;
  CONSTANT c_sdp_W_sub_fraction  : NATURAL := c_sdp_W_sub_weight - c_sdp_W_sub_magnitude -1;
  CONSTANT c_sdp_W_bf_weight     : NATURAL := 16;
  CONSTANT c_sdp_W_bf_magnitude  : NATURAL := 1;
  CONSTANT c_sdp_W_bf_fraction   : NATURAL := c_sdp_W_bf_weight - c_sdp_W_bf_magnitude -1;
  CONSTANT c_sdp_W_bf_product    : NATURAL := c_sdp_W_subband + c_sdp_W_bf_weight -1; 
  CONSTANT c_sdp_W_beamlet_sum   : NATURAL := 18; 
  CONSTANT c_sdp_W_beamlet       : NATURAL := 8; 
  CONSTANT c_sdp_W_beamlet_scale : NATURAL := 16; 
  CONSTANT c_sdp_W_gn_id         : NATURAL := 5;
  CONSTANT c_sdp_N_pn_lb         : NATURAL := 16;

  -- AIT constants
  CONSTANT c_sdp_ait_buf_nof_data_jesd : NATURAL := 1024; -- 1024 14 bit samples fit in one M20k BRAM 
  CONSTANT c_sdp_ait_buf_nof_data_bsn  : NATURAL := 1024; -- 1024 14 bit samples fit in one M20k BRAM
 
  -- In SDP c_nof_channels = 2**nof_chan = 1 and wb_factor = 1, 
  -- therefore these parameters are not explicitly used in calculation of derived constants
  CONSTANT c_sdp_wpfb_subbands : t_wpfb :=
        (1, c_sdp_N_fft, 0, c_sdp_P_pfb,
         c_sdp_N_taps, 1, c_sdp_W_adc, 16, c_sdp_W_fir_coef,
         true, false, true, 16, c_sdp_W_subband, 1, 18, 2, 
         true, 54, 2, 195313, c_fft_pipeline, c_fft_pipeline, 
         c_fil_ppf_pipeline);

  -- JESD204
  CONSTANT c_sdp_jesd204b_bus_w   : NATURAL := 12;
  CONSTANT c_sdp_jesd204b_nof_bus : NATURAL := 1;


  -- AIT MM address widths
  CONSTANT c_sdp_jesd204b_addr_w               : NATURAL := 8 + ceil_log2(c_sdp_S_pn); 
  CONSTANT c_sdp_reg_bsn_monitor_input_addr_w  : NATURAL := 8;
  CONSTANT c_sdp_reg_wg_addr_w                 : NATURAL := 2 + ceil_log2(c_sdp_S_pn);
  CONSTANT c_sdp_ram_wg_addr_w                 : NATURAL := 10 + ceil_log2(c_sdp_S_pn); 
  CONSTANT c_sdp_reg_dp_shiftram_addr_w        : NATURAL := 1 + ceil_log2(c_sdp_S_pn); 
  CONSTANT c_sdp_reg_bsn_source_addr_w         : NATURAL := 2;
  CONSTANT c_sdp_reg_bsn_scheduler_addr_w      : NATURAL := 1;
  CONSTANT c_sdp_ram_diag_data_buf_jesd_addr_w : NATURAL := ceil_log2(2*c_sdp_ait_buf_nof_data_jesd);
  CONSTANT c_sdp_reg_diag_data_buf_jesd_addr_w : NATURAL := 1 + ceil_log2(2);
  CONSTANT c_sdp_ram_diag_data_buf_bsn_addr_w  : NATURAL := ceil_log2(c_sdp_S_pn*c_sdp_ait_buf_nof_data_bsn);  
  CONSTANT c_sdp_reg_diag_data_buf_bsn_addr_w  : NATURAL := 1 + ceil_log2(c_sdp_S_pn);  
  CONSTANT c_sdp_reg_aduh_monitor_addr_w       : NATURAL := 2 + ceil_log2(c_sdp_S_pn);

  -- FSUB MM address widths
  CONSTANT c_sdp_ram_fil_coefs_addr_w       : NATURAL := ceil_log2(c_sdp_N_fft * c_sdp_N_taps);
  CONSTANT c_sdp_ram_st_sst_addr_w          : NATURAL := ceil_log2(c_sdp_P_pfb*c_sdp_N_sub*c_sdp_Q_fft*c_sdp_wpfb_subbands.stat_data_sz);
  CONSTANT c_sdp_reg_si_addr_w              : NATURAL := 1; --enable/disable
  CONSTANT c_sdp_ram_equalizer_gains_addr_w : NATURAL := ceil_log2(c_sdp_P_pfb*c_sdp_N_sub*c_sdp_Q_fft);
  CONSTANT c_sdp_reg_dp_selector_addr_w     : NATURAL := 1; --Select input 0 or 1.

END PACKAGE sdp_pkg;

PACKAGE BODY sdp_pkg IS

  
END sdp_pkg;