1 |
2 |
rpaley_yid |
-- $Author: rpaley_yid $
|
2 |
|
|
-- $Date: 2003-01-14 21:48:11 $
|
3 |
|
|
-- $Header: /home/marcus/revision_ctrl_test/oc_cvs/cvs/single_port/VHDL/tc_single_port.vhd,v 1.1.1.1 2003-01-14 21:48:11 rpaley_yid Exp $
|
4 |
|
|
-- $Locker
|
5 |
|
|
-- $Revision: 1.1.1.1 $
|
6 |
|
|
-- $State: Exp $
|
7 |
|
|
|
8 |
|
|
-- --------------------------------------------------------------------------
|
9 |
|
|
--
|
10 |
|
|
-- Purpose: This file specifies test cases for the single_port
|
11 |
|
|
-- Memory.
|
12 |
|
|
--
|
13 |
|
|
--
|
14 |
|
|
-- References:
|
15 |
|
|
-- 1. The Designer's Guide to VHDL by Peter Ashenden
|
16 |
|
|
-- ISBN: 1-55860-270-4 (pbk.)
|
17 |
|
|
-- 2. Writing Testbenches - Functional Verification of HDL models by
|
18 |
|
|
-- Janick Bergeron | ISBN: 0-7923-7766-4
|
19 |
|
|
--
|
20 |
|
|
-- Notes:
|
21 |
|
|
--
|
22 |
|
|
-- --------------------------------------------------------------------------
|
23 |
|
|
LIBRARY IEEE;
|
24 |
|
|
LIBRARY WORK;
|
25 |
|
|
USE IEEE.STD_LOGIC_1164.ALL;
|
26 |
|
|
USE IEEE.NUMERIC_STD.ALL;
|
27 |
|
|
USE WORK.SINGLE_PORT_PKG.ALL;
|
28 |
|
|
USE WORK.PKG_IMAGE.ALL;
|
29 |
|
|
|
30 |
|
|
ENTITY tc_single_port IS
|
31 |
|
|
PORT (
|
32 |
|
|
to_srv : OUT to_srv_typ;
|
33 |
|
|
frm_srv : IN frm_srv_typ
|
34 |
|
|
);
|
35 |
|
|
END ENTITY tc_single_port;
|
36 |
|
|
|
37 |
|
|
-- --------------------------------------------------
|
38 |
|
|
-- Test Case TC0
|
39 |
|
|
-- This test case is to check two pages of memory
|
40 |
|
|
-- Starting at physical address 0x0 ,
|
41 |
|
|
-- Write a '1' to bit position 0, leaving all other bits 0.
|
42 |
|
|
-- Increment the address,
|
43 |
|
|
-- Write a '1' to bit position 1, leaving all other bits 0.
|
44 |
|
|
-- Increment the address.
|
45 |
|
|
-- Write a '1' to bit position 2, leaving all other bits 0.
|
46 |
|
|
-- Continue in this fasion, until write a 1 to the MSB.
|
47 |
|
|
-- increment the address,
|
48 |
|
|
-- Write a '1' to bit position 0, leaving all other bits 0.
|
49 |
|
|
-- Continue until the entire page is written to.
|
50 |
|
|
-- Read back all addresses in the page, ensuring the
|
51 |
|
|
-- correct data is read back.
|
52 |
|
|
-- --------------------------------------------------
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
ARCHITECTURE TC0 OF tc_single_port IS
|
56 |
|
|
BEGIN
|
57 |
|
|
MAIN : PROCESS
|
58 |
|
|
VARIABLE to_srv_v : to_srv_typ;
|
59 |
|
|
VARIABLE frm_srv_v : frm_srv_typ;
|
60 |
|
|
VARIABLE dv : data_inter_typ :=
|
61 |
|
|
STD_LOGIC_VECTOR(TO_UNSIGNED(1,data_inter_typ'length));
|
62 |
|
|
VARIABLE offset_v : INTEGER;
|
63 |
|
|
BEGIN
|
64 |
|
|
offset_v := 0;
|
65 |
|
|
-- Run this write/read test 10 times for benchmark
|
66 |
|
|
-- purposes.
|
67 |
|
|
for i in 0 to 9 loop
|
68 |
|
|
for index in 0 to 2*PAGEDEPTH-1 loop
|
69 |
|
|
-- Specify to testbench server to perform write operation;
|
70 |
|
|
to_srv_v.do := write;
|
71 |
|
|
to_srv_v.data := dv; -- specify data to write
|
72 |
|
|
dv := To_StdLogicVector(TO_BitVector(dv) rol 1); -- ROL 1 for next write
|
73 |
|
|
-- Specify physical address.
|
74 |
|
|
to_srv_v.addr := STD_LOGIC_VECTOR(TO_UNSIGNED(index+offset_v,
|
75 |
|
|
ADDRESS_WIDTH));
|
76 |
|
|
to_srv <= to_srv_v ; WAIT FOR 0 NS;
|
77 |
|
|
WAIT ON frm_srv'TRANSACTION;
|
78 |
|
|
end loop;
|
79 |
|
|
-- Reset data to 1.
|
80 |
|
|
dv := STD_LOGIC_VECTOR(TO_UNSIGNED(1,data_inter_typ'length));
|
81 |
|
|
for index in 0 to 2*PAGEDEPTH-1 loop
|
82 |
|
|
-- Perform read operation.
|
83 |
|
|
to_srv_v.do := read;
|
84 |
|
|
-- Specify physical address.
|
85 |
|
|
to_srv_v.addr := STD_LOGIC_VECTOR(TO_UNSIGNED(index+offset_v,
|
86 |
|
|
ADDRESS_WIDTH));
|
87 |
|
|
to_srv <= to_srv_v ; WAIT FOR 0 NS;
|
88 |
|
|
WAIT ON frm_srv'TRANSACTION;
|
89 |
|
|
-- Compare actual with expected read back data, if the
|
90 |
|
|
-- the expected and actual to not compare, print the
|
91 |
|
|
-- expected and actual values.
|
92 |
|
|
ASSERT frm_srv.data = dv
|
93 |
|
|
REPORT "Expected: " & HexImage(frm_srv.data) &
|
94 |
|
|
" did not equal Actual: " & HexImage(dv)
|
95 |
|
|
SEVERITY ERROR;
|
96 |
|
|
-- Set expected data for next read.
|
97 |
|
|
dv := TO_STDLOGICVECTOR(TO_BITVECTOR(dv) rol 1);
|
98 |
|
|
end loop;
|
99 |
|
|
end loop;
|
100 |
|
|
to_srv_v.do := dealloc; -- Deallocate memory
|
101 |
|
|
--
|
102 |
|
|
to_srv <= to_srv_v ; WAIT FOR 0 NS;
|
103 |
|
|
-- Tell test bench server process test completed.
|
104 |
|
|
to_srv_v.do := end_test;
|
105 |
|
|
to_srv <= to_srv_v;
|
106 |
|
|
ASSERT FALSE
|
107 |
|
|
REPORT "Completed Test TC0"
|
108 |
|
|
SEVERITY NOTE;
|
109 |
|
|
WAIT;
|
110 |
|
|
END PROCESS main;
|
111 |
|
|
END TC0;
|
112 |
|
|
|
113 |
|
|
-- --------------------------------------------------
|
114 |
|
|
-- Test Case TC1
|
115 |
|
|
-- This test case is to check if the test bench will
|
116 |
|
|
-- return 'U' for invalid memory locations for
|
117 |
|
|
-- single_port architectures ArrayMEm and LinkedList
|
118 |
|
|
-- --------------------------------------------------
|
119 |
|
|
ARCHITECTURE TC1 OF tc_single_port IS
|
120 |
|
|
BEGIN
|
121 |
|
|
MAIN : PROCESS
|
122 |
|
|
VARIABLE to_srv_v : to_srv_typ;
|
123 |
|
|
VARIABLE frm_srv_v : frm_srv_typ;
|
124 |
|
|
VARIABLE dv : data_inter_typ := (OTHERS => 'U');
|
125 |
|
|
BEGIN
|
126 |
|
|
-- Perform read operation.
|
127 |
|
|
to_srv_v.do := read;
|
128 |
|
|
-- Specify physical address.
|
129 |
|
|
to_srv_v.addr := STD_LOGIC_VECTOR(TO_UNSIGNED(0,
|
130 |
|
|
ADDRESS_WIDTH));
|
131 |
|
|
to_srv <= to_srv_v; WAIT FOR 0 NS;
|
132 |
|
|
WAIT ON frm_srv'TRANSACTION;
|
133 |
|
|
-- Compare actual with expected read back data, if the
|
134 |
|
|
-- the expected and actual to not compare, print the
|
135 |
|
|
-- expected and actual values.
|
136 |
|
|
ASSERT frm_srv.data = dv
|
137 |
|
|
REPORT "Expected: " & HexImage(frm_srv.data) &
|
138 |
|
|
" did not equal Actual: " & HexImage(dv)
|
139 |
|
|
SEVERITY ERROR;
|
140 |
|
|
|
141 |
|
|
-- Write and read back from same address.
|
142 |
|
|
|
143 |
|
|
-- Specify to testbench server to perform write operation;
|
144 |
|
|
to_srv_v.do := write;
|
145 |
|
|
dv := X"a5a5a5a5";
|
146 |
|
|
to_srv_v.data := dv; -- specify data to write
|
147 |
|
|
-- Specify physical address.
|
148 |
|
|
to_srv_v.addr := STD_LOGIC_VECTOR(TO_UNSIGNED(0,
|
149 |
|
|
ADDRESS_WIDTH));
|
150 |
|
|
to_srv <= to_srv_v; WAIT FOR 0 NS;
|
151 |
|
|
-- Wait until the test bench server finished with the write.
|
152 |
|
|
-- WAIT UNTIL frm_srv.event = true;
|
153 |
|
|
WAIT ON frm_srv'transaction;
|
154 |
|
|
|
155 |
|
|
to_srv_v.do := read;
|
156 |
|
|
-- Specify physical address.
|
157 |
|
|
to_srv_v.addr := STD_LOGIC_VECTOR(TO_UNSIGNED(0,
|
158 |
|
|
ADDRESS_WIDTH));
|
159 |
|
|
to_srv <= to_srv_v; WAIT FOR 0 NS;
|
160 |
|
|
WAIT ON frm_srv'transaction;
|
161 |
|
|
|
162 |
|
|
-- Compare actual with expected read back data, if the
|
163 |
|
|
-- the expected and actual to not compare, print the
|
164 |
|
|
-- expected and actual values.
|
165 |
|
|
ASSERT frm_srv.data = dv
|
166 |
|
|
REPORT "Expected: " & HexImage(frm_srv.data) &
|
167 |
|
|
" did not equal Actual: " & HexImage(dv)
|
168 |
|
|
SEVERITY ERROR;
|
169 |
|
|
|
170 |
|
|
to_srv_v.do := dealloc; -- Deallocate memory
|
171 |
|
|
--
|
172 |
|
|
to_srv <= to_srv_v; WAIT FOR 0 NS;
|
173 |
|
|
-- Tell test bench server process test completed.
|
174 |
|
|
to_srv_v.do := end_test;
|
175 |
|
|
to_srv <= to_srv_v; WAIT FOR 0 NS;
|
176 |
|
|
|
177 |
|
|
ASSERT FALSE
|
178 |
|
|
REPORT "Completed Test TC1"
|
179 |
|
|
SEVERITY NOTE;
|
180 |
|
|
WAIT;
|
181 |
|
|
END PROCESS main;
|
182 |
|
|
END TC1;
|
183 |
|
|
|
184 |
|
|
-- $Log: not supported by cvs2svn $
|
185 |
|
|
-- Revision 1.1 2003/01/14 17:49:04 Default
|
186 |
|
|
-- Initial revision
|
187 |
|
|
--
|
188 |
|
|
-- Revision 1.2 2002/12/31 19:19:43 Default
|
189 |
|
|
-- Updated 'transaction statements for fixed simulator.
|
190 |
|
|
--
|
191 |
|
|
-- Revision 1.1 2002/12/24 18:13:50 Default
|
192 |
|
|
-- Initial revision
|
193 |
|
|
--
|
194 |
|
|
|