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_07_fg_07_20.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
|
library ieee;
|
30
|
use ieee.std_logic_1164.all;
|
31
|
|
32
|
entity reg_ctrl is
|
33
|
port ( reg_addr_decoded, rd, wr, io_en, cpu_clk : in std_ulogic;
|
34
|
reg_rd, reg_wr : out std_ulogic );
|
35
|
end entity reg_ctrl;
|
36
|
|
37
|
architecture bool_eqn of reg_ctrl is
|
38
|
begin
|
39
|
|
40
|
rd_ctrl : reg_rd <= reg_addr_decoded and rd and io_en;
|
41
|
|
42
|
rw_ctrl : reg_wr <= reg_addr_decoded and wr and io_en
|
43
|
and not cpu_clk;
|
44
|
|
45
|
end architecture bool_eqn;
|
46
|
|
47
|
-- end code from book
|
48
|
|
49
|
entity fg_07_20 is
|
50
|
|
51
|
end entity fg_07_20;
|
52
|
|
53
|
library ieee;
|
54
|
use ieee.std_logic_1164.all;
|
55
|
library stimulus;
|
56
|
|
57
|
architecture test of fg_07_20 is
|
58
|
|
59
|
signal reg_addr_decoded, rd, wr, io_en,
|
60
|
cpu_clk, reg_rd, reg_wr : std_ulogic := '0';
|
61
|
signal test_vector : std_ulogic_vector(1 to 5);
|
62
|
|
63
|
use stimulus.stimulus_generators.all;
|
64
|
|
65
|
begin
|
66
|
|
67
|
dut : entity work.reg_ctrl
|
68
|
port map ( reg_addr_decoded, rd, wr, io_en, cpu_clk, reg_rd, reg_wr );
|
69
|
|
70
|
stimulus_proc : process is
|
71
|
begin
|
72
|
all_possible_values( bv => test_vector,
|
73
|
delay_between_values => 10 ns );
|
74
|
wait;
|
75
|
end process stimulus_proc;
|
76
|
|
77
|
(reg_addr_decoded, rd, wr, io_en, cpu_clk) <= test_vector;
|
78
|
|
79
|
end architecture test;
|