diff --git a/applications/lofar1/pfb2/src/vhdl/pfb2.vhd b/applications/lofar1/pfb2/src/vhdl/pfb2.vhd index 54ce610ba7342fcfe9aa733b2fec45def52df0e1..cd8327a0b3a0946a86f238017bbecce981a588ea 100644 --- a/applications/lofar1/pfb2/src/vhdl/pfb2.vhd +++ b/applications/lofar1/pfb2/src/vhdl/pfb2.vhd @@ -1,6 +1,6 @@ ------------------------------------------------------------------------------- -- --- Copyright 2020 +-- Copyright 2021 -- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> -- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -- @@ -33,6 +33,7 @@ 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 pfs_lib.pfs_pkg.ALL; USE pft2_lib.pft_pkg.ALL; ENTITY pfb2 IS @@ -44,7 +45,8 @@ ENTITY pfb2 IS 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; + g_pfs_coef_dat_w : NATURAL := c_pfs_coef_w; -- = 16, should match coefs in g_pfs_coefs_file + g_pfs_coefs_file : STRING := c_pfs_coefs_file; -- = "data/pfs_coefsbuf_1024.hex" -- pft2 g_pft_mode : PFT_MODE_TYPE := PFT_MODE_REAL2; @@ -94,7 +96,8 @@ BEGIN 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 + g_coef_dat_w => g_pfs_coef_dat_w, + g_coefs_file => g_pfs_coefs_file ) PORT MAP ( in_dat_x => pfs_in_dat_x, diff --git a/applications/lofar1/pfb2/src/vhdl/pfb2_unit.vhd b/applications/lofar1/pfb2/src/vhdl/pfb2_unit.vhd index be145f288ffe6b874c4e871e7c898cddf392b162..3d4e01d114ddfe2b833d835c93d42f89c59d401e 100644 --- a/applications/lofar1/pfb2/src/vhdl/pfb2_unit.vhd +++ b/applications/lofar1/pfb2/src/vhdl/pfb2_unit.vhd @@ -1,6 +1,6 @@ ------------------------------------------------------------------------------- -- --- Copyright 2020 +-- Copyright 2021 -- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> -- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -- @@ -22,8 +22,8 @@ -- 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 +-- . one complex pfb2 per stream +-- . one complex pfb2 can process two real inputs with PFT_MODE_REAL2 -- . pass on in_sosi.bsn -- -- Remark: @@ -33,6 +33,7 @@ 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 pfs_lib.pfs_pkg.ALL; USE pft2_lib.pft_pkg.ALL; ENTITY pfb2_unit IS @@ -45,7 +46,8 @@ ENTITY pfb2_unit IS 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; + g_pfs_coef_dat_w : NATURAL := c_pfs_coef_w; -- = 16, should match coefs in g_pfs_coefs_file + g_pfs_coefs_file : STRING := c_pfs_coefs_file; -- = "data/pfs_coefsbuf_1024.hex" -- pft2 g_pft_mode : PFT_MODE_TYPE := PFT_MODE_REAL2; @@ -95,6 +97,7 @@ BEGIN 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, + g_pfs_coefs_file => g_pfs_coefs_file, -- pft2 g_pft_mode => g_pft_mode, diff --git a/applications/lofar1/pfs/hdllib.cfg b/applications/lofar1/pfs/hdllib.cfg index 3023ef367fefd7adf4079cc9afaf0895daa418eb..051dcac1569c102c52adcf26b4f806687df0ed2a 100644 --- a/applications/lofar1/pfs/hdllib.cfg +++ b/applications/lofar1/pfs/hdllib.cfg @@ -5,6 +5,7 @@ hdl_lib_uses_sim = hdl_lib_technology = synth_files = + src/vhdl/pfs_pkg.vhd src/vhdl/pfs_ctrl.vhd src/vhdl/pfs_tapsbuf.vhd src/vhdl/pfs_coefsbuf.vhd diff --git a/applications/lofar1/pfs/src/vhdl/pfs.vhd b/applications/lofar1/pfs/src/vhdl/pfs.vhd index f639776cad20e018bb85e2f206a4e35f023a1567..fc750abced2bda64c9a33c11abdb5b46cebec4b3 100644 --- a/applications/lofar1/pfs/src/vhdl/pfs.vhd +++ b/applications/lofar1/pfs/src/vhdl/pfs.vhd @@ -26,6 +26,7 @@ LIBRARY IEEE, common_lib; USE IEEE.std_logic_1164.ALL; USE common_lib.common_pkg.ALL; +USE work.pfs_pkg.ALL; ENTITY pfs IS GENERIC ( @@ -33,7 +34,8 @@ ENTITY pfs IS g_nof_taps : NATURAL := 16*1024; g_in_dat_w : NATURAL := 12; g_out_dat_w : NATURAL := 18; - g_coef_dat_w : NATURAL := 16 + g_coef_dat_w : NATURAL := c_pfs_coef_w; -- = 16, should match coefs in g_coefs_file + g_coefs_file : STRING := c_pfs_coefs_file -- = "data/pfs_coefsbuf_1024.hex" ); PORT ( in_dat_x : IN STD_LOGIC_VECTOR(g_in_dat_w-1 DOWNTO 0); @@ -162,6 +164,7 @@ BEGIN coefsbuf : ENTITY work.pfs_coefsbuf GENERIC MAP ( g_data_w => g_coef_dat_w * c_nof_fir_taps, + g_coefs_file => g_coefs_file, g_nof_coefs => g_nof_bands, g_addr_w => c_nof_bands_w ) diff --git a/applications/lofar1/pfs/src/vhdl/pfs_coefsbuf.vhd b/applications/lofar1/pfs/src/vhdl/pfs_coefsbuf.vhd index 3d0965b570d4b718a634aef4f71d7ef8f9989ad8..e7ae9a6fd4ade4b9e5a51454bfbe06d5ec7c21d8 100644 --- a/applications/lofar1/pfs/src/vhdl/pfs_coefsbuf.vhd +++ b/applications/lofar1/pfs/src/vhdl/pfs_coefsbuf.vhd @@ -31,9 +31,11 @@ USE common_lib.common_mem_pkg.ALL; ENTITY pfs_coefsbuf IS GENERIC ( - g_data_w : NATURAL; - g_nof_coefs : NATURAL; - g_addr_w : NATURAL + g_data_w : NATURAL; + g_coefs_file : STRING := "data/pfs_coefsbuf_1024.hex"; -- Quartus .hex extension, replaced by .bin in common_rom works for XST + --g_coefs_file : STRING := "data/pfs_coefsbuf_1024.bin"; -- Synplify fails on file extension change to .bin in common_rom and requires extra ../ + g_nof_coefs : NATURAL; + g_addr_w : NATURAL ); PORT ( addr : IN STD_LOGIC_VECTOR(g_addr_w-1 DOWNTO 0); @@ -57,8 +59,7 @@ BEGIN rom : ENTITY common_lib.common_rom GENERIC MAP ( g_ram => c_coefs_rom, - g_init_file => "data/pfs_coefsbuf_1024.hex" -- Quartus .hex extension, replaced by .bin in common_rom works for XST - --g_init_file => "data/pfs_coefsbuf_1024.bin" -- Synplify fails on file extension change to .bin in common_rom and requires extra ../ + g_init_file => g_coefs_file ) PORT MAP ( rst => rst, diff --git a/applications/lofar1/pfs/src/vhdl/pfs_pkg.vhd b/applications/lofar1/pfs/src/vhdl/pfs_pkg.vhd new file mode 100644 index 0000000000000000000000000000000000000000..e708a66d17fb3415b533e2e2ba876421e9657991 --- /dev/null +++ b/applications/lofar1/pfs/src/vhdl/pfs_pkg.vhd @@ -0,0 +1,41 @@ +------------------------------------------------------------------------------- +-- +-- Copyright 2021 +-- 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, for pfs original 2004 by W. Lubberhuizen / W. Poeisz +-- Purpose: Polyphase FIR filter +-- Description: Ported from LOFAR1, see readme_lofar1.txt +-- Remark: Use package to keep default pfs constants + +LIBRARY IEEE; +USE IEEE.STD_LOGIC_1164.ALL; +USE IEEE.NUMERIC_STD.ALL; + +PACKAGE pfs_pkg IS + + CONSTANT c_pfs_coef_w : NATURAL := 16; + CONSTANT c_pfs_coefs_file : STRING := "data/pfs_coefsbuf_1024.hex"; + +END pfs_pkg; + + +PACKAGE BODY pfs_pkg IS +END pfs_pkg; + + diff --git a/applications/lofar1/pfs/tb/vhdl/tb_pfs.vhd b/applications/lofar1/pfs/tb/vhdl/tb_pfs.vhd index 3d1420b1709690fe4e1a32cc92479cfb7129f71b..db7c793e6c931232db65b1ede2d626364ac47f33 100644 --- a/applications/lofar1/pfs/tb/vhdl/tb_pfs.vhd +++ b/applications/lofar1/pfs/tb/vhdl/tb_pfs.vhd @@ -1,3 +1,26 @@ +------------------------------------------------------------------------------- +-- +-- Copyright 2021 +-- 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: ported by E. Kooistra, original 2004 by W. Lubberhuizen / W. Poeisz +-- Purpose: Testbench for Polyphase FIR filter +-- -- Usage: -- > as 5 -- > run -a diff --git a/applications/lofar1/readme_lofar1.txt b/applications/lofar1/readme_lofar1.txt index c252f9e0b705b6b8c1e444048b2e6e0d8e5635c8..a2919ef2722301fd3369f6d7de589a4b0f7096fa 100644 --- a/applications/lofar1/readme_lofar1.txt +++ b/applications/lofar1/readme_lofar1.txt @@ -113,12 +113,18 @@ c) Simulating tb/vhdl/tb_pft2.vhd -5) Add generics - * pft2: - - g_stage_dat_w +5) Add generics and package constant defaults + * pfs_pkg.vhd: + - g_pfs_coef_dat_w, default is c_pfs_coef_w = 16, should match coefs in g_pfs_coefs_file + - g_pfs_coefs_file, default is c_pfs_coefs_file = "data/pfs_coefsbuf_1024.hex" + + * pft2_pkg.vhd: + - c_coeff_w in pft_tmult.vhd default is c_pft_twiddle_w = 16 + - g_stage_dat_w in pft.vhd, default is c_pft_stage_dat_w = 20 - verified range of g_stage_dat_w in tb_pft2 - verified switch_en input in tb_pft2 - * pfb2: + + * pfb2.vhd: - g_switch_en - g_stage_dat_w - g_pfs_bypass