Skip to content
Snippets Groups Projects
Commit e6a4427b authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Added pfb2 library, see readme_lofar1.txt.

parent 29d1a089
No related branches found
No related tags found
1 merge request!100Removed text for XSub that is now written in Confluence Subband correlator...
hdl_lib_name = pfb2
hdl_library_clause_name = pfb2_lib
hdl_lib_uses_synth = common dp pfs pft2 st
hdl_lib_uses_sim =
hdl_lib_technology =
synth_files =
src/vhdl/pfb2.vhd
src/vhdl/pfb2_unit.vhd
test_bench_files =
regression_test_vhdl =
[modelsim_project_file]
[ise_project_file]
-------------------------------------------------------------------------------
--
-- 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: E. Kooistra
-- Purpose: Combine LOFAR1 pfs + pft2 into pfb2 with statistics and streaming
-- interfaces, similar as wpfb_unit_dev
-- Description:
--
-- Remark:
-- . Convert between LOFAR1 sync timing 1 clk before sop and streaming data path
-- (DP) sync timing at sop.
-- . g_switch_en = '1' decorrelates rounding crosstalk between the X and Y output
-- that can occur due to PFT_MODE_REAL2.
LIBRARY IEEE, common_lib, dp_lib, pfs_lib, pft2_lib;
USE IEEE.std_logic_1164.ALL;
USE common_lib.common_pkg.ALL;
USE dp_lib.dp_stream_pkg.ALL;
USE pft2_lib.pft_pkg.ALL;
ENTITY pfb2 IS
GENERIC (
g_nof_points : NATURAL := 1024;
-- pfs
g_pfs_nof_taps : NATURAL := 16;
g_pfs_in_dat_w : NATURAL := 12;
g_pfs_out_dat_w : NATURAL := 18;
g_pfs_coef_dat_w : NATURAL := 16;
-- pft2
g_pft_mode : PFT_MODE_TYPE := PFT_MODE_REAL2;
g_pft_switch_en : STD_LOGIC := '1';
g_pft_out_dat_w : NATURAL := 18
);
PORT (
dp_rst : IN STD_LOGIC;
dp_clk : IN STD_LOGIC;
in_sosi : IN t_dp_sosi;
fil_sosi : OUT t_dp_sosi;
out_sosi : OUT t_dp_sosi
);
END pfb2;
ARCHITECTURE str OF pfb2 IS
CONSTANT c_nof_coeffs : NATURAL := g_pfs_nof_taps*g_nof_points;
SIGNAL pfs_in_dat_x : STD_LOGIC_VECTOR(g_pfs_in_dat_w-1 DOWNTO 0);
SIGNAL pfs_in_dat_y : STD_LOGIC_VECTOR(g_pfs_in_dat_w-1 DOWNTO 0);
SIGNAL pfs_in_val : STD_LOGIC;
SIGNAL pfs_in_sync : STD_LOGIC;
SIGNAL fil_out_dat_x : STD_LOGIC_VECTOR(g_pfs_out_dat_w-1 DOWNTO 0);
SIGNAL fil_out_dat_y : STD_LOGIC_VECTOR(g_pfs_out_dat_w-1 DOWNTO 0);
SIGNAL fil_out_val : STD_LOGIC;
SIGNAL fil_out_sync : STD_LOGIC;
SIGNAL pft_out_dat_re : STD_LOGIC_VECTOR(g_pft_out_dat_w-1 DOWNTO 0);
SIGNAL pft_out_dat_im : STD_LOGIC_VECTOR(g_pft_out_dat_w-1 DOWNTO 0);
SIGNAL pft_out_val : STD_LOGIC;
SIGNAL pft_out_sync : STD_LOGIC;
BEGIN
-- Delay in_sosi data with respect to sync to fit LOFAR1 sync timing
pfs_in_dat_x <= in_sosi.re(g_pfs_in_dat_w-1 DOWNTO 0) WHEN rising_edge(dp_clk);
pfs_in_dat_y <= in_sosi.im(g_pfs_in_dat_w-1 DOWNTO 0) WHEN rising_edge(dp_clk);
pfs_in_val <= in_sosi.valid WHEN rising_edge(dp_clk);
pfs_in_sync <= in_sosi.sync;
pfs : ENTITY pfs_lib.pfs
GENERIC MAP (
g_nof_bands => g_nof_points,
g_nof_taps => c_nof_coeffs,
g_in_dat_w => g_pfs_in_dat_w,
g_out_dat_w => g_pfs_out_dat_w,
g_coef_dat_w => g_pfs_coef_dat_w
)
PORT MAP (
in_dat_x => pfs_in_dat_x,
in_dat_y => pfs_in_dat_y,
in_val => pfs_in_val,
in_sync => pfs_in_sync,
out_dat_x => fil_out_dat_x,
out_dat_y => fil_out_dat_y,
out_val => fil_out_val,
out_sync => fil_out_sync,
clk => dp_clk,
rst => dp_rst,
restart => '0'
);
fil_sosi.re <= RESIZE_DP_DSP_DATA(fil_out_dat_x);
fil_sosi.im <= RESIZE_DP_DSP_DATA(fil_out_dat_y);
fil_sosi.valid <= fil_out_val;
fil_sosi.sync <= fil_out_sync;
pft : ENTITY pft2_lib.pft
GENERIC MAP (
g_fft_size_w => ceil_log2(g_nof_points),
g_in_dat_w => g_pfs_out_dat_w,
g_out_dat_w => g_pft_out_dat_w,
g_mode => PFT_MODE_REAL2
)
PORT MAP (
in_re => fil_out_dat_x,
in_im => fil_out_dat_y,
in_val => fil_out_val,
in_sync => fil_out_sync,
switch_en => g_pft_switch_en,
out_re => pft_out_dat_re,
out_im => pft_out_dat_im,
out_val => pft_out_val,
out_sync => pft_out_sync,
clk => dp_clk,
rst => dp_rst
);
-- Delay pft sync with respect pft data to fit DP sync timing
out_sosi.re <= RESIZE_DP_DSP_DATA(pft_out_dat_re);
out_sosi.im <= RESIZE_DP_DSP_DATA(pft_out_dat_im);
out_sosi.valid <= pft_out_val;
out_sosi.sync <= pft_out_sync WHEN rising_edge(dp_clk);
END str;
-------------------------------------------------------------------------------
--
-- 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: E. Kooistra
-- Purpose: Combine LOFAR1 pfb2 with subband statistics (SST), similar as wpfb_unit_dev
-- Description:
-- . support multiple complex input streams via g_nof_streams
-- . 1 complex pfb2 per stream
-- . 1 complex pfb2 can process two real inputs with PFT_MODE_REAL2
-- . pass on in_sosi.bsn
--
-- Remark:
LIBRARY IEEE, common_lib, dp_lib, pfs_lib, pft2_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 pft2_lib.pft_pkg.ALL;
ENTITY pfb2_unit IS
GENERIC (
g_nof_streams : NATURAL := 1; -- number of pfb2 instances, 1 pfb2 per stream
g_nof_points : NATURAL := 1024;
-- pfs
g_pfs_nof_taps : NATURAL := 16;
g_pfs_in_dat_w : NATURAL := 12;
g_pfs_out_dat_w : NATURAL := 18;
g_pfs_coef_dat_w : NATURAL := 16;
-- pft2
g_pft_mode : PFT_MODE_TYPE := PFT_MODE_REAL2;
g_pft_switch_en : STD_LOGIC := '1';
g_pft_out_dat_w : NATURAL := 18;
-- sst
g_sst_data_w : NATURAL := 64; -- nof bits for the SST power values
g_sst_data_sz : NATURAL := 2 -- nof MM 32b words to fit g_sst_data_w
);
PORT (
dp_rst : IN STD_LOGIC;
dp_clk : IN STD_LOGIC;
mm_rst : IN STD_LOGIC;
mm_clk : IN STD_LOGIC;
ram_st_sst_mosi : IN t_mem_mosi := c_mem_mosi_rst; -- Subband statistics registers
ram_st_sst_miso : OUT t_mem_miso;
in_sosi_arr : IN t_dp_sosi_arr(g_nof_streams-1 DOWNTO 0);
fil_sosi_arr : OUT t_dp_sosi_arr(g_nof_streams-1 DOWNTO 0);
out_sosi_arr : OUT t_dp_sosi_arr(g_nof_streams-1 DOWNTO 0)
);
END pfb2_unit;
ARCHITECTURE str OF pfb2_unit IS
CONSTANT c_nof_stats : NATURAL := g_nof_points; -- SST X and SST Y are interleaved for PFT_MODE_REAL2
SIGNAL ram_st_sst_mosi_arr : t_mem_mosi_arr(g_nof_streams-1 downto 0);
SIGNAL ram_st_sst_miso_arr : t_mem_miso_arr(g_nof_streams-1 downto 0) := (OTHERS => c_mem_miso_rst);
SIGNAL pft_sosi_arr : t_dp_sosi_arr(g_nof_streams-1 DOWNTO 0);
BEGIN
---------------------------------------------------------------
-- Polyphase Filterbanks
---------------------------------------------------------------
gen_pfb2: FOR I IN 0 TO g_nof_streams-1 GENERATE
u_pfb2 : ENTITY work.pfb2
GENERIC MAP (
g_nof_points => g_nof_points,
-- pfs
g_pfs_nof_taps => g_pfs_nof_taps,
g_pfs_in_dat_w => g_pfs_in_dat_w,
g_pfs_out_dat_w => g_pfs_out_dat_w,
g_pfs_coef_dat_w => g_pfs_coef_dat_w,
-- pft2
g_pft_mode => g_pft_mode,
g_pft_switch_en => g_pft_switch_en,
g_pft_out_dat_w => g_pft_out_dat_w
)
PORT MAP (
dp_rst => dp_rst,
dp_clk => dp_clk,
in_sosi => in_sosi_arr(I),
fil_sosi => fil_sosi_arr(I),
out_sosi => pft_sosi_arr(I)
);
END GENERATE;
---------------------------------------------------------------
-- Subband Statistics (SST)
---------------------------------------------------------------
-- MM mux for SST
u_mem_mux_sst : ENTITY common_lib.common_mem_mux
GENERIC MAP (
g_nof_mosi => g_nof_streams,
g_mult_addr_w => ceil_log2(g_sst_data_sz*c_nof_stats)
)
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
);
gen_sst: FOR I IN 0 TO g_nof_streams-1 GENERATE
u_sst : ENTITY st_lib.st_sst
GENERIC MAP (
g_nof_stat => c_nof_stats,
g_in_data_w => g_pft_out_dat_w,
g_stat_data_w => g_sst_data_w,
g_stat_data_sz => g_sst_data_sz
)
PORT MAP (
mm_rst => mm_rst,
mm_clk => mm_clk,
dp_rst => dp_rst,
dp_clk => dp_clk,
in_complex => pft_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;
out_sosi_arr <= pft_sosi_arr;
end str;
This diff is collapsed.
-------------------------------------------------------------------------------
--
-- 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: E. Kooistra
This readme describes how the PFB (= pfs + pft2) code of LOFAR1/RSP was ported to git for LOFAR2 This readme describes how the PFB (= pfs + pft2) code of LOFAR1/RSP was ported to git for LOFAR2
Contents Contents
1) Comparison of LOFAR1 and APERTIF polyphase filterbank (PFB) 1) Comparison of LOFAR1 and APERTIF polyphase filterbank (PFB)
2) Porting LOFAR1 PFB code to LOFAR2.0 2) Porting LOFAR1 PFB code to LOFAR2.0
a) pfs
b) pft2
c) Simulating tb/vhdl/tb_pft2.vhd
3) Create pfb2_unit.vhd that can replace wpfb_unit_dev.vhd
References: References:
[1] LOFAR1 RSP firmware SVN repository https://svn.astron.nl/Station/trunk/RSP/ [1] LOFAR1 RSP firmware SVN repository https://svn.astron.nl/Station/trunk/RSP/
...@@ -11,6 +38,8 @@ References: ...@@ -11,6 +38,8 @@ References:
[4] APERTIF DSP firmware (rTwoSDF, filter, fft, wpfb) in LOFAR2.0 GIT repository https://git.astron.nl/desp/hdl/-/tree/master/libraries/dsp [4] APERTIF DSP firmware (rTwoSDF, filter, fft, wpfb) in LOFAR2.0 GIT repository https://git.astron.nl/desp/hdl/-/tree/master/libraries/dsp
[5] APERTIF PFB MATLAB code in APERTIF firmware SVN repository https://svn.astron.nl/UniBoard_FP7/RadioHDL/trunk/applications/apertif/matlab/apertif_matlab_readme.txt [5] APERTIF PFB MATLAB code in APERTIF firmware SVN repository https://svn.astron.nl/UniBoard_FP7/RadioHDL/trunk/applications/apertif/matlab/apertif_matlab_readme.txt
1) Comparison of LOFAR1 and APERTIF polyphase filterbank (PFB) 1) Comparison of LOFAR1 and APERTIF polyphase filterbank (PFB)
- Advantages of LOFAR1 PFB (= pfs + pft2) are: - Advantages of LOFAR1 PFB (= pfs + pft2) are:
. used in LOFAR1 . used in LOFAR1
...@@ -21,9 +50,11 @@ References: ...@@ -21,9 +50,11 @@ References:
. already available in LOFAR2.0 SDP . already available in LOFAR2.0 SDP
2) Porting LOFAR1 PFB code to LOFAR2.0 2) Porting LOFAR1 PFB code to LOFAR2.0
- Porting from [1] to [3] - Porting from [1] to [3]
a) pfs/
a) pfs
* hdllib.cfg : copy simulation files to data/ * hdllib.cfg : copy simulation files to data/
* src/vhdl/ * src/vhdl/
- pfs_coefsbuf(str).vhd : - pfs_coefsbuf(str).vhd :
...@@ -32,7 +63,8 @@ a) pfs/ ...@@ -32,7 +63,8 @@ a) pfs/
- pfs_filter(rtl).vhd : use ported common_mult_add.vhd from common_mult_lib - pfs_filter(rtl).vhd : use ported common_mult_add.vhd from common_mult_lib
* tb/vhdl/tb_pfs.vhd : ==> simulates OK * tb/vhdl/tb_pfs.vhd : ==> simulates OK
. added usage comment . added usage comment
b) pft2/ at
b) pft2
* hdllib.cfg : copy simulation files to data/ * hdllib.cfg : copy simulation files to data/
* src/vhdl/ * src/vhdl/
- pft_bf(rtl).vhd : - pft_bf(rtl).vhd :
...@@ -60,6 +92,12 @@ c) Simulating tb/vhdl/tb_pft2.vhd ...@@ -60,6 +92,12 @@ c) Simulating tb/vhdl/tb_pft2.vhd
* Added multi tb_tb_pft2.vhd to verify ptf2 with all available *sig files. * Added multi tb_tb_pft2.vhd to verify ptf2 with all available *sig files.
==> tb_tb_pft2.vhd simulates OK using c_diff_max = 20 like in data/tc.tcl ==> tb_tb_pft2.vhd simulates OK using c_diff_max = 20 like in data/tc.tcl
d) Creating pfb2.vhd that can replace wpfb_unit_dev.vhd
3) Create pfb2_unit.vhd that can replace wpfb_unit_dev.vhd
* pfb2.vhd = pfs + pft2
* pfb2_unit.vhd = multiple instances of pfb2 + sst, similar as wpfb_unit_dev.vhd for wideband factor wb = 1.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment