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

Subversion Repositories common_components

[/] [common_components/] [trunk/] [tb_common_spulse.vhd] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 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: Testbench for common_spulse.
23
-- Description:
24
--   The tb is not self checking, so manually observe working in Wave window.
25
-- Usage:
26
-- > as 10
27
-- > run 1 us
28
 
29
LIBRARY IEEE, common_pkg_lib;
30
USE IEEE.std_logic_1164.ALL;
31
USE IEEE.numeric_std.ALL;
32
USE common_pkg_lib.common_pkg.ALL;
33
 
34
ENTITY tb_common_spulse IS
35
END tb_common_spulse;
36
 
37
ARCHITECTURE tb OF tb_common_spulse IS
38
 
39
  CONSTANT c_meta_delay    : NATURAL := 2;
40
 
41
  --CONSTANT in_clk_period   : TIME := 10 ns;
42
  CONSTANT in_clk_period   : TIME := 27 ns;
43
  CONSTANT out_clk_period  : TIME := 17 ns;
44
 
45
  SIGNAL in_rst    : STD_LOGIC;
46
  SIGNAL out_rst   : STD_LOGIC;
47
  SIGNAL in_clk    : STD_LOGIC := '0';
48
  SIGNAL out_clk   : STD_LOGIC := '0';
49
  SIGNAL in_pulse  : STD_LOGIC;
50
  SIGNAL out_pulse : STD_LOGIC;
51
 
52
BEGIN
53
 
54
  in_clk  <= NOT in_clk  AFTER in_clk_period/2;
55
  out_clk <= NOT out_clk AFTER out_clk_period/2;
56
 
57
  p_in_stimuli : PROCESS
58
  BEGIN
59
    in_rst <= '1';
60
    in_pulse <= '0';
61
    WAIT UNTIL rising_edge(in_clk);
62
    in_rst <= '0';
63
    FOR I IN 0 TO 9 LOOP
64
      WAIT UNTIL rising_edge(in_clk);
65
    END LOOP;
66
    in_pulse <= '1';
67
    WAIT UNTIL rising_edge(in_clk);
68
    in_pulse <= '0';
69
    WAIT;
70
  END PROCESS;
71
 
72
  u_out_rst : ENTITY work.common_areset
73
  PORT MAP (
74
    in_rst   => in_rst,
75
    clk      => out_clk,
76
    out_rst  => out_rst
77
  );
78
 
79
  u_spulse : ENTITY work.common_spulse
80
  GENERIC MAP (
81
    g_delay_len => c_meta_delay
82
  )
83
  PORT MAP (
84
    in_clk     => in_clk,
85
    in_rst     => in_rst,
86
    in_pulse   => in_pulse,
87
    out_clk    => out_clk,
88
    out_rst    => out_rst,
89
    out_pulse  => out_pulse
90
  );
91
 
92
END tb;

powered by: WebSVN 2.1.0

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