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

powered by: WebSVN 2.1.0

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