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 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 danv
-------------------------------------------------------------------------------
2
--
3 3 danv
-- Copyright 2020
4 2 danv
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
5
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
6 3 danv
-- 
7
-- Licensed under the Apache License, Version 2.0 (the "License");
8
-- you may not use this file except in compliance with the License.
9
-- You may obtain a copy of the License at
10
-- 
11
--     http://www.apache.org/licenses/LICENSE-2.0
12
-- 
13
-- Unless required by applicable law or agreed to in writing, software
14
-- distributed under the License is distributed on an "AS IS" BASIS,
15
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
-- See the License for the specific language governing permissions and
17
-- limitations under the License.
18 2 danv
--
19
-------------------------------------------------------------------------------
20
 
21
-- Purpose: Test bench for rTwoOrder
22
-- Features:
23
--
24
-- Usage:
25
-- > as 10
26
-- > run -all
27
-- Observe manually in Wave Window that out_dat is the previous page in_dat.
28
-- Use g_bit_flip=false to ease manualy interpretation of out_dat. 
29
 
30
LIBRARY IEEE, common_pkg_lib;
31
USE IEEE.std_logic_1164.ALL;
32
USE IEEE.numeric_std.ALL;
33
USE common_pkg_lib.common_pkg.ALL;
34
USE common_pkg_lib.common_lfsr_sequences_pkg.ALL;
35
USE common_pkg_lib.tb_common_pkg.ALL;
36
 
37
ENTITY tb_rTwoOrder IS
38
END tb_rTwoOrder;
39
 
40
ARCHITECTURE tb OF tb_rTwoOrder IS
41
 
42
  CONSTANT c_clk_period : TIME := 10 ns;
43
 
44
  CONSTANT c_nof_points : NATURAL := 8;
45
  CONSTANT c_dat_w      : NATURAL := 10;
46
 
47
  SIGNAL tb_end    : STD_LOGIC := '0';
48
  SIGNAL rst       : STD_LOGIC;
49
  SIGNAL clk       : STD_LOGIC := '1';
50
 
51
  SIGNAL random_0  : STD_LOGIC_VECTOR(14 DOWNTO 0) := (OTHERS=>'0');  -- use different lengths to have different random sequences
52
 
53
  SIGNAL in_dat    : STD_LOGIC_VECTOR(c_dat_w-1 DOWNTO 0) := TO_UVEC(1, c_dat_w);
54
  SIGNAL in_val    : STD_LOGIC;
55
 
56
  SIGNAL out_dat   : STD_LOGIC_VECTOR(c_dat_w-1 DOWNTO 0);
57
  SIGNAL out_val   : STD_LOGIC;
58
 
59
BEGIN
60
 
61
  clk <= (NOT clk) OR tb_end AFTER c_clk_period/2;
62
  rst <= '1', '0' AFTER c_clk_period*3;
63
 
64
  random_0 <= func_common_random(random_0) WHEN rising_edge(clk);
65
 
66
  in_dat <= INCR_UVEC(in_dat, 1) when rising_edge(clk) and in_val='1';
67
 
68
  -- run 1 us
69
  p_stimuli : PROCESS
70
  BEGIN
71
    in_val <= '0';
72
    WAIT UNTIL rst = '0';
73
    proc_common_wait_some_cycles(clk, 3);
74
 
75
    FOR J IN 0 TO 7 LOOP
76
      -- wait some time
77
--       in_val <= '0';
78
--       FOR I IN 0 TO 1 LOOP WAIT UNTIL rising_edge(clk); END LOOP;
79
 
80
      -- one block
81
      in_val <= NOT in_val;                 -- toggling
82
      FOR I IN 0 TO c_nof_points-1 LOOP
83
        --in_val <= NOT in_val;                 -- toggling
84
        --in_val <= random_0(random_0'HIGH);    -- random
85
        WAIT UNTIL rising_edge(clk);
86
      END LOOP;
87
    END LOOP;
88
 
89
    in_val <= '0';
90
 
91
    proc_common_wait_some_cycles(clk, 10);
92
    tb_end <= '1';
93
    WAIT;
94
  END PROCESS;
95
 
96
  -- device under test
97
  u_dut : ENTITY work.rTwoOrder
98
  GENERIC MAP (
99
    g_nof_points  => c_nof_points,
100
    g_bit_flip    => false
101
  )
102
  port map (
103
    clk     => clk,
104
    rst     => rst,
105
    in_dat  => in_dat,
106
    in_val  => in_val,
107
    out_dat => out_dat,
108
    out_val => out_val
109
  );
110
 
111
END tb;

powered by: WebSVN 2.1.0

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