1 |
98 |
jeremybenn |
# jtag-read-control.exp. Tests of the library JTAG READ_CONTROL command
|
2 |
|
|
|
3 |
|
|
# Copyright (C) 2010 Embecosm Limited
|
4 |
|
|
|
5 |
|
|
# Contributor Jeremy Bennett
|
6 |
|
|
|
7 |
|
|
# This file is part of OpenRISC 1000 Architectural Simulator.
|
8 |
|
|
|
9 |
|
|
# This program is free software; you can redistribute it and/or modify it
|
10 |
|
|
# under the terms of the GNU General Public License as published by the Free
|
11 |
|
|
# Software Foundation; either version 3 of the License, or (at your option)
|
12 |
|
|
# any later version.
|
13 |
|
|
|
14 |
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
15 |
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
16 |
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
17 |
|
|
# more details.
|
18 |
|
|
|
19 |
|
|
# You should have received a copy of the GNU General Public License along
|
20 |
|
|
# with this program. If not, see . */
|
21 |
|
|
|
22 |
|
|
# -----------------------------------------------------------------------------
|
23 |
|
|
# This code is commented throughout for use with Doxygen.
|
24 |
|
|
# -----------------------------------------------------------------------------
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
# These tests check all the behavior associated with the JTAG READ_CONTROL
|
28 |
|
|
# command.
|
29 |
|
|
|
30 |
|
|
# NOTE. All these tests return timing information, but we ignore it, since in
|
31 |
|
|
# general it will not be repeatable.
|
32 |
|
|
|
33 |
|
|
# Tests of the READ_CONTROL for reading from different modules. This should
|
34 |
|
|
# work fine for CPU0, but provoke a warning for Wishbone and CPU1 and a
|
35 |
|
|
# different warning for all other modules. Test no module, Wishbone, CPU0,
|
36 |
|
|
# CPU1 and module 6.
|
37 |
|
|
|
38 |
|
|
# READ_CONTROL with no module selected.
|
39 |
|
|
run_libsim "JTAG READ_CONTROL no module" \
|
40 |
|
|
[list "Initalization succeeded." \
|
41 |
|
|
"Execution step completed OK." \
|
42 |
|
|
"Resetting JTAG." \
|
43 |
|
|
"Execution step completed OK." \
|
44 |
|
|
"Shifting instruction." \
|
45 |
|
|
" shifting in: 0x01" \
|
46 |
|
|
" shifted out: 0x01" \
|
47 |
|
|
" time taken:" \
|
48 |
|
|
"Execution step completed OK." \
|
49 |
|
|
"Processing READ_CONTROL." \
|
50 |
|
|
" shifting in: 0x000000000000000000000005ffa8ec38" \
|
51 |
|
|
"ERROR: JTAG READ_CONTROL with no module selected." \
|
52 |
|
|
" shifted out: 0x0c526410200000000000000000000000" \
|
53 |
|
|
" reset: disabled" \
|
54 |
|
|
" stall: unstalled" \
|
55 |
|
|
" status: 0x0" \
|
56 |
|
|
" time taken:" \
|
57 |
|
|
"Execution step completed OK." \
|
58 |
|
|
"Test completed successfully."] \
|
59 |
|
|
"lib-jtag/lib-jtag-full" "" "loop/loop-init" "RESET" "INSTRUCTION" \
|
60 |
|
|
"8" "READ_CONTROL"
|
61 |
|
|
|
62 |
|
|
# READ_CONTROL with only WishBone module selected.
|
63 |
|
|
run_libsim "JTAG READ_CONTROL WB module" \
|
64 |
|
|
[list "Initalization succeeded." \
|
65 |
|
|
"Execution step completed OK." \
|
66 |
|
|
"Resetting JTAG." \
|
67 |
|
|
"Execution step completed OK." \
|
68 |
|
|
"Shifting instruction." \
|
69 |
|
|
" shifting in: 0x01" \
|
70 |
|
|
" shifted out: 0x01" \
|
71 |
|
|
" time taken:" \
|
72 |
|
|
"Execution step completed OK." \
|
73 |
|
|
"Selecting module." \
|
74 |
|
|
" shifting in: 0x0000000000174841bc61" \
|
75 |
|
|
" shifted out: 0x0164841bc60000000000" \
|
76 |
|
|
" status: 0x0" \
|
77 |
|
|
" time taken:" \
|
78 |
|
|
"Execution step completed OK." \
|
79 |
|
|
"Processing READ_CONTROL." \
|
80 |
|
|
" shifting in: 0x000000000000000000000005ffa8ec38" \
|
81 |
|
|
"ERROR: JTAG READ_CONTROL of WishBone not supported." \
|
82 |
|
|
" shifted out: 0x0c526410200000000000000000000000" \
|
83 |
|
|
" reset: disabled" \
|
84 |
|
|
" stall: unstalled" \
|
85 |
|
|
" time taken:" \
|
86 |
|
|
"Execution step completed OK." \
|
87 |
|
|
"Test completed successfully."] \
|
88 |
|
|
"lib-jtag/lib-jtag-full" "" "loop/loop-init" "RESET" "INSTRUCTION" \
|
89 |
|
|
"8" "SELECT_MODULE" "0" "READ_CONTROL"
|
90 |
|
|
|
91 |
|
|
# READ_CONTROL with only invalid module selected.
|
92 |
|
|
run_libsim "JTAG READ_CONTROL invalid module" \
|
93 |
|
|
[list "Initalization succeeded." \
|
94 |
|
|
"Execution step completed OK." \
|
95 |
|
|
"Resetting JTAG." \
|
96 |
|
|
"Execution step completed OK." \
|
97 |
|
|
"Shifting instruction." \
|
98 |
|
|
" shifting in: 0x01" \
|
99 |
|
|
" shifted out: 0x01" \
|
100 |
|
|
" time taken:" \
|
101 |
|
|
"Execution step completed OK." \
|
102 |
|
|
"Selecting module." \
|
103 |
|
|
" shifting in: 0x00000000001993c98e69" \
|
104 |
|
|
" shifted out: 0x0164841bc60000000000" \
|
105 |
|
|
" status: 0x0" \
|
106 |
|
|
" time taken:" \
|
107 |
|
|
"Execution step completed OK." \
|
108 |
|
|
"Processing READ_CONTROL." \
|
109 |
|
|
" shifting in: 0x000000000000000000000005ffa8ec38" \
|
110 |
|
|
"ERROR: JTAG READ_CONTROL of CPU1 not supported." \
|
111 |
|
|
" shifted out: 0x0c526410200000000000000000000000" \
|
112 |
|
|
" reset: disabled" \
|
113 |
|
|
" stall: unstalled" \
|
114 |
|
|
" time taken:" \
|
115 |
|
|
"Execution step completed OK." \
|
116 |
|
|
"Test completed successfully."] \
|
117 |
|
|
"lib-jtag/lib-jtag-full" "" "loop/loop-init" "RESET" "INSTRUCTION" \
|
118 |
|
|
"8" "SELECT_MODULE" "2" "READ_CONTROL"
|
119 |
|
|
|
120 |
|
|
# READ_CONTROL with invalid module selected after valid module
|
121 |
|
|
run_libsim "JTAG READ_CONTROL invalid after valid module" \
|
122 |
|
|
[list "Initalization succeeded." \
|
123 |
|
|
"Execution step completed OK." \
|
124 |
|
|
"Resetting JTAG." \
|
125 |
|
|
"Execution step completed OK." \
|
126 |
|
|
"Shifting instruction." \
|
127 |
|
|
" shifting in: 0x01" \
|
128 |
|
|
" shifted out: 0x01" \
|
129 |
|
|
" time taken:" \
|
130 |
|
|
"Execution step completed OK." \
|
131 |
|
|
"Selecting module." \
|
132 |
|
|
" shifting in: 0x00000000000aff51d871" \
|
133 |
|
|
" shifted out: 0x0164841bc60000000000" \
|
134 |
|
|
" status: 0x0" \
|
135 |
|
|
" time taken:" \
|
136 |
|
|
"Execution step completed OK." \
|
137 |
|
|
"Selecting module." \
|
138 |
|
|
" shifting in: 0x00000000001efe0d976d" \
|
139 |
|
|
" shifted out: 0x01893c98e68000000000" \
|
140 |
|
|
" status: 0x2" \
|
141 |
|
|
" time taken:" \
|
142 |
|
|
"Execution step completed OK." \
|
143 |
|
|
"Processing READ_CONTROL." \
|
144 |
|
|
" shifting in: 0x000000000000000000000005ffa8ec38" \
|
145 |
|
|
"ERROR: JTAG READ_CONTROL with no module selected." \
|
146 |
|
|
" shifted out: 0x0c526410200000000000000000000000" \
|
147 |
|
|
" reset: disabled" \
|
148 |
|
|
" stall: unstalled" \
|
149 |
|
|
" status: 0x0" \
|
150 |
|
|
" time taken:" \
|
151 |
|
|
"Execution step completed OK." \
|
152 |
|
|
"Test completed successfully."] \
|
153 |
|
|
"lib-jtag/lib-jtag-full" "" "loop/loop-init" "RESET" "INSTRUCTION" \
|
154 |
|
|
"8" "SELECT_MODULE" "1" "SELECT_MODULE" "6" "READ_CONTROL"
|
155 |
|
|
|
156 |
|
|
# READ_CONTROL with valid module selected after invalid module
|
157 |
|
|
run_libsim "JTAG READ_CONTROL valid after invalid module" \
|
158 |
|
|
[list "Initalization succeeded." \
|
159 |
|
|
"Execution step completed OK." \
|
160 |
|
|
"Resetting JTAG." \
|
161 |
|
|
"Execution step completed OK." \
|
162 |
|
|
"Shifting instruction." \
|
163 |
|
|
" shifting in: 0x01" \
|
164 |
|
|
" shifted out: 0x01" \
|
165 |
|
|
" time taken:" \
|
166 |
|
|
"Execution step completed OK." \
|
167 |
|
|
"Selecting module." \
|
168 |
|
|
" shifting in: 0x00000000001efe0d976d" \
|
169 |
|
|
" shifted out: 0x01893c98e68000000000" \
|
170 |
|
|
" status: 0x2" \
|
171 |
|
|
" time taken:" \
|
172 |
|
|
"Execution step completed OK." \
|
173 |
|
|
"Selecting module." \
|
174 |
|
|
" shifting in: 0x00000000000aff51d871" \
|
175 |
|
|
" shifted out: 0x0164841bc60000000000" \
|
176 |
|
|
" status: 0x0" \
|
177 |
|
|
" time taken:" \
|
178 |
|
|
"Execution step completed OK." \
|
179 |
|
|
"Processing READ_CONTROL." \
|
180 |
|
|
" shifting in: 0x000000000000000000000005ffa8ec38" \
|
181 |
|
|
" shifted out: 0x0c526410200000000000000000000000" \
|
182 |
|
|
" reset: disabled" \
|
183 |
|
|
" stall: unstalled" \
|
184 |
|
|
" status: 0x0" \
|
185 |
|
|
" time taken:" \
|
186 |
|
|
"Execution step completed OK." \
|
187 |
|
|
"Test completed successfully."] \
|
188 |
|
|
"lib-jtag/lib-jtag-full" "" "loop/loop-init" "RESET" "INSTRUCTION" \
|
189 |
|
|
"8" "SELECT_MODULE" "6" "SELECT_MODULE" "1" "READ_CONTROL"
|
190 |
|
|
|
191 |
|
|
# Verify that reading works correctly from the valid module, CPU0.
|
192 |
|
|
|
193 |
|
|
# READ_CONTROL for CPU0.
|
194 |
|
|
run_libsim "JTAG READ_CONTROL CPU0" \
|
195 |
|
|
[list "Initalization succeeded." \
|
196 |
|
|
"Execution step completed OK." \
|
197 |
|
|
"Resetting JTAG." \
|
198 |
|
|
"Execution step completed OK." \
|
199 |
|
|
"Shifting instruction." \
|
200 |
|
|
" shifting in: 0x01" \
|
201 |
|
|
" shifted out: 0x01" \
|
202 |
|
|
" time taken:" \
|
203 |
|
|
"Execution step completed OK." \
|
204 |
|
|
"Selecting module." \
|
205 |
|
|
" shifting in: 0x00000000000aff51d871" \
|
206 |
|
|
" shifted out: 0x0164841bc60000000000" \
|
207 |
|
|
" status: 0x0" \
|
208 |
|
|
" time taken:" \
|
209 |
|
|
"Execution step completed OK." \
|
210 |
|
|
"Processing READ_CONTROL." \
|
211 |
|
|
" shifting in: 0x000000000000000000000005ffa8ec38" \
|
212 |
|
|
" shifted out: 0x0c526410200000000000000000000000" \
|
213 |
|
|
" status: 0x0" \
|
214 |
|
|
" time taken:" \
|
215 |
|
|
"Execution step completed OK." \
|
216 |
|
|
"Test completed successfully."] \
|
217 |
|
|
"lib-jtag/lib-jtag-full" "" "loop/loop-init" "RESET" "INSTRUCTION" \
|
218 |
|
|
"8" "SELECT_MODULE" "1" "READ_CONTROL"
|
219 |
|
|
|
220 |
|
|
# The only flag that we can sensible read back is the stall flag. In practice
|
221 |
|
|
# the reset flag is only set during the reset sequence, during which we may
|
222 |
|
|
# not get back any data. All we can test (simply) is that if we set the stall
|
223 |
|
|
# flag it reads back correctly. We leave it to the test of WRITE_CONTROL to
|
224 |
|
|
# determine that the stall actually happens!
|
225 |
|
|
|
226 |
|
|
# Write the stall bit for CPU and read it back.
|
227 |
|
|
run_libsim "JTAG READ_CONTROL CPU0 read stall bit set" \
|
228 |
|
|
[list "Initalization succeeded." \
|
229 |
|
|
"Execution step completed OK." \
|
230 |
|
|
"Resetting JTAG." \
|
231 |
|
|
"Execution step completed OK." \
|
232 |
|
|
"Shifting instruction." \
|
233 |
|
|
" shifting in: 0x01" \
|
234 |
|
|
" shifted out: 0x01" \
|
235 |
|
|
" time taken:" \
|
236 |
|
|
"Execution step completed OK." \
|
237 |
|
|
"Selecting module." \
|
238 |
|
|
" shifting in: 0x00000000000aff51d871" \
|
239 |
|
|
" shifted out: 0x0164841bc60000000000" \
|
240 |
|
|
" status: 0x0" \
|
241 |
|
|
" time taken:" \
|
242 |
|
|
"Execution step completed OK." \
|
243 |
|
|
"Processing WRITE_CONTROL." \
|
244 |
|
|
" shifting in: 0x000000000109a677aa00000000000044" \
|
245 |
|
|
" shifted out: 0x164841bc600000000000000000000000" \
|
246 |
|
|
" status: 0x0" \
|
247 |
|
|
" time taken:" \
|
248 |
|
|
"Execution step completed with breakpoint." \
|
249 |
|
|
"Processing READ_CONTROL." \
|
250 |
|
|
" shifting in: 0x000000000000000000000005ffa8ec38" \
|
251 |
|
|
" shifted out: 0x1ea18635000000000000004000000000" \
|
252 |
|
|
" reset: disabled" \
|
253 |
|
|
" stall: stalled" \
|
254 |
|
|
" status: 0x0" \
|
255 |
|
|
" time taken:" \
|
256 |
|
|
"Execution step completed with breakpoint." \
|
257 |
|
|
"Test completed successfully."] \
|
258 |
|
|
"lib-jtag/lib-jtag-full" "" "loop/loop-init" "RESET" "INSTRUCTION" \
|
259 |
|
|
"8" "SELECT_MODULE" "1" "WRITE_CONTROL" "0" "1" "READ_CONTROL"
|
260 |
|
|
|
261 |
|
|
# Clear the stall bit for CPU and read it back.
|
262 |
|
|
run_libsim "JTAG READ_CONTROL CPU0 read stall bit clear" \
|
263 |
|
|
[list "Initalization succeeded." \
|
264 |
|
|
"Execution step completed OK." \
|
265 |
|
|
"Resetting JTAG." \
|
266 |
|
|
"Execution step completed OK." \
|
267 |
|
|
"Shifting instruction." \
|
268 |
|
|
" shifting in: 0x01" \
|
269 |
|
|
" shifted out: 0x01" \
|
270 |
|
|
" time taken:" \
|
271 |
|
|
"Execution step completed OK." \
|
272 |
|
|
"Selecting module." \
|
273 |
|
|
" shifting in: 0x00000000000aff51d871" \
|
274 |
|
|
" shifted out: 0x0164841bc60000000000" \
|
275 |
|
|
" status: 0x0" \
|
276 |
|
|
" time taken:" \
|
277 |
|
|
"Execution step completed OK." \
|
278 |
|
|
"Processing WRITE_CONTROL." \
|
279 |
|
|
" shifting in: 0x000000000096dc049200000000000004" \
|
280 |
|
|
" shifted out: 0x164841bc600000000000000000000000" \
|
281 |
|
|
" status: 0x0" \
|
282 |
|
|
" time taken:" \
|
283 |
|
|
"Execution step completed OK." \
|
284 |
|
|
"Processing READ_CONTROL." \
|
285 |
|
|
" shifting in: 0x000000000000000000000005ffa8ec38" \
|
286 |
|
|
" shifted out: 0x0c526410200000000000000000000000" \
|
287 |
|
|
" reset: disabled" \
|
288 |
|
|
" stall: unstalled" \
|
289 |
|
|
" status: 0x0" \
|
290 |
|
|
" time taken:" \
|
291 |
|
|
"Execution step completed OK." \
|
292 |
|
|
"Test completed successfully."] \
|
293 |
|
|
"lib-jtag/lib-jtag-full" "" "loop/loop-init" "RESET" "INSTRUCTION" \
|
294 |
|
|
"8" "SELECT_MODULE" "1" "WRITE_CONTROL" "0" "0" "READ_CONTROL"
|