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

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.hwp.storage/] [fifos/] [gray_fifo/] [1.0/] [tb/] [tb_cdc_fifo_tester.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      : Testbench for design "cdc_fifo_tester"
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : tb_cdc_fifo_tester.vhd
6
-- Author     : 
7
-- Created    : 19.12.2006
8
-- Last update: 19.12.2006
9
-- Description: 
10
-------------------------------------------------------------------------------
11
-- Copyright (c) 2006 
12
-------------------------------------------------------------------------------
13
-- Revisions  :
14
-- Date        Version  Author  Description
15
-- 19.12.2006  1.0      AK      Created
16
-------------------------------------------------------------------------------
17
 
18
library ieee;
19
use ieee.std_logic_1164.all;
20
use ieee.std_logic_arith.all;
21
use ieee.std_logic_unsigned.all;use ieee.std_logic_1164.all;
22
 
23
-------------------------------------------------------------------------------
24
 
25
entity tb_cdc_fifo_tester is
26
 
27
end tb_cdc_fifo_tester;
28
 
29
-------------------------------------------------------------------------------
30
 
31
architecture struct of tb_cdc_fifo_tester is
32
 
33
  component cdc_fifo_tester
34
    generic (
35
      depth_log2_g : integer;
36
      dataw_g      : integer);
37
    port (
38
      rd_clk, wr_clk      : in  std_logic;
39
      rst_n               : in  std_logic;
40
      pass_out, error_out : out std_logic;
41
      pass_count_out      : out std_logic_vector(31 downto 0));
42
  end component;
43
 
44
  -- component generics
45
  constant depth_log2_g : integer := 3;
46
  constant dataw_g      : integer := 30;
47
 
48
  -- component ports
49
  signal Clk1, Clk2      : std_logic;
50
  signal rst_n               : std_logic;
51
  signal pass_out, error_out : std_logic;
52
  signal pass_count_out      : std_logic_vector(31 downto 0);
53
 
54
  -- clock and reset
55
  constant Period1 : time := 100 ns;
56
  constant Period2 : time := 10 ns;
57
 
58
begin  -- struct
59
 
60
  assertion: process (Clk1, rst_n)
61
  begin  -- process assertion
62
    if rst_n = '0' then                 -- asynchronous reset (active low)
63
 
64
    elsif Clk1'event and Clk1 = '1' then  -- rising clock edge
65
      assert error_out = '0' report "Error!" severity error;
66
    end if;
67
  end process assertion;
68
 
69
  -- component instantiation
70
  DUT: cdc_fifo_tester
71
    generic map (
72
      depth_log2_g => depth_log2_g,
73
      dataw_g      => dataw_g)
74
    port map (
75
      rd_clk         => Clk1,
76
      wr_clk         => Clk2,
77
      rst_n          => rst_n,
78
      pass_out       => pass_out,
79
      error_out      => error_out,
80
      pass_count_out => pass_count_out);
81
 
82
  -- clock generation
83
  -- PROC  
84
  CLOCK1: process -- generate clock signal for design
85
    variable clktmp: std_logic := '0';
86
  begin
87
    wait for PERIOD1/2;
88
    clktmp := not clktmp;
89
    Clk1 <= clktmp;
90
  end process CLOCK1;
91
 
92
  -- clock generation
93
  -- PROC  
94
  CLOCK2: process -- generate clock signal for design
95
    variable clktmp: std_logic := '0';
96
  begin
97
    wait for PERIOD2/2;
98
    clktmp := not clktmp;
99
    Clk2 <= clktmp;
100
  end process CLOCK2;
101
 
102
  -- PROC
103
  RESET: process
104
  begin
105
    Rst_n <= '0';        -- Reset the testsystem
106
    wait for 6*PERIOD1; -- Wait 
107
    Rst_n <= '1';        -- de-assert reset
108
    wait;
109
  end process RESET;
110
 
111
end struct;
112
 
113
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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