1 |
d93979b7
|
Arnaud Dieumegard
|
|
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_18_fg_18_11.vhd,v 1.2 2001-10-26 16:29:36 paw Exp $
|
23 |
|
|
-- $Revision: 1.2 $
|
24 |
|
|
--
|
25 |
|
|
-- ---------------------------------------------------------------------
|
26 |
|
|
|
27 |
|
|
entity fg_18_11 is
|
28 |
|
|
end entity fg_18_11;
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
architecture test of fg_18_11 is
|
33 |
|
|
|
34 |
|
|
subtype byte is bit_vector(7 downto 0);
|
35 |
|
|
type byte_array is array (natural range <>) of byte;
|
36 |
|
|
|
37 |
|
|
function resolve_bytes ( drivers : in byte_array ) return byte is
|
38 |
|
|
begin
|
39 |
|
|
return drivers(drivers'left);
|
40 |
|
|
end function resolve_bytes;
|
41 |
|
|
|
42 |
|
|
function resolve_bits ( drivers : in bit_vector ) return bit is
|
43 |
|
|
begin
|
44 |
|
|
return drivers(drivers'left);
|
45 |
|
|
end function resolve_bits;
|
46 |
|
|
|
47 |
|
|
-- code from book (in text)
|
48 |
|
|
|
49 |
|
|
signal address : bit_vector(15 downto 0);
|
50 |
|
|
signal data : resolve_bytes byte;
|
51 |
|
|
signal rd, wr, io : bit; -- read, write, io/mem select
|
52 |
|
|
signal ready : resolve_bits bit;
|
53 |
|
|
|
54 |
|
|
-- end code from book
|
55 |
|
|
|
56 |
|
|
begin
|
57 |
|
|
|
58 |
|
|
-- code from book
|
59 |
|
|
|
60 |
|
|
bus_monitor : process is
|
61 |
|
|
|
62 |
|
|
constant header : string(1 to 44)
|
63 |
|
|
:= FF & " Time R/W I/M Address Data";
|
64 |
|
|
|
65 |
|
|
use std.textio.all;
|
66 |
|
|
|
67 |
|
|
file log : text open write_mode is "buslog";
|
68 |
|
|
variable trace_line : line;
|
69 |
|
|
variable line_count : natural := 0;
|
70 |
|
|
|
71 |
|
|
begin
|
72 |
|
|
|
73 |
|
|
if line_count mod 60 = 0 then
|
74 |
|
|
write ( trace_line, header );
|
75 |
|
|
writeline ( log, trace_line );
|
76 |
|
|
writeline ( log, trace_line ); -- empty line
|
77 |
|
|
end if;
|
78 |
|
|
wait until (rd = '1' or wr = '1') and ready = '1';
|
79 |
|
|
write ( trace_line, now, justified => right, field => 10, unit => us );
|
80 |
|
|
write ( trace_line, string'(" ") );
|
81 |
|
|
if rd = '1' then
|
82 |
|
|
write ( trace_line, 'R' );
|
83 |
|
|
else
|
84 |
|
|
write ( trace_line, 'W' );
|
85 |
|
|
end if;
|
86 |
|
|
write ( trace_line, string'(" ") );
|
87 |
|
|
if io = '1' then
|
88 |
|
|
write ( trace_line, 'I' );
|
89 |
|
|
else
|
90 |
|
|
write ( trace_line, 'M' );
|
91 |
|
|
end if;
|
92 |
|
|
write ( trace_line, string'(" ") );
|
93 |
|
|
write ( trace_line, address );
|
94 |
|
|
write ( trace_line, ' ');
|
95 |
|
|
write ( trace_line, data );
|
96 |
|
|
writeline ( log, trace_line );
|
97 |
|
|
line_count := line_count + 1;
|
98 |
|
|
|
99 |
|
|
end process bus_monitor;
|
100 |
|
|
|
101 |
|
|
-- end code from book
|
102 |
|
|
|
103 |
|
|
stimulus : process is
|
104 |
|
|
begin
|
105 |
|
|
wait for 0.4 us - now;
|
106 |
|
|
rd <= '1', '0' after 10 ns;
|
107 |
|
|
address <= X"0000";
|
108 |
|
|
data <= B"10011110";
|
109 |
|
|
ready <= '1', '0' after 10 ns;
|
110 |
|
|
|
111 |
|
|
wait for 0.9 us - now;
|
112 |
|
|
rd <= '1', '0' after 10 ns;
|
113 |
|
|
address <= X"0001";
|
114 |
|
|
data <= B"00010010";
|
115 |
|
|
ready <= '1', '0' after 10 ns;
|
116 |
|
|
|
117 |
|
|
wait for 2.0 us - now;
|
118 |
|
|
rd <= '1', '0' after 10 ns;
|
119 |
|
|
address <= X"0014";
|
120 |
|
|
data <= B"11100111";
|
121 |
|
|
ready <= '1', '0' after 10 ns;
|
122 |
|
|
|
123 |
|
|
wait for 2.7 us - now;
|
124 |
|
|
wr <= '1', '0' after 10 ns;
|
125 |
|
|
io <= '1', '0' after 10 ns;
|
126 |
|
|
address <= X"0007";
|
127 |
|
|
data <= X"00";
|
128 |
|
|
ready <= '1', '0' after 10 ns;
|
129 |
|
|
|
130 |
|
|
wait;
|
131 |
|
|
end process stimulus;
|
132 |
|
|
|
133 |
|
|
end architecture test;
|