1
|
|
2
|
-- Copyright (C) 2002 Morgan Kaufmann Publishers, Inc
|
3
|
|
4
|
-- This file is part of VESTs (Vhdl tESTs).
|
5
|
|
6
|
-- VESTs is free software; you can redistribute it and/or modify it
|
7
|
-- under the terms of the GNU General Public License as published by the
|
8
|
-- Free Software Foundation; either version 2 of the License, or (at
|
9
|
-- your option) any later version.
|
10
|
|
11
|
-- VESTs is distributed in the hope that it will be useful, but WITHOUT
|
12
|
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14
|
-- for more details.
|
15
|
|
16
|
-- You should have received a copy of the GNU General Public License
|
17
|
-- along with VESTs; if not, write to the Free Software Foundation,
|
18
|
-- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
|
20
|
entity hold_time_checker is
|
21
|
end entity hold_time_checker;
|
22
|
|
23
|
|
24
|
|
25
|
architecture test of hold_time_checker is
|
26
|
|
27
|
constant Thold_d_clk : delay_length := 3 ns;
|
28
|
|
29
|
signal clk, d : bit := '0';
|
30
|
|
31
|
begin
|
32
|
|
33
|
-- code from book
|
34
|
|
35
|
hold_time_checker : process ( clk, d ) is
|
36
|
variable last_clk_edge_time : time := 0 fs;
|
37
|
begin
|
38
|
if clk'event and clk = '1' then
|
39
|
last_clk_edge_time := now;
|
40
|
end if;
|
41
|
if d'event then
|
42
|
assert now - last_clk_edge_time >= Thold_d_clk
|
43
|
report "hold time violation";
|
44
|
end if;
|
45
|
end process hold_time_checker;
|
46
|
|
47
|
-- end code from book
|
48
|
|
49
|
clk_gen : clk <= '1' after 10 ns, '0' after 20 ns when clk = '0';
|
50
|
|
51
|
stimulus : d <= '1' after 15 ns,
|
52
|
'0' after 53 ns,
|
53
|
'1' after 72 ns;
|
54
|
|
55
|
end architecture test;
|