diff --git a/libraries/dsp/wpfb/src/vhdl/wpfb_pkg.vhd b/libraries/dsp/wpfb/src/vhdl/wpfb_pkg.vhd index 12730e7fa80dafbd458a2215319ec1d529a1b9af..5b2aefd0e897ab4d2cf5042836c58a3d990634bc 100644 --- a/libraries/dsp/wpfb/src/vhdl/wpfb_pkg.vhd +++ b/libraries/dsp/wpfb/src/vhdl/wpfb_pkg.vhd @@ -66,10 +66,18 @@ package wpfb_pkg is -- Pipeline parameters for both poly phase filter and FFT. These are heritaged from the filter and fft libraries. pft_pipeline : t_fft_pipeline; -- Pipeline settings for the pipelined FFT fft_pipeline : t_fft_pipeline; -- Pipeline settings for the parallel FFT - fil_pipeline : t_fil_ppf_pipeline; -- Pipeline settings for the filter units - + fil_pipeline : t_fil_ppf_pipeline; -- Pipeline settings for the filter units + end record; + + -- Extra parameters for the (wideband) poly phase filter, put in new record to show that they are new + type t_wpfb_extra is record + r2_mul_extra_w : natural; -- 0 --> 2, extra LSbits at rTwoMult output in rTwoSDFStage to improve FFT stage output requantization + sepa_extra_w : natural; -- 0 --> 2, extra LSbits in output of last rTwoSDFStage to improve two real separate requantization end record; + CONSTANT c_wpfb_extra_none : t_wpfb_extra := (0, 0); + CONSTANT c_wpfb_extra_lofar20 : t_wpfb_extra := (2, 2); + ----------------------------------------------------------------------------- -- Apertif application specfic settings ----------------------------------------------------------------------------- diff --git a/libraries/dsp/wpfb/src/vhdl/wpfb_unit_dev.vhd b/libraries/dsp/wpfb/src/vhdl/wpfb_unit_dev.vhd index 5120a95708dc58f7046698a595c5ce5f66fc5ac1..67d65dac3c7cb640832ca576997c8cf46634ec0f 100644 --- a/libraries/dsp/wpfb/src/vhdl/wpfb_unit_dev.vhd +++ b/libraries/dsp/wpfb/src/vhdl/wpfb_unit_dev.vhd @@ -360,8 +360,7 @@ entity wpfb_unit_dev is generic ( g_big_endian_wb_in : boolean := true; g_wpfb : t_wpfb; - g_r2_mul_extra_w : natural := 0; -- extra bits at rTwoWMul output in rTwoSDFStage to improve rTwoSDFStage output requantization in fft_r2_pipe and fft_r2_wide - g_sepa_extra_w : natural := 0; -- extra LSbits in output of last rTwoSDFStage to improve two real separate requantization in fft_r2_pipe + g_wpfb_extra : t_wpfb_extra := c_wpfb_extra_none; g_dont_flip_channels: boolean := false; -- True preserves channel interleaving for pipelined FFT g_use_prefilter : boolean := TRUE; g_stats_ena : boolean := TRUE; -- Enables the statistics unit @@ -570,7 +569,7 @@ begin g_fft => c_fft, -- generics for the WFFT g_pft_pipeline => g_wpfb.pft_pipeline, g_fft_pipeline => g_wpfb.fft_pipeline, - g_r2_mul_extra_w => g_r2_mul_extra_w + g_r2_mul_extra_w => g_wpfb_extra.r2_mul_extra_w ) port map( clk => dp_clk, @@ -595,8 +594,8 @@ begin g_fft => c_fft, g_pipeline => g_wpfb.fft_pipeline, g_dont_flip_channels => g_dont_flip_channels, - g_r2_mul_extra_w => g_r2_mul_extra_w, - g_sepa_extra_w => g_sepa_extra_w + g_r2_mul_extra_w => g_wpfb_extra.r2_mul_extra_w, + g_sepa_extra_w => g_wpfb_extra.sepa_extra_w ) port map( clk => dp_clk, diff --git a/libraries/dsp/wpfb/tb/vhdl/tb_wpfb_unit_dev_wg.vhd b/libraries/dsp/wpfb/tb/vhdl/tb_wpfb_unit_dev_wg.vhd index 3ad305b38bf3a4956ef5f3348403a932fc83b163..c635538264f8b4f73ef91718ea292b41948f40ef 100644 --- a/libraries/dsp/wpfb/tb/vhdl/tb_wpfb_unit_dev_wg.vhd +++ b/libraries/dsp/wpfb/tb/vhdl/tb_wpfb_unit_dev_wg.vhd @@ -94,7 +94,7 @@ ENTITY tb_wpfb_unit_dev_wg IS -- WG g_subband_index_a : REAL := 61.0; -- 0:511 g_subband_index_b : REAL := 61.0; -- 0:511 - g_amplitude_a : REAL := 0.99; -- 1.0 is full scale + g_amplitude_a : REAL := 1.0; -- 1.0 is full scale g_amplitude_b : REAL := 0.0; -- 1.0 is full scale g_phase_a : REAL := 0.0; -- 0:360 degrees g_phase_b : REAL := 0.0; -- 0:360 degrees @@ -124,17 +124,17 @@ ENTITY tb_wpfb_unit_dev_wg IS g_fil_coef_dat_w : NATURAL := 16; -- = 16, data width of the FIR coefficients --g_fil_coef_dat_w : NATURAL := 18; -- = 16, data width of the FIR coefficients g_fil_backoff_w : NATURAL := 0; -- = 0, number of bits for input backoff to avoid output overflow - g_fil_in_dat_w : NATURAL := 14; -- = W_adc, number of input bits + g_fil_in_dat_w : NATURAL := 8; -- = W_adc, number of input bits - g_internal_dat_w : NATURAL := 19; -- = number of bits between fil and fft, g_internal_dat_w <= g_fft_stage_dat_w - g_fft_guard_w in fft_r2_pipe + g_internal_dat_w : NATURAL := 17; -- = number of bits between fil and fft, g_internal_dat_w <= g_fft_stage_dat_w - g_fft_guard_w in fft_r2_pipe -- FFT - g_fft_out_dat_w : NATURAL := 20; -- = W_subband, number of output bits + g_fft_out_dat_w : NATURAL := 18; -- = W_subband, number of output bits g_fft_out_gain_w : NATURAL := 0; -- = 1, output gain factor applied after the last stage output, before requantization to out_dat_w - g_fft_stage_dat_w : NATURAL := 20; -- = c_dsp_mult_w = 18, number of bits that are used inter-stage + g_fft_stage_dat_w : NATURAL := 18; -- = c_dsp_mult_w = 18, number of bits that are used inter-stage g_fft_guard_w : NATURAL := 1; -- = 2 - g_r2_mul_extra_w : NATURAL := 2; -- = 2, extra bits at rTwoWMul output in rTwoSDFStage to improve rTwoSDFStage output requantization in fft_r2_pipe in wpfb_unit_dev - g_sepa_extra_w : NATURAL := 2 -- = 2, extra LSbits in output of last rTwoSDFStage to improve two real separate requantization in fft_r2_pipe in wpfb_unit_dev + g_r2_mul_extra_w : NATURAL := 0; -- = 2, extra bits at rTwoWMul output in rTwoSDFStage to improve rTwoSDFStage output requantization in fft_r2_pipe in wpfb_unit_dev + g_sepa_extra_w : NATURAL := 0 -- = 2, extra LSbits in output of last rTwoSDFStage to improve two real separate requantization in fft_r2_pipe in wpfb_unit_dev ); END ENTITY tb_wpfb_unit_dev_wg; @@ -183,6 +183,9 @@ ARCHITECTURE tb OF tb_wpfb_unit_dev_wg IS 16, g_fil_backoff_w, g_fil_in_dat_w, g_internal_dat_w, g_fil_coef_dat_w, true, false, true, g_internal_dat_w, g_fft_out_dat_w, g_fft_out_gain_w, g_fft_stage_dat_w, g_fft_guard_w, true, 54, 2, 10, c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline); + + CONSTANT c_wpfb_extra : t_wpfb_extra := (g_r2_mul_extra_w, g_sepa_extra_w); + CONSTANT c_N_fft : NATURAL := c_wpfb.nof_points; CONSTANT c_N_sub : NATURAL := c_N_fft / c_nof_complex; @@ -993,8 +996,7 @@ BEGIN u_dut : ENTITY work.wpfb_unit_dev GENERIC MAP ( g_wpfb => c_wpfb, - g_r2_mul_extra_w => g_r2_mul_extra_w, - g_sepa_extra_w => g_sepa_extra_w, + g_wpfb_extra => c_wpfb_extra, g_coefs_file_prefix => g_fil_coefs_file_prefix ) PORT MAP (