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

Subversion Repositories astron_wpfb

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 danv
 
2
-------------------------------------------------------------------------------
3
--
4
-- Copyright (C) 2012
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 the wideband poly phase filterbank.
24
--
25
--          The testbech uses blockgenerators to generate data for 
26
--          every input of the wideband poly phase filterbank. 
27
--          The output of the WPFB is stored in databuffers. 
28
--          Both the block generators and databuffers are controlled
29
--          via a mm interface. 
30
--          Use this testbench in conjunction with: 
31
--
32
--          ../python/tc_mmf_wpfb_unit.py
33
--          For verifying the complete wideband polyphase filter bank: g_use_bg = FALSE
34
--
35
--          ../python/tc_mmf_wpfb_unit_functional.py
36
--          For verifying the different wide- and narrowband configurationss
37
--          of the wpfb_unit. 
38
--
39
-- (Automated) Usage: 
40
--   > Be sure that the c_start_modelsim variable is set to 1 in the script. 
41
--   > Run python script in separate terminal: "python tc_mmf_wpfb_unit.py --unb 0 --bn 0 --sim"
42
--          
43
-- (Manual) Usage:
44
--   > run -all
45
--   > Be sure that the c_start_modelsim variable is set to 0 in the script. 
46
--   > Run python script in separate terminal: "python tc_mmf_wpfb_unit.py --unb 0 --bn 0 --sim"
47
--   > Check the results of the python script. 
48
--   > Stop the simulation manually in Modelsim by pressing the stop-button. 
49
--   > For fractional frequencies set g_nof_blocks=32 to be able to simulate a sufficent number of periods without transition.
50
 
51
 
52
LIBRARY IEEE, common_pkg_lib, astron_mm_lib, astron_diagnostics_lib, dp_pkg_lib, astron_r2sdf_fft_lib, astron_wb_fft_lib, astron_filter_lib, astron_ram_lib, astron_sim_tools_lib;
53
USE IEEE.std_logic_1164.ALL;
54
USE IEEE.numeric_std.ALL;
55
USE IEEE.math_real.ALL;
56
USE common_pkg_lib.common_pkg.ALL;
57
USE astron_ram_lib.common_ram_pkg.ALL;
58
USE common_pkg_lib.common_str_pkg.ALL;
59
USE common_pkg_lib.tb_common_pkg.ALL;
60
USE astron_mm_lib.tb_common_mem_pkg.ALL;
61
USE astron_mm_lib.mm_file_unb_pkg.ALL;
62
USE astron_mm_lib.mm_file_pkg.ALL;
63
USE dp_pkg_lib.dp_stream_pkg.ALL;
64
USE astron_diagnostics_lib.diag_pkg.ALL;
65
USE astron_r2sdf_fft_lib.twiddlesPkg.all;
66
USE astron_r2sdf_fft_lib.rTwoSDFPkg.all;
67
USE astron_wb_fft_lib.tb_fft_pkg.all;
68
USE astron_wb_fft_lib.fft_pkg.all;
69
USE astron_filter_lib.fil_pkg.all;
70
USE work.wpfb_pkg.all;
71
 
72
 
73
ENTITY tb_mmf_wpfb_unit IS
74
  GENERIC(
75
    g_wb_factor         : natural := 1;      -- = default 1, wideband factor
76
    g_nof_wb_streams    : natural := 1;      -- = 1, the number of parallel wideband streams. The filter coefficients are shared on every wb-stream.                      
77
    g_nof_chan          : natural := 0;      -- = default 0, defines the number of channels (=time-multiplexed input signals): nof channels = 2**nof_chan         
78
    g_nof_points        : natural := 64;     -- = 1024, N point FFT
79
    g_nof_taps          : natural := 16;      -- = 8 nof taps n the filter
80
    g_nof_blocks        : natural := 4;      -- = 4, the number of blocks of g_nof_points each in the BG waveform (must be power of 2 due to that BG c_bg_block_len must be power of 2)
81
    g_in_dat_w          : natural := 8;      -- = 8, number of input bits                                                       
82
    g_out_dat_w         : natural := 16;     -- = 14, number of output bits: in_dat_w + natural((ceil_log2(nof_points))/2) 
83
    g_use_separate      : boolean := FALSE;   -- = false for complex input, true for two real inputs
84
    g_use_bg            : boolean := FALSE;
85
    g_coefs_file_prefix : string  := "data/coefs_wide"
86
  );
87
END tb_mmf_wpfb_unit;
88
 
89
ARCHITECTURE tb OF tb_mmf_wpfb_unit IS
90
 
91
    CONSTANT c_in_backoff_w     : natural := 0;      -- = 0, number of bits for input backoff to avoid FIR output overflow
92
    CONSTANT c_nof_blk_per_sync : natural := 20;
93
 
94
    CONSTANT c_wpfb : t_wpfb  := (g_wb_factor, g_nof_points, g_nof_chan, g_nof_wb_streams,
95
                                  g_nof_taps, c_in_backoff_w, g_in_dat_w, 16, 16,
96
                                  true, false, g_use_separate, 16, g_out_dat_w, 0, 18, 2, true, 56, 2, c_nof_blk_per_sync,
97
                                  c_fft_pipeline, c_fft_pipeline, c_fil_ppf_pipeline);
98
 
99
    --  type t_wpfb is record  
100
    --  -- General parameters for the wideband poly phase filter
101
    --  wb_factor         : natural;        -- = default 4, wideband factor
102
    --  nof_points        : natural;        -- = 1024, N point FFT (Also the number of subbands for the filetr part)
103
    --  nof_chan          : natural;        -- = default 0, defines the number of channels (=time-multiplexed input signals): nof channels = 2**nof_chan     
104
    --  nof_wb_streams    : natural;        -- = 1, the number of parallel wideband streams. The filter coefficients are shared on every stream.                      
105
    --  
106
    --  -- Parameters for the poly phase filter
107
    --  nof_taps          : natural;        -- = 16, the number of FIR taps per subband
108
    --  fil_backoff_w     : natural;        -- = 0, number of bits for input backoff to avoid output overflow
109
    --  fil_in_dat_w      : natural;        -- = 8, number of input bits
110
    --  fil_out_dat_w     : natural;        -- = 16, number of output bits
111
    --  coef_dat_w        : natural;        -- = 16, data width of the FIR coefficients
112
    --                                    
113
    --  -- Parameters for the FFT         
114
    --  use_reorder       : boolean;        -- = false for bit-reversed output, true for normal output
115
    --  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
116
    --  use_separate      : boolean;        -- = false for complex input, true for two real inputs
117
    --  fft_in_dat_w      : natural;        -- = 16, number of input bits
118
    --  fft_out_dat_w     : natural;        -- = 13, number of output bits
119
    --  fft_out_gain_w    : natural;        -- = 0, output gain factor applied after the last stage output, before requantization to out_dat_w
120
    --  stage_dat_w       : natural;        -- = 18, number of bits that are used inter-stage
121
    --  guard_w           : natural;        -- = 2   
122
    --  guard_enable      : boolean;        -- = true
123
    --
124
    --  -- Parameters for the statistics
125
    --  stat_data_w       : positive;       -- = 56
126
    --  stat_data_sz      : positive;       -- = 2
127
    --  nof_blk_per_sync  : natural;        -- = 800000, number of FFT output blocks per sync interval
128
    --
129
    --  -- Pipeline parameters for both poly phase filter and FFT. These are heritaged from the filter and fft libraries.  
130
    --  pft_pipeline      : t_fft_pipeline;     -- Pipeline settings for the pipelined FFT
131
    --  fft_pipeline      : t_fft_pipeline;     -- Pipeline settings for the parallel FFT
132
    --  fil_pipeline      : t_fil_ppf_pipeline; -- Pipeline settings for the filter units 
133
    --  
134
    --  end record;
135
 
136
  ----------------------------------------------------------------------------
137
  -- Clocks and resets
138
  ----------------------------------------------------------------------------   
139
  CONSTANT c_mm_clk_period         : TIME := 100 ps;
140
  CONSTANT c_dp_clk_period         : TIME := 5 ns;
141
  CONSTANT c_sclk_period           : TIME := c_dp_clk_period / c_wpfb.wb_factor;
142
  CONSTANT c_dp_pps_period         : NATURAL := 64;
143
 
144
  SIGNAL dp_pps                    : STD_LOGIC;
145
 
146
  SIGNAL mm_rst                    : STD_LOGIC;
147
  SIGNAL mm_clk                    : STD_LOGIC := '0';
148
 
149
  SIGNAL dp_rst                    : STD_LOGIC;
150
  SIGNAL dp_clk                    : STD_LOGIC := '0';
151
 
152
  SIGNAL SCLK                      : STD_LOGIC := '0';
153
 
154
  ----------------------------------------------------------------------------
155
  -- MM buses
156
  ----------------------------------------------------------------------------                                         
157
  SIGNAL reg_diag_bg_mosi          : t_mem_mosi;
158
  SIGNAL reg_diag_bg_miso          : t_mem_miso;
159
 
160
  SIGNAL ram_diag_bg_mosi          : t_mem_mosi;
161
  SIGNAL ram_diag_bg_miso          : t_mem_miso;
162
 
163
  SIGNAL ram_diag_data_buf_re_mosi : t_mem_mosi;
164
  SIGNAL ram_diag_data_buf_re_miso : t_mem_miso;
165
 
166
  SIGNAL reg_diag_data_buf_re_mosi : t_mem_mosi;
167
  SIGNAL reg_diag_data_buf_re_miso : t_mem_miso;
168
 
169
  SIGNAL ram_diag_data_buf_im_mosi : t_mem_mosi;
170
  SIGNAL ram_diag_data_buf_im_miso : t_mem_miso;
171
 
172
  SIGNAL reg_diag_data_buf_im_mosi : t_mem_mosi;
173
  SIGNAL reg_diag_data_buf_im_miso : t_mem_miso;
174
 
175
  SIGNAL ram_st_sst_mosi           : t_mem_mosi := c_mem_mosi_rst;
176
  SIGNAL ram_st_sst_miso           : t_mem_miso := c_mem_miso_rst;
177
 
178
  SIGNAL ram_fil_coefs_mosi        : t_mem_mosi := c_mem_mosi_rst;
179
  SIGNAL ram_fil_coefs_miso        : t_mem_miso := c_mem_miso_rst;
180
 
181
  SIGNAL reg_diag_bg_pfb_mosi      : t_mem_mosi := c_mem_mosi_rst;
182
  SIGNAL reg_diag_bg_pfb_miso      : t_mem_miso := c_mem_miso_rst;
183
 
184
  SIGNAL ram_diag_bg_pfb_mosi      : t_mem_mosi := c_mem_mosi_rst;
185
  SIGNAL ram_diag_bg_pfb_miso      : t_mem_miso := c_mem_miso_rst;
186
 
187
  CONSTANT c_coefs_file_prefix      : STRING  := g_coefs_file_prefix & NATURAL'IMAGE(c_wpfb.wb_factor) & "_p"& NATURAL'IMAGE(c_wpfb.nof_points) & "_t"& NATURAL'IMAGE(c_wpfb.nof_taps);
188
 
189
  CONSTANT c_nof_streams            : POSITIVE := c_wpfb.nof_wb_streams*c_wpfb.wb_factor;
190
  CONSTANT c_nof_channels           : NATURAL  := 2**c_wpfb.nof_chan;
191
  CONSTANT c_bg_block_len           : NATURAL  := c_wpfb.nof_points*g_nof_blocks*c_nof_channels/c_wpfb.wb_factor;
192
 
193
  CONSTANT c_bg_buf_adr_w           : NATURAL := ceil_log2(c_bg_block_len);
194
  CONSTANT c_bg_data_file_index_arr : t_nat_natural_arr := array_init(0, c_nof_streams, 1);
195
  CONSTANT c_bg_data_file_prefix    : STRING := "UNUSED";
196
 
197
  SIGNAL bg_siso_arr                : t_dp_siso_arr(c_nof_streams-1 DOWNTO 0) := (OTHERS=>c_dp_siso_rdy);
198
  SIGNAL bg_sosi_arr                : t_dp_sosi_arr(c_nof_streams-1 DOWNTO 0);
199
  SIGNAL out_sosi_arr               : t_dp_sosi_arr(c_nof_streams-1 DOWNTO 0);
200
 
201
  SIGNAL scope_in_sosi              : t_dp_sosi_integer_arr(c_wpfb.nof_wb_streams-1 DOWNTO 0);
202
  SIGNAL scope_out_sosi             : t_dp_sosi_integer_arr(c_wpfb.nof_wb_streams-1 DOWNTO 0);
203
  SIGNAL scope_out_power            : REAL := 0.0;
204
  SIGNAL scope_out_ampl             : REAL := 0.0;
205
  SIGNAL scope_out_index            : NATURAL;
206
  SIGNAL scope_out_bin              : NATURAL;
207
  SIGNAL scope_out_band             : NATURAL;
208
  SIGNAL scope_out_ampl_x           : REAL := 0.0;
209
  SIGNAL scope_out_ampl_y           : REAL := 0.0;
210
 
211
BEGIN
212
 
213
  ----------------------------------------------------------------------------
214
  -- Clock and reset generation
215
  ----------------------------------------------------------------------------
216
  mm_clk <= NOT mm_clk AFTER c_mm_clk_period/2;
217
  mm_rst <= '1', '0' AFTER c_mm_clk_period*5;
218
 
219
  dp_clk <= NOT dp_clk AFTER c_dp_clk_period/2;
220
  dp_rst <= '1', '0' AFTER c_dp_clk_period*5;
221
 
222
  SCLK   <= NOT SCLK AFTER c_sclk_period/2;
223
 
224
  ------------------------------------------------------------------------------
225
  -- External PPS
226
  ------------------------------------------------------------------------------  
227
  proc_common_gen_pulse(1, c_dp_pps_period, '1', dp_clk, dp_pps);
228
 
229
   ----------------------------------------------------------------------------
230
  -- Procedure that polls a sim control file that can be used to e.g. get
231
  -- the simulation time in ns
232
  ----------------------------------------------------------------------------
233
  mmf_poll_sim_ctrl_file(c_mmf_unb_file_path & "sim.ctrl", c_mmf_unb_file_path & "sim.stat");
234
 
235
  ----------------------------------------------------------------------------
236
  -- MM buses  
237
  ----------------------------------------------------------------------------
238
  u_mm_file_reg_diag_bg          : mm_file GENERIC MAP(mmf_unb_file_prefix(0, 0, "BN") & "REG_DIAG_BG")
239
                                           PORT MAP(mm_rst, mm_clk, reg_diag_bg_mosi, reg_diag_bg_miso);
240
 
241
  u_mm_file_ram_diag_bg          : mm_file GENERIC MAP(mmf_unb_file_prefix(0, 0, "BN") & "RAM_DIAG_BG")
242
                                           PORT MAP(mm_rst, mm_clk, ram_diag_bg_mosi, ram_diag_bg_miso);
243
 
244
  u_mm_file_ram_diag_data_buf_re : mm_file GENERIC MAP(mmf_unb_file_prefix(0, 0, "BN") & "RAM_DIAG_DATA_BUFFER_REAL")
245
                                           PORT MAP(mm_rst, mm_clk, ram_diag_data_buf_re_mosi, ram_diag_data_buf_re_miso);
246
 
247
  u_mm_file_reg_diag_data_buf_re : mm_file GENERIC MAP(mmf_unb_file_prefix(0, 0, "BN") & "REG_DIAG_DATA_BUFFER_REAL")
248
                                           PORT MAP(mm_rst, mm_clk, reg_diag_data_buf_re_mosi, reg_diag_data_buf_re_miso);
249
 
250
  u_mm_file_ram_diag_data_buf_im : mm_file GENERIC MAP(mmf_unb_file_prefix(0, 0, "BN") & "RAM_DIAG_DATA_BUFFER_IMAG")
251
                                           PORT MAP(mm_rst, mm_clk, ram_diag_data_buf_im_mosi, ram_diag_data_buf_im_miso);
252
 
253
  u_mm_file_reg_diag_data_buf_im : mm_file GENERIC MAP(mmf_unb_file_prefix(0, 0, "BN") & "REG_DIAG_DATA_BUFFER_IMAG")
254
                                           PORT MAP(mm_rst, mm_clk, reg_diag_data_buf_im_mosi, reg_diag_data_buf_im_miso);
255
 
256
  u_mm_file_ram_fil_coefs        : mm_file GENERIC MAP(mmf_unb_file_prefix(0, 0, "BN") & "RAM_FIL_COEFS")
257
                                           PORT MAP(mm_rst, mm_clk, ram_fil_coefs_mosi, ram_fil_coefs_miso);
258
 
259
  u_mm_file_ram_st_sst           : mm_file GENERIC MAP(mmf_unb_file_prefix(0, 0, "BN") & "RAM_ST_SST")
260
                                           PORT MAP(mm_rst, mm_clk, ram_st_sst_mosi, ram_st_sst_miso);
261
 
262
  u_mm_file_reg_diag_pfb_bg      : mm_file GENERIC MAP(mmf_unb_file_prefix(0, 0, "BN") & "REG_DIAG_BG_PFB")
263
                                           PORT MAP(mm_rst, mm_clk, reg_diag_bg_pfb_mosi, reg_diag_bg_pfb_miso);
264
 
265
  u_mm_file_ram_diag_pfb_bg      : mm_file GENERIC MAP(mmf_unb_file_prefix(0, 0, "BN") & "RAM_DIAG_BG_PFB")
266
                                           PORT MAP(mm_rst, mm_clk, ram_diag_bg_pfb_mosi, ram_diag_bg_pfb_miso);
267
 
268
  ----------------------------------------------------------------------------
269
  -- Source: block generator
270
  ---------------------------------------------------------------------------- 
271
  u_bg : ENTITY astron_diagnostics_lib.mms_diag_block_gen
272
  GENERIC MAP(
273
    g_nof_streams        => c_nof_streams,
274
    g_buf_dat_w          => c_nof_complex*c_wpfb.fil_in_dat_w,
275
    g_buf_addr_w         => c_bg_buf_adr_w,               -- Waveform buffer size 2**g_buf_addr_w nof samples
276
    g_file_index_arr     => c_bg_data_file_index_arr,
277
    g_file_name_prefix   => c_bg_data_file_prefix
278
  )
279
  PORT MAP(
280
    -- System
281
    mm_rst           => mm_rst,
282
    mm_clk           => mm_clk,
283
    dp_rst           => dp_rst,
284
    dp_clk           => dp_clk,
285
    en_sync          => dp_pps,
286
    -- MM interface
287
    reg_bg_ctrl_mosi => reg_diag_bg_mosi,
288
    reg_bg_ctrl_miso => reg_diag_bg_miso,
289
    ram_bg_data_mosi => ram_diag_bg_mosi,
290
    ram_bg_data_miso => ram_diag_bg_miso,
291
    -- ST interface
292
    out_siso_arr     => bg_siso_arr,
293
    out_sosi_arr     => bg_sosi_arr
294
  );
295
 
296
  ----------------------------------------------------------------------------
297
  -- Source: DUT input scope 
298
  ---------------------------------------------------------------------------- 
299
  gen_input_scopes : FOR I IN 0 TO c_wpfb.nof_wb_streams-1 GENERATE
300
    u_in_scope : ENTITY astron_sim_tools_lib.dp_wideband_wb_arr_scope
301
    GENERIC MAP (
302
      g_sim                 => TRUE,
303
      g_wideband_factor     => c_wpfb.wb_factor,
304
      g_wideband_big_endian => FALSE,
305
      g_dat_w               => c_wpfb.fil_in_dat_w
306
    )
307
    PORT MAP (
308
      SCLK         => SCLK,
309
      wb_sosi_arr  => bg_sosi_arr((I+1)*c_wpfb.wb_factor-1 DOWNTO I*c_wpfb.wb_factor),
310
      scope_sosi   => scope_in_sosi(I)
311
    );
312
  END GENERATE;
313
  ---------------------------------------------------------------------------- 
314
  -- DUT = Device Under Test
315
  ---------------------------------------------------------------------------- 
316
  u_dut : ENTITY work.wpfb_unit
317
  GENERIC MAP(
318
    g_wpfb              => c_wpfb,
319
    g_use_bg            => g_use_bg,
320
    g_coefs_file_prefix => c_coefs_file_prefix
321
  )
322
  PORT MAP(
323
    dp_rst             => dp_rst,
324
    dp_clk             => dp_clk,
325
    mm_rst             => mm_rst,
326
    mm_clk             => mm_clk,
327
    ram_fil_coefs_mosi => ram_fil_coefs_mosi,
328
    ram_fil_coefs_miso => ram_fil_coefs_miso,
329
    ram_st_sst_mosi    => ram_st_sst_mosi,
330
    ram_st_sst_miso    => ram_st_sst_miso,
331
    reg_bg_ctrl_mosi   => reg_diag_bg_pfb_mosi,
332
    reg_bg_ctrl_miso   => reg_diag_bg_pfb_miso,
333
    ram_bg_data_mosi   => ram_diag_bg_pfb_mosi,
334
    ram_bg_data_miso   => ram_diag_bg_pfb_miso,
335
    in_sosi_arr        => bg_sosi_arr,
336
    out_sosi_arr       => out_sosi_arr
337
  );
338
 
339
  time_map : process is
340
    variable sim_time_str_v : string(1 to 30);  -- 30 chars should be enough
341
    variable sim_time_len_v : natural;
342
  begin
343
    wait for 1000 ns;
344
    sim_time_len_v := time'image(now)'length;
345
    sim_time_str_v := (others => ' ');
346
    sim_time_str_v(1 to sim_time_len_v) := time'image(now);
347
    report "Sim time string length: " & integer'image(sim_time_len_v);
348
    report "Sim time string.......:'" & sim_time_str_v & "'";
349
  end process;
350
 
351
  ----------------------------------------------------------------------------
352
  -- Sink: DUT output scope 
353
  ---------------------------------------------------------------------------- 
354
  gen_output_scopes : FOR I IN 0 TO c_wpfb.nof_wb_streams-1 GENERATE
355
    u_out_scope : ENTITY astron_sim_tools_lib.dp_wideband_wb_arr_scope
356
    GENERIC MAP (
357
      g_sim                 => TRUE,
358
      g_wideband_factor     => c_wpfb.wb_factor,
359
      g_wideband_big_endian => FALSE,
360
      g_dat_w               => c_wpfb.fft_out_dat_w
361
    )
362
    PORT MAP (
363
      SCLK         => SCLK,
364
      wb_sosi_arr  => out_sosi_arr((I+1)*c_wpfb.wb_factor-1 DOWNTO I*c_wpfb.wb_factor),
365
      scope_sosi   => scope_out_sosi(I)
366
    );
367
  END GENERATE;
368
 
369
  p_scope_out_index : PROCESS(SCLK)
370
  BEGIN
371
    IF rising_edge(SCLK) THEN
372
      IF scope_out_sosi(0).valid='1' THEN
373
        scope_out_index <= scope_out_index+1;
374
        IF scope_out_index>=g_nof_points-1 THEN
375
          scope_out_index <= 0;
376
        END IF;
377
      END IF;
378
    END IF;
379
  END PROCESS;
380
  scope_out_bin    <= fft_index_to_bin_frequency(c_wpfb.wb_factor, c_wpfb.nof_points, scope_out_index, TRUE, FALSE, TRUE);  -- complex bin
381
  scope_out_band   <= fft_index_to_bin_frequency(c_wpfb.wb_factor, c_wpfb.nof_points, scope_out_index, TRUE, TRUE, TRUE);   -- two real bin
382
 
383
  scope_out_power  <= REAL(scope_out_sosi(0).re)**2 + REAL(scope_out_sosi(0).im)**2;
384
  scope_out_ampl   <= SQRT(scope_out_power);
385
  scope_out_ampl_x <= scope_out_ampl WHEN (scope_out_bin MOD 2)=0 ELSE 0.0;
386
  scope_out_ampl_y <= scope_out_ampl WHEN (scope_out_bin MOD 2)=1 ELSE 0.0;
387
 
388
  ----------------------------------------------------------------------------
389
  -- Sink: data buffer real 
390
  ---------------------------------------------------------------------------- 
391
  u_data_buf_re : ENTITY astron_diagnostics_lib.mms_diag_data_buffer
392
  GENERIC MAP (
393
    g_nof_streams  => c_nof_streams,
394
    g_data_type    => e_real,
395
    g_data_w       => c_wpfb.fft_out_dat_w,
396
    g_buf_nof_data => c_bg_block_len,
397
    g_buf_use_sync => TRUE
398
  )
399
  PORT MAP (
400
    -- System
401
    mm_rst            => mm_rst,
402
    mm_clk            => mm_clk,
403
    dp_rst            => dp_rst,
404
    dp_clk            => dp_clk,
405
 
406
    -- MM interface
407
    ram_data_buf_mosi => ram_diag_data_buf_re_mosi,
408
    ram_data_buf_miso => ram_diag_data_buf_re_miso,
409
 
410
    reg_data_buf_mosi => reg_diag_data_buf_re_mosi,
411
    reg_data_buf_miso => reg_diag_data_buf_re_miso,
412
 
413
    -- ST interface
414
    in_sync           => out_sosi_arr(0).sync,
415
    in_sosi_arr       => out_sosi_arr
416
  );
417
 
418
  ----------------------------------------------------------------------------
419
  -- Sink: data buffer imag 
420
  ---------------------------------------------------------------------------- 
421
  u_data_buf_im : ENTITY astron_diagnostics_lib.mms_diag_data_buffer
422
  GENERIC MAP (
423
    g_nof_streams  => c_nof_streams,
424
    g_data_type    => e_imag,
425
    g_data_w       => c_wpfb.fft_out_dat_w,
426
    g_buf_nof_data => c_bg_block_len,
427
    g_buf_use_sync => TRUE
428
  )
429
  PORT MAP (
430
    -- System
431
    mm_rst            => mm_rst,
432
    mm_clk            => mm_clk,
433
    dp_rst            => dp_rst,
434
    dp_clk            => dp_clk,
435
 
436
    -- MM interface
437
    ram_data_buf_mosi => ram_diag_data_buf_im_mosi,
438
    ram_data_buf_miso => ram_diag_data_buf_im_miso,
439
 
440
    reg_data_buf_mosi => reg_diag_data_buf_im_mosi,
441
    reg_data_buf_miso => reg_diag_data_buf_im_miso,
442
 
443
    -- ST interface
444
    in_sync           => out_sosi_arr(0).sync,
445
    in_sosi_arr       => out_sosi_arr
446
  );
447
 
448
END tb;

powered by: WebSVN 2.1.0

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