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 5

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

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

powered by: WebSVN 2.1.0

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