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

Subversion Repositories astron_wb_fft

[/] [astron_wb_fft/] [trunk/] [tb_fft_functions.vhd] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 danv
-------------------------------------------------------------------------------
2
--
3
-- Copyright (C) 2013
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: Test bench for functions in fft_pkg.vhd
23
--
24
-- Description:
25
--   Use signals to observe the result of functions in the Wave Window.
26
--   Manually verify that the functions yield the expected result.
27
-- Usage:
28
--   > as 3
29
--   > run 1 us
30
--
31
 
32
LIBRARY IEEE, common_pkg_lib;
33
USE IEEE.STD_LOGIC_1164.ALL;
34
USE common_pkg_lib.common_pkg.ALL;
35
USE work.fft_pkg.ALL;
36
USE work.tb_fft_pkg.ALL;
37
 
38
ENTITY tb_fft_functions IS
39
END tb_fft_functions;
40
 
41
ARCHITECTURE tb OF tb_fft_functions IS
42
 
43
  CONSTANT c_wb_factor     : NATURAL := 4;
44
  CONSTANT c_nof_points    : NATURAL := 32;
45
  CONSTANT c_w             : NATURAL := ceil_log2(c_nof_points);
46
 
47
  -- index_arr                          =  0  1  2  3   4  5  6  7   8  9 10 11  12 13 14 15  16 17 18 19  20 21 22 23  24 25 26 27  28 29 30 31
48
  -- index_transpose_P_N_arr            =  0  8 16 24   1  9 17 25   2 10 18 26   3 11 19 27   4 12 20 28   5 13 21 29   6 14 22 30   7 15 23 31
49
  -- index_transpose_N_P_arr            =  0  4  8 12  16 20 24 28   1  5  9 13  17 21 25 29   2  6 10 14  18 22 26 30   3  7 11 15  19 23 27 31
50
  -- bin_complex_arr                    = 16  0 24  8  20  4 28 12  18  2 26 10  22  6 30 14  17  1 25  9  21  5 29 13  19  3 27 11  23  7 31 15
51
  -- bin_complex_flip_arr               = 16 17 18 19  20 21 22 23  24 25 26 27  28 29 30 31   0  1  2  3   4  5  6  7   8  9 10 11  12 13 14 15
52
  -- bin_complex_flip_transpose_arr     =  4 12 20 28   5 13 21 29   6 14 22 30   7 15 23 31   0  8 16 24   1  9 17 25   2 10 18 26   3 11 19 27
53
  -- bin_complex_reorder_arr            =  0  1  2  3   4  5  6  7   8  9 10 11  12 13 14 15  16 17 18 19  20 21 22 23  24 25 26 27  28 29 30 31
54
  -- bin_complex_reorder_transpose_arr  =  0  8 16 24   1  9 17 25   2 10 18 26   3 11 19 27   4 12 20 28   5 13 21 29   6 14 22 30   7 15 23 31
55
  -- bin_two_real_reorder_arr           =  0  1  2  3   0  1  2  3   4  5  6  7   4  5  6  7   8  9 10 11   8  9 10 11  12 13 14 15  12 13 14 15
56
  -- bin_two_real_reorder_transpose_arr =  0  4  8 12   0  4  8 12   1  5  9 13   1  5  9 13   2  6 10 14   2  6 10 14   3  7 11 15   3  7 11 15
57
  SIGNAL index_arr                          : t_natural_arr(0 TO c_nof_points-1) := array_init(0, c_nof_points, 1);
58
  SIGNAL index_transpose_P_N_arr            : t_natural_arr(0 TO c_nof_points-1);
59
  SIGNAL index_transpose_N_P_arr            : t_natural_arr(0 TO c_nof_points-1);
60
  SIGNAL index_transpose_N_P_flip_arr       : t_natural_arr(0 TO c_nof_points-1);
61
  SIGNAL index_flip_transpose_N_P_arr       : t_natural_arr(0 TO c_nof_points-1);
62
  SIGNAL index_flip_arr                     : t_natural_arr(0 TO c_nof_points-1);
63
  SIGNAL index_flip_shift_arr               : t_natural_arr(0 TO c_nof_points-1);
64
  SIGNAL index_shift_flip_arr               : t_natural_arr(0 TO c_nof_points-1);
65
  SIGNAL bin_complex_arr                    : t_natural_arr(0 TO c_nof_points-1);
66
  SIGNAL bin_complex_flip_arr               : t_natural_arr(0 TO c_nof_points-1);  -- flip()
67
  SIGNAL bin_complex_flip_transpose_arr     : t_natural_arr(0 TO c_nof_points-1);
68
  SIGNAL bin_complex_reorder_arr            : t_natural_arr(0 TO c_nof_points-1);  -- fft_shift(flip())
69
  SIGNAL bin_complex_reorder_transpose_arr  : t_natural_arr(0 TO c_nof_points-1);
70
  SIGNAL bin_two_real_reorder_arr           : t_natural_arr(0 TO c_nof_points-1);  -- separate(flip())
71
  SIGNAL bin_two_real_reorder_transpose_arr : t_natural_arr(0 TO c_nof_points-1);
72
 
73
BEGIN
74
 
75
  p_bin : PROCESS
76
  BEGIN
77
    FOR I IN 0 TO c_nof_points-1 LOOP
78
      index_flip_arr(I)                    <= flip(I, c_w);
79
      index_transpose_P_N_arr(I)           <= transpose(I, c_wb_factor, c_nof_points/c_wb_factor);
80
      index_transpose_N_P_arr(I)           <= transpose(I, c_nof_points/c_wb_factor, c_wb_factor);
81
      index_transpose_N_P_flip_arr(I)      <= transpose(flip(I, c_w), c_nof_points/c_wb_factor, c_wb_factor);
82
      index_flip_transpose_N_P_arr(I)      <= flip(transpose(I, c_nof_points/c_wb_factor, c_wb_factor), c_w);
83
      index_flip_shift_arr(I)              <= flip(fft_shift(I, c_w), c_w);
84
      index_shift_flip_arr(I)              <= fft_shift(flip(I, c_w), c_w);
85
      --                                                                                                use_       use_      use_
86
      --                                                                                                index_flip fft_shift separate
87
      bin_complex_arr(I)                    <= fft_index_to_bin_frequency(c_wb_factor, c_nof_points, I, FALSE,     FALSE,    FALSE);
88
      bin_complex_flip_arr(I)               <= fft_index_to_bin_frequency(c_wb_factor, c_nof_points, I, TRUE,      FALSE,    FALSE);
89
      bin_complex_flip_transpose_arr(I)     <= fft_index_to_bin_frequency(c_wb_factor, c_nof_points, I, TRUE,      FALSE,    FALSE);
90
      bin_complex_reorder_arr(I)            <= fft_index_to_bin_frequency(c_wb_factor, c_nof_points, I, TRUE,      TRUE,     FALSE);
91
      bin_complex_reorder_transpose_arr(I)  <= fft_index_to_bin_frequency(c_wb_factor, c_nof_points, I, TRUE,      TRUE,     FALSE);
92
      bin_two_real_reorder_arr(I)           <= fft_index_to_bin_frequency(c_wb_factor, c_nof_points, I, TRUE,      FALSE,    TRUE);
93
      bin_two_real_reorder_transpose_arr(I) <= fft_index_to_bin_frequency(c_wb_factor, c_nof_points, I, TRUE,      FALSE,    TRUE);
94
    END LOOP;
95
    WAIT;
96
  END PROCESS;
97
 
98
END tb;
99
 

powered by: WebSVN 2.1.0

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