Skip to content
Snippets Groups Projects

Resolve L2SDP-130

Merged Reinier van der Walle requested to merge L2SDP-130 into master
Files
5
-------------------------------------------------------------------------------
--
-- 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:
-- . Implements the functionality of the subband filterbank (Fsub) in the
-- LOFAR2 SDPFW design.
-- Description:
-- . The subband filterbank seperates the incoming timestamped ADC samples into
-- 512 frequency bands called subbands.
-- . It implements a critically sampled poly-phase filterbank (PFB). The PFB consists of a
-- poly-phase finite impulse response (PFIR) filter per real input and a
-- complex fast fourier transform (FFT) per 2 real inputs.
-- . The number of points of the FFT is 1024.
-- Remark:
-- .
-------------------------------------------------------------------------------
LIBRARY IEEE, common_lib, dp_lib, rTwoSDF_lib, wpfb_lib, filter_lib, si_lib, st_lib;
USE IEEE.STD_LOGIC_1164.ALL;
USE common_lib.common_pkg.ALL;
USE common_lib.common_mem_pkg.ALL;
USE dp_lib.dp_stream_pkg.ALL;
USE rTwoSDF_lib.rTwoSDFPkg.ALL;
USE filter_lib.fil_pkg.ALL;
USE wpfb_lib.wpfb_pkg.ALL;
USE work.sdp_pkg.ALL;
ENTITY node_sdp_filterbank IS
GENERIC (
g_sim : BOOLEAN := FALSE;
g_scope_selected_subband : NATURAL := 0
);
PORT (
dp_clk : IN STD_LOGIC;
dp_rst : IN STD_LOGIC;
in_sosi_arr : IN t_dp_sosi_arr(c_sdp_S_pn-1 DOWNTO 0);
pfb_sosi_arr : OUT t_dp_sosi_arr(c_sdp_P_pfb-1 DOWNTO 0);
mm_rst : IN STD_LOGIC;
mm_clk : IN STD_LOGIC;
reg_si_mosi : IN t_mem_mosi := c_mem_mosi_rst;
reg_si_miso : OUT t_mem_miso;
ram_st_sst_mosi : IN t_mem_mosi := c_mem_mosi_rst;
ram_st_sst_miso : OUT t_mem_miso;
ram_fil_coefs_mosi : IN t_mem_mosi := c_mem_mosi_rst;
ram_fil_coefs_miso : OUT t_mem_miso
);
END node_sdp_filterbank;
ARCHITECTURE str OF node_sdp_filterbank IS
CONSTANT c_coefs_file_prefix : STRING := "UNUSED"; --"data/coefs_wide";
SIGNAL ram_st_sst_mosi_arr : t_mem_mosi_arr(c_sdp_P_pfb-1 DOWNTO 0) := (OTHERS => c_mem_mosi_rst);
SIGNAL ram_st_sst_miso_arr : t_mem_miso_arr(c_sdp_P_pfb-1 DOWNTO 0) := (OTHERS => c_mem_miso_rst);
SIGNAL si_sosi_arr : t_dp_sosi_arr(c_sdp_S_pn-1 DOWNTO 0) := (OTHERS => c_dp_sosi_rst);
SIGNAL wpfb_unit_out_sosi_arr : t_dp_sosi_arr(c_sdp_P_pfb-1 DOWNTO 0) := (OTHERS => c_dp_sosi_rst);
SIGNAL wpfb_unit_fil_sosi_arr : t_dp_sosi_arr(c_sdp_P_pfb-1 DOWNTO 0) := (OTHERS => c_dp_sosi_rst);
SIGNAL wpfb_unit_in_sosi_arr : t_dp_sosi_arr(c_sdp_P_pfb-1 DOWNTO 0) := (OTHERS => c_dp_sosi_rst);
SIGNAL scope_sosi_arr : t_dp_sosi_integer_arr(c_sdp_S_pn-1 DOWNTO 0);
BEGIN
---------------------------------------------------------------
-- SPECTRAL INVERSION
---------------------------------------------------------------
u_si_arr : ENTITY si_lib.si_arr
GENERIC MAP (
g_nof_streams => c_sdp_S_pn,
g_pipeline => 1,
g_dat_w => c_sdp_W_adc
)
PORT MAP(
in_sosi_arr => in_sosi_arr,
out_sosi_arr => si_sosi_arr,
reg_si_mosi => reg_si_mosi,
reg_si_miso => reg_si_miso,
mm_rst => mm_rst,
mm_clk => mm_clk,
dp_clk => dp_clk,
dp_rst => dp_rst
);
---------------------------------------------------------------
-- POLY-PHASE FILTERBANK
---------------------------------------------------------------
-- Connect the 12 ADC streams to the re and im fields of the PFB input.
p_pfb_streams : PROCESS(si_sosi_arr)
BEGIN
FOR I IN 0 TO c_sdp_P_pfb-1 LOOP
wpfb_unit_in_sosi_arr(I) <= si_sosi_arr(2*I);
wpfb_unit_in_sosi_arr(I).re <= RESIZE_DP_DSP_DATA(si_sosi_arr(2*I).data);
wpfb_unit_in_sosi_arr(I).im <= RESIZE_DP_DSP_DATA(si_sosi_arr(2*I+1).data);
END LOOP;
END PROCESS;
-- PFB
u_wpfb_unit_dev : ENTITY wpfb_lib.wpfb_unit_dev
GENERIC MAP (
g_wpfb => c_sdp_wpfb_subbands,
g_use_prefilter => TRUE,
g_stats_ena => FALSE,
g_use_bg => FALSE,
g_coefs_file_prefix => c_coefs_file_prefix
)
PORT MAP (
dp_rst => dp_rst,
dp_clk => dp_clk,
mm_rst => mm_rst,
mm_clk => mm_clk,
ram_fil_coefs_mosi => ram_fil_coefs_mosi,
ram_fil_coefs_miso => ram_fil_coefs_miso,
in_sosi_arr => wpfb_unit_in_sosi_arr,
fil_sosi_arr => wpfb_unit_fil_sosi_arr,
out_sosi_arr => wpfb_unit_out_sosi_arr
);
-- Output PFB streams
pfb_sosi_arr <= wpfb_unit_out_sosi_arr;
---------------------------------------------------------------
-- SUBBAND STATISTICS
---------------------------------------------------------------
gen_stats_streams: FOR I IN 0 TO c_sdp_P_pfb-1 GENERATE
u_subband_stats : ENTITY st_lib.st_sst
GENERIC MAP(
g_nof_stat => c_sdp_N_fft,
g_in_data_w => c_sdp_W_subband,
g_stat_data_w => c_sdp_wpfb_subbands.stat_data_w,
g_stat_data_sz => c_sdp_wpfb_subbands.stat_data_sz
)
PORT MAP (
mm_rst => mm_rst,
mm_clk => mm_clk,
dp_rst => dp_rst,
dp_clk => dp_clk,
in_complex => wpfb_unit_out_sosi_arr(I),
ram_st_sst_mosi => ram_st_sst_mosi_arr(I),
ram_st_sst_miso => ram_st_sst_miso_arr(I)
);
END GENERATE;
---------------------------------------------------------------
-- COMBINE MEMORY MAPPED INTERFACES
---------------------------------------------------------------
-- Combine the internal array of mm interfaces for the subband
-- statistics to one array.
u_mem_mux_sst : ENTITY common_lib.common_mem_mux
GENERIC MAP (
g_nof_mosi => c_sdp_P_pfb,
g_mult_addr_w => ceil_log2(c_sdp_N_sub*c_sdp_Q_fft*c_sdp_wpfb_subbands.stat_data_sz)
)
PORT MAP (
mosi => ram_st_sst_mosi,
miso => ram_st_sst_miso,
mosi_arr => ram_st_sst_mosi_arr,
miso_arr => ram_st_sst_miso_arr
);
---------------------------------------------------------------
-- SIGNAL SCOPE
---------------------------------------------------------------
u_sdp_scope : ENTITY work.sdp_scope
GENERIC MAP (
g_sim => g_sim,
g_selected_subband => g_scope_selected_subband
)
PORT MAP (
clk => dp_clk,
rst => dp_rst,
sp_sosi_arr => wpfb_unit_out_sosi_arr,
scope_sosi_arr => scope_sosi_arr
);
END str;
Loading