1
|
|
2
|
-- Copyright (C) 1996 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
|
-- ---------------------------------------------------------------------
|
21
|
--
|
22
|
-- $Id: ch_16_fg_16_09.vhd,v 1.2 2001-10-26 16:29:36 paw Exp $
|
23
|
-- $Revision: 1.2 $
|
24
|
--
|
25
|
-- ---------------------------------------------------------------------
|
26
|
|
27
|
entity latch is
|
28
|
generic ( width : positive );
|
29
|
port ( enable : in bit;
|
30
|
d : in bit_vector(0 to width - 1);
|
31
|
q : out bit_vector(0 to width - 1) );
|
32
|
end entity latch;
|
33
|
|
34
|
--------------------------------------------------
|
35
|
|
36
|
architecture behavioral of latch is
|
37
|
begin
|
38
|
|
39
|
transfer_control : block ( enable = '1' ) is
|
40
|
begin
|
41
|
q <= guarded d;
|
42
|
end block transfer_control;
|
43
|
|
44
|
end architecture behavioral;
|
45
|
|
46
|
|
47
|
-- not in book
|
48
|
|
49
|
entity fg_16_09 is
|
50
|
end entity fg_16_09;
|
51
|
|
52
|
|
53
|
architecture test of fg_16_09 is
|
54
|
|
55
|
signal enable : bit := '0';
|
56
|
signal d, q : bit_vector(0 to 7);
|
57
|
|
58
|
begin
|
59
|
|
60
|
dut : entity work.latch(behavioral)
|
61
|
generic map ( width => 8 )
|
62
|
port map ( enable => enable, d => d, q => q );
|
63
|
|
64
|
stimulus : process is
|
65
|
begin
|
66
|
wait for 10 ns;
|
67
|
d <= X"11"; wait for 10 ns;
|
68
|
enable <= '1'; wait for 10 ns;
|
69
|
d <= X"AA"; wait for 10 ns;
|
70
|
enable <= '0'; wait for 10 ns;
|
71
|
d <= X"00"; wait for 10 ns;
|
72
|
|
73
|
wait;
|
74
|
end process stimulus;
|
75
|
|
76
|
end architecture test;
|
77
|
|
78
|
-- end not in book
|