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_13_fg_13_19.vhd,v 1.2 2001-10-26 16:29:35 paw Exp $
|
23
|
-- $Revision: 1.2 $
|
24
|
--
|
25
|
-- ---------------------------------------------------------------------
|
26
|
|
27
|
-- code from book (in text)
|
28
|
|
29
|
entity nand3 is
|
30
|
port ( a, b, c : in bit; y : out bit );
|
31
|
end entity nand3;
|
32
|
|
33
|
-- end code from book
|
34
|
|
35
|
architecture behavioral of nand3 is
|
36
|
begin
|
37
|
y <= not (a and b and c);
|
38
|
end architecture behavioral;
|
39
|
|
40
|
|
41
|
entity logic_block is
|
42
|
end entity logic_block;
|
43
|
|
44
|
|
45
|
-- code from book
|
46
|
|
47
|
library gate_lib;
|
48
|
|
49
|
architecture ideal of logic_block is
|
50
|
|
51
|
component nand2 is
|
52
|
port ( in1, in2 : in bit; result : out bit );
|
53
|
end component nand2;
|
54
|
|
55
|
for all : nand2
|
56
|
use entity gate_lib.nand3(behavioral)
|
57
|
port map ( a => in1, b => in2, c => '1', y => result );
|
58
|
|
59
|
-- . . . -- other declarations
|
60
|
|
61
|
-- not in book
|
62
|
signal s1, s2, s3 : bit := '0';
|
63
|
|
64
|
begin
|
65
|
|
66
|
gate1 : component nand2
|
67
|
port map ( in1 => s1, in2 => s2, result => s3 );
|
68
|
|
69
|
-- . . . -- other concurrent statements
|
70
|
|
71
|
-- not in book
|
72
|
|
73
|
s1 <= '1' after 20 ns;
|
74
|
|
75
|
s2 <= '1' after 10 ns, '0' after 20 ns, '1' after 30 ns;
|
76
|
|
77
|
-- end not in book
|
78
|
|
79
|
end architecture ideal;
|
80
|
|
81
|
-- end code from book
|