1 |
2 |
danv |
--------------------------------------------------------------------------------
|
2 |
|
|
--
|
3 |
|
|
-- Copyright (C) 2016
|
4 |
|
|
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
|
5 |
|
|
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
|
6 |
|
|
--
|
7 |
|
|
-- This program is free software: you can redistribute it and/or modify
|
8 |
|
|
-- it under the terms of the GNU General Public License as published by
|
9 |
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
10 |
|
|
-- (at your option) any later version.
|
11 |
|
|
--
|
12 |
|
|
-- This program is distributed in the hope that it will be useful,
|
13 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
-- GNU General Public License for more details.
|
16 |
|
|
--
|
17 |
|
|
-- You should have received a copy of the GNU General Public License
|
18 |
|
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19 |
|
|
--
|
20 |
|
|
--------------------------------------------------------------------------------
|
21 |
|
|
|
22 |
|
|
-- Purpose: Multi-testbench for fil_ppf_wide using file data
|
23 |
|
|
-- Description:
|
24 |
|
|
-- Verify fil_ppf_wide using coefficients and data generated by
|
25 |
|
|
-- Matlab $RADIOHDL_WORK/applications/apertif/matlab/run_pfir.m
|
26 |
|
|
--
|
27 |
|
|
-- Usage:
|
28 |
|
|
-- > as 4
|
29 |
|
|
-- > run -all
|
30 |
|
|
|
31 |
|
|
LIBRARY IEEE, common_pkg_lib;
|
32 |
|
|
USE IEEE.std_logic_1164.ALL;
|
33 |
|
|
USE common_pkg_lib.common_pkg.all;
|
34 |
|
|
USE work.fil_pkg.all;
|
35 |
|
|
|
36 |
|
|
ENTITY tb_tb_fil_ppf_wide_file_data IS
|
37 |
|
|
END tb_tb_fil_ppf_wide_file_data;
|
38 |
|
|
|
39 |
|
|
ARCHITECTURE tb OF tb_tb_fil_ppf_wide_file_data IS
|
40 |
|
|
|
41 |
|
|
CONSTANT c_pipeline : t_fil_ppf_pipeline := (1, 1, 1, 1, 1, 1, 0);
|
42 |
|
|
|
43 |
|
|
CONSTANT c_coeff_prefix : string := "hex/run_pfir_m_pfir_coeff_fircls1";
|
44 |
|
|
CONSTANT c_data : string := "data/run_pfir_m_sinusoid_chirp_8b_16taps_128points_16b_16b.dat"; -- coefs, input and output data for 1 stream
|
45 |
|
|
CONSTANT c_data15 : string := "data/run_pfir_m_sinusoid_chirp_8b_15taps_128points_16b_16b.dat"; -- coefs, input and output data for 1 stream
|
46 |
|
|
|
47 |
|
|
SIGNAL tb_end : STD_LOGIC := '0'; -- declare tb_end to avoid 'No objects found' error on 'when -label tb_end'
|
48 |
|
|
|
49 |
|
|
BEGIN
|
50 |
|
|
|
51 |
|
|
--g_big_endian_wb_in : boolean := true;
|
52 |
|
|
--g_big_endian_wb_out : boolean := true;
|
53 |
|
|
--g_fil_ppf_pipeline : t_fil_ppf_pipeline := (1, 1, 1, 1, 1, 1, 0);
|
54 |
|
|
-- -- type t_fil_pipeline is record
|
55 |
|
|
-- -- -- generic for the taps and coefficients memory
|
56 |
|
|
-- -- mem_delay : natural; -- = 2
|
57 |
|
|
-- -- -- generics for the multiplier in in the filter unit
|
58 |
|
|
-- -- mult_input : natural; -- = 1
|
59 |
|
|
-- -- mult_product : natural; -- = 1
|
60 |
|
|
-- -- mult_output : natural; -- = 1
|
61 |
|
|
-- -- -- generics for the adder tree in in the filter unit
|
62 |
|
|
-- -- adder_stage : natural; -- = 1
|
63 |
|
|
-- -- -- generics for the requantizer in the filter unit
|
64 |
|
|
-- -- requant_remove_lsb : natural; -- = 1
|
65 |
|
|
-- -- requant_remove_msb : natural; -- = 0
|
66 |
|
|
-- -- end record;
|
67 |
|
|
--g_fil_ppf : t_fil_ppf := (1, 1, 64, 8, 1, 8, 20, 16);
|
68 |
|
|
-- -- type t_fil_ppf is record
|
69 |
|
|
-- -- wb_factor : natural; -- = 1, the wideband factor
|
70 |
|
|
-- -- nof_chan : natural; -- = default 0, defines the number of channels (=time-multiplexed input signals): nof channels = 2**nof_chan
|
71 |
|
|
-- -- nof_bands : natural; -- = 128, the number of polyphase channels (= number of points of the FFT)
|
72 |
|
|
-- -- nof_taps : natural; -- = 16, the number of FIR taps per subband
|
73 |
|
|
-- -- nof_streams : natural; -- = 1, the number of streams that are served by the same coefficients.
|
74 |
|
|
-- -- backoff_w : natural; -- = 0, number of bits for input backoff to avoid output overflow
|
75 |
|
|
-- -- in_dat_w : natural; -- = 8, number of input bits per stream
|
76 |
|
|
-- -- out_dat_w : natural; -- = 23, number of output bits (per stream). It is set to in_dat_w+coef_dat_w-1 = 23 to be sure the requantizer
|
77 |
|
|
-- -- does not remove any of the data in order to be able to verify with the original coefficients values.
|
78 |
|
|
-- -- coef_dat_w : natural; -- = 16, data width of the FIR coefficients
|
79 |
|
|
-- -- end record;
|
80 |
|
|
--g_coefs_file_prefix : string := "hex/run_pfir_m_pfir_coeff_fircls1";
|
81 |
|
|
--g_data_file : string := "data/run_pfir_m_sinusoid_chirp_8b_16taps_128points_16b_16b.dat"; -- coefs, input and output data for 1 stream
|
82 |
|
|
--g_data_file_nof_lines : natural := 25600; -- number of lines with input data that is available in the g_data_file
|
83 |
|
|
--g_data_file_nof_read : natural := 5000; -- number of lines with input data to read and simulate, must be <= g_data_file_nof_lines
|
84 |
|
|
--g_enable_in_val_gaps : boolean := FALSE
|
85 |
|
|
|
86 |
|
|
-- verify fil_ppf_wide for wb_factor=1, so effectively same as using fil_ppf_single directly
|
87 |
|
|
u1_act : ENTITY work.tb_fil_ppf_wide_file_data GENERIC MAP (FALSE, FALSE, c_pipeline, (1, 0, 128, 16, 1, 1, 8, 16, 16), c_coeff_prefix, c_data, 25600, 25600, FALSE);
|
88 |
|
|
u1_act_15taps : ENTITY work.tb_fil_ppf_wide_file_data GENERIC MAP (FALSE, FALSE, c_pipeline, (1, 0, 128, 15, 1, 1, 8, 16, 16), c_coeff_prefix, c_data15, 25600, 5000, FALSE);
|
89 |
|
|
u1_rnd : ENTITY work.tb_fil_ppf_wide_file_data GENERIC MAP (FALSE, FALSE, c_pipeline, (1, 0, 128, 16, 1, 1, 8, 16, 16), c_coeff_prefix, c_data, 25600, 5000, TRUE);
|
90 |
|
|
u1_rnd_channels_streams : ENTITY work.tb_fil_ppf_wide_file_data GENERIC MAP (FALSE, FALSE, c_pipeline, (1, 1, 128, 16, 2, 1, 8, 16, 16), c_coeff_prefix, c_data, 25600, 5000, TRUE);
|
91 |
|
|
|
92 |
|
|
-- verify fil_ppf_wide for wb_factor>1 (be = big endian, le = little endian)
|
93 |
|
|
u4_act : ENTITY work.tb_fil_ppf_wide_file_data GENERIC MAP ( TRUE, TRUE, c_pipeline, (4, 0, 128, 16, 1, 1, 8, 16, 16), c_coeff_prefix, c_data, 25600, 25600, FALSE);
|
94 |
|
|
u4_act_be_le : ENTITY work.tb_fil_ppf_wide_file_data GENERIC MAP ( TRUE, FALSE, c_pipeline, (4, 0, 128, 16, 1, 1, 8, 16, 16), c_coeff_prefix, c_data, 25600, 25600, FALSE);
|
95 |
|
|
u4_act_le_be : ENTITY work.tb_fil_ppf_wide_file_data GENERIC MAP (FALSE, TRUE, c_pipeline, (4, 0, 128, 16, 1, 1, 8, 16, 16), c_coeff_prefix, c_data, 25600, 25600, FALSE);
|
96 |
|
|
u4_act_le_le : ENTITY work.tb_fil_ppf_wide_file_data GENERIC MAP (FALSE, FALSE, c_pipeline, (4, 0, 128, 16, 1, 1, 8, 16, 16), c_coeff_prefix, c_data, 25600, 25600, FALSE);
|
97 |
|
|
u4_act_15taps : ENTITY work.tb_fil_ppf_wide_file_data GENERIC MAP ( TRUE, TRUE, c_pipeline, (4, 0, 128, 15, 1, 1, 8, 16, 16), c_coeff_prefix, c_data15, 25600, 5000, FALSE);
|
98 |
|
|
u4_rnd : ENTITY work.tb_fil_ppf_wide_file_data GENERIC MAP ( TRUE, TRUE, c_pipeline, (4, 0, 128, 16, 1, 1, 8, 16, 16), c_coeff_prefix, c_data, 25600, 5000, TRUE);
|
99 |
|
|
u4_rnd_channels_streams : ENTITY work.tb_fil_ppf_wide_file_data GENERIC MAP ( TRUE, TRUE, c_pipeline, (4, 1, 128, 16, 4, 1, 8, 16, 16), c_coeff_prefix, c_data, 25600, 5000, TRUE);
|
100 |
|
|
|
101 |
|
|
END tb;
|