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_05_ch_05_24.vhd,v 1.3 2001-10-26 16:29:34 paw Exp $
|
23
|
-- $Revision: 1.3 $
|
24
|
--
|
25
|
-- ---------------------------------------------------------------------
|
26
|
|
27
|
-- code from book:
|
28
|
|
29
|
entity and3 is
|
30
|
port ( a, b, c : in bit := '1';
|
31
|
z, not_z : out bit);
|
32
|
end entity and3;
|
33
|
|
34
|
-- end of code from book
|
35
|
|
36
|
architecture functional of and3 is
|
37
|
begin
|
38
|
|
39
|
non_inverting:
|
40
|
z <= a and b and c;
|
41
|
|
42
|
inverting:
|
43
|
not_z <= not (a and b and c);
|
44
|
|
45
|
end architecture functional;
|
46
|
|
47
|
entity ch_05_24 is
|
48
|
|
49
|
end entity ch_05_24;
|
50
|
|
51
|
library stimulus;
|
52
|
|
53
|
architecture test of ch_05_24 is
|
54
|
|
55
|
signal s1, s2, ctrl1_a, ctrl1_b : bit;
|
56
|
signal test_input : bit_vector(1 to 2);
|
57
|
|
58
|
use stimulus.stimulus_generators.all;
|
59
|
|
60
|
begin
|
61
|
|
62
|
|
63
|
block_05_4_a : block is
|
64
|
port ( ctrl1 : out bit );
|
65
|
port map ( ctrl1 => ctrl1_a );
|
66
|
begin
|
67
|
|
68
|
-- code from book:
|
69
|
|
70
|
g1 : entity work.and3 port map (a => s1, b => s2, not_z => ctrl1);
|
71
|
|
72
|
-- end of code from book
|
73
|
|
74
|
end block block_05_4_a;
|
75
|
|
76
|
block_05_4_b : block is
|
77
|
port ( ctrl1 : out bit );
|
78
|
port map ( ctrl1 => ctrl1_b );
|
79
|
begin
|
80
|
|
81
|
-- code from book:
|
82
|
|
83
|
g1 : entity work.and3 port map (a => s1, b => s2, not_z => ctrl1,
|
84
|
c => open, z => open);
|
85
|
|
86
|
-- end of code from book
|
87
|
|
88
|
end block block_05_4_b;
|
89
|
|
90
|
stimulus_proc : all_possible_values( bv => test_input,
|
91
|
delay_between_values => 10 ns );
|
92
|
|
93
|
(s1, s2) <= test_input;
|
94
|
|
95
|
verifier :
|
96
|
assert ctrl1_a = ctrl1_b
|
97
|
report "versions differ";
|
98
|
|
99
|
end architecture test;
|