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

Subversion Repositories astron_r2sdf_fft

[/] [astron_r2sdf_fft/] [trunk/] [tb_rTwoOrder.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) 2011
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 rTwoOrder
23
-- Features:
24
--
25
-- Usage:
26
-- > as 10
27
-- > run -all
28
-- Observe manually in Wave Window that out_dat is the previous page in_dat.
29
-- Use g_bit_flip=false to ease manualy interpretation of out_dat. 
30
 
31
LIBRARY IEEE, common_pkg_lib;
32
USE IEEE.std_logic_1164.ALL;
33
USE IEEE.numeric_std.ALL;
34
USE common_pkg_lib.common_pkg.ALL;
35
USE common_pkg_lib.common_lfsr_sequences_pkg.ALL;
36
USE common_pkg_lib.tb_common_pkg.ALL;
37
 
38
ENTITY tb_rTwoOrder IS
39
END tb_rTwoOrder;
40
 
41
ARCHITECTURE tb OF tb_rTwoOrder IS
42
 
43
  CONSTANT c_clk_period : TIME := 10 ns;
44
 
45
  CONSTANT c_nof_points : NATURAL := 8;
46
  CONSTANT c_dat_w      : NATURAL := 10;
47
 
48
  SIGNAL tb_end    : STD_LOGIC := '0';
49
  SIGNAL rst       : STD_LOGIC;
50
  SIGNAL clk       : STD_LOGIC := '1';
51
 
52
  SIGNAL random_0  : STD_LOGIC_VECTOR(14 DOWNTO 0) := (OTHERS=>'0');  -- use different lengths to have different random sequences
53
 
54
  SIGNAL in_dat    : STD_LOGIC_VECTOR(c_dat_w-1 DOWNTO 0) := TO_UVEC(1, c_dat_w);
55
  SIGNAL in_val    : STD_LOGIC;
56
 
57
  SIGNAL out_dat   : STD_LOGIC_VECTOR(c_dat_w-1 DOWNTO 0);
58
  SIGNAL out_val   : STD_LOGIC;
59
 
60
BEGIN
61
 
62
  clk <= (NOT clk) OR tb_end AFTER c_clk_period/2;
63
  rst <= '1', '0' AFTER c_clk_period*3;
64
 
65
  random_0 <= func_common_random(random_0) WHEN rising_edge(clk);
66
 
67
  in_dat <= INCR_UVEC(in_dat, 1) when rising_edge(clk) and in_val='1';
68
 
69
  -- run 1 us
70
  p_stimuli : PROCESS
71
  BEGIN
72
    in_val <= '0';
73
    WAIT UNTIL rst = '0';
74
    proc_common_wait_some_cycles(clk, 3);
75
 
76
    FOR J IN 0 TO 7 LOOP
77
      -- wait some time
78
--       in_val <= '0';
79
--       FOR I IN 0 TO 1 LOOP WAIT UNTIL rising_edge(clk); END LOOP;
80
 
81
      -- one block
82
      in_val <= NOT in_val;                 -- toggling
83
      FOR I IN 0 TO c_nof_points-1 LOOP
84
        --in_val <= NOT in_val;                 -- toggling
85
        --in_val <= random_0(random_0'HIGH);    -- random
86
        WAIT UNTIL rising_edge(clk);
87
      END LOOP;
88
    END LOOP;
89
 
90
    in_val <= '0';
91
 
92
    proc_common_wait_some_cycles(clk, 10);
93
    tb_end <= '1';
94
    WAIT;
95
  END PROCESS;
96
 
97
  -- device under test
98
  u_dut : ENTITY work.rTwoOrder
99
  GENERIC MAP (
100
    g_nof_points  => c_nof_points,
101
    g_bit_flip    => false
102
  )
103
  port map (
104
    clk     => clk,
105
    rst     => rst,
106
    in_dat  => in_dat,
107
    in_val  => in_val,
108
    out_dat => out_dat,
109
    out_val => out_val
110
  );
111
 
112
END tb;

powered by: WebSVN 2.1.0

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