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_15_dlxtst-v.vhd,v 1.3 2001-11-03 23:19:37 paw Exp $
|
23
|
-- $Revision: 1.3 $
|
24
|
--
|
25
|
-- ---------------------------------------------------------------------
|
26
|
|
27
|
library ieee;
|
28
|
use ieee.std_logic_1164.all;
|
29
|
|
30
|
architecture verifier of dlx_test is
|
31
|
|
32
|
use work.dlx_types.all;
|
33
|
|
34
|
component clock_gen is
|
35
|
port ( phi1, phi2 : out std_logic;
|
36
|
reset : out std_logic );
|
37
|
end component clock_gen;
|
38
|
|
39
|
component memory is
|
40
|
port ( phi1, phi2 : in std_logic;
|
41
|
a : in dlx_address;
|
42
|
d : inout dlx_word;
|
43
|
width : in dlx_mem_width;
|
44
|
write_enable : in std_logic;
|
45
|
burst : in std_logic := '0';
|
46
|
mem_enable : in std_logic;
|
47
|
ready : out std_logic );
|
48
|
end component memory;
|
49
|
|
50
|
component dlx is
|
51
|
port ( phi1, phi2 : in std_logic;
|
52
|
reset : in std_logic;
|
53
|
halt : out std_logic;
|
54
|
a : out dlx_address;
|
55
|
d : inout dlx_word;
|
56
|
width : out dlx_mem_width;
|
57
|
write_enable : out std_logic;
|
58
|
ifetch : out std_logic;
|
59
|
mem_enable : out std_logic;
|
60
|
ready : in std_logic );
|
61
|
end component dlx;
|
62
|
|
63
|
signal phi1, phi2, reset : std_logic;
|
64
|
|
65
|
signal a_behav : dlx_address;
|
66
|
signal d_behav : dlx_word;
|
67
|
signal halt_behav : std_logic;
|
68
|
signal width_behav : dlx_mem_width;
|
69
|
signal write_enable_behav, mem_enable_behav, ifetch_behav : std_logic;
|
70
|
|
71
|
signal a_rtl : dlx_address;
|
72
|
signal d_rtl : dlx_word;
|
73
|
signal halt_rtl : std_logic;
|
74
|
signal width_rtl : dlx_mem_width;
|
75
|
signal write_enable_rtl, mem_enable_rtl, ifetch_rtl : std_logic;
|
76
|
|
77
|
signal ready_mem : std_logic;
|
78
|
|
79
|
begin
|
80
|
|
81
|
cg : component clock_gen
|
82
|
port map ( phi1 => phi1, phi2 => phi2, reset => reset );
|
83
|
|
84
|
mem : component memory
|
85
|
port map ( phi1 => phi1, phi2 => phi2,
|
86
|
a => a_behav, d => d_behav,
|
87
|
width => width_behav, write_enable => write_enable_behav,
|
88
|
burst => open,
|
89
|
mem_enable => mem_enable_behav, ready => ready_mem );
|
90
|
|
91
|
proc_behav : component dlx
|
92
|
port map ( phi1 => phi1, phi2 => phi2, reset => reset, halt => halt_behav,
|
93
|
a => a_behav, d => d_behav,
|
94
|
width => width_behav, write_enable => write_enable_behav,
|
95
|
ifetch => ifetch_behav,
|
96
|
mem_enable => mem_enable_behav, ready => ready_mem );
|
97
|
|
98
|
proc_rtl : component dlx
|
99
|
port map ( phi1 => phi1, phi2 => phi2, reset => reset, halt => halt_rtl,
|
100
|
a => a_rtl, d => d_rtl,
|
101
|
width => width_rtl, write_enable => write_enable_rtl,
|
102
|
ifetch => ifetch_rtl,
|
103
|
mem_enable => mem_enable_rtl, ready => ready_mem );
|
104
|
|
105
|
verification_section : block is
|
106
|
begin
|
107
|
|
108
|
fwd_data_from_mem_to_rtl :
|
109
|
d_rtl <= d_behav when mem_enable_rtl = '1'
|
110
|
and write_enable_rtl = '0' else
|
111
|
disabled_dlx_word;
|
112
|
|
113
|
monitor : process
|
114
|
|
115
|
variable write_command_behav : boolean;
|
116
|
variable write_command_rtl : boolean;
|
117
|
|
118
|
begin
|
119
|
monitor_loop : loop
|
120
|
-- wait for a command, valid on leading edge of phi2
|
121
|
wait until rising_edge(phi2)
|
122
|
and mem_enable_behav = '1' and mem_enable_rtl = '1';
|
123
|
--
|
124
|
-- capture the command information
|
125
|
write_command_behav := write_enable_behav = '1';
|
126
|
write_command_rtl := write_enable_rtl = '1';
|
127
|
assert a_behav = a_rtl
|
128
|
report "addresses differ";
|
129
|
assert write_enable_behav = write_enable_rtl
|
130
|
report "write enable states differ";
|
131
|
assert ifetch_behav = ifetch_rtl
|
132
|
report "instruction fetch states differ";
|
133
|
assert width_behav = width_rtl
|
134
|
report "widths differ";
|
135
|
if write_command_behav and write_command_rtl then
|
136
|
assert d_behav = d_rtl
|
137
|
report "write data differs";
|
138
|
end if;
|
139
|
--
|
140
|
-- wait for the response from memory
|
141
|
ready_loop : loop
|
142
|
wait until falling_edge(phi2);
|
143
|
exit monitor_loop when reset = '1';
|
144
|
exit ready_loop when ready_mem = '1';
|
145
|
end loop ready_loop;
|
146
|
end loop monitor_loop;
|
147
|
--
|
148
|
-- get here when reset is asserted
|
149
|
wait until reset = '0';
|
150
|
--
|
151
|
-- process monitor now starts again from beginning
|
152
|
end process monitor;
|
153
|
|
154
|
end block verification_section;
|
155
|
|
156
|
end architecture verifier;
|