mi_system_dv.html
15.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.72 [en] (X11; U; Linux 2.2.14-5.0 i686) [Netscape]">
<title>MI System Verification</title>
</head>
<body>
<center>
<h1>
MI Verification</h1></center>
<a href="http://therouter/bb/rf/doc/hw/mi-spec.html">MI Specification</a>
<br>
<h3>
TODO</h3>
MI_VTIMER_REG
<br>MI_AVCTRL_REG
<br>Reset values of registers
<br>Virage store controller, Charge pump and NV array
<h3>
Register Tests</h3>
<i>IOSIM Only (?)</i>
<p><b>Non-secure Mode Testing</b>
<p>MI_MODE: Only bit 11 (CLR_DPINTR) has a function in BCP. For all other
bits check that writes are ignored and reads return 0.
<p>MI_VERSION: Check all writes are ignored. Read should return a known
result: 0x0202b0b0.
<p>MI_INTR: Check that writes are ignored. Reads are checked through interrupt
tests (see later).
<p>MI_MASK: This register has unique (ehh!) behavior. Writes set up the
interrupt mask bits. Reads return the interrupt mask bits. These are probably
tested in other tests, but we should independently set and clear all mask
bits and check the results through read. Check that bits 31:12 are ignored
on write and bits 31:6 return 0 on read.
<p>MI_ENTR: Check that writes are ignored. Reads are checked through interrupt
tests.
<p>MI_EMASK: This has the same behavior as MI_MASK, but it defines additional
BCP only interrupts.
<p>MI_CTRL: Check bits 31:19 and bits 7:0 ignore writes and return 0 on
reads. Bits 18:13 should be tested through the general register test for
write/read, since they have no side effects. Side effects of bits 12:8
are tested later.
<p>MI_SEC_MODE: Check that writes are ignored. Seems we must write, then
read, which will cause an entry into secure mode. Since the read still
returns we can check that the write was ignored. Reads have the side effect
of arming the logic to enter secure mode, and are tested later.
<p>MI_SEC_TIMER: Check that writes are ignored and reads return 0.
<p>MI_SEC_FLASH: Check that writes are ignored and reads return 0.
<p>MI_ERR_ADDR: Check that writes are ignored. Behavior on read is tested
below under write error testing
<p>MI_ERR_DATA: Behavior is tested below under write error testing
<p><b>Secure Mode Testing</b>
<p>Access to MI_MODE, MI_VERSION, MI_INTR, MI_MASK, MI_CTRL, MI_ERR_ADDR,
MI_ERR_DATA should be the same as above, so re-run identical tests.
<p>MI_SEC_MODE: This register appears differently in secure mode. Check
bits 31:7 writes are ignored and reads return 0. Bit 6 EN_IRAM and bit
1 RESET are tested in the SRAM access tests above. Other bits have side
effects are tested in secure mode entry/exit tests below.
<p>MI_SEC_TIMER: Check writes to 31:24 are ignored, set 23:16 to zero,
run register test on 15:0. Other patterns have side effects, so are tested
below under secure timer.
<p>MI_SEC_FLASH: XXX Unknown as yet
<br>
<h3>
SRAM/ROM/Virage RAM Testing</h3>
<i>IOSIM Only (?)</i>
<p>MI has several SRAM blocks. The requirement is to test that the address
and data lines are wired correctly and that all possible access types (byte,
half-word, work, block) work correctly. Since the SRAMs have different
access functionality dependent on the mode (secure mode or not) and on
the state of the EN_IRAM bit in the MI_SEC_MODE register. Access functionality
needs to be tested as well. For the SRAMs we have the following properties
<p><b>ISRAM</b>, 32kByte R/W: byte, half-word, word, block accesses. Accessible
in secure mode and in non-secure mode if EN_ISRAM bit is set
<p><b>BSRAM</b>, 64kByte R/W: byte, half-word, word and block accesses.
Accessible in secure mode only. Access is at address 0x1fc20000 if RESET
in MI_SEC_MODE is set (which is the pin reset condition). If RESET is not
set then BSRAM is accessible at 0x1fc00000.
<p><b>BROM</b>, 16kByte RO (may change to 8kByte): word and block accesses.
Accessible in secure mode only. Access is at address 0x1fc00000 if RESET
in MI_SEC_MODE is set. If RESET is not set BROM is accessible at 0x1fc20000.
<p><b>Virage0</b>, 512 bits R/W: word and block accesses. Accessible in
secure mode only. Access is at address 0x1fc80000.
<p><b>Virage1</b>, 512 bits R/W: word and block accesses. Accessible in
secure mode only. Access is at address 0x1fc90000.
<p><b>Virage2</b>, 2048 bits R/W: word and block accesses. Accessible in
secure mode only. Access is at address 0x1fca0000.
<p><b>Address/Data R/W testing</b>
<p>To test appropriate address wiring, run the following address patterns,
doing read/write for SRAMs:
<br>
<blockquote>byte: 0, b1, b11, b111, etc
<br>half-word: 0, b10, b110, b1110, etc
<br>word: 0, b100, b1100, b11100, etc
<br>8 byte block: 0, b1000, b11000, b111000, etc
<br>16 byte block: 0, b10000, b110000, b1110000, etc
<br>32 byte block: 0, b100000, b1100000, b11100000, etc</blockquote>
<p><br>To test data line wiring use the standard register test (see Haishan's
IOSIM document), that as a minimum usese a walking 1's pattern across all
data lines in a 32 bit word, with the address fixed at the first location
in the SRAM block.
<p>For BROM, read only and match against known contents at the given locations.
<p><b>Access testing</b>
<p>To test access in secure mode and non-secure mode do at least the following:
<p>1. In secure mode, run all sram testing ensure everything passes.
<br>2. In non-secure mode, with EN_ISRAM bit turned off, do word write/read
first location of each SRAM and make sure all fail.
<br>3. In non-secure mode, with EN_ISRAM bit turned on, do word write/read
first location of each SRAM and make sure only ISRAM passes. Run complete
SRAM test on ISRAM from non-secure mode.
<br>4. For BSRAM check access at address 0x1fc20000 when RESET is set and
0x1fc00000 when RESET is not set.
<br>5. Check read only access to BROM at address 0x1fc00000 when RESET
is set and 0x1fc20000 when RESET is not set.
<h3>
Functional Tests</h3>
<h3>
<i>PIF RAM Access</i></h3>
The MI provides mechanisms to trap accesses to PIF RAMwhich on N64 was
located at 0x1fc0_07c0-7ff. On BB this space is occupied by the BRAM/BROM.
The address trapping is provided to help debug applications/games that
write to this address space. There are two mechanisms to trap writes and
one mechanism to trap reads. The mechanisms are defined by bits in the
MI_CTRL register.
<p><b>Writes</b>
<p>There are 2 mechanisms to trap writes to PIF RAM:
<ol>
<li>
Secure Kernel Trap - set SKI_PIF bit in MI_CTRL</li>
<li>
Write Error interrupt - set WEI_PIF bit in MI_CTRL</li>
</ol>
In both cases information on the cause of the error is recorded in
<ul>
<li>
MI_ERR_ADDR</li>
<li>
MI_ERR_DATA</li>
<li>
MI_ERR_INFO registers. These capture the address of first write error,
the data of the first single write error (does not capture data for block
writes)</li>
</ul>
Since the PIF RAM size is small (64 Bytes) all possible combinations of
byte, half-word, word, and block (8, 16, 32) writes can be tested for all
possible locations.
<p>For each case check:
<ol>
<li>
The secure kernel trap or interrupt is generated correctly</li>
<li>
The contents of the MI_ERR_ADDR, MI_ERR_DATA and MI_ERR_INFO registers
are correct.</li>
<li>
For the secure kernel trap, check that the STRAP bit is set in MI_SEC_MODE</li>
<li>
The interrupt is cleared (on reading MI_ERR_INFO) or secure mode can be
exited and NMI goes away.</li>
</ol>
XXX Does it make any sense to test with both bits set?
<p><b>Reads</b>
<p>Setting the BER_PIF bit in the MI_CTRL register will result in BUS errors
being returned to the CPU on PIF RAM accesses. This is best tested by running
code on the CPU, since the IOSIM socket does not return an SYSAD information.
<br>
<h3>
<i>Illegal Block Request</i></h3>
<i>CPU and IOSIM</i>.
<p>MI has mechanisms to trap on block writes to non-memory spaces and generate
Bus errors on block reads. The actions taken are controlled by bits set
in the MI_CTRL register. Definition of a non-memory space is anything which
is not in the following areas:
<ol>
<li>
0x1fc00000 to 0x1fcfffff</li>
<li>
0x0 to 0x3000000</li>
<li>
0x80000000 to 0xffffffff</li>
</ol>
<b>Writes</b>
<p>The two possible actions on illegal block writes are:
<ol>
<li>
Secure Kernel Trap - Set bit SKI_BNM</li>
<li>
Write Error Interrupt - Set bit WEI_BNM</li>
</ol>
For each of these 2 cases we check:
<ol>
<li>
The secure kernel trap or interrupt is generated correctly</li>
<li>
The contents of the MI_ERR_ADDR, MI_ERR_DATA and MI_ERR_INFO registers
are correct.</li>
<li>
For the secure kernel trap, check that the STRAP bit is set in MI_SEC_MODE</li>
<li>
The interrupt is cleared (on reading MI_ERR_INFO) or secure mode can be
exited and NMI goes away.</li>
</ol>
Since the size of non-memory regions are large and it is not possible to
cover all addresses exhaustively, so we can use randomly generated addresses,
with a different random seed each time. The test cases should cover all
combinations for block write (8, 16, 32 bytes).
<p><b>Reads</b>
<p>Since we cannot record Bus errors through IOSIM, Block reads must be
tested using code on the CPU.
<h3>
<i>Interrupt Control</i></h3>
<i>CPU Only.</i>
<p>XXX We should cover 1 case from each of INT0 - INT4. Focus on the new
units. Since all interrupts will be tested in the individual unit tests
here we should just make sure the interrupt lines are wired up correctly
to the CPU.
<p>Test enabling, masking, polling status in MI_INTR, MI_MASK. Need
separate test for each device (VI, PI, SP, SI, AI, DP, etc) to raise an
interrupt. Test should be extended to include new interrupts when
defined. Test should also verify clearing the DP interrupt using
the MI_MODE register.
<h3>
<i>Cold Reset/DIV_MODE</i></h3>
<i>CPU Only.</i>
<p>Test that DIV_MODE in MI_CTRL is set properly on cold reset, appropriate
signals are set to mips core. Verify that all MI registers on restored
to initial state.
<h3>
<i>Warm Reset</i></h3>
<i>CPU Only.</i>
<p>Like the cold reset test, but don't test DIV_MODE
<h3>
<i>Secure Mode Entry/Exit</i></h3>
<i>CPU Only (Other tests cover this in IOSIM)</i>
<p>Verify secure kernel entry from non-secure mode for each cause: app
triggered, timer triggered, emulation trap, fatal error. The different
cases are:
<ol>
<li>
Application triggered entry/exit. This is covered in the many IOSIM tests
already.</li>
<li>
Emulation trap triggered. This is covered in the IOSIM PIF RAM access tests
and the Illegal block request tests.</li>
<li>
Secure Timer. This is covered in the IOSIM Secure Timer tests.</li>
<li>
Fatal. Fatal is caused by errors from the PI. A secure kernel trap can
be generated by setting the SK bit in the PI_ERROR register.</li>
</ol>
In each of the cases above we must make sure that on entry the MI_SEC_MODE
register is set correctly, and that on exit NMI is cleared.
<h3>
<i>Secure Timer</i></h3>
<i>IOSIM Only (except for a few values to check SK trap, see above?)</i>
<p>The Secure Timer uses a pre-scaler to divide the system clock that then
drives a count down register that is initialized with a start value. The
pre-scaler and the timer are both 16 bits. The behavior of the pre-scaler
and the start value can be verified by using a walking 1 through each of
them independently, with the other set to a fixed value. The time between
setting the register and generating the trap should be checked.
<p>The equation defining the total time is: system_clk_period*(pre-scaler+1)*start_value
(XXX this does not seem to be correct).
<p>The current value of the count is given in bits 31:16 of the MI_SEC_TIMER
register on read. It should be verified that these count down correctly.
<p>The timer can be stopped at anytime by writing 0 to the pre-scaler.
This should be verified for at least one case.
<h3>
<i>Virage0/Virage1 Recall/Store</i></h3>
Verify that the 16x32 SRAM can be read and written for both devices.
Verify that recall with known content works correctly. Verify that
store works correctly by performing a recall, rewriting the SRAM, performing
a store, clearing the SRAM and performing another recall.
<h3>
<i>Virage2 Recall/Store</i></h3>
Verify that the 64x32 SRAM can be read and written. Verify that recall
with known content works correctly. Verify that store works
correctly by pushing a write through the controller and recalling it.
<br>
<h1>
Test List</h1>
<b>Reset Register Test</b>
<p>Fill registers with RANDOMs (where it makes sense), do pin reset, check
that all registers come up with correct values.
<p><b>Register Test</b>
<p>Check register bits in Secure and Non-secure mode.
<p>Use standard register_test from bcp_util.c to check r/w and r/o bits.
<p>For mask registers (MI_INTR_MASK, MI_INTR_EMASK) set and clear each
bit.
<p>For Secure mode register, check that writing 1's does not change the
state of bits 2-7.
<p><b>PIF RAM Access test</b>
<p>Check Secure Kernel Trap and Interrupt on PIF RAM access. Write all
locations using byte, half-word, triple byte, word, double word, quad word
and 32 bytes.
<p>Check multiple writes. Make sure first write is captured.
<p>Check Error registers for correct values
<p><b>Block Write Error test</b>
<p>Check SK trap and Interrupt on Block writes to non-memory spaces.
<p>Uses randoms, 100 runs per night. Check all block sizes (8, 16, 32).
<p>Check correct values in Error registers.
<p><b>SRAM Access tests</b>
<p>From Secure Mode check all SRAMS (including virage SRAMS) by walking
ones through address bits and data bits.
<p>Check RESET bit for relocation of Boot ROM and Internal SRAM.
<p>Check that setting IRAM_EN bit, enables access to SRAM from non-secure
mode. Resetting bit disables access.
<p>Check that all other SRAMs and Boot ROM are not accessible from non-secure
mode.
<p><b>Secure Timer tests</b>
<p>Check pre-scaler by walking ones through all bits. Check timer by walking
ones through all bits.
<p>In all cases check timer trap is generated correctly.
<p>Check that the count down is really counting down.
<br>Check that writing zero to scaler stops the timer.
<p><b>BROM Read test</b>
<p>Check that the values read from BROM are the same as the ones programmed.
<p><b>DP/SP/VI Interrupt Test</b>
<p>Check DP Interrupt gets generated and can be cleared by bit in MI_MODE
register. Check that mask works.
<p>Check SP Interrupt generation, clearing and masking.
<p>Check VI Interrupt generation, clearing and masking.
<p><b>NV Recall Test</b>
<p>Do a recall and check that correct signals bits are asserted at correct
times.
<p><b>NV Store Recall Test</b>
<p>Do a store and recall by directly programming Charge Pump and NV array.
<p><b>NV Compare Test</b>
<p>Do a standard compare, check that correct signals are asserted at correct
times, check for MATCH.
<p><b>NMS Store Test</b>
<p>Do a standard store using NMS. Check that values are correctlly stored.
using NMS recall operation.
<br>Three versions:
<ol>
<li>
Default parameters</li>
<li>
Typical fixed set of parameters</li>
<li>
Random Test with random selection for vpp_sel, vpp_max and increment.
Set number of dumb pulses to maximum. Program in nms register interface
and check vpp levels in sequence as they appear in CP_VPPSEL bits.</li>
</ol>
<p><br><b>NMS Compare Test</b>
<p>Do an NMS recall operation to get values into the SRAM.
<p>Use the store controller to do a compare. Check that signal timing is
correct.
<p><b>NMS Recall Auto Margin Test</b>
<p>Do Recall auto margin, check for correct timing of signals.
<br>Use this test to check nms_crm* registers. Program random set of BIAS,
TECC, MRCL settings in NMS_CRM* registers and check the outputs in the
nv_mrcl, nv_tecc and nv_bias bits in sequence and verify with respect to
inputs.
<p><b>NMS Keep mode Test</b>
<p>Put NMS in keep mode, check that SRAM array can be read. Put array back
in idle, check that array can be read.
<p><b>MI_SEC_VTIME register</b>
<br>Vary the sysclk from 62.5 to 100Mhz and check that tests pass with
various programmings of VTIME register.
<br>
<br>
</body>
</html>