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

Subversion Repositories minirisc

[/] [minirisc/] [trunk/] [scode/] [rf1.asm] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 lampret
;/////////////////////////////////////////////////////////////////////
2
;////                                                             ////
3
;////  Mini-RISC-1                                                ////
4
;////  Register File Test 1                                       ////
5
;////  Tests Register File                                        ////
6
;////                                                             ////
7
;////  Author: Rudolf Usselmann                                   ////
8
;////          russelmann@hotmail.com                             ////
9
;////                                                             ////
10
;/////////////////////////////////////////////////////////////////////
11
;////                                                             ////
12
;//// Copyright (C) 2000 Rudolf Usselmann                         ////
13
;////                    russelmann@hotmail.com                   ////
14
;////                                                             ////
15
;//// This source file may be used and distributed without        ////
16
;//// restriction provided that this copyright statement is not   ////
17
;//// removed from the file and that any derivative work contains ////
18
;//// the original copyright notice and the associated disclaimer.////
19
;////                                                             ////
20
;//// THIS SOURCE FILE IS PROVIDED "AS IS" AND WITHOUT ANY        ////
21
;//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT           ////
22
;//// LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND   ////
23
;//// FITNESS FOR A PARTICULAR PURPOSE.                           ////
24
;////                                                             ////
25
;/////////////////////////////////////////////////////////////////////
26
 
27
        list    p=16c57
28
        #include p16c5x.inc
29
 
30
; global Registers
31
r0      equ     0x8
32
r1      equ     0x9
33
r2      equ     0xa
34
r3      equ     0xb
35
r4      equ     0xc
36
r5      equ     0xd
37
r6      equ     0xe
38
r7      equ     0xf
39
 
40
; banked Registers
41
br0     equ     0x10
42
br1     equ     0x11
43
br2     equ     0x12
44
br3     equ     0x13
45
br4     equ     0x14
46
br5     equ     0x15
47
br6     equ     0x16
48
br7     equ     0x17
49
br8     equ     0x18
50
br9     equ     0x19
51
br10    equ     0x1a
52
br11    equ     0x1b
53
br12    equ     0x1c
54
br13    equ     0x1d
55
br14    equ     0x1e
56
br15    equ     0x1f
57
 
58
 
59
;       PORTB Indicates Test Number
60
;       PORTA Indicates Status: 0 - Running; 1 - done OK; ff - stoped on error
61
 
62
main    ; Main code entry
63
        ; Port IO Test
64
        ; All ports have a Pull up resistor
65
 
66
        ; SETUP all ports
67
        clrw
68
        movwf   FSR
69
        movwf   PORTA
70
        movwf   PORTB
71
        movwf   PORTC
72
        tris    PORTA
73
        tris    PORTB
74
        tris    PORTC
75
 
76
        bsf     STATUS,5
77
 
78
        ; ---------------------------------------
79
        ; ---- Test the entire register file ----
80
        ; ---------------------------------------
81
 
82
        movlw   0x81
83
        movwf   r0
84
        movlw   0x82
85
        movwf   r1
86
        movlw   0x83
87
        movwf   r2
88
        movlw   0x84
89
        movwf   r3
90
        movlw   0x85
91
        movwf   r4
92
        movlw   0x86
93
        movwf   r5
94
        movlw   0x87
95
        movwf   r6
96
        movlw   0x88
97
        movwf   r7
98
 
99
 
100
        movlw   0x90
101
        movwf   br0
102
        movlw   0x91
103
        movwf   br1
104
        movlw   0x92
105
        movwf   br2
106
        movlw   0x93
107
        movwf   br3
108
        movlw   0x94
109
        movwf   br4
110
        movlw   0x95
111
        movwf   br5
112
        movlw   0x96
113
        movwf   br6
114
        movlw   0x97
115
        movwf   br7
116
        movlw   0x98
117
        movwf   br8
118
        movlw   0x99
119
        movwf   br9
120
        movlw   0x9a
121
        movwf   br10
122
        movlw   0x9b
123
        movwf   br11
124
        movlw   0x9c
125
        movwf   br12
126
        movlw   0x9d
127
        movwf   br13
128
        movlw   0x9e
129
        movwf   br14
130
        movlw   0x9f
131
        movwf   br15
132
 
133
        bsf     FSR,5   ; Select Register Bank 01
134
 
135
        movlw   0xa0
136
        movwf   br0
137
        movlw   0xa1
138
        movwf   br1
139
        movlw   0xa2
140
        movwf   br2
141
        movlw   0xa3
142
        movwf   br3
143
        movlw   0xa4
144
        movwf   br4
145
        movlw   0xa5
146
        movwf   br5
147
        movlw   0xa6
148
        movwf   br6
149
        movlw   0xa7
150
        movwf   br7
151
        movlw   0xa8
152
        movwf   br8
153
        movlw   0xa9
154
        movwf   br9
155
        movlw   0xaa
156
        movwf   br10
157
        movlw   0xab
158
        movwf   br11
159
        movlw   0xac
160
        movwf   br12
161
        movlw   0xad
162
        movwf   br13
163
        movlw   0xae
164
        movwf   br14
165
        movlw   0xaf
166
        movwf   br15
167
 
168
        bcf     FSR,5   ; Select Register Bank 10
169
        bsf     FSR,6
170
 
171
        movlw   0xb0
172
        movwf   br0
173
        movlw   0xb1
174
        movwf   br1
175
        movlw   0xb2
176
        movwf   br2
177
        movlw   0xb3
178
        movwf   br3
179
        movlw   0xb4
180
        movwf   br4
181
        movlw   0xb5
182
        movwf   br5
183
        movlw   0xb6
184
        movwf   br6
185
        movlw   0xb7
186
        movwf   br7
187
        movlw   0xb8
188
        movwf   br8
189
        movlw   0xb9
190
        movwf   br9
191
        movlw   0xba
192
        movwf   br10
193
        movlw   0xbb
194
        movwf   br11
195
        movlw   0xbc
196
        movwf   br12
197
        movlw   0xbd
198
        movwf   br13
199
        movlw   0xbe
200
        movwf   br14
201
        movlw   0xbf
202
        movwf   br15
203
 
204
        bsf     FSR,5   ; Select Register Bank 11
205
        bsf     FSR,6
206
 
207
        movlw   0xc0
208
        movwf   br0
209
        movlw   0xc1
210
        movwf   br1
211
        movlw   0xc2
212
        movwf   br2
213
        movlw   0xc3
214
        movwf   br3
215
        movlw   0xc4
216
        movwf   br4
217
        movlw   0xc5
218
        movwf   br5
219
        movlw   0xc6
220
        movwf   br6
221
        movlw   0xc7
222
        movwf   br7
223
        movlw   0xc8
224
        movwf   br8
225
        movlw   0xc9
226
        movwf   br9
227
        movlw   0xca
228
        movwf   br10
229
        movlw   0xcb
230
        movwf   br11
231
        movlw   0xcc
232
        movwf   br12
233
        movlw   0xcd
234
        movwf   br13
235
        movlw   0xce
236
        movwf   br14
237
        movlw   0xcf
238
        movwf   br15
239
 
240
        ; Register File         TEST 1
241
        movlw   0x01
242
        movwf   PORTB   ; Set Test Number
243
 
244
        clrw
245
        movwf   FSR
246
 
247
        movlw   0x81
248
        subwf   r0,W
249
        btfss   STATUS,Z
250
        goto    lerr
251
        movlw   0x82
252
        subwf   r1,W
253
        btfss   STATUS,Z
254
        goto    lerr
255
        movlw   0x83
256
        subwf   r2,W
257
        btfss   STATUS,Z
258
        goto    lerr
259
        movlw   0x84
260
        subwf   r3,W
261
        btfss   STATUS,Z
262
        goto    lerr
263
        movlw   0x85
264
        subwf   r4,W
265
        btfss   STATUS,Z
266
        goto    lerr
267
        movlw   0x86
268
        subwf   r5,W
269
        btfss   STATUS,Z
270
        goto    lerr
271
        movlw   0x87
272
        subwf   r6,W
273
        btfss   STATUS,Z
274
        goto    lerr
275
        movlw   0x88
276
        subwf   r7,W
277
        btfss   STATUS,Z
278
        goto    lerr
279
 
280
        movlw   0x90
281
        subwf   br0,W
282
        btfss   STATUS,Z
283
        goto    lerr
284
        movlw   0x91
285
        subwf   br1,W
286
        btfss   STATUS,Z
287
        goto    lerr
288
        movlw   0x92
289
        subwf   br2,W
290
        btfss   STATUS,Z
291
        goto    lerr
292
        movlw   0x93
293
        subwf   br3,W
294
        btfss   STATUS,Z
295
        goto    lerr
296
        movlw   0x94
297
        subwf   br4,W
298
        btfss   STATUS,Z
299
        goto    lerr
300
        movlw   0x95
301
        subwf   br5,W
302
        btfss   STATUS,Z
303
        goto    lerr
304
        movlw   0x96
305
        subwf   br6,W
306
        btfss   STATUS,Z
307
        goto    lerr
308
        movlw   0x97
309
        subwf   br7,W
310
        btfss   STATUS,Z
311
        goto    lerr
312
        movlw   0x98
313
        subwf   br8,W
314
        btfss   STATUS,Z
315
        goto    lerr
316
        movlw   0x99
317
        subwf   br9,W
318
        btfss   STATUS,Z
319
        goto    lerr
320
        movlw   0x9a
321
        subwf   br10,W
322
        btfss   STATUS,Z
323
        goto    lerr
324
        movlw   0x9b
325
        subwf   br11,W
326
        btfss   STATUS,Z
327
        goto    lerr
328
        movlw   0x9c
329
        subwf   br12,W
330
        btfss   STATUS,Z
331
        goto    lerr
332
        movlw   0x9d
333
        subwf   br13,W
334
        btfss   STATUS,Z
335
        goto    lerr
336
        movlw   0x9e
337
        subwf   br14,W
338
        btfss   STATUS,Z
339
        goto    lerr
340
        movlw   0x9f
341
        subwf   br15,W
342
        btfss   STATUS,Z
343
        goto    lerr
344
 
345
        ; Register File         TEST 2
346
        movlw   0x02
347
        movwf   PORTB   ; Set Test Number
348
 
349
        bsf     FSR,5   ; Select Register Bank 01
350
 
351
        movlw   0x81
352
        subwf   r0,W
353
        btfss   STATUS,Z
354
        goto    lerr
355
        movlw   0x82
356
        subwf   r1,W
357
        btfss   STATUS,Z
358
        goto    lerr
359
        movlw   0x83
360
        subwf   r2,W
361
        btfss   STATUS,Z
362
        goto    lerr
363
        movlw   0x84
364
        subwf   r3,W
365
        btfss   STATUS,Z
366
        goto    lerr
367
        movlw   0x85
368
        subwf   r4,W
369
        btfss   STATUS,Z
370
        goto    lerr
371
        movlw   0x86
372
        subwf   r5,W
373
        btfss   STATUS,Z
374
        goto    lerr
375
        movlw   0x87
376
        subwf   r6,W
377
        btfss   STATUS,Z
378
        goto    lerr
379
        movlw   0x88
380
        subwf   r7,W
381
        btfss   STATUS,Z
382
        goto    lerr
383
 
384
        movlw   0xa0
385
        subwf   br0,W
386
        btfss   STATUS,Z
387
        goto    lerr
388
        movlw   0xa1
389
        subwf   br1,W
390
        btfss   STATUS,Z
391
        goto    lerr
392
        movlw   0xa2
393
        subwf   br2,W
394
        btfss   STATUS,Z
395
        goto    lerr
396
        movlw   0xa3
397
        subwf   br3,W
398
        btfss   STATUS,Z
399
        goto    lerr
400
        movlw   0xa4
401
        subwf   br4,W
402
        btfss   STATUS,Z
403
        goto    lerr
404
        movlw   0xa5
405
        subwf   br5,W
406
        btfss   STATUS,Z
407
        goto    lerr
408
        movlw   0xa6
409
        subwf   br6,W
410
        btfss   STATUS,Z
411
        goto    lerr
412
        movlw   0xa7
413
        subwf   br7,W
414
        btfss   STATUS,Z
415
        goto    lerr
416
        movlw   0xa8
417
        subwf   br8,W
418
        btfss   STATUS,Z
419
        goto    lerr
420
        movlw   0xa9
421
        subwf   br9,W
422
        btfss   STATUS,Z
423
        goto    lerr
424
        movlw   0xaa
425
        subwf   br10,W
426
        btfss   STATUS,Z
427
        goto    lerr
428
        movlw   0xab
429
        subwf   br11,W
430
        btfss   STATUS,Z
431
        goto    lerr
432
        movlw   0xac
433
        subwf   br12,W
434
        btfss   STATUS,Z
435
        goto    lerr
436
        movlw   0xad
437
        subwf   br13,W
438
        btfss   STATUS,Z
439
        goto    lerr
440
        movlw   0xae
441
        subwf   br14,W
442
        btfss   STATUS,Z
443
        goto    lerr
444
        movlw   0xaf
445
        subwf   br15,W
446
        btfss   STATUS,Z
447
        goto    lerr
448
 
449
        ; Register File         TEST 3
450
        movlw   0x03
451
        movwf   PORTB   ; Set Test Number
452
 
453
        bcf     FSR,5   ; Select Register Bank 10
454
        bsf     FSR,6
455
 
456
        movlw   0x81
457
        subwf   r0,W
458
        btfss   STATUS,Z
459
        goto    lerr
460
        movlw   0x82
461
        subwf   r1,W
462
        btfss   STATUS,Z
463
        goto    lerr
464
        movlw   0x83
465
        subwf   r2,W
466
        btfss   STATUS,Z
467
        goto    lerr
468
        movlw   0x84
469
        subwf   r3,W
470
        btfss   STATUS,Z
471
        goto    lerr
472
        movlw   0x85
473
        subwf   r4,W
474
        btfss   STATUS,Z
475
        goto    lerr
476
        movlw   0x86
477
        subwf   r5,W
478
        btfss   STATUS,Z
479
        goto    lerr
480
        movlw   0x87
481
        subwf   r6,W
482
        btfss   STATUS,Z
483
        goto    lerr
484
        movlw   0x88
485
        subwf   r7,W
486
        btfss   STATUS,Z
487
        goto    lerr
488
 
489
        movlw   0xb0
490
        subwf   br0,W
491
        btfss   STATUS,Z
492
        goto    lerr
493
        movlw   0xb1
494
        subwf   br1,W
495
        btfss   STATUS,Z
496
        goto    lerr
497
        movlw   0xb2
498
        subwf   br2,W
499
        btfss   STATUS,Z
500
        goto    lerr
501
        movlw   0xb3
502
        subwf   br3,W
503
        btfss   STATUS,Z
504
        goto    lerr
505
        movlw   0xb4
506
        subwf   br4,W
507
        btfss   STATUS,Z
508
        goto    lerr
509
        movlw   0xb5
510
        subwf   br5,W
511
        btfss   STATUS,Z
512
        goto    lerr
513
        movlw   0xb6
514
        subwf   br6,W
515
        btfss   STATUS,Z
516
        goto    lerr
517
        movlw   0xb7
518
        subwf   br7,W
519
        btfss   STATUS,Z
520
        goto    lerr
521
        movlw   0xb8
522
        subwf   br8,W
523
        btfss   STATUS,Z
524
        goto    lerr
525
        movlw   0xb9
526
        subwf   br9,W
527
        btfss   STATUS,Z
528
        goto    lerr
529
        movlw   0xba
530
        subwf   br10,W
531
        btfss   STATUS,Z
532
        goto    lerr
533
        movlw   0xbb
534
        subwf   br11,W
535
        btfss   STATUS,Z
536
        goto    lerr
537
        movlw   0xbc
538
        subwf   br12,W
539
        btfss   STATUS,Z
540
        goto    lerr
541
        movlw   0xbd
542
        subwf   br13,W
543
        btfss   STATUS,Z
544
        goto    lerr
545
        movlw   0xbe
546
        subwf   br14,W
547
        btfss   STATUS,Z
548
        goto    lerr
549
        movlw   0xbf
550
        subwf   br15,W
551
        btfss   STATUS,Z
552
        goto    lerr
553
 
554
 
555
        ; Register File         TEST 4
556
        movlw   0x04
557
        movwf   PORTB   ; Set Test Number
558
 
559
        bsf     FSR,5   ; Select Register Bank 11
560
        bsf     FSR,6
561
 
562
        movlw   0x81
563
        subwf   r0,W
564
        btfss   STATUS,Z
565
        goto    lerr
566
        movlw   0x82
567
        subwf   r1,W
568
        btfss   STATUS,Z
569
        goto    lerr
570
        movlw   0x83
571
        subwf   r2,W
572
        btfss   STATUS,Z
573
        goto    lerr
574
        movlw   0x84
575
        subwf   r3,W
576
        btfss   STATUS,Z
577
        goto    lerr
578
        movlw   0x85
579
        subwf   r4,W
580
        btfss   STATUS,Z
581
        goto    lerr
582
        movlw   0x86
583
        subwf   r5,W
584
        btfss   STATUS,Z
585
        goto    lerr
586
        movlw   0x87
587
        subwf   r6,W
588
        btfss   STATUS,Z
589
        goto    lerr
590
        movlw   0x88
591
        subwf   r7,W
592
        btfss   STATUS,Z
593
        goto    lerr
594
 
595
        movlw   0xc0
596
        subwf   br0,W
597
        btfss   STATUS,Z
598
        goto    lerr
599
        movlw   0xc1
600
        subwf   br1,W
601
        btfss   STATUS,Z
602
        goto    lerr
603
        movlw   0xc2
604
        subwf   br2,W
605
        btfss   STATUS,Z
606
        goto    lerr
607
        movlw   0xc3
608
        subwf   br3,W
609
        btfss   STATUS,Z
610
        goto    lerr
611
        movlw   0xc4
612
        subwf   br4,W
613
        btfss   STATUS,Z
614
        goto    lerr
615
        movlw   0xc5
616
        subwf   br5,W
617
        btfss   STATUS,Z
618
        goto    lerr
619
        movlw   0xc6
620
        subwf   br6,W
621
        btfss   STATUS,Z
622
        goto    lerr
623
        movlw   0xc7
624
        subwf   br7,W
625
        btfss   STATUS,Z
626
        goto    lerr
627
        movlw   0xc8
628
        subwf   br8,W
629
        btfss   STATUS,Z
630
        goto    lerr
631
        movlw   0xc9
632
        subwf   br9,W
633
        btfss   STATUS,Z
634
        goto    lerr
635
        movlw   0xca
636
        subwf   br10,W
637
        btfss   STATUS,Z
638
        goto    lerr
639
        movlw   0xcb
640
        subwf   br11,W
641
        btfss   STATUS,Z
642
        goto    lerr
643
        movlw   0xcc
644
        subwf   br12,W
645
        btfss   STATUS,Z
646
        goto    lerr
647
        movlw   0xcd
648
        subwf   br13,W
649
        btfss   STATUS,Z
650
        goto    lerr
651
        movlw   0xce
652
        subwf   br14,W
653
        btfss   STATUS,Z
654
        goto    lerr
655
        movlw   0xcf
656
        subwf   br15,W
657
        btfss   STATUS,Z
658
        goto    lerr
659
 
660
 
661
        nop
662
        nop
663
        nop
664
        nop
665
        movlw   0x01
666
        movwf   PORTA
667
        nop
668
        nop
669
        nop
670
        nop
671
good                    ; Loop in good on success
672
        goto    good
673
        nop
674
        nop
675
        nop
676
        nop
677
 
678
lerr
679
        movlw   0xff
680
        movwf   PORTA
681
 
682
        nop
683
        nop
684
        nop
685
        nop
686
lerr_loop               ; Loop in lerr on failure
687
        goto    lerr_loop
688
        nop
689
        nop
690
        nop
691
        nop
692
 
693
   END
694
 

powered by: WebSVN 2.1.0

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