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

Subversion Repositories minirisc

[/] [minirisc/] [trunk/] [scode/] [rf3.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 3                                       ////
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
        ; ---------------------------------------
77
        ; ---- Test RMW on Register fil      ----
78
        ; ---------------------------------------
79
 
80
        movlw   0x01    ;       TEST 1
81
        movwf   PORTB   ; Set Test Number
82
 
83
        movlw   0xfc
84
        movwf   r0
85
        incf    r0,F
86
        incf    r0,F
87
        incf    r0,F
88
        incf    r0,F
89
        btfss   STATUS,Z
90
        goto    lerr
91
 
92
        movlw   0xfc
93
        movwf   br8
94
        incf    br8,F
95
        incf    br8,F
96
        incf    br8,F
97
        incf    br8,F
98
        btfss   STATUS,Z
99
        goto    lerr
100
 
101
        movlw   0x02    ;       TEST 2
102
        movwf   PORTB   ; Set Test Number
103
 
104
        movlw   r1
105
        movwf   FSR
106
        movlw   0xfc
107
        movwf   INDF
108
        incf    INDF,F
109
        incf    INDF,F
110
        incf    INDF,F
111
        incf    INDF,F
112
        btfss   STATUS,Z
113
        goto    lerr
114
 
115
        movlw   br9
116
        movwf   FSR
117
        movlw   0xfc
118
        movwf   INDF
119
        incf    INDF,F
120
        incf    INDF,F
121
        incf    INDF,F
122
        incf    INDF,F
123
        btfss   STATUS,Z
124
        goto    lerr
125
 
126
 
127
 
128
        movlw   0x03    ;       TEST 3
129
        movwf   PORTB   ; Set Test Number
130
 
131
        movlw   0x04
132
        movwf   r0
133
        decf    r0,F
134
        decf    r0,F
135
        decf    r0,F
136
        decf    r0,F
137
        btfss   STATUS,Z
138
        goto    lerr
139
 
140
 
141
        movlw   0x04
142
        movwf   br0
143
        decf    br0,F
144
        decf    br0,F
145
        decf    br0,F
146
        decf    br0,F
147
        btfss   STATUS,Z
148
        goto    lerr
149
 
150
 
151
        movlw   0x04    ;       TEST 4
152
        movwf   PORTB   ; Set Test Number
153
 
154
        movlw   r1
155
        movwf   FSR
156
        movlw   0x04
157
        movwf   INDF
158
        decf    INDF,F
159
        decf    INDF,F
160
        decf    INDF,F
161
        decf    INDF,F
162
        btfss   STATUS,Z
163
        goto    lerr
164
 
165
        movlw   br9
166
        movwf   FSR
167
        movlw   0x04
168
        movwf   INDF
169
        decf    INDF,F
170
        decf    INDF,F
171
        decf    INDF,F
172
        decf    INDF,F
173
        btfss   STATUS,Z
174
        goto    lerr
175
 
176
 
177
        movlw   0x05    ;       TEST 5
178
        movwf   PORTB   ; Set Test Number
179
 
180
        movlw   0xfc
181
        movwf   r4
182
        incfsz  r4,F
183
        incfsz  r4,F
184
        incfsz  r4,F
185
        incfsz  r4,F
186
        goto    lerr
187
 
188
        movlw   0xfc
189
        movwf   br8
190
        incfsz  br8,F
191
        incfsz  br8,F
192
        incfsz  br8,F
193
        incfsz  br8,F
194
        goto    lerr
195
 
196
 
197
        movlw   0x06    ;       TEST 6
198
        movwf   PORTB   ; Set Test Number
199
 
200
        movlw   r1
201
        movwf   FSR
202
        movlw   0xfc
203
        movwf   INDF
204
        incfsz  INDF,F
205
        incfsz  INDF,F
206
        incfsz  INDF,F
207
        incfsz  INDF,F
208
        goto    lerr
209
 
210
        movlw   br9
211
        movwf   FSR
212
        movlw   0xfc
213
        movwf   INDF
214
        incfsz  INDF,F
215
        incfsz  INDF,F
216
        incfsz  INDF,F
217
        incfsz  INDF,F
218
        goto    lerr
219
 
220
        movlw   0x07    ;       TEST 7
221
        movwf   PORTB   ; Set Test Number
222
 
223
        movlw   0x04
224
        movwf   r0
225
        decfsz  r0,F
226
        decfsz  r0,F
227
        decfsz  r0,F
228
        decfsz  r0,F
229
        goto    lerr
230
 
231
 
232
        movlw   0x04
233
        movwf   br0
234
        decfsz  br0,F
235
        decfsz  br0,F
236
        decfsz  br0,F
237
        decfsz  br0,F
238
        goto    lerr
239
 
240
 
241
        movlw   0x08    ;       TEST 8
242
        movwf   PORTB   ; Set Test Number
243
 
244
        movlw   r1
245
        movwf   FSR
246
        movlw   0x04
247
        movwf   INDF
248
        decfsz  INDF,F
249
        decfsz  INDF,F
250
        decfsz  INDF,F
251
        decfsz  INDF,F
252
        goto    lerr
253
 
254
        movlw   br9
255
        movwf   FSR
256
        movlw   0x04
257
        movwf   INDF
258
        decfsz  INDF,F
259
        decfsz  INDF,F
260
        decfsz  INDF,F
261
        decfsz  INDF,F
262
        goto    lerr
263
 
264
 
265
        movlw   0x09    ;       TEST 9
266
        movwf   PORTB   ; Set Test Number
267
 
268
        movlw   0xfc
269
        movwf   FSR
270
        incf    FSR,F
271
        incf    FSR,F
272
        incf    FSR,F
273
        incf    FSR,F
274
        btfss   STATUS,Z
275
        goto    lerr
276
 
277
        movlw   0x04
278
        movwf   FSR
279
        movlw   0x7f
280
        decf    FSR,F
281
        decf    FSR,F
282
        decf    FSR,F
283
        decf    FSR,F
284
        andwf   FSR,F
285
        btfss   STATUS,Z
286
        goto    lerr
287
 
288
        movlw   0x0a    ;       TEST 10
289
        movwf   PORTB   ; Set Test Number
290
 
291
        movlw   0xfc
292
        movwf   STATUS
293
        movlw   0x18
294
        incf    STATUS,F
295
        incf    STATUS,F
296
        incf    STATUS,F
297
        incf    STATUS,F
298
        subwf   STATUS,W
299
        btfss   STATUS,Z
300
        goto    lerr
301
 
302
 
303
 
304
 
305
        nop
306
        nop
307
        nop
308
        nop
309
        movlw   0x01
310
        movwf   PORTA
311
        nop
312
        nop
313
        nop
314
        nop
315
good                    ; Loop in good on success
316
        goto    good
317
        nop
318
        nop
319
        nop
320
        nop
321
 
322
lerr
323
        movlw   0xff
324
        movwf   PORTA
325
 
326
        nop
327
        nop
328
        nop
329
        nop
330
lerr_loop               ; Loop in lerr on failure
331
        goto    lerr_loop
332
        nop
333
        nop
334
        nop
335
        nop
336
 
337
   END
338
 

powered by: WebSVN 2.1.0

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