1 |
2 |
pela |
----------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- PlTbUtils Components ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- This file is part of the PlTbUtils project ----
|
6 |
|
|
---- http://opencores.org/project,pltbutils ----
|
7 |
|
|
---- ----
|
8 |
|
|
---- Description: ----
|
9 |
|
|
---- PlTbUtils is a collection of functions, procedures and ----
|
10 |
|
|
---- components for easily creating stimuli and checking response ----
|
11 |
|
|
---- in automatic self-checking testbenches. ----
|
12 |
|
|
---- ----
|
13 |
|
|
---- pltbutils_comp.vhd (this file) defines testbench components. ----
|
14 |
|
|
---- ----
|
15 |
|
|
---- ----
|
16 |
|
|
---- To Do: ----
|
17 |
|
|
---- - ----
|
18 |
|
|
---- ----
|
19 |
|
|
---- Author(s): ----
|
20 |
97 |
pela |
---- - Per Larsson, pela.opencores@gmail.com ----
|
21 |
2 |
pela |
---- ----
|
22 |
|
|
----------------------------------------------------------------------
|
23 |
|
|
---- ----
|
24 |
|
|
---- Copyright (C) 2013 Authors and OPENCORES.ORG ----
|
25 |
|
|
---- ----
|
26 |
|
|
---- This source file may be used and distributed without ----
|
27 |
|
|
---- restriction provided that this copyright statement is not ----
|
28 |
|
|
---- removed from the file and that any derivative work contains ----
|
29 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
30 |
|
|
---- ----
|
31 |
|
|
---- This source file is free software; you can redistribute it ----
|
32 |
|
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
33 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
34 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
35 |
|
|
---- later version. ----
|
36 |
|
|
---- ----
|
37 |
|
|
---- This source is distributed in the hope that it will be ----
|
38 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
39 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
40 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
41 |
|
|
---- details. ----
|
42 |
|
|
---- ----
|
43 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
44 |
|
|
---- Public License along with this source; if not, download it ----
|
45 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
46 |
|
|
---- ----
|
47 |
|
|
----------------------------------------------------------------------
|
48 |
|
|
|
49 |
|
|
----------------------------------------------------------------------
|
50 |
|
|
-- pltbutils_clkgen
|
51 |
|
|
-- Creates a clock for use in a testbech.
|
52 |
7 |
pela |
-- A non-inverted as well as an inverted output is available,
|
53 |
|
|
-- use one or both depending on if you need a single-ended or
|
54 |
|
|
-- differential clock.
|
55 |
2 |
pela |
-- The clock stops when input port stop_sim goes '1'.
|
56 |
|
|
-- This makes the simulator stop (unless there are other infinite
|
57 |
|
|
-- processes running in the simulation).
|
58 |
|
|
----------------------------------------------------------------------
|
59 |
|
|
library ieee;
|
60 |
|
|
use ieee.std_logic_1164.all;
|
61 |
|
|
|
62 |
|
|
entity pltbutils_clkgen is
|
63 |
|
|
generic (
|
64 |
7 |
pela |
G_PERIOD : time := 10 ns;
|
65 |
|
|
G_INITVALUE : std_logic := '0'
|
66 |
2 |
pela |
);
|
67 |
|
|
port (
|
68 |
|
|
clk_o : out std_logic;
|
69 |
7 |
pela |
clk_n_o : out std_logic;
|
70 |
2 |
pela |
stop_sim_i : in std_logic
|
71 |
|
|
);
|
72 |
|
|
end entity pltbutils_clkgen;
|
73 |
|
|
|
74 |
|
|
architecture bhv of pltbutils_clkgen is
|
75 |
|
|
constant C_HALF_PERIOD : time := G_PERIOD / 2;
|
76 |
7 |
pela |
signal clk : std_logic := G_INITVALUE;
|
77 |
2 |
pela |
begin
|
78 |
|
|
|
79 |
7 |
pela |
clk <= not clk and not stop_sim_i after C_HALF_PERIOD;
|
80 |
|
|
clk_o <= clk;
|
81 |
|
|
clk_n_o <= not clk;
|
82 |
2 |
pela |
|
83 |
|
|
end architecture bhv;
|
84 |
|
|
|
85 |
|
|
|