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

Subversion Repositories minirisc

[/] [minirisc/] [trunk/] [scode/] [rf2.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 2                                       ////
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
        movlw   r0
241
        movwf   FSR
242
        comf    INDF,F
243
        incf    FSR,F
244
        comf    INDF,F
245
        incf    FSR,F
246
        comf    INDF,F
247
        incf    FSR,F
248
        comf    INDF,F
249
        incf    FSR,F
250
        comf    INDF,F
251
        incf    FSR,F
252
        comf    INDF,F
253
        incf    FSR,F
254
        comf    INDF,F
255
        incf    FSR,F
256
        comf    INDF,F
257
        incf    FSR,F
258
 
259
 
260
        movlw   br0
261
        movwf   FSR
262
        comf    INDF,F
263
        incf    FSR,F
264
        comf    INDF,F
265
        incf    FSR,F
266
        comf    INDF,F
267
        incf    FSR,F
268
        comf    INDF,F
269
        incf    FSR,F
270
        comf    INDF,F
271
        incf    FSR,F
272
        comf    INDF,F
273
        incf    FSR,F
274
        comf    INDF,F
275
        incf    FSR,F
276
        comf    INDF,F
277
        incf    FSR,F
278
        comf    INDF,F
279
        incf    FSR,F
280
        comf    INDF,F
281
        incf    FSR,F
282
        comf    INDF,F
283
        incf    FSR,F
284
        comf    INDF,F
285
        incf    FSR,F
286
        comf    INDF,F
287
        incf    FSR,F
288
        comf    INDF,F
289
        incf    FSR,F
290
        comf    INDF,F
291
        incf    FSR,F
292
        comf    INDF,F
293
        incf    FSR,F
294
 
295
        movlw   br0
296
        movwf   FSR
297
        bsf     FSR,5
298
        comf    INDF,F
299
        incf    FSR,F
300
        comf    INDF,F
301
        incf    FSR,F
302
        comf    INDF,F
303
        incf    FSR,F
304
        comf    INDF,F
305
        incf    FSR,F
306
        comf    INDF,F
307
        incf    FSR,F
308
        comf    INDF,F
309
        incf    FSR,F
310
        comf    INDF,F
311
        incf    FSR,F
312
        comf    INDF,F
313
        incf    FSR,F
314
        comf    INDF,F
315
        incf    FSR,F
316
        comf    INDF,F
317
        incf    FSR,F
318
        comf    INDF,F
319
        incf    FSR,F
320
        comf    INDF,F
321
        incf    FSR,F
322
        comf    INDF,F
323
        incf    FSR,F
324
        comf    INDF,F
325
        incf    FSR,F
326
        comf    INDF,F
327
        incf    FSR,F
328
        comf    INDF,F
329
        incf    FSR,F
330
 
331
        movlw   br0
332
        movwf   FSR
333
        bsf     FSR,6
334
        comf    INDF,F
335
        incf    FSR,F
336
        comf    INDF,F
337
        incf    FSR,F
338
        comf    INDF,F
339
        incf    FSR,F
340
        comf    INDF,F
341
        incf    FSR,F
342
        comf    INDF,F
343
        incf    FSR,F
344
        comf    INDF,F
345
        incf    FSR,F
346
        comf    INDF,F
347
        incf    FSR,F
348
        comf    INDF,F
349
        incf    FSR,F
350
        comf    INDF,F
351
        incf    FSR,F
352
        comf    INDF,F
353
        incf    FSR,F
354
        comf    INDF,F
355
        incf    FSR,F
356
        comf    INDF,F
357
        incf    FSR,F
358
        comf    INDF,F
359
        incf    FSR,F
360
        comf    INDF,F
361
        incf    FSR,F
362
        comf    INDF,F
363
        incf    FSR,F
364
        comf    INDF,F
365
        incf    FSR,F
366
 
367
        movlw   br0
368
        movwf   FSR
369
        bsf     FSR,5
370
        bsf     FSR,6
371
        comf    INDF,F
372
        incf    FSR,F
373
        comf    INDF,F
374
        incf    FSR,F
375
        comf    INDF,F
376
        incf    FSR,F
377
        comf    INDF,F
378
        incf    FSR,F
379
        comf    INDF,F
380
        incf    FSR,F
381
        comf    INDF,F
382
        incf    FSR,F
383
        comf    INDF,F
384
        incf    FSR,F
385
        comf    INDF,F
386
        incf    FSR,F
387
        comf    INDF,F
388
        incf    FSR,F
389
        comf    INDF,F
390
        incf    FSR,F
391
        comf    INDF,F
392
        incf    FSR,F
393
        comf    INDF,F
394
        incf    FSR,F
395
        comf    INDF,F
396
        incf    FSR,F
397
        comf    INDF,F
398
        incf    FSR,F
399
        comf    INDF,F
400
        incf    FSR,F
401
        comf    INDF,F
402
        incf    FSR,F
403
 
404
        ; Register File         TEST 1
405
        movlw   0x01
406
        movwf   PORTB   ; Set Test Number
407
 
408
        movlw   r0
409
        movwf   FSR
410
        movlw   0x7e
411
        subwf   INDF,W
412
        btfss   STATUS,Z
413
        goto    lerr
414
        movlw   0x7d
415
        incf    FSR,F
416
        subwf   INDF,W
417
        btfss   STATUS,Z
418
        goto    lerr
419
        movlw   0x7c
420
        incf    FSR,F
421
        subwf   INDF,W
422
        btfss   STATUS,Z
423
        goto    lerr
424
        movlw   0x7b
425
        incf    FSR,F
426
        subwf   INDF,W
427
        btfss   STATUS,Z
428
        goto    lerr
429
        movlw   0x7a
430
        incf    FSR,F
431
        subwf   INDF,W
432
        btfss   STATUS,Z
433
        goto    lerr
434
        movlw   0x79
435
        incf    FSR,F
436
        subwf   INDF,W
437
        btfss   STATUS,Z
438
        goto    lerr
439
        movlw   0x78
440
        incf    FSR,F
441
        subwf   INDF,W
442
        btfss   STATUS,Z
443
        goto    lerr
444
        movlw   0x77
445
        incf    FSR,F
446
        subwf   INDF,W
447
        btfss   STATUS,Z
448
        goto    lerr
449
 
450
        movlw   br0
451
        movwf   FSR
452
        movlw   0x6f
453
        subwf   INDF,W
454
        btfss   STATUS,Z
455
        goto    lerr
456
        movlw   0x6e
457
        incf    FSR,F
458
        subwf   INDF,W
459
        btfss   STATUS,Z
460
        goto    lerr
461
        movlw   0x6d
462
        incf    FSR,F
463
        subwf   INDF,W
464
        btfss   STATUS,Z
465
        goto    lerr
466
        movlw   0x6c
467
        incf    FSR,F
468
        subwf   INDF,W
469
        btfss   STATUS,Z
470
        goto    lerr
471
        movlw   0x6b
472
        incf    FSR,F
473
        subwf   INDF,W
474
        btfss   STATUS,Z
475
        goto    lerr
476
        movlw   0x6a
477
        incf    FSR,F
478
        subwf   INDF,W
479
        btfss   STATUS,Z
480
        goto    lerr
481
        movlw   0x69
482
        incf    FSR,F
483
        subwf   INDF,W
484
        btfss   STATUS,Z
485
        goto    lerr
486
        movlw   0x68
487
        incf    FSR,F
488
        subwf   INDF,W
489
        btfss   STATUS,Z
490
        goto    lerr
491
        movlw   0x67
492
        incf    FSR,F
493
        subwf   INDF,W
494
        btfss   STATUS,Z
495
        goto    lerr
496
        movlw   0x66
497
        incf    FSR,F
498
        subwf   INDF,W
499
        btfss   STATUS,Z
500
        goto    lerr
501
        movlw   0x65
502
        incf    FSR,F
503
        subwf   INDF,W
504
        btfss   STATUS,Z
505
        goto    lerr
506
        movlw   0x64
507
        incf    FSR,F
508
        subwf   INDF,W
509
        btfss   STATUS,Z
510
        goto    lerr
511
        movlw   0x63
512
        incf    FSR,F
513
        subwf   INDF,W
514
        btfss   STATUS,Z
515
        goto    lerr
516
        movlw   0x62
517
        incf    FSR,F
518
        subwf   INDF,W
519
        btfss   STATUS,Z
520
        goto    lerr
521
        movlw   0x61
522
        incf    FSR,F
523
        subwf   INDF,W
524
        btfss   STATUS,Z
525
        goto    lerr
526
        movlw   0x60
527
        incf    FSR,F
528
        subwf   INDF,W
529
        btfss   STATUS,Z
530
        goto    lerr
531
 
532
        ; Register File         TEST 2
533
        movlw   0x02
534
        movwf   PORTB   ; Set Test Number
535
 
536
        movlw   br0
537
        movwf   FSR
538
        bsf     FSR,5
539
        movlw   0x5f
540
        subwf   INDF,W
541
        btfss   STATUS,Z
542
        goto    lerr
543
        movlw   0x5e
544
        incf    FSR,F
545
        subwf   INDF,W
546
        btfss   STATUS,Z
547
        goto    lerr
548
        movlw   0x5d
549
        incf    FSR,F
550
        subwf   INDF,W
551
        btfss   STATUS,Z
552
        goto    lerr
553
        movlw   0x5c
554
        incf    FSR,F
555
        subwf   INDF,W
556
        btfss   STATUS,Z
557
        goto    lerr
558
        movlw   0x5b
559
        incf    FSR,F
560
        subwf   INDF,W
561
        btfss   STATUS,Z
562
        goto    lerr
563
        movlw   0x5a
564
        incf    FSR,F
565
        subwf   INDF,W
566
        btfss   STATUS,Z
567
        goto    lerr
568
        movlw   0x59
569
        incf    FSR,F
570
        subwf   INDF,W
571
        btfss   STATUS,Z
572
        goto    lerr
573
        movlw   0x58
574
        incf    FSR,F
575
        subwf   INDF,W
576
        btfss   STATUS,Z
577
        goto    lerr
578
        movlw   0x57
579
        incf    FSR,F
580
        subwf   INDF,W
581
        btfss   STATUS,Z
582
        goto    lerr
583
        movlw   0x56
584
        incf    FSR,F
585
        subwf   INDF,W
586
        btfss   STATUS,Z
587
        goto    lerr
588
        movlw   0x55
589
        incf    FSR,F
590
        subwf   INDF,W
591
        btfss   STATUS,Z
592
        goto    lerr
593
        movlw   0x54
594
        incf    FSR,F
595
        subwf   INDF,W
596
        btfss   STATUS,Z
597
        goto    lerr
598
        movlw   0x53
599
        incf    FSR,F
600
        subwf   INDF,W
601
        btfss   STATUS,Z
602
        goto    lerr
603
        movlw   0x52
604
        incf    FSR,F
605
        subwf   INDF,W
606
        btfss   STATUS,Z
607
        goto    lerr
608
        movlw   0x51
609
        incf    FSR,F
610
        subwf   INDF,W
611
        btfss   STATUS,Z
612
        goto    lerr
613
        movlw   0x50
614
        incf    FSR,F
615
        subwf   INDF,W
616
        btfss   STATUS,Z
617
        goto    lerr
618
 
619
        ; Register File         TEST 3
620
        movlw   0x03
621
        movwf   PORTB   ; Set Test Number
622
 
623
        movlw   br0
624
        movwf   FSR
625
        bsf     FSR,6
626
        movlw   0x4f
627
        subwf   INDF,W
628
        btfss   STATUS,Z
629
        goto    lerr
630
        movlw   0x4e
631
        incf    FSR,F
632
        subwf   INDF,W
633
        btfss   STATUS,Z
634
        goto    lerr
635
        movlw   0x4d
636
        incf    FSR,F
637
        subwf   INDF,W
638
        btfss   STATUS,Z
639
        goto    lerr
640
        movlw   0x4c
641
        incf    FSR,F
642
        subwf   INDF,W
643
        btfss   STATUS,Z
644
        goto    lerr
645
        movlw   0x4b
646
        incf    FSR,F
647
        subwf   INDF,W
648
        btfss   STATUS,Z
649
        goto    lerr
650
        movlw   0x4a
651
        incf    FSR,F
652
        subwf   INDF,W
653
        btfss   STATUS,Z
654
        goto    lerr
655
        movlw   0x49
656
        incf    FSR,F
657
        subwf   INDF,W
658
        btfss   STATUS,Z
659
        goto    lerr
660
        movlw   0x48
661
        incf    FSR,F
662
        subwf   INDF,W
663
        btfss   STATUS,Z
664
        goto    lerr
665
        movlw   0x47
666
        incf    FSR,F
667
        subwf   INDF,W
668
        btfss   STATUS,Z
669
        goto    lerr
670
        movlw   0x46
671
        incf    FSR,F
672
        subwf   INDF,W
673
        btfss   STATUS,Z
674
        goto    lerr
675
        movlw   0x45
676
        incf    FSR,F
677
        subwf   INDF,W
678
        btfss   STATUS,Z
679
        goto    lerr
680
        movlw   0x44
681
        incf    FSR,F
682
        subwf   INDF,W
683
        btfss   STATUS,Z
684
        goto    lerr
685
        movlw   0x43
686
        incf    FSR,F
687
        subwf   INDF,W
688
        btfss   STATUS,Z
689
        goto    lerr
690
        movlw   0x42
691
        incf    FSR,F
692
        subwf   INDF,W
693
        btfss   STATUS,Z
694
        goto    lerr
695
        movlw   0x41
696
        incf    FSR,F
697
        subwf   INDF,W
698
        btfss   STATUS,Z
699
        goto    lerr
700
        movlw   0x40
701
        incf    FSR,F
702
        subwf   INDF,W
703
        btfss   STATUS,Z
704
        goto    lerr
705
 
706
        ; Register File         TEST 4
707
        movlw   0x04
708
        movwf   PORTB   ; Set Test Number
709
 
710
        movlw   br0
711
        movwf   FSR
712
        bsf     FSR,5
713
        bsf     FSR,6
714
        movlw   0x3f
715
        subwf   INDF,W
716
        btfss   STATUS,Z
717
        goto    lerr
718
        movlw   0x3e
719
        incf    FSR,F
720
        subwf   INDF,W
721
        btfss   STATUS,Z
722
        goto    lerr
723
        movlw   0x3d
724
        incf    FSR,F
725
        subwf   INDF,W
726
        btfss   STATUS,Z
727
        goto    lerr
728
        movlw   0x3c
729
        incf    FSR,F
730
        subwf   INDF,W
731
        btfss   STATUS,Z
732
        goto    lerr
733
        movlw   0x3b
734
        incf    FSR,F
735
        subwf   INDF,W
736
        btfss   STATUS,Z
737
        goto    lerr
738
        movlw   0x3a
739
        incf    FSR,F
740
        subwf   INDF,W
741
        btfss   STATUS,Z
742
        goto    lerr
743
        movlw   0x39
744
        incf    FSR,F
745
        subwf   INDF,W
746
        btfss   STATUS,Z
747
        goto    lerr
748
        movlw   0x38
749
        incf    FSR,F
750
        subwf   INDF,W
751
        btfss   STATUS,Z
752
        goto    lerr
753
        movlw   0x37
754
        incf    FSR,F
755
        subwf   INDF,W
756
        btfss   STATUS,Z
757
        goto    lerr
758
        movlw   0x36
759
        incf    FSR,F
760
        subwf   INDF,W
761
        btfss   STATUS,Z
762
        goto    lerr
763
        movlw   0x35
764
        incf    FSR,F
765
        subwf   INDF,W
766
        btfss   STATUS,Z
767
        goto    lerr
768
        movlw   0x34
769
        incf    FSR,F
770
        subwf   INDF,W
771
        btfss   STATUS,Z
772
        goto    lerr
773
        movlw   0x33
774
        incf    FSR,F
775
        subwf   INDF,W
776
        btfss   STATUS,Z
777
        goto    lerr
778
        movlw   0x32
779
        incf    FSR,F
780
        subwf   INDF,W
781
        btfss   STATUS,Z
782
        goto    lerr
783
        movlw   0x31
784
        incf    FSR,F
785
        subwf   INDF,W
786
        btfss   STATUS,Z
787
        goto    lerr
788
        movlw   0x30
789
        incf    FSR,F
790
        subwf   INDF,W
791
        btfss   STATUS,Z
792
        goto    lerr
793
 
794
        nop
795
        nop
796
        nop
797
        nop
798
        movlw   0x01
799
        movwf   PORTA
800
        nop
801
        nop
802
        nop
803
        nop
804
good                    ; Loop in good on success
805
        goto    good
806
        nop
807
        nop
808
        nop
809
        nop
810
 
811
lerr
812
        movlw   0xff
813
        movwf   PORTA
814
 
815
        nop
816
        nop
817
        nop
818
        nop
819
lerr_loop               ; Loop in lerr on failure
820
        goto    lerr_loop
821
        nop
822
        nop
823
        nop
824
        nop
825
 
826
   END
827
 

powered by: WebSVN 2.1.0

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