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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [mp3/] [sw/] [basic/] [basic.S] - Blame information for rev 505

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 505 lampret
/* Basic instruction set test */
2
#include "../support/spr_defs.h"
3
 
4
.global _main
5
.global _buserr_except
6
.global _dpf_except
7
.global _ipf_except
8
.global _lpint_except
9
.global _align_except
10
.global _illegal_except
11
.global _hpint_except
12
.global _dtlbmiss_except
13
.global _itlbmiss_except
14
.global _range_except
15
.global _syscall_except
16
.global _res1_except
17
.global _trap_except
18
.global _res2_except
19
 
20
_buserr_except:
21
_dpf_except:
22
_ipf_except:
23
_lpint_except:
24
_align_except:
25
_illegal_except:
26
_hpint_except:
27
_dtlbmiss_except:
28
_itlbmiss_except:
29
_range_except:
30
_syscall_except:
31
_res1_except:
32
_trap_except:
33
_res2_except:
34
 
35
_main:
36
        l.nop
37
        l.j     _regs
38
        l.nop
39
 
40
  .section .text
41
_regs:
42
        l.addi  r1,r0,0x1
43
        l.addi  r2,r1,0x2
44
        l.addi  r3,r2,0x4
45
        l.addi  r4,r3,0x8
46
        l.addi  r5,r4,0x10
47
        l.addi  r6,r5,0x20
48
        l.addi  r7,r6,0x40
49
        l.addi  r8,r7,0x80
50
        l.addi  r9,r8,0x100
51
        l.addi  r10,r9,0x200
52
        l.addi  r11,r10,0x400
53
        l.addi  r12,r11,0x800
54
        l.addi  r13,r12,0x1000
55
        l.addi  r14,r13,0x2000
56
        l.addi  r15,r14,0x4000
57
        l.addi  r16,r15,0x8000
58
 
59
        l.sub   r31,r0,r1
60
        l.sub   r30,r31,r2
61
        l.sub   r29,r30,r3
62
        l.sub   r28,r29,r4
63
        l.sub   r27,r28,r5
64
        l.sub   r26,r27,r6
65
        l.sub   r25,r26,r7
66
        l.sub   r24,r25,r8
67
        l.sub   r23,r24,r9
68
        l.sub   r22,r23,r10
69
        l.sub   r21,r22,r11
70
        l.sub   r20,r21,r12
71
        l.sub   r19,r20,r13
72
        l.sub   r18,r19,r14
73
        l.sub   r17,r18,r15
74
        l.sub   r16,r17,r16
75
        l.movhi r31,0x8000
76
        l.ori   r31,r31,0x0040
77
 
78
        l.mtspr r0,r16,0x1234   /* Should be 0xffff0012 */
79
 
80
        l.sw    0(r31),r16
81
 
82
_mem:   l.movhi r3,0x1234
83
        l.ori   r3,r3,0x5678
84
 
85
        l.sw    4(r31),r3
86
 
87
        l.lbz   r4,4(r31)
88
        l.add   r8,r8,r4
89
        l.sb    11(r31),r4
90
        l.lbz   r4,5(r31)
91
        l.add   r8,r8,r4
92
        l.sb    10(r31),r4
93
        l.lbz   r4,6(r31)
94
        l.add   r8,r8,r4
95
        l.sb    9(r31),r4
96
        l.lbz   r4,7(r31)
97
        l.add   r8,r8,r4
98
        l.sb    8(r31),r4
99
 
100
        l.lbs   r4,8(r31)
101
        l.add   r8,r8,r4
102
        l.sb    7(r31),r4
103
        l.lbs   r4,9(r31)
104
        l.add   r8,r8,r4
105
        l.sb    6(r31),r4
106
        l.lbs   r4,10(r31)
107
        l.add   r8,r8,r4
108
        l.sb    5(r31),r4
109
        l.lbs   r4,11(r31)
110
        l.add   r8,r8,r4
111
        l.sb    4(r31),r4
112
 
113
        l.lhz   r4,4(r31)
114
        l.add   r8,r8,r4
115
        l.sh    10(r31),r4
116
        l.lhz   r4,6(r31)
117
        l.add   r8,r8,r4
118
        l.sh    8(r31),r4
119
 
120
        l.lhs   r4,8(r31)
121
        l.add   r8,r8,r4
122
        l.sh    6(r31),r4
123
        l.lhs   r4,10(r31)
124
        l.add   r8,r8,r4
125
        l.sh    4(r31),r4
126
 
127
        l.lwz   r4,4(r31)
128
        l.add   r8,r8,r4
129
 
130
        l.mtspr r0,r8,0x1234   /* Should be 0x12352af7 */
131
 
132
        l.lwz   r9,0(r31)
133
        l.add   r8,r9,r8
134
        l.sw    0(r31),r8
135
 
136
_arith:
137
        l.addi  r3,r0,1
138
        l.addi  r4,r0,2
139
        l.addi  r5,r0,-1
140
        l.addi  r6,r0,-1
141
        l.addi  r8,r0,0
142
 
143
        l.sub   r7,r5,r3
144
        l.sub   r8,r3,r5
145
        l.add   r8,r8,r7
146
 
147
#       l.div   r7,r7,r4
148
        l.add   r9,r3,r4
149
        l.mul   r7,r9,r7
150
#       l.divu  r7,r7,r4
151
        l.add   r8,r8,r7
152
 
153
        l.mtspr r0,r8,0x1234   /* Should be 0x7ffffffe */
154
 
155
        l.lwz   r9,0(r31)
156
        l.add   r8,r9,r8
157
        l.sw    0(r31),r8
158
 
159
_log:
160
        l.addi  r3,r0,1
161
        l.addi  r4,r0,2
162
        l.addi  r5,r0,-1
163
        l.addi  r6,r0,-1
164
        l.addi  r8,r0,0
165
 
166
        l.andi  r8,r8,1
167
        l.and   r8,r8,r3
168
 
169
        l.xori  r8,r5,0xa5a5
170
        l.xor   r8,r8,r5
171
 
172
        l.ori   r8,r8,2
173
        l.or    r8,r8,r4
174
 
175
        l.mtspr r0,r8,0x1234   /* Should be 0xffffa5a7 */
176
 
177
        l.lwz   r9,0(r31)
178
        l.add   r8,r9,r8
179
        l.sw    0(r31),r8
180
 
181
_shift:
182
        l.addi  r3,r0,1
183
        l.addi  r4,r0,2
184
        l.addi  r5,r0,-1
185
        l.addi  r6,r0,-1
186
        l.addi  r8,r0,0
187
 
188
        l.slli  r8,r5,6
189
        l.sll   r8,r8,r4
190
 
191
        l.srli  r8,r8,6
192
        l.srl   r8,r8,r4
193
 
194
        l.srai  r8,r8,2
195
        l.sra   r8,r8,r4
196
 
197
        l.mtspr r0,r8,0x1234   /* Should be 0x000fffff */
198
 
199
        l.lwz   r9,0(r31)
200
        l.add   r8,r9,r8
201
        l.sw    0(r31),r8
202
 
203
_flag:
204
        l.addi  r3,r0,1
205
        l.addi  r4,r0,-2
206
        l.addi  r8,r0,0
207
 
208
        l.sfeq  r3,r3
209
        l.mfspr r5,r0,17
210
        l.andi  r4,r5,0x200
211
        l.add   r8,r8,r4
212
 
213
        l.sfeq  r3,r4
214
        l.mfspr r5,r0,17
215
        l.andi  r4,r5,0x200
216
        l.add   r8,r8,r4
217
 
218
        l.sfeqi r3,1
219
        l.mfspr r5,r0,17
220
        l.andi  r4,r5,0x200
221
        l.add   r8,r8,r4
222
 
223
        l.sfeqi r3,-2
224
        l.mfspr r5,r0,17
225
        l.andi  r4,r5,0x200
226
        l.add   r8,r8,r4
227
 
228
        l.sfne  r3,r3
229
        l.mfspr r5,r0,17
230
        l.andi  r4,r5,0x200
231
        l.add   r8,r8,r4
232
 
233
        l.sfne  r3,r4
234
        l.mfspr r5,r0,17
235
        l.andi  r4,r5,0x200
236
        l.add   r8,r8,r4
237
 
238
        l.sfnei r3,1
239
        l.mfspr r5,r0,17
240
        l.andi  r4,r5,0x200
241
        l.add   r8,r8,r4
242
 
243
        l.sfnei r3,-2
244
        l.mfspr r5,r0,17
245
        l.andi  r4,r5,0x200
246
        l.add   r8,r8,r4
247
 
248
        l.sfgtu r3,r3
249
        l.mfspr r5,r0,17
250
        l.andi  r4,r5,0x200
251
        l.add   r8,r8,r4
252
 
253
        l.sfgtu r3,r4
254
        l.mfspr r5,r0,17
255
        l.andi  r4,r5,0x200
256
        l.add   r8,r8,r4
257
 
258
        l.sfgtui        r3,1
259
        l.mfspr r5,r0,17
260
        l.andi  r4,r5,0x200
261
        l.add   r8,r8,r4
262
 
263
        l.sfgtui        r3,-2
264
        l.mfspr r5,r0,17
265
        l.andi  r4,r5,0x200
266
        l.add   r8,r8,r4
267
 
268
        l.sfgeu r3,r3
269
        l.mfspr r5,r0,17
270
        l.andi  r4,r5,0x200
271
        l.add   r8,r8,r4
272
 
273
        l.sfgeu r3,r4
274
        l.mfspr r5,r0,17
275
        l.andi  r4,r5,0x200
276
        l.add   r8,r8,r4
277
 
278
        l.sfgeui        r3,1
279
        l.mfspr r5,r0,17
280
        l.andi  r4,r5,0x200
281
        l.add   r8,r8,r4
282
 
283
        l.sfgeui        r3,-2
284
        l.mfspr r5,r0,17
285
        l.andi  r4,r5,0x200
286
        l.add   r8,r8,r4
287
 
288
        l.sfltu r3,r3
289
        l.mfspr r5,r0,17
290
        l.andi  r4,r5,0x200
291
        l.add   r8,r8,r4
292
 
293
        l.sfltu r3,r4
294
        l.mfspr r5,r0,17
295
        l.andi  r4,r5,0x200
296
        l.add   r8,r8,r4
297
 
298
        l.sfltui        r3,1
299
        l.mfspr r5,r0,17
300
        l.andi  r4,r5,0x200
301
        l.add   r8,r8,r4
302
 
303
        l.sfltui        r3,-2
304
        l.mfspr r5,r0,17
305
        l.andi  r4,r5,0x200
306
        l.add   r8,r8,r4
307
 
308
        l.sfleu r3,r3
309
        l.mfspr r5,r0,17
310
        l.andi  r4,r5,0x200
311
        l.add   r8,r8,r4
312
 
313
        l.sfleu r3,r4
314
        l.mfspr r5,r0,17
315
        l.andi  r4,r5,0x200
316
        l.add   r8,r8,r4
317
 
318
        l.sfleui        r3,1
319
        l.mfspr r5,r0,17
320
        l.andi  r4,r5,0x200
321
        l.add   r8,r8,r4
322
 
323
        l.sfleui        r3,-2
324
        l.mfspr r5,r0,17
325
        l.andi  r4,r5,0x200
326
        l.add   r8,r8,r4
327
 
328
        l.sfgts r3,r3
329
        l.mfspr r5,r0,17
330
        l.andi  r4,r5,0x200
331
        l.add   r8,r8,r4
332
 
333
        l.sfgts r3,r4
334
        l.mfspr r5,r0,17
335
        l.andi  r4,r5,0x200
336
        l.add   r8,r8,r4
337
 
338
        l.sfgtsi        r3,1
339
        l.mfspr r5,r0,17
340
        l.andi  r4,r5,0x200
341
        l.add   r8,r8,r4
342
 
343
        l.sfgtsi        r3,-2
344
        l.mfspr r5,r0,17
345
        l.andi  r4,r5,0x200
346
        l.add   r8,r8,r4
347
 
348
        l.sfges r3,r3
349
        l.mfspr r5,r0,17
350
        l.andi  r4,r5,0x200
351
        l.add   r8,r8,r4
352
 
353
        l.sfges r3,r4
354
        l.mfspr r5,r0,17
355
        l.andi  r4,r5,0x200
356
        l.add   r8,r8,r4
357
 
358
        l.sfgesi        r3,1
359
        l.mfspr r5,r0,17
360
        l.andi  r4,r5,0x200
361
        l.add   r8,r8,r4
362
 
363
        l.sfgesi        r3,-2
364
        l.mfspr r5,r0,17
365
        l.andi  r4,r5,0x200
366
        l.add   r8,r8,r4
367
 
368
        l.sflts r3,r3
369
        l.mfspr r5,r0,17
370
        l.andi  r4,r5,0x200
371
        l.add   r8,r8,r4
372
 
373
        l.sflts r3,r4
374
        l.mfspr r5,r0,17
375
        l.andi  r4,r5,0x200
376
        l.add   r8,r8,r4
377
 
378
        l.sfltsi        r3,1
379
        l.mfspr r5,r0,17
380
        l.andi  r4,r5,0x200
381
        l.add   r8,r8,r4
382
 
383
        l.sfltsi        r3,-2
384
        l.mfspr r5,r0,17
385
        l.andi  r4,r5,0x200
386
        l.add   r8,r8,r4
387
 
388
        l.sfles r3,r3
389
        l.mfspr r5,r0,17
390
        l.andi  r4,r5,0x200
391
        l.add   r8,r8,r4
392
 
393
        l.sfles r3,r4
394
        l.mfspr r5,r0,17
395
        l.andi  r4,r5,0x200
396
        l.add   r8,r8,r4
397
 
398
        l.sflesi        r3,1
399
        l.mfspr r5,r0,17
400
        l.andi  r4,r5,0x200
401
        l.add   r8,r8,r4
402
 
403
        l.sflesi        r3,-2
404
        l.mfspr r5,r0,17
405
        l.andi  r4,r5,0x200
406
        l.add   r8,r8,r4
407
 
408
        l.mtspr r0,r8,0x1234   /* Should be 0x00002800 */
409
 
410
        l.lwz   r9,0(r31)
411
        l.add   r8,r9,r8
412
        l.sw    0(r31),r8
413
 
414
_jump:
415
        l.addi  r8,r0,0
416
 
417
        l.j     _T1
418
        l.addi  r8,r8,1
419
 
420
_T2:    l.jalr  r9
421
        l.addi  r8,r8,1
422
 
423
_T1:    l.jal   _T2
424
        l.addi  r8,r8,1
425
 
426
        l.sfeqi r0,0
427
        l.bf    _T3
428
        l.addi  r8,r8,1
429
 
430
_T3:    l.sfeqi r0,1
431
        l.bf    _T4
432
        l.addi  r8,r8,1
433
 
434
        l.addi  r8,r8,1
435
 
436
_T4:    l.sfeqi r0,0
437
        l.bnf    _T5
438
        l.addi  r8,r8,1
439
 
440
        l.addi  r8,r8,1
441
 
442
_T5:    l.sfeqi r0,1
443
        l.bnf    _T6
444
        l.addi  r8,r8,1
445
 
446
        l.addi  r8,r8,1
447
 
448
_T6:    l.movhi r3,hi(_T7)
449
        l.ori  r3,r0,lo(_T7)
450
        l.mtspr r0,r3,32
451
        l.mfspr r5,r0,17
452
        l.mtspr r0,r5,64
453
        l.rfe
454
        l.addi  r8,r8,1
455
 
456
        l.addi  r8,r8,1
457
 
458
_T7:    l.mtspr r0,r8,0x1234   /* Should be 0x00000000a */
459
 
460
        l.lwz   r9,0(r31)
461
        l.add   r8,r9,r8
462
        l.sw    0(r31),r8
463
 
464
        l.lwz   r9,0(r31)
465
        l.movhi r3,0xcc69
466
        l.ori   r3,r3,0xe5fb
467
        l.add   r8,r8,r3
468
 
469
        l.mtspr r0,r8,0x1234   /* Should be 0xdeaddead */
470
 
471
        l.addi  r3,r0,0
472
        l.sys   203
473
        l.nop
474
        l.nop
475
 

powered by: WebSVN 2.1.0

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