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 |
|
|
---- - Per Larsson, pela@opencores.org ----
|
21 |
|
|
---- ----
|
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 |
|
|
-- The clock stops when input port stop_sim goes '1'.
|
53 |
|
|
-- This makes the simulator stop (unless there are other infinite
|
54 |
|
|
-- processes running in the simulation).
|
55 |
|
|
----------------------------------------------------------------------
|
56 |
|
|
library ieee;
|
57 |
|
|
use ieee.std_logic_1164.all;
|
58 |
|
|
|
59 |
|
|
entity pltbutils_clkgen is
|
60 |
|
|
generic (
|
61 |
|
|
G_PERIOD : time := 10 ns
|
62 |
|
|
);
|
63 |
|
|
port (
|
64 |
|
|
clk_o : out std_logic;
|
65 |
|
|
stop_sim_i : in std_logic
|
66 |
|
|
);
|
67 |
|
|
end entity pltbutils_clkgen;
|
68 |
|
|
|
69 |
|
|
architecture bhv of pltbutils_clkgen is
|
70 |
|
|
constant C_HALF_PERIOD : time := G_PERIOD / 2;
|
71 |
|
|
signal clk : std_logic := '0';
|
72 |
|
|
begin
|
73 |
|
|
|
74 |
|
|
clk <= not clk and not stop_sim_i after C_HALF_PERIOD;
|
75 |
|
|
clk_o <= clk;
|
76 |
|
|
|
77 |
|
|
end architecture bhv;
|
78 |
|
|
|
79 |
|
|
|