OpenCores
URL https://opencores.org/ocsvn/astron_wpfb/astron_wpfb/trunk

Subversion Repositories astron_wpfb

[/] [astron_wpfb/] [trunk/] [tb_wpfb_unit_wide.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 danv
-- Author: Eric Kooistra    : kooistra at astron.nl: july 2016
2
--------------------------------------------------------------------------------
3
--
4
-- Copyright (C) 2016
5
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
6
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
7
--
8
-- This program is free software: you can redistribute it and/or modify
9
-- it under the terms of the GNU General Public License as published by
10
-- the Free Software Foundation, either version 3 of the License, or
11
-- (at your option) any later version.
12
--
13
-- This program is distributed in the hope that it will be useful,
14
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
-- GNU General Public License for more details.
17
--
18
-- You should have received a copy of the GNU General Public License
19
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
--
21
--------------------------------------------------------------------------------
22
--
23
-- Purpose: Test bench for wpfb_unit_dev.vhd using file data
24
--
25
-- Description:
26
--   This tb uses the Matlab stimuli and expected results obtained with:
27
--
28
--   $RADIOHDL_WORK/applications/apertif/matlab/run_pfb.m
29
--   $RADIOHDL_WORK/applications/apertif/matlab/run_pfb_complex.m
30
--
31
--   For more description see:
32
--   . tb_fil_ppf_wide_file_data.vhd
33
--   . tb_fft_r2_wide.vhd
34
--
35
-- Remark:
36
--   . tb supports wb_factor = 1 and wb_factor > 1
37
--   . tb supports use_separate for complex and two real input 
38
--   . tb supports use_reorder for complex input with flipped or reordered output
39
--   . tb supports use_reorder for two real input with reordered output
40
--   . tb does support nof_wb_streams > 1
41
--   . tb does support nof_chan > 0 
42
-- 
43
-- Usage:
44
--   > run -all
45
--   > testbench is selftesting.
46
--   > observe the *_scope signals as radix decimal, format analogue format
47
--     signals in the Wave window
48
--
49
library ieee, common_pkg_lib, dp_pkg_lib, astron_filter_lib, astron_r2sdf_fft_lib, astron_wb_fft_lib, astron_ram_lib, astron_mm_lib, dp_components_lib, astron_sim_tools_lib;
50
use IEEE.std_logic_1164.all;
51
use IEEE.numeric_std.all;
52
use IEEE.std_logic_textio.all;
53
use std.textio.all;
54
use common_pkg_lib.common_pkg.all;
55
use astron_ram_lib.common_ram_pkg.ALL;
56
use common_pkg_lib.common_lfsr_sequences_pkg.ALL;
57
use common_pkg_lib.tb_common_pkg.all;
58
use astron_mm_lib.tb_common_mem_pkg.ALL;
59
use dp_pkg_lib.dp_stream_pkg.all;
60
use astron_filter_lib.fil_pkg.all;
61
use astron_r2sdf_fft_lib.rTwoSDFPkg.all;
62
use astron_wb_fft_lib.fft_pkg.all;
63
use astron_wb_fft_lib.tb_fft_pkg.all;
64
use work.wpfb_pkg.all;
65
 
66
entity tb_wpfb_unit_wide is
67
  generic(
68
    -- DUT generics
69
    g_wpfb : t_wpfb := (4, 32, 0, 1,
70
                        16, 1, 8, 16, 16,
71
                        true, false, true, 16, 16, 1, c_dsp_mult_w, 2, true, 56, 2, 20,
72
                        c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline);
73
    --  type t_wpfb is record  
74
    --    -- General parameters for the wideband poly phase filter
75
    --    wb_factor         : natural;        -- = default 4, wideband factor
76
    --    nof_points        : natural;        -- = 1024, N point FFT (Also the number of subbands for the filter part)
77
    --    nof_chan          : natural;        -- = default 0, defines the number of channels (=time-multiplexed input signals): nof channels = 2**nof_chan
78
    --    nof_wb_streams    : natural;        -- = 1, the number of parallel wideband streams. The filter coefficients are shared on every wb-stream. 
79
    --    
80
    --    -- Parameters for the poly phase filter
81
    --    nof_taps          : natural;        -- = 16, the number of FIR taps per subband
82
    --    fil_backoff_w     : natural;        -- = 0, number of bits for input backoff to avoid output overflow
83
    --    fil_in_dat_w      : natural;        -- = 8, number of input bits
84
    --    fil_out_dat_w     : natural;        -- = 16, number of output bits
85
    --    coef_dat_w        : natural;        -- = 16, data width of the FIR coefficients
86
    --                                      
87
    --    -- Parameters for the FFT         
88
    --    use_reorder       : boolean;        -- = false for bit-reversed output, true for normal output
89
    --    use_fft_shift     : boolean;        -- = false for [0, pos, neg] bin frequencies order, true for [neg, 0, pos] bin frequencies order in case of complex input
90
    --    use_separate      : boolean;        -- = false for complex input, true for two real inputs
91
    --    fft_in_dat_w      : natural;        -- = 16, number of input bits
92
    --    fft_out_dat_w     : natural;        -- = 13, number of output bits
93
    --    fft_out_gain_w    : natural;        -- = 0, output gain factor applied after the last stage output, before requantization to out_dat_w
94
    --    stage_dat_w       : natural;        -- = 18, number of bits that are used inter-stage
95
    --    guard_w           : natural;        -- = 2
96
    --    guard_enable      : boolean;        -- = true
97
    --
98
    --    -- Parameters for the statistics
99
    --    stat_data_w       : positive;       -- = 56
100
    --    stat_data_sz      : positive;       -- = 2
101
    --    nof_blk_per_sync  : natural;        -- = 800000, number of FFT output blocks per sync interval
102
    -- 
103
    --    -- Pipeline parameters for both poly phase filter and FFT. These are heritaged from the filter and fft libraries.  
104
    --    pft_pipeline      : t_fft_pipeline;     -- Pipeline settings for the pipelined FFT
105
    --    fft_pipeline      : t_fft_pipeline;     -- Pipeline settings for the parallel FFT
106
    --    fil_pipeline      : t_fil_ppf_pipeline; -- Pipeline settings for the filter units 
107
    --  end record;
108
 
109
    -- TB generics
110
    g_diff_margin           : integer := 5;  -- maximum difference between HDL output and expected output (> 0 to allow minor rounding differences)
111
                                             -- for complex  diff margin = 3 appears sufficient
112
                                             -- for two_real diff margin = 5 appears sufficient
113
                                             -- if stage_dat_w >> 18 >= fft_out_dat_w then g_diff_margin = 1 is sufficient
114
 
115
    -- PFIR coefficients
116
    g_coefs_file_prefix_ab    : string := "data/run_pfb_m_pfir_coeff_fircls1";
117
    g_coefs_file_prefix_c     : string := "data/run_pfb_complex_m_pfir_coeff_fircls1";
118
 
119
    -- Two real input data files A and B used when g_fft.use_separate = true
120
    -- * 1024 points = 512 subbands
121
    --g_data_file_a           : string := "data/run_pfb_m_sinusoid_chirp_8b_16taps_1024points_16b_16b.dat";
122
    --g_data_file_a_nof_lines : natural := 204800;
123
    --g_data_file_b           : string := "UNUSED";
124
    --g_data_file_b_nof_lines : natural := 0;
125
 
126
    -- * 32 points = 16 subbands
127
    --g_data_file_a           : string := "data/run_pfb_m_sinusoid_chirp_8b_16taps_32points_16b_16b.dat";
128
    --g_data_file_a_nof_lines : natural := 6400;
129
    g_data_file_a           : string := "data/run_pfb_m_sinusoid_8b_16taps_32points_16b_16b.dat";
130
    g_data_file_a_nof_lines : natural := 1600;
131
 
132
    --g_data_file_b           : string := "data/run_pfb_m_impulse_chirp_8b_16taps_32points_16b_16b.dat";
133
    --g_data_file_b_nof_lines : natural := 6400;
134
    g_data_file_b           : string := "UNUSED";
135
    g_data_file_b_nof_lines : natural := 0;
136
 
137
    -- One complex input data file C used when g_fft.use_separate = false
138
    -- * 64 points = 64 channels
139
    --g_data_file_c           : string := "data/run_pfb_complex_m_phasor_chirp_8b_16taps_64points_16b_16b.dat";
140
    --g_data_file_c_nof_lines : natural := 12800;
141
    --g_data_file_c           : string := "data/run_pfb_complex_m_phasor_8b_16taps_64points_16b_16b.dat";
142
    --g_data_file_c_nof_lines : natural := 320;
143
    --g_data_file_c           : string := "data/run_pfb_complex_m_noise_8b_16taps_64points_16b_16b.dat";
144
    --g_data_file_c_nof_lines : natural := 640;
145
 
146
    -- * 32 points = 32 channels
147
    --g_data_file_c           : string := "data/run_pfb_complex_m_phasor_chirp_8b_16taps_32points_16b_16b.dat";
148
    --g_data_file_c_nof_lines : natural := 6400;
149
    --g_data_file_c           : string := "data/run_pfb_complex_m_phasor_8b_16taps_32points_16b_16b.dat";
150
    --g_data_file_c_nof_lines : natural := 1600;
151
    g_data_file_c           : string := "data/run_pfb_complex_m_noise_complex_8b_16taps_32points_16b_16b.dat";
152
    g_data_file_c_nof_lines : natural := 1600;
153
 
154
    g_data_file_nof_lines   : natural := 1600;   -- actual number of lines with input data to simulate from the data files, must be <= g_data_file_*_nof_lines
155
    g_enable_in_val_gaps    : boolean := FALSE   -- when false then in_val flow control active continuously, else with random inactive gaps
156
  );
157
end entity tb_wpfb_unit_wide;
158
 
159
architecture tb of tb_wpfb_unit_wide is
160
 
161
  constant c_big_endian_wb_in      : boolean := true;
162
 
163
  constant c_clk_period            : time := 10 ns;
164
  constant c_sclk_period           : time := c_clk_period / g_wpfb.wb_factor;
165
 
166
  constant c_in_complex            : boolean := not g_wpfb.use_separate;
167
 
168
  constant c_nof_channels          : natural := 2**g_wpfb.nof_chan;
169
  constant c_nof_coefs             : natural := g_wpfb.nof_taps * g_wpfb.nof_points;       -- nof PFIR coef
170
 
171
  constant c_nof_data_per_block    : natural := g_wpfb.nof_points * c_nof_channels;
172
  constant c_nof_valid_per_block   : natural := c_nof_data_per_block / g_wpfb.wb_factor;
173
 
174
  constant c_rnd_factor            : natural := sel_a_b(g_enable_in_val_gaps, 3, 1);
175
  constant c_dut_block_latency     : natural := func_wpfb_maximum_sop_latency(g_wpfb);  -- choose large enough for output to have become available
176
  constant c_dut_clk_latency       : natural := c_nof_valid_per_block * c_dut_block_latency * c_rnd_factor;  -- worst case
177
 
178
  -- PFIR coefficients file access
179
  constant c_coefs_dat_file_prefix    : string  := sel_a_b(c_in_complex, g_coefs_file_prefix_c, g_coefs_file_prefix_ab) &
180
                                                                         "_" & integer'image(g_wpfb.nof_taps) & "taps" &
181
                                                                         "_" & integer'image(g_wpfb.nof_points) & "points" &
182
                                                                         "_" & integer'image(g_wpfb.coef_dat_w) & "b";
183
  constant c_coefs_mif_file_prefix    : string  := c_coefs_dat_file_prefix & "_" & integer'image(g_wpfb.wb_factor) & "wb";
184
 
185
  -- input/output data width
186
  constant c_in_dat_w              : natural := g_wpfb.fil_in_dat_w;
187
  constant c_fil_dat_w             : natural := g_wpfb.fil_out_dat_w;
188
  constant c_out_dat_w             : natural := g_wpfb.fft_out_dat_w;
189
 
190
  -- Data file access (Header + PFIR coefficients + WG data + PFIR data + PFFT data)
191
  constant c_nof_lines_header        : natural := 4;
192
  constant c_nof_lines_pfir_coefs    : natural := c_nof_coefs;                                -- PFIR coefficients
193
  constant c_nof_lines_a_wg_dat      : natural := g_data_file_a_nof_lines;                    -- Real input A via in_re, one value per line
194
  constant c_nof_lines_a_pfir_dat    : natural := g_data_file_a_nof_lines;                    -- Real pfir A, one value per line
195
  constant c_nof_lines_a_pfft_dat    : natural := g_data_file_a_nof_lines/c_nof_complex;      -- Half spectrum, two values per line (re, im)
196
  constant c_nof_lines_a_wg_header   : natural := c_nof_lines_header + c_nof_lines_pfir_coefs;
197
  constant c_nof_lines_a_pfir_header : natural := c_nof_lines_header + c_nof_lines_pfir_coefs + c_nof_lines_a_wg_dat;
198
  constant c_nof_lines_a_pfft_header : natural := c_nof_lines_header + c_nof_lines_pfir_coefs + c_nof_lines_a_wg_dat + c_nof_lines_a_pfir_dat;
199
  constant c_nof_lines_b_wg_dat      : natural := g_data_file_b_nof_lines;                    -- Real input A via in_re, one value per line
200
  constant c_nof_lines_b_pfir_dat    : natural := g_data_file_b_nof_lines;                    -- Real pfir A, one value per line
201
  constant c_nof_lines_b_pfft_dat    : natural := g_data_file_b_nof_lines/c_nof_complex;      -- Half spectrum, two values per line (re, im)
202
  constant c_nof_lines_b_wg_header   : natural := c_nof_lines_header + c_nof_lines_pfir_coefs;
203
  constant c_nof_lines_b_pfir_header : natural := c_nof_lines_header + c_nof_lines_pfir_coefs + c_nof_lines_b_wg_dat;
204
  constant c_nof_lines_b_pfft_header : natural := c_nof_lines_header + c_nof_lines_pfir_coefs + c_nof_lines_b_wg_dat + c_nof_lines_b_pfir_dat;
205
  constant c_nof_lines_c_wg_dat      : natural := g_data_file_c_nof_lines;                    -- Complex input, two values per line (re, im)
206
  constant c_nof_lines_c_pfir_dat    : natural := g_data_file_c_nof_lines;                    -- Complex pfir, two values per line (re, im)
207
  constant c_nof_lines_c_pfft_dat    : natural := g_data_file_c_nof_lines;                    -- Full spectrum, two values per line (re, im)
208
  constant c_nof_lines_c_wg_header   : natural := c_nof_lines_header + c_nof_lines_pfir_coefs;
209
  constant c_nof_lines_c_pfir_header : natural := c_nof_lines_header + c_nof_lines_pfir_coefs + c_nof_lines_c_wg_dat;
210
  constant c_nof_lines_c_pfft_header : natural := c_nof_lines_header + c_nof_lines_pfir_coefs + c_nof_lines_c_wg_dat + c_nof_lines_c_pfir_dat;
211
 
212
  -- signal definitions
213
  signal tb_end                 : std_logic := '0';
214
  signal tb_end_almost          : std_logic := '0';
215
  signal clk                    : std_logic := '0';
216
  signal sclk                   : std_logic := '0';
217
  signal rst                    : std_logic := '0';
218
  signal random                 : std_logic_vector(15 DOWNTO 0) := (OTHERS=>'0');  -- use different lengths to have different random sequences
219
 
220
  signal coefs_dat_arr          : t_integer_arr(c_nof_coefs-1 downto 0) := (OTHERS=>0);  -- = PFIR coef for all taps as read from via c_coefs_dat_file_prefix
221
  signal coefs_ref_c_arr        : t_integer_arr(c_nof_coefs-1 downto 0) := (OTHERS=>0);  -- = PFIR coef for all taps as read from via g_data_file_c
222
  signal coefs_ref_a_arr        : t_integer_arr(c_nof_coefs-1 downto 0) := (OTHERS=>0);  -- = PFIR coef for all taps as read from via g_data_file_a
223
  signal coefs_ref_b_arr        : t_integer_arr(c_nof_coefs-1 downto 0) := (OTHERS=>0);  -- = PFIR coef for all taps as read from via g_data_file_b
224
 
225
  signal input_data_a_arr       : t_integer_arr(0 to g_data_file_nof_lines-1) := (OTHERS=>0);                -- one value per line (A via re input)
226
  signal input_data_b_arr       : t_integer_arr(0 to g_data_file_nof_lines-1) := (OTHERS=>0);                -- one value per line (B via im input)
227
  signal input_data_c_arr       : t_integer_arr(0 to g_data_file_nof_lines*c_nof_complex-1) := (OTHERS=>0);  -- two values per line (re, im)
228
 
229
  signal exp_filter_data_a_arr     : t_integer_arr(0 to g_data_file_nof_lines-1) := (OTHERS=>0);                -- one value per line (A via re input)
230
  signal exp_filter_data_b_arr     : t_integer_arr(0 to g_data_file_nof_lines-1) := (OTHERS=>0);                -- one value per line (B via im input)
231
  signal exp_filter_data_c_arr     : t_integer_arr(0 to g_data_file_nof_lines*c_nof_complex-1) := (OTHERS=>0);  -- two values per line (re, im)
232
  signal exp_filter_data_c_re_arr  : t_integer_arr(0 to g_data_file_nof_lines-1) := (OTHERS=>0);                -- one value per line (re input)
233
  signal exp_filter_data_c_im_arr  : t_integer_arr(0 to g_data_file_nof_lines-1) := (OTHERS=>0);                -- one value per line (im input)
234
 
235
  signal output_data_a_re_arr   : t_integer_arr(0 to g_data_file_nof_lines/c_nof_complex-1) := (OTHERS=>0);  -- half spectrum, re
236
  signal output_data_a_im_arr   : t_integer_arr(0 to g_data_file_nof_lines/c_nof_complex-1) := (OTHERS=>0);  -- half spectrum, im
237
  signal output_data_b_re_arr   : t_integer_arr(0 to g_data_file_nof_lines/c_nof_complex-1) := (OTHERS=>0);  -- half spectrum, re
238
  signal output_data_b_im_arr   : t_integer_arr(0 to g_data_file_nof_lines/c_nof_complex-1) := (OTHERS=>0);  -- half spectrum, im
239
  signal output_data_c_re_arr   : t_integer_arr(0 to g_data_file_nof_lines-1) := (OTHERS=>0);                -- full spectrum, re
240
  signal output_data_c_im_arr   : t_integer_arr(0 to g_data_file_nof_lines-1) := (OTHERS=>0);                -- full spectrum, im  
241
 
242
  signal exp_output_data_a_arr    : t_integer_arr(0 to g_data_file_nof_lines-1) := (OTHERS=>0);                -- half spectrum, two values per line (re, im)
243
  signal exp_output_data_a_re_arr : t_integer_arr(0 to g_data_file_nof_lines/c_nof_complex-1) := (OTHERS=>0);  -- half spectrum, re
244
  signal exp_output_data_a_im_arr : t_integer_arr(0 to g_data_file_nof_lines/c_nof_complex-1) := (OTHERS=>0);  -- half spectrum, im
245
  signal exp_output_data_b_arr    : t_integer_arr(0 to g_data_file_nof_lines-1) := (OTHERS=>0);                -- half spectrum, two values per line (re, im)
246
  signal exp_output_data_b_re_arr : t_integer_arr(0 to g_data_file_nof_lines/c_nof_complex-1) := (OTHERS=>0);  -- half spectrum, re
247
  signal exp_output_data_b_im_arr : t_integer_arr(0 to g_data_file_nof_lines/c_nof_complex-1) := (OTHERS=>0);  -- half spectrum, im
248
  signal exp_output_data_c_arr    : t_integer_arr(0 to g_data_file_nof_lines*c_nof_complex-1) := (OTHERS=>0);  -- full spectrum, two values per line (re, im)
249
  signal exp_output_data_c_re_arr : t_integer_arr(0 to g_data_file_nof_lines-1) := (OTHERS=>0);                -- full spectrum, re
250
  signal exp_output_data_c_im_arr : t_integer_arr(0 to g_data_file_nof_lines-1) := (OTHERS=>0);                -- full spectrum, im  
251
 
252
  -- Input
253
  signal in_re_arr              : t_fft_slv_arr(g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 downto 0);
254
  signal in_im_arr              : t_fft_slv_arr(g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 downto 0);
255
  signal in_re_data             : std_logic_vector(g_wpfb.wb_factor*c_in_dat_w-1 DOWNTO 0);  -- scope data only for stream 0
256
  signal in_im_data             : std_logic_vector(g_wpfb.wb_factor*c_in_dat_w-1 DOWNTO 0);  -- scope data only for stream 0
257
  signal in_val                 : std_logic:= '0';
258
  signal in_val_cnt             : natural := 0;
259
  signal in_blk_val             : std_logic;
260
  signal in_blk_val_cnt         : natural := 0;
261
  signal in_gap                 : std_logic := '0';
262
  signal in_sosi_arr            : t_dp_sosi_arr(g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 downto 0) := (others=>c_dp_sosi_rst);
263
  signal in_blk_time            : integer := 0;  -- input block time counter
264
 
265
  signal in_sosi_val            : t_dp_sosi;
266
  signal ref_sosi_ctrl          : t_dp_sosi;
267
  signal ref_re_arr             : t_fft_slv_arr(g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 downto 0);
268
  signal ref_im_arr             : t_fft_slv_arr(g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 downto 0);
269
 
270
  -- Input in sclk domain  
271
  signal in_re_scope            : integer;
272
  signal in_im_scope            : integer;
273
  signal in_val_scope           : std_logic:= '0';
274
 
275
  -- Filter output
276
  signal fil_sosi_arr           : t_dp_sosi_arr(g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 downto 0);
277
  signal fil_re_arr             : t_fft_slv_arr(g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 downto 0);
278
  signal fil_im_arr             : t_fft_slv_arr(g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 downto 0);
279
  signal fil_re_data            : std_logic_vector(g_wpfb.wb_factor*c_fil_dat_w-1 DOWNTO 0);  -- scope data only for stream 0
280
  signal fil_im_data            : std_logic_vector(g_wpfb.wb_factor*c_fil_dat_w-1 DOWNTO 0);  -- scope data only for stream 0
281
  signal fil_val                : std_logic:= '0';  -- for parallel output
282
 
283
  -- Filter in sclk domain
284
  signal fil_re_scope           : integer;
285
  signal fil_im_scope           : integer;
286
  signal fil_val_scope          : std_logic:= '0';
287
  signal exp_fil_re_scope       : integer;
288
  signal exp_fil_im_scope       : integer;
289
 
290
  -- Observe common sosi fields via sosi_arr(0)
291
  signal in_sosi_0              : t_dp_sosi;
292
  signal out_sosi_0             : t_dp_sosi;
293
 
294
  -- Output
295
  signal out_sosi_arr           : t_dp_sosi_arr(g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 downto 0) := (others=>c_dp_sosi_rst);
296
  signal out_re_arr             : t_fft_slv_arr(g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 downto 0);
297
  signal out_im_arr             : t_fft_slv_arr(g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 downto 0);
298
  signal out_re_data            : std_logic_vector(g_wpfb.wb_factor*c_out_dat_w-1 DOWNTO 0);  -- scope data only for stream 0
299
  signal out_im_data            : std_logic_vector(g_wpfb.wb_factor*c_out_dat_w-1 DOWNTO 0);  -- scope data only for stream 0
300
  signal out_val                : std_logic:= '0';  -- for parallel output
301
  signal out_val_cnt            : natural := 0;
302
  signal out_blk_time           : integer := 0;  -- output block time counter
303
 
304
  -- Output in sclk domain  
305
  signal out_re_scope           : integer := 0;
306
  signal out_im_scope           : integer := 0;
307
  signal out_val_a              : std_logic:= '0';  -- for real A
308
  signal out_val_b              : std_logic:= '0';  -- for real B
309
  signal out_val_c              : std_logic:= '0';  -- for complex(A,B)
310
  signal out_channel            : natural := 0;
311
  signal out_cnt                : natural := 0;
312
  signal out_bin_cnt            : natural := 0;
313
  signal out_bin                : natural;
314
 
315
  -- Output data for complex input data
316
  signal out_re_c_scope         : integer := 0;
317
  signal exp_re_c_scope         : integer := 0;
318
  signal out_im_c_scope         : integer := 0;
319
  signal exp_im_c_scope         : integer := 0;
320
  signal diff_re_c_scope        : integer := 0;
321
  signal diff_im_c_scope        : integer := 0;
322
 
323
  -- register control signals to account for sclk register in output scope signals
324
  signal reg_out_val_a          : std_logic;
325
  signal reg_out_val_b          : std_logic;
326
  signal reg_out_val_c          : std_logic;
327
  signal reg_out_channel        : natural := 0;
328
  signal reg_out_cnt            : natural := 0;
329
  signal reg_out_bin_cnt        : natural := 0;
330
  signal reg_out_bin            : natural;
331
  signal reg_out_blk_time       : integer := 0;
332
 
333
  -- Output data two real input data A and B
334
  signal out_re_a_scope         : integer := 0;
335
  signal exp_re_a_scope         : integer := 0;
336
  signal out_im_a_scope         : integer := 0;
337
  signal exp_im_a_scope         : integer := 0;
338
  signal out_re_b_scope         : integer := 0;
339
  signal exp_re_b_scope         : integer := 0;
340
  signal out_im_b_scope         : integer := 0;
341
  signal exp_im_b_scope         : integer := 0;
342
  signal diff_re_a_scope        : integer := 0;
343
  signal diff_im_a_scope        : integer := 0;
344
  signal diff_re_b_scope        : integer := 0;
345
  signal diff_im_b_scope        : integer := 0;
346
 
347
begin
348
 
349
  sclk <= (not sclk) or tb_end after c_sclk_period/2;
350
  clk <= (not clk) or tb_end after c_clk_period/2;
351
  rst <= '1', '0' after c_clk_period*7;
352
  random <= func_common_random(random) WHEN rising_edge(clk);
353
  in_gap <= random(random'HIGH) WHEN g_enable_in_val_gaps=TRUE ELSE '0';
354
 
355
  in_sosi_0  <= in_sosi_arr(0);
356
  out_sosi_0 <= out_sosi_arr(0);
357
 
358
  ---------------------------------------------------------------
359
  -- DATA INPUT
360
  ---------------------------------------------------------------
361
  p_input_stimuli : process
362
    variable vP : natural;
363
  begin
364
    -- read input data from file
365
    if c_in_complex then
366
      proc_common_read_integer_file(g_data_file_c, c_nof_lines_c_wg_header, g_data_file_nof_lines, c_nof_complex, input_data_c_arr);
367
    else
368
      proc_common_read_integer_file(g_data_file_a, c_nof_lines_a_wg_header, g_data_file_nof_lines, 1, input_data_a_arr);
369
      proc_common_read_integer_file(g_data_file_b, c_nof_lines_b_wg_header, g_data_file_nof_lines, 1, input_data_b_arr);
370
    end if;
371
    wait for 1 ns;
372
    in_re_arr <= (others=>(others=>'0'));
373
    in_im_arr <= (others=>(others=>'0'));
374
    in_val <= '0';
375
    proc_common_wait_until_low(clk, rst);         -- Wait until reset has finished
376
    proc_common_wait_some_cycles(clk, 10);        -- Wait an additional amount of cycles
377
 
378
    -- apply stimuli
379
    for I in 0 to g_data_file_nof_lines/g_wpfb.wb_factor-1 loop  -- serial
380
      for K in 0 to c_nof_channels-1 loop  -- serial
381
        for S in 0 to g_wpfb.nof_wb_streams-1 loop  -- parallel
382
          for P in 0 to g_wpfb.wb_factor-1 loop  -- parallel
383
            if c_big_endian_wb_in=TRUE then
384
              vP := g_wpfb.wb_factor-1-P;        -- time to big endian
385
            else
386
              vP := P;                           -- time in little endian
387
            end if;
388
            if K=1 or S=1 then
389
              -- if present then serial channel  1 carries zero data to be able to recognize the serial channel  order in the wave window
390
              -- if present then parallel stream 1 carries zero data to be able to recognize the parallel stream order in the wave window
391
              in_re_arr(S*g_wpfb.wb_factor + vP) <= (OTHERS=>'0');
392
              in_im_arr(S*g_wpfb.wb_factor + vP) <= (OTHERS=>'0');
393
            else
394
              -- stream 0 and if present the other streams >= 2 carry the same input reference data to verify the filter function
395
              if c_in_complex then
396
                in_re_arr(S*g_wpfb.wb_factor + vP) <= TO_SVEC_32(input_data_c_arr((I*g_wpfb.wb_factor+P)*c_nof_complex));
397
                in_im_arr(S*g_wpfb.wb_factor + vP) <= TO_SVEC_32(input_data_c_arr((I*g_wpfb.wb_factor+P)*c_nof_complex+1));
398
              else
399
                in_re_arr(S*g_wpfb.wb_factor + vP) <= TO_SVEC_32(input_data_a_arr(I*g_wpfb.wb_factor+P));
400
                in_im_arr(S*g_wpfb.wb_factor + vP) <= TO_SVEC_32(input_data_b_arr(I*g_wpfb.wb_factor+P));
401
              end if;
402
            end if;
403
          end loop;
404
        end loop;
405
        in_val <= '1';  -- serial
406
        proc_common_wait_some_cycles(clk, 1);
407
        if in_gap='1' then
408
          in_val <= '0';  -- serial
409
          proc_common_wait_some_cycles(clk, 1);
410
        end if;
411
      end loop;
412
    end loop;
413
 
414
    -- Wait until done
415
    in_val <= '0';
416
    proc_common_wait_some_cycles(clk, c_dut_clk_latency);  -- wait for DUT latency
417
    tb_end_almost <= '1';
418
    proc_common_wait_some_cycles(clk, 100);
419
    tb_end <= '1';
420
    wait;
421
  end process;
422
 
423
  in_sosi_val.valid <= in_val;
424
 
425
  u_ref_sosi_ctrl : entity dp_components_lib.dp_block_gen
426
  generic map (
427
    g_use_src_in         => false,                  -- when true use src_in.ready else use snk_in.valid for flow control
428
    g_nof_data           => c_nof_valid_per_block,  -- nof data per block
429
    g_nof_blk_per_sync   => g_wpfb.nof_blk_per_sync,
430
    g_empty              => 0,
431
    g_channel            => 0,
432
    g_error              => 0,
433
    g_bsn                => 12,
434
    g_preserve_sync      => false,
435
    g_preserve_bsn       => false
436
  )
437
  port map (
438
    rst        => rst,
439
    clk        => clk,
440
    -- Streaming sink
441
    snk_in     => in_sosi_val,
442
    -- Streaming source
443
    src_in     => c_dp_siso_rdy,
444
    src_out    => ref_sosi_ctrl,
445
    -- MM control
446
    en         => '1'
447
  );
448
 
449
  ref_re_arr <= in_re_arr when rising_edge(clk);
450
  ref_im_arr <= in_im_arr when rising_edge(clk);
451
 
452
  ---------------------------------------------------------------
453
  -- DUT = Device Under Test
454
  ---------------------------------------------------------------
455
  p_in_sosi_arr : process(ref_re_arr, ref_im_arr, ref_sosi_ctrl)
456
  begin
457
    for I in 0 to g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 loop
458
      -- DUT input
459
      in_sosi_arr(I)    <= ref_sosi_ctrl;
460
      in_sosi_arr(I).re <= RESIZE_DP_DSP_DATA(ref_re_arr(I));
461
      in_sosi_arr(I).im <= RESIZE_DP_DSP_DATA(ref_im_arr(I));
462
    end loop;
463
  end process;
464
 
465
  u_dut : entity work.wpfb_unit_dev
466
  generic map (
467
    g_big_endian_wb_in  => c_big_endian_wb_in,
468
    g_wpfb              => g_wpfb,
469
    g_use_prefilter     => TRUE,
470
    g_stats_ena         => TRUE,
471
    g_use_bg            => FALSE,
472
    g_coefs_file_prefix => c_coefs_mif_file_prefix
473
  )
474
  port map (
475
    dp_rst             => rst,
476
    dp_clk             => clk,
477
    mm_rst             => rst,
478
    mm_clk             => clk,
479
    ram_fil_coefs_mosi => c_mem_mosi_rst,
480
    ram_fil_coefs_miso => open,
481
    ram_st_sst_mosi    => c_mem_mosi_rst,
482
    ram_st_sst_miso    => open,
483
    reg_bg_ctrl_mosi   => c_mem_mosi_rst,
484
    reg_bg_ctrl_miso   => open,
485
    ram_bg_data_mosi   => c_mem_mosi_rst,
486
    ram_bg_data_miso   => open,
487
    in_sosi_arr        => in_sosi_arr,
488
    fil_sosi_arr       => fil_sosi_arr,
489
    out_sosi_arr       => out_sosi_arr
490
  );
491
 
492
  p_fil_sosi_arr : process(fil_sosi_arr)
493
  begin
494
    for I in 0 to g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 loop
495
      fil_re_arr(I) <= RESIZE_SVEC_32(fil_sosi_arr(I).re);
496
      fil_im_arr(I) <= RESIZE_SVEC_32(fil_sosi_arr(I).im);
497
    end loop;
498
  end process;
499
  fil_val <= fil_sosi_arr(0).valid;
500
 
501
  p_out_sosi_arr : process(out_sosi_arr)
502
  begin
503
    for I in 0 to g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 loop
504
      out_re_arr(I) <= RESIZE_SVEC_32(out_sosi_arr(I).re);
505
      out_im_arr(I) <= resize_fft_svec(out_sosi_arr(I).im);
506
    end loop;
507
  end process;
508
  out_val <= out_sosi_arr(0).valid;
509
 
510
  -- Data valid count
511
  in_val_cnt  <= in_val_cnt+1  when rising_edge(clk) and in_val='1'  else in_val_cnt;
512
  out_val_cnt <= out_val_cnt+1 when rising_edge(clk) and out_val='1' else out_val_cnt;
513
 
514
  -- Block count blocks for c_nof_channels>=1 channels per block
515
  in_blk_val  <= '1' when in_val='1'  and (in_val_cnt  mod c_nof_channels)=0 else '0';
516
  in_blk_val_cnt  <= in_val_cnt/c_nof_channels;
517
 
518
  -- Block count time axis
519
  in_blk_time <= in_blk_val_cnt / (g_wpfb.nof_points/g_wpfb.wb_factor);
520
 
521
  -- Verify nof valid counts
522
  p_verify_out_val_cnt : process
523
  begin
524
    -- Wait until tb_end_almost
525
    proc_common_wait_until_high(clk, tb_end_almost);
526
    assert in_val_cnt > 0 report "Test did not run, no valid input data"  severity error;
527
    -- The WPFB has a memory of 2 block, independent of use_reorder and use_separate, but without the
528
    -- reorder buffer it outputs 1 sample more, because that is immediately available in a new block.
529
    -- Ensure g_data_file_nof_lines is multiple of g_wpfb.nof_points.
530
    if g_wpfb.use_reorder=true then
531
      assert out_val_cnt = in_val_cnt-2*c_nof_valid_per_block                report "Unexpected number of valid output data" severity error;
532
    else
533
      assert out_val_cnt = in_val_cnt-2*c_nof_valid_per_block+c_nof_channels report "Unexpected number of valid output data" severity error;
534
    end if;
535
    wait;
536
  end process;
537
 
538
  ---------------------------------------------------------------
539
  -- DATA OUTPUT CONTROL IN SCLK DOMAIN
540
  ---------------------------------------------------------------
541
  out_cnt <= out_cnt + 1 when rising_edge(sclk) and out_val_c='1' else out_cnt;
542
 
543
  out_blk_time <= (out_cnt / c_nof_channels) / g_wpfb.nof_points;
544
 
545
  proc_fft_out_control(g_wpfb.wb_factor, g_wpfb.nof_points, c_nof_channels, g_wpfb.use_reorder, g_wpfb.use_fft_shift, g_wpfb.use_separate,
546
                       out_cnt, out_val_c, out_val_a, out_val_b, out_channel, out_bin, out_bin_cnt);
547
 
548
  -- clk diff to avoid combinatorial glitches when selecting the data with out_val_a,b,c
549
  reg_out_val_a    <= out_val_a    when rising_edge(sclk);
550
  reg_out_val_b    <= out_val_b    when rising_edge(sclk);
551
  reg_out_val_c    <= out_val_c    when rising_edge(sclk);
552
  reg_out_channel  <= out_channel  when rising_edge(sclk);
553
  reg_out_cnt      <= out_cnt      when rising_edge(sclk);
554
  reg_out_bin_cnt  <= out_bin_cnt  when rising_edge(sclk);
555
  reg_out_bin      <= out_bin      when rising_edge(sclk);
556
  reg_out_blk_time <= out_blk_time when rising_edge(sclk);
557
 
558
  out_re_a_scope <= out_re_scope when rising_edge(sclk) and out_val_a='1';
559
  out_im_a_scope <= out_im_scope when rising_edge(sclk) and out_val_a='1';
560
  out_re_b_scope <= out_re_scope when rising_edge(sclk) and out_val_b='1';
561
  out_im_b_scope <= out_im_scope when rising_edge(sclk) and out_val_b='1';
562
  out_re_c_scope <= out_re_scope when rising_edge(sclk) and out_val_c='1';
563
  out_im_c_scope <= out_im_scope when rising_edge(sclk) and out_val_c='1';
564
 
565
  exp_re_a_scope <= exp_output_data_a_re_arr(out_bin_cnt) when rising_edge(sclk) and out_val_a='1';
566
  exp_im_a_scope <= exp_output_data_a_im_arr(out_bin_cnt) when rising_edge(sclk) and out_val_a='1';
567
  exp_re_b_scope <= exp_output_data_b_re_arr(out_bin_cnt) when rising_edge(sclk) and out_val_b='1';
568
  exp_im_b_scope <= exp_output_data_b_im_arr(out_bin_cnt) when rising_edge(sclk) and out_val_b='1';
569
  exp_re_c_scope <= exp_output_data_c_re_arr(out_bin_cnt) when rising_edge(sclk) and out_val_c='1';
570
  exp_im_c_scope <= exp_output_data_c_im_arr(out_bin_cnt) when rising_edge(sclk) and out_val_c='1';
571
 
572
  diff_re_a_scope <= exp_re_a_scope - out_re_a_scope;
573
  diff_im_a_scope <= exp_im_a_scope - out_im_a_scope;
574
  diff_re_b_scope <= exp_re_b_scope - out_re_b_scope;
575
  diff_im_b_scope <= exp_im_b_scope - out_im_b_scope;
576
  diff_re_c_scope <= exp_re_c_scope - out_re_c_scope;
577
  diff_im_c_scope <= exp_im_c_scope - out_im_c_scope;
578
 
579
  ---------------------------------------------------------------
580
  -- VERIFY OUTPUT DATA
581
  ---------------------------------------------------------------
582
  p_verify_output : process(sclk)
583
  begin
584
    -- verify at sclk rising edge to avoid void differences due to delta-cycle differences that can occur between combinatorial signals
585
    if rising_edge(sclk) then
586
      if not c_in_complex then
587
        if reg_out_channel=1 then
588
          --if reg_out_val_a='1' then
589
            assert out_re_a_scope = 0 report "Output data A real error in channel" severity error;
590
            assert out_im_a_scope = 0 report "Output data A imag error in channel" severity error;
591
          --end if;
592
          if reg_out_val_b='1' then
593
            assert out_re_b_scope = 0 report "Output data B real error in channel" severity error;
594
            assert out_im_b_scope = 0 report "Output data B imag error in channel" severity error;
595
          end if;
596
        else
597
          --if reg_out_val_a='1' then
598
            assert diff_re_a_scope >= -g_diff_margin and diff_re_a_scope <= g_diff_margin report "Output data A real error" severity error;
599
            assert diff_im_a_scope >= -g_diff_margin and diff_im_a_scope <= g_diff_margin report "Output data A imag error" severity error;
600
          --end if;
601
          if reg_out_val_b='1' then
602
            assert diff_re_b_scope >= -g_diff_margin and diff_re_b_scope <= g_diff_margin report "Output data B real error" severity error;
603
            assert diff_im_b_scope >= -g_diff_margin and diff_im_b_scope <= g_diff_margin report "Output data B imag error" severity error;
604
          end if;
605
        end if;
606
      else
607
        if reg_out_val_c='1' then
608
          if reg_out_channel=1 then
609
            assert out_re_c_scope = 0 report "Output data C real error in channel" severity error;
610
            assert out_im_c_scope = 0 report "Output data C imag error in channel" severity error;
611
          else
612
            assert diff_re_c_scope >= -g_diff_margin and diff_re_c_scope <= g_diff_margin report "Output data C real error" severity error;
613
            assert diff_im_c_scope >= -g_diff_margin and diff_im_c_scope <= g_diff_margin report "Output data C imag error" severity error;
614
          end if;
615
        end if;
616
      end if;
617
    end if;
618
  end process;
619
 
620
  ---------------------------------------------------------------
621
  -- READ EXPECTED FILTER OUTPUT DATA FROM FILE
622
  ---------------------------------------------------------------
623
  p_exp_filter_data : process
624
  begin
625
    -- read filter data from file
626
    if c_in_complex then
627
      proc_common_read_integer_file(g_data_file_c, c_nof_lines_c_pfir_header, g_data_file_nof_lines, c_nof_complex, exp_filter_data_c_arr);
628
      wait for 1 ns;
629
      for I in 0 to g_data_file_nof_lines-1 loop
630
        exp_filter_data_c_re_arr(I) <= exp_filter_data_c_arr(2*I);
631
        exp_filter_data_c_im_arr(I) <= exp_filter_data_c_arr(2*I+1);
632
      end loop;
633
    else
634
      proc_common_read_integer_file(g_data_file_a, c_nof_lines_a_pfir_header, g_data_file_nof_lines, 1, exp_filter_data_a_arr);
635
      proc_common_read_integer_file(g_data_file_b, c_nof_lines_b_pfir_header, g_data_file_nof_lines, 1, exp_filter_data_b_arr);
636
      wait for 1 ns;
637
    end if;
638
    wait;
639
  end process;
640
 
641
  ---------------------------------------------------------------
642
  -- READ EXPECTED WPFB OUTPUT DATA FROM FILE
643
  ---------------------------------------------------------------
644
  p_expected_wpfb_output : process
645
  begin
646
    if c_in_complex then
647
      proc_common_read_integer_file(g_data_file_c, c_nof_lines_c_pfft_header, g_data_file_nof_lines, c_nof_complex, exp_output_data_c_arr);
648
      wait for 1 ns;
649
      for I in 0 to g_data_file_nof_lines-1 loop
650
        exp_output_data_c_re_arr(I) <= exp_output_data_c_arr(2*I);
651
        exp_output_data_c_im_arr(I) <= exp_output_data_c_arr(2*I+1);
652
      end loop;
653
    else
654
      proc_common_read_integer_file(g_data_file_a, c_nof_lines_a_pfft_header, g_data_file_nof_lines/c_nof_complex, c_nof_complex, exp_output_data_a_arr);
655
      proc_common_read_integer_file(g_data_file_b, c_nof_lines_b_pfft_header, g_data_file_nof_lines/c_nof_complex, c_nof_complex, exp_output_data_b_arr);
656
      wait for 1 ns;
657
      for I in 0 to g_data_file_nof_lines/c_nof_complex-1 loop
658
        exp_output_data_a_re_arr(I) <= exp_output_data_a_arr(2*I);
659
        exp_output_data_a_im_arr(I) <= exp_output_data_a_arr(2*I+1);
660
        exp_output_data_b_re_arr(I) <= exp_output_data_b_arr(2*I);
661
        exp_output_data_b_im_arr(I) <= exp_output_data_b_arr(2*I+1);
662
      end loop;
663
    end if;
664
    wait;
665
  end process;
666
 
667
  ---------------------------------------------------------------
668
  -- INPUT AND OUTPUT DATA SCOPES : ONLY FOR WB STREAM S = 0
669
  ---------------------------------------------------------------
670
  rewire_scope_data : for P in 0 to g_wpfb.wb_factor-1 generate
671
    in_re_data((P+1)*c_in_dat_w-1 downto P*c_in_dat_w) <= in_re_arr(P)(c_in_dat_w-1 downto 0);
672
    in_im_data((P+1)*c_in_dat_w-1 downto P*c_in_dat_w) <= in_im_arr(P)(c_in_dat_w-1 downto 0);
673
 
674
    fil_re_data((P+1)*c_fil_dat_w-1 downto P*c_fil_dat_w) <= fil_re_arr(P)(c_fil_dat_w-1 downto 0);
675
    fil_im_data((P+1)*c_fil_dat_w-1 downto P*c_fil_dat_w) <= fil_im_arr(P)(c_fil_dat_w-1 downto 0);
676
 
677
    out_re_data((P+1)*c_out_dat_w-1 downto P*c_out_dat_w) <= out_re_arr(P)(c_out_dat_w-1 downto 0);
678
    out_im_data((P+1)*c_out_dat_w-1 downto P*c_out_dat_w) <= out_im_arr(P)(c_out_dat_w-1 downto 0);
679
  end generate;
680
 
681
  u_in_re_scope : entity astron_sim_tools_lib.common_wideband_data_scope
682
  generic map (
683
    g_sim                 => TRUE,
684
    g_wideband_factor     => g_wpfb.wb_factor,  -- Wideband rate factor = 4 for dp_clk processing frequency is 200 MHz frequency and SCLK sample frequency Fs is 800 MHz
685
    g_wideband_big_endian => TRUE,              -- When true in_data[3:0] = sample[t0,t1,t2,t3], else when false : in_data[3:0] = sample[t3,t2,t1,t0]
686
    g_dat_w               => c_in_dat_w         -- Actual width of the data samples
687
  )
688
  port map (
689
    -- Sample clock
690
    SCLK      => sclk,  -- sample clk, use only for simulation purposes
691
 
692
    -- Streaming input data
693
    in_data   => in_re_data,
694
    in_val    => in_val,
695
 
696
    -- Scope output samples
697
    out_dat   => OPEN,
698
    out_int   => in_re_scope,
699
    out_val   => in_val_scope
700
  );
701
 
702
  u_in_im_scope : entity astron_sim_tools_lib.common_wideband_data_scope
703
  generic map (
704
    g_sim                 => TRUE,
705
    g_wideband_factor     => g_wpfb.wb_factor,  -- Wideband rate factor = 4 for dp_clk processing frequency is 200 MHz frequency and SCLK sample frequency Fs is 800 MHz
706
    g_wideband_big_endian => TRUE,              -- When true in_data[3:0] = sample[t0,t1,t2,t3], else when false : in_data[3:0] = sample[t3,t2,t1,t0]
707
    g_dat_w               => c_in_dat_w         -- Actual width of the data samples
708
  )
709
  port map (
710
    -- Sample clock
711
    SCLK      => sclk,  -- sample clk, use only for simulation purposes
712
 
713
    -- Streaming input data
714
    in_data   => in_im_data,
715
    in_val    => in_val,
716
 
717
    -- Scope output samples
718
    out_dat   => OPEN,
719
    out_int   => in_im_scope,
720
    out_val   => open
721
  );
722
 
723
  u_fil_re_scope : entity astron_sim_tools_lib.common_wideband_data_scope
724
  generic map (
725
    g_sim                 => TRUE,
726
    g_wideband_factor     => g_wpfb.wb_factor,  -- Wideband rate factor = 4 for dp_clk processing frequency is 200 MHz frequency and SCLK sample frequency Fs is 800 MHz
727
    g_wideband_big_endian => TRUE,              -- When true in_data[3:0] = sample[t0,t1,t2,t3], else when false : in_data[3:0] = sample[t3,t2,t1,t0]
728
    g_dat_w               => c_fil_dat_w        -- Actual width of the data samples
729
  )
730
  port map (
731
    -- Sample clock
732
    SCLK      => sclk,  -- sample clk, use only for simulation purposes
733
 
734
    -- Streaming input data
735
    in_data   => fil_re_data,
736
    in_val    => fil_val,
737
 
738
    -- Scope output samples
739
    out_dat   => OPEN,
740
    out_int   => fil_re_scope,
741
    out_val   => fil_val_scope
742
  );
743
 
744
  u_fil_im_scope : entity astron_sim_tools_lib.common_wideband_data_scope
745
  generic map (
746
    g_sim                 => TRUE,
747
    g_wideband_factor     => g_wpfb.wb_factor,  -- Wideband rate factor = 4 for dp_clk processing frequency is 200 MHz frequency and SCLK sample frequency Fs is 800 MHz
748
    g_wideband_big_endian => TRUE,              -- When true in_data[3:0] = sample[t0,t1,t2,t3], else when false : in_data[3:0] = sample[t3,t2,t1,t0]
749
    g_dat_w               => c_fil_dat_w        -- Actual width of the data samples
750
  )
751
  port map (
752
    -- Sample clock
753
    SCLK      => sclk,  -- sample clk, use only for simulation purposes
754
 
755
    -- Streaming input data
756
    in_data   => fil_im_data,
757
    in_val    => fil_val,
758
 
759
    -- Scope output samples
760
    out_dat   => OPEN,
761
    out_int   => fil_im_scope,
762
    out_val   => open
763
  );
764
 
765
  u_out_re_scope : entity astron_sim_tools_lib.common_wideband_data_scope
766
  generic map (
767
    g_sim                 => TRUE,
768
    g_wideband_factor     => g_wpfb.wb_factor,  -- Wideband rate factor = 4 for dp_clk processing frequency is 200 MHz frequency and SCLK sample frequency Fs is 800 MHz
769
    g_wideband_big_endian => FALSE,             -- When true in_data[3:0] = sample[t0,t1,t2,t3], else when false : in_data[3:0] = sample[t3,t2,t1,t0]
770
    g_dat_w               => c_out_dat_w        -- Actual width of the data samples
771
  )
772
  port map (
773
    -- Sample clock
774
    SCLK      => sclk,  -- sample clk, use only for simulation purposes
775
 
776
    -- Streaming input data
777
    in_data   => out_re_data,
778
    in_val    => out_val,
779
 
780
    -- Scope output samples
781
    out_dat   => OPEN,
782
    out_int   => out_re_scope,
783
    out_val   => out_val_c
784
  );
785
 
786
  u_out_im_scope : entity astron_sim_tools_lib.common_wideband_data_scope
787
  generic map (
788
    g_sim                 => TRUE,
789
    g_wideband_factor     => g_wpfb.wb_factor,  -- Wideband rate factor = 4 for dp_clk processing frequency is 200 MHz frequency and SCLK sample frequency Fs is 800 MHz
790
    g_wideband_big_endian => FALSE,             -- When true in_data[3:0] = sample[t0,t1,t2,t3], else when false : in_data[3:0] = sample[t3,t2,t1,t0]
791
    g_dat_w               => c_out_dat_w        -- Actual width of the data samples
792
  )
793
  port map (
794
    -- Sample clock
795
    SCLK      => sclk,  -- sample clk, use only for simulation purposes
796
 
797
    -- Streaming input data
798
    in_data   => out_im_data,
799
    in_val    => out_val,
800
 
801
    -- Scope output samples
802
    out_dat   => OPEN,
803
    out_int   => out_im_scope,
804
    out_val   => open
805
  );
806
 
807
end tb;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.