OpenCores
URL https://opencores.org/ocsvn/t400/t400/trunk

Subversion Repositories t400

[/] [t400/] [trunk/] [sw/] [verif/] [black_box/] [x/] [test.asm] - Blame information for rev 179

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 arniml
        ;; *******************************************************************
2 179 arniml
        ;; $Id: test.asm 179 2009-04-01 19:48:38Z arniml $
3 2 arniml
        ;;
4
        ;; Checks the X instruction.
5
        ;; Br can't be observed directly via XABR on COP41x.
6
        ;; Therefore, Br address is observed indirectly via memory content.
7
        ;;
8
 
9
        ;; the cpu type is defined on asl's command line
10
 
11
        org     0x00
12
        clra
13
 
14
        ;; preload a digit of each data register
15
        ;; Br = 0 -> data = 0x1
16
        lbi     0, 0
17
        stii    0x1
18
        ;; Br = 1 -> data = 0x2
19
        lbi     1, 0
20
        stii    0x2
21
        ;; Br = 2 -> data = 0x3
22
        lbi     2, 0
23
        stii    0x3
24
        ;; Br = 3 -> data = 0x4
25
        lbi     3, 0
26
        stii    0x4
27
 
28
 
29
        ;; *******************************************************************
30
        ;; XOR 0
31
        ;;
32
        ;; Br(0) xor 0
33
        clra
34
        aisc    0xf
35
        lbi     0, 0
36
        x       0x0
37
        xad     3, 15           ; save A
38
        ;; expect 0xf in M
39
        clra
40
        aisc    0xf
41
        ske
42
        jmp     fail
43
        xad     3, 15           ; restore A
44
        x       0x0
45
        ;; expect 0x1 in M
46
        clra
47
        aisc    0x1
48
        ske
49
        jmp     fail
50
 
51
        ;; Br(1) xor 0
52
        clra
53
        aisc    0xf
54
        lbi     1, 0
55
        x       0x0
56
        xad     3, 15           ; save A
57
        ;; expect 0xf in M
58
        clra
59
        aisc    0xf
60
        ske
61
        jmp     fail
62
        xad     3, 15           ; restore A
63
        x       0x0
64
        ;; expect 0x2 in M
65
        clra
66
        aisc    0x2
67
        ske
68
        jmp     fail
69
 
70
        ;; Br(2) xor 0
71
        clra
72
        aisc    0xf
73
        lbi     2, 0
74
        x       0x0
75
        xad     3, 15           ; save A
76
        ;; expect 0xf in M
77
        clra
78
        aisc    0xf
79
        ske
80
        jmp     fail
81
        xad     3, 15           ; restore A
82
        x       0x0
83
        ;; expect 0x3 in M
84
        clra
85
        aisc    0x3
86
        ske
87
        jmp     fail
88
 
89
        ;; Br(3) xor 0
90
        clra
91
        aisc    0xf
92
        lbi     3, 0
93
        x       0x0
94
        xad     3, 15           ; save A
95
        ;; expect 0xf in M
96
        clra
97
        aisc    0xf
98
        ske
99
        jmp     fail
100
        xad     3, 15           ; restore A
101
        x       0x0
102
        ;; expect 0x4 in M
103
        clra
104
        aisc    0x4
105
        ske
106
        jmp     fail
107
 
108
 
109
        clra
110
        aisc    0xf
111
        ;; *******************************************************************
112
        ;; XOR 1
113
        ;;
114
        ;; Br(0) & Br(1) xor 1
115
        lbi     0, 0
116
        x       0x1             ; Br(0)=0xf, A=0x1, now Br(1)
117
        xad     3, 15           ; save A
118
        ;; expect 0x2 in M
119
        clra
120
        aisc    0x2
121
        ske
122
        jmp     fail
123
        xad     3, 15           ; restore A
124
        x       0x1             ; Br(1)=0x1, A=0x2, now Br(0)
125
        xad     3, 15           ; save A
126
        ;; expect 0xf in M
127
        clra
128
        aisc    0xf
129
        ske
130
        jmp     fail
131
        xad     3, 15           ; restore A
132
        x       0x1             ; Br(0)=0x2, A=0xf, now Br(1)
133
        xad     3, 15           ; save A
134
        ;; expect 0x1 in M
135
        clra
136
        aisc    0x1
137
        ske
138
        jmp     fail
139
        xad     3, 15           ; restore A
140
        ;; swap all back
141
        x       0x1             ; Br(1)=0xf, A=0x1, now Br(0)
142
        x       0x1             ; Br(0)=0x1, A=0x2, now Br(1)
143
        x       0x1             ; Br(1)=0x2, A=0xf, now Br(0)
144
        ;; same memory & accumulator content as before
145
 
146
        ;; Br(2) & Br(3) xor 1
147
        lbi     2, 0
148
        x       0x1             ; Br(2)=0xf, A=0x3, now Br(3)
149
        xad     3, 15           ; save A
150
        ;; expect 0x4 in M
151
        clra
152
        aisc    0x4
153
        ske
154
        jmp     fail
155
        xad     3, 15           ; restore A
156
        x       0x1             ; Br(3)=0x3, A=0x4, now Br(2)
157
        xad     3, 15           ; save A
158
        ;; expect 0xf in M
159
        clra
160
        aisc    0xf
161
        ske
162
        jmp     fail
163
        xad     3, 15           ; restore A
164
        x       0x1             ; Br(2)=0x4, A=0xf, now Br(3)
165
        xad     3, 15           ; save A
166
        ;; expect 0x3 in M
167
        clra
168
        aisc    0x3
169
        ske
170
        jmp     fail
171
        xad     3, 15           ; restore A
172
        ;; swap all back
173
        x       0x1             ; Br(3)=0xf, A=0x3, now Br(2)
174
        x       0x1             ; Br(2)=0x3, A=0x4, now Br(3)
175
        x       0x1             ; Br(3)=0x4, A=0xf, now Br(2)
176
        ;; same memory & accumulator content as before
177
 
178
        ;; now check that all
179
        clra
180
        lbi     0, 0
181
        aisc    0x1
182
        ske                     ; Br(0) == 1 ?
183
        jmp     fail
184
        lbi     1, 0
185
        aisc    0x1
186
        ske                     ; Br(1) == 2 ?
187
        jmp     fail
188
        lbi     2, 0
189
        aisc    0x1
190
        ske                     ; Br(2) == 3 ?
191
        jmp     fail
192
        lbi     3, 0
193
        aisc    0x1
194
        ske                     ; Br(3) == 4 ?
195
        jmp     fail
196
 
197
 
198
        clra
199
        aisc    0xf
200
        ;; *******************************************************************
201
        ;; XOR 2
202
        ;;
203
        ;; Br(0) & Br(2) xor 2
204
        lbi     0x0, 0x0
205
        x       0x2             ; Br(0)=0xf, A=0x1, now Br(2)
206
        xad     3, 15           ; save A
207
        ;; expect 0x3 in M
208
        clra
209
        aisc    0x3
210
        ske
211
        jmp     fail
212
        xad     3, 15           ; restore A
213
        x       0x2             ; Br(2)=0x1, A=0x3, now Br(0)
214
        xad     3, 15           ; save A
215
        ;; expect 0xf in M
216
        clra
217
        aisc    0xf
218
        ske
219
        jmp     fail
220
        xad     3, 15           ; restore A
221
        x       0x2             ; Br(0)=0x3, A=0xf, now Br(2)
222
        xad     3, 15           ; save A
223
        ;; expect 0x1 in M
224
        clra
225
        aisc    0x1
226
        ske
227
        jmp     fail
228
        xad     3, 15           ; restore A
229
        ;; swap all back
230
        x       0x2             ; Br(2)=0xf, A=0x1, now Br(0)
231
        x       0x2             ; Br(0)=0x1, A=0x3, now Br(2)
232
        x       0x2             ; Br(2)=0x3, A=0xf, now Br(0)
233
        ;; same memory & accumulator content as before
234
 
235
        ;; Br(1) & Br(3) xor 2
236
        lbi     0x1, 0x0
237
        x       0x2             ; Br(1)=0xf, A=0x2, now Br(3)
238
        xad     3, 15           ; save A
239
        ;; expect 0x4 in M
240
        clra
241
        aisc    0x4
242
        ske
243
        jmp     fail
244
        xad     3, 15           ; restore A
245
        x       0x2             ; Br(3)=0x2, A=0x4, now Br(1)
246
        xad     3, 15           ; save A
247
        ;; expect 0xf in M
248
        clra
249
        aisc    0xf
250
        ske
251
        jmp     fail
252
        xad     3, 15           ; restore A
253
        x       0x2             ; Br(1)=0x4, A=0xf, now Br(3)
254
        xad     3, 15           ; save A
255
        ;; expect 0x2 in M
256
        clra
257
        aisc    0x2
258
        ske
259
        jmp     fail
260
        xad     3, 15           ; restore A
261
        ;; swap all back
262
        x       0x2             ; Br(3)=0xf, A=0x2, now Br(1)
263
        x       0x2             ; Br(1)=0x2, A=0x4, now Br(3)
264
        x       0x2             ; Br(3)=0x4, A=0xf, now Br(1)
265
        ;; same memory & accumulator content as before
266
 
267
        ;; now check that all
268
        clra
269
        lbi     0, 0
270
        aisc    0x1
271
        ske                     ; Br(0) == 1 ?
272
        jmp     fail
273
        lbi     1, 0
274
        aisc    0x1
275
        ske                     ; Br(1) == 2 ?
276
        jmp     fail
277
        lbi     2, 0
278
        aisc    0x1
279
        ske                     ; Br(2) == 3 ?
280
        jmp     fail
281
        lbi     3, 0
282
        aisc    0x1
283
        ske                     ; Br(3) == 4 ?
284
        jmp     fail
285
 
286
 
287
        clra
288
        aisc    0xf
289
        ;; *******************************************************************
290
        ;; XOR 3
291
        ;;
292
        ;; Br(0) & Br(3) xor 3
293
        lbi     0x0, 0x0
294
        x       0x3             ; Br(0)=0xf, A=0x1, now Br(3)
295
        xad     3, 15           ; save A
296
        ;; expect 0x4 in M
297
        clra
298
        aisc    0x4
299
        ske
300
        jmp     fail
301
        xad     3, 15           ; restore A
302
        x       0x3             ; Br(3)=0x1, A=0x4, now Br(0)
303
        xad     3, 15           ; save A
304
        ;; expect 0xf in M
305
        clra
306
        aisc    0xf
307
        ske
308
        jmp     fail
309
        xad     3, 15           ; restore A
310
        x       0x3             ; Br(0)=0x4, A=0xf, now Br(3)
311
        xad     3, 15           ; save A
312
        ;; expect 0x1 in M
313
        clra
314
        aisc    0x1
315
        ske
316
        jmp     fail
317
        xad     3, 15           ; restore A
318
        ;; swap all back
319
        x       0x3             ; Br(3)=0xf, A=0x1, now Br(0)
320
        x       0x3             ; Br(0)=0x1, A=0x4, now Br(3)
321
        x       0x3             ; Br(3)=0x4, A=0xf, now Br(0)
322
        ;; same memory & accumulator content as before
323
 
324
        ;; Br(1) & Br(2) xor 3
325
        lbi     0x1, 0x0
326
        x       0x3             ; Br(1)=0xf, A=0x2, now Br(2)
327
        xad     3, 15           ; save A
328
        ;; expect 0x3 in M
329
        clra
330
        aisc    0x3
331
        ske
332
        jmp     fail
333
        xad     3, 15           ; restore A
334
        x       0x3             ; Br(2)=0x2, A=0x3, now Br(1)
335
        xad     3, 15           ; save A
336
        ;; expect 0xf in M
337
        clra
338
        aisc    0xf
339
        ske
340
        jmp     fail
341
        xad     3, 15           ; restore A
342
        x       0x3             ; Br(1)=0x3, A=0xf, now Br(2)
343
        xad     3, 15           ; save A
344
        ;; expect 0x2 in M
345
        clra
346
        aisc    0x2
347
        ske
348
        jmp     fail
349
        xad     3, 15           ; restore A
350
        ;; swap all back
351
        x       0x3             ; Br(2)=0xf, A=0x2, now Br(1)
352
        x       0x3             ; Br(1)=0x2, A=0x3, now Br(2)
353
        x       0x3             ; Br(2)=0x3, A=0xf, now Br(1)
354
        ;; same memory & accumulator content as before
355
 
356
        ;; now check that all
357
        clra
358
        lbi     0, 0
359
        aisc    0x1
360
        ske                     ; Br(0) == 1 ?
361
        jmp     fail
362
        lbi     1, 0
363
        aisc    0x1
364
        ske                     ; Br(1) == 2 ?
365
        jmp     fail
366
        lbi     2, 0
367
        aisc    0x1
368
        ske                     ; Br(2) == 3 ?
369
        jmp     fail
370
        lbi     3, 0
371
        aisc    0x1
372
        ske                     ; Br(3) == 4 ?
373
        jmp     fail
374
 
375
 
376
        jmp     pass
377
 
378
        org     0x1c0
379
        include "pass_fail.asm"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.