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

Subversion Repositories astron_multiplexer

[/] [astron_multiplexer/] [trunk/] [tb_common_zip.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) 2009
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 common_zip
23
-- Features:
24
--
25
-- Usage:
26
-- > as 10
27
-- > run -all
28
-- Observe manually in Wave Window that the values of the in_dat_arr are zipped
29
-- to the out_dat vector. 
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
 
39
ENTITY tb_common_zip IS
40
  GENERIC (
41
    g_nof_streams : natural := 3;  -- Number of input streams to be zipped
42
    g_dat_w       : natural := 8
43
  );
44
END tb_common_zip;
45
 
46
 
47
ARCHITECTURE tb OF tb_common_zip IS
48
 
49
  CONSTANT clk_period   : TIME      := 10 ns;
50
  CONSTANT c_rl         : NATURAL   := 1;     -- Read Latency = 1
51
 
52
  SIGNAL rst         : STD_LOGIC;
53
  SIGNAL clk         : STD_LOGIC := '0';
54
  SIGNAL tb_end      : STD_LOGIC := '0';
55
 
56
  SIGNAL ready       : STD_LOGIC := '1';       -- Ready is always '1'
57
  SIGNAL in_dat_arr  : t_slv_64_arr(g_nof_streams-1 DOWNTO 0);
58
  SIGNAL in_val      : STD_LOGIC := '1';
59
  SIGNAL out_dat     : std_logic_vector(g_dat_w-1 DOWNTO 0);
60
  SIGNAL out_val     : std_logic;
61
  SIGNAL ena         : STD_LOGIC := '1';
62
  SIGNAL ena_mask    : STD_LOGIC := '1';
63
  SIGNAL enable      : STD_LOGIC := '1';
64
BEGIN
65
 
66
  clk    <= NOT clk OR tb_end AFTER clk_period/2;
67
  rst    <= '1', '0' AFTER 7 * clk_period;
68
  tb_end <= '0', '1' AFTER 1 us;
69
 
70
  gen_data : FOR I IN 0 TO g_nof_streams-1 GENERATE
71
    proc_common_gen_data(c_rl, I*10, rst, clk, enable, ready, in_dat_arr(I), in_val);
72
  END GENERATE;
73
 
74
  -- The "ena" forms the dutu cycle for the in_val signal
75
  proc_common_gen_pulse(1, g_nof_streams, '1', clk, ena);
76
 
77
  -- The "ena_mask" creates a gap between series of incoming packets in order
78
  -- to simulate the starting and stopping of the incoming streams. 
79
  proc_common_gen_pulse(g_nof_streams*10, g_nof_streams*15, '1', clk, ena_mask);
80
  enable <= ena and ena_mask;
81
 
82
  u_dut : ENTITY work.common_zip
83
  GENERIC MAP (
84
    g_nof_streams => g_nof_streams,
85
    g_dat_w       => g_dat_w
86
  )
87
  PORT MAP (
88
    rst        => rst,
89
    clk        => clk,
90
    in_val     => in_val,
91
    in_dat_arr => in_dat_arr,
92
    out_val    => out_val,
93
    out_dat    => out_dat
94
  );
95
 
96
END tb;
97
 

powered by: WebSVN 2.1.0

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