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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [src/] [two-op_mov.s43] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 olivier.gi
/*===========================================================================*/
2
/* Copyright (C) 2001 Authors                                                */
3
/*                                                                           */
4
/* This source file may be used and distributed without restriction provided */
5
/* that this copyright statement is not removed from the file and that any   */
6
/* derivative work contains the original copyright notice and the associated */
7
/* disclaimer.                                                               */
8
/*                                                                           */
9
/* This source file is free software; you can redistribute it and/or modify  */
10
/* it under the terms of the GNU Lesser General Public License as published  */
11
/* by the Free Software Foundation; either version 2.1 of the License, or    */
12
/* (at your option) any later version.                                       */
13
/*                                                                           */
14
/* This source is distributed in the hope that it will be useful, but WITHOUT*/
15
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     */
16
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public       */
17
/* License for more details.                                                 */
18
/*                                                                           */
19
/* You should have received a copy of the GNU Lesser General Public License  */
20
/* along with this source; if not, write to the Free Software Foundation,    */
21
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA        */
22
/*                                                                           */
23
/*===========================================================================*/
24
/*                   TWO-OPERAND ARITHMETIC: MOV INSTRUCTION                 */
25
/*---------------------------------------------------------------------------*/
26
/* Test the MOV instruction with all addressing modes                        */
27
/*===========================================================================*/
28
 
29
 
30
.global main
31
 
32
main:
33
        /* ---------------------- INITIALIZE REGISTERS --------------------- */
34
        mov     #0x2222, r2
35
        mov     #0x3333, r3
36
        mov     #0x4444, r4
37
        mov     #0x5555, r5
38
        mov     #0x6666, r6
39
        mov     #0x7777, r7
40
        mov     #0x8888, r8
41
        mov     #0x9999, r9
42
        mov     #0xaaaa, r10
43
        mov     #0xbbbb, r11
44
        mov     #0xcccc, r12
45
        mov     #0xdddd, r13
46
        mov     #0xeeee, r14
47
 
48
        mov     #0x1000, r15
49
 
50
 
51
        /* ---------------------- TEST WHEN SOURCE IS Rn ------------------- */
52
.set   Rn_EDE,  __data_start
53
.set   Rn_TONY, 0x0204
54
 
55
        mov          r4, r3        ;# Overwrite r3 with 0x4444
56
        mov #test_Rn_PC, r4
57
        br           r4
58
        nop
59
        nop
60
        nop
61
        nop
62
        mov     #0x0000, r4        ;# Make sure the jump is taken
63
test_Rn_PC:
64
        mov     #0x0200, r5
65
        mov     #0x1234, r6
66
        mov          r6, 16(r5)    ;# Write 0x1234 to memory @0x0210
67
        mov     #0x5678, r7
68
        mov          r7, Rn_EDE    ;# Write 0x5678 to memory @0x0200
69
        mov     #0x9abc, r8
70
        mov          r8, &Rn_TONY  ;# Write 0x9abc to memory @0x0204
71
 
72
        mov     #0x2000, r15
73
 
74
 
75
        /* ---------------------- TEST WHEN SOURCE IS @Rn ------------------ */
76
.set   aRn_EDE,  __data_start
77
.set   aRn_TONY, 0x0204
78
 
79
        mov      #0x0210, r4
80
        mov      #0x3333, r3
81
        mov          @r4, r3        ;# r3 takes @0x0210 value: 0x1234
82
        mov #test_aRn_PC, r4
83
        mov           r4, &0x0200
84
        mov      #0x0200, r4
85
        br           @r4
86
        nop
87
        nop
88
        nop
89
        mov      #0x0000, r4        ;# Make sure the jump is taken
90
test_aRn_PC:
91
        mov      #0x0200, r5
92
        mov      #0x0204, r6
93
        mov          @r6, 16(r5)    ;# Move memory @0x204 (0x9abc) to memory @0x210
94
        mov      #0xfedc, &0x202
95
        mov      #0x0202, r6
96
        mov          @r6, aRn_EDE   ;# Move memory @0x202 (0xfedc) to memory @0x200
97
        mov      #0xf1d2, &0x202
98
        mov      #0x0202, r6
99
        mov          @r6, &aRn_TONY ;# Move memory @0x202 (0xf1d2) to memory @0x204
100
 
101
        mov      #0x3000, r15
102
 
103
 
104
        /* ---------------------- TEST WHEN SOURCE IS @Rn+ ----------------- */
105
.set   aRni_EDE,  __data_start
106
.set   aRni_TONY, 0x0214
107
 
108
        mov      #0x1111, &0x200
109
        mov      #0x0200, r4
110
        mov         @r4+, r5         ;# Write @0x200 (0x1111) to R5
111
 
112
        mov #test_aRni_PC, &0x204
113
        mov      #0x0204, r6
114
        br          @r6+
115
        nop
116
        nop
117
        nop
118
        nop
119
        mov      #0x0000, r6         ;# Make sure the jump is taken
120
test_aRni_PC:
121
        mov      #0x1234, &0x210
122
        mov      #0x5678, &0x212
123
        mov      #0x9abc, &0x214
124
        mov      #0xdef0, &0x216
125
 
126
        mov      #0x0210, r8
127
        mov      #0x0216, r7
128
        mov         @r7+, 16(r8)     ;# Move memory @0x216 (0xdef0) to memory @0x220
129
 
130
        mov      #0x0212, r8
131
        mov         @r8+, aRni_EDE   ;# Move memory @0x212 (0x5678) to memory @0x200
132
 
133
        mov      #0x0210, r9
134
        mov         @r9+, &aRni_TONY ;# Move memory @0x210 (0x1234) to memory @0x214
135
 
136
        mov      #0x4000, r15
137
 
138
 
139
 
140
        /* ---------------------- TEST WHEN SOURCE IS #N ------------------- */
141
.set   N_EDE,  (__data_start+0x0010)
142
.set   N_TONY, 0x0206
143
 
144
        mov      #0x3210, r4         ;# Write 0x3210 to R4
145
        mov      #0xfcde, r5
146
        br       #test_N_PC
147
        nop
148
        nop
149
        nop
150
        nop
151
        mov      #0x0000, r5         ;# Make sure the jump is taken
152
test_N_PC:
153
        mov      #0x0200, r6
154
        mov      #0x5a5a, 48(r6)     ;# Move memory 0x5a5a to memory @0x230
155
        mov      #0x1a2b, N_EDE      ;# Move memory 0x1a2b to memory @0x210
156
        mov      #0x3c4d, &N_TONY    ;# Move memory 0x3c4d to memory @0x206
157
 
158
        mov      #0x5000, r15
159
 
160
 
161
 
162
        /* ---------------------- TEST WHEN SOURCE IS x(Rn) ---------------- */
163
.set   xRn_EDE,  (__data_start+0x0020)
164
.set   xRn_TONY, 0x0208
165
 
166
        mov      #0x8347, &0x0210
167
        mov      #0x1234, &0x0200
168
        mov      #0x0200, r4
169
        mov       16(r4), r5         ;# Write 0x8347 to R5
170
 
171
        mov #test_xRn_PC, &0x0208
172
        mov      #0x1234, &0x0200
173
        mov      #0x2345, r6
174
        mov      #0x0200, r4
175
        br       8(r4)
176
        nop
177
        nop
178
        nop
179
        nop
180
        mov      #0x0000, r6         ;# Make sure the jump is taken
181
test_xRn_PC:
182
        mov      #0x4231, &0x0210
183
        mov      #0x1234, &0x0200
184
        mov      #0x0200, r7
185
        mov      #0x0202, r8
186
        mov      16(r7), 18(r8)      ;# Move memory @0x210 (0x4231) to memory @0x214
187
        mov      #0x7238, &0x0204
188
        mov      #0x1234, &0x0200
189
        mov      #0x0200, r7
190
        mov      4(r7), xRn_EDE      ;# Move memory @0x204 (0x7238) to memory @0x220
191
        mov      #0x98b2, &0x0216
192
        mov      #0x1234, &0x0200
193
        mov      #0x0200, r7
194
        mov      22(r4), &xRn_TONY   ;# Move memory @0x216 (0x98b2) to memory @0x208
195
 
196
        mov      #0x6000, r15
197
 
198
 
199
 
200
        /* ---------------------- TEST WHEN SOURCE IS 'EDE' ---------------- */
201
.set   EDE_EDE,  (__data_start+0x0016)
202
.set   EDE_TONY, 0x0212
203
 
204
.set   EDE_200,  (__data_start+0x0000)
205
.set   EDE_202,  (__data_start+0x0002)
206
.set   EDE_204,  (__data_start+0x0004)
207
.set   EDE_206,  (__data_start+0x0006)
208
.set   EDE_208,  (__data_start+0x0008)
209
 
210
        mov      #0xc3d6, &0x0200
211
        mov      #0x1234, &0x0202
212
        mov      #0x4321, r4
213
        mov      EDE_200, r4          ;# Write 0xc3d6 to R4
214
 
215
        mov #test_EDE_PC, &0x0202
216
        mov      #0x1234, &0x0204
217
        mov      #0x3456, r6
218
        br       EDE_202
219
        nop
220
        nop
221
        nop
222
        nop
223
        mov      #0x0000, r6          ;# Make sure the jump is taken
224
test_EDE_PC:
225
 
226
        mov      #0x0202, r8
227
        mov      #0xf712, &0x0204
228
        mov      #0x1234, &0x0206
229
        mov      EDE_204, 18(r8)      ;# Move memory @0x204 (0xf712) to memory @0x214
230
 
231
        mov      #0xb3a9, &0x0206
232
        mov      #0x1234, &0x0208
233
        mov      EDE_206, EDE_EDE     ;# Move memory @0x206 (0xb3a9) to memory @0x216
234
 
235
        mov      #0x837A, &0x0208
236
        mov      #0x1234, &0x020A
237
        mov      EDE_208, &EDE_TONY   ;# Move memory @0x208 (0x837A) to memory @0x212
238
 
239
        mov      #0x7000, r15
240
 
241
 
242
 
243
        /* ---------------------- TEST WHEN SOURCE IS '&EDE' --------------- */
244
.set   aEDE_EDE,  (__data_start+0x0018)
245
.set   aEDE_TONY, 0x0202
246
 
247
        mov      #0x23d4, &0x0200
248
        mov      #0x1234, &0x0202
249
        mov      #0x4321, r4
250
        mov      &0x0200, r4          ;# Write 0x23d4 to R4
251
 
252
        mov #test_aEDE_PC, &0x0202
253
        mov      #0x1234,  &0x0204
254
        mov      #0xfb58,  r6
255
        br       &0x0202
256
        nop
257
        nop
258
        nop
259
        nop
260
        mov      #0x0000, r6          ;# Make sure the jump is taken
261
test_aEDE_PC:
262
 
263
        mov      #0x0202, r7
264
        mov      #0x481c, &0x0204
265
        mov      #0x1234, &0x0206
266
        mov      &0x0204, 18(r7)      ;# Move memory @0x204 (0x481c) to memory @0x214
267
 
268
        mov      #0x5c1f, &0x0206
269
        mov      #0x1234, &0x0208
270
        mov      &0x0206, aEDE_EDE    ;# Move memory @0x206 (0x5c1f) to memory @0x218
271
 
272
        mov      #0xc16e, &0x0208
273
        mov      #0x1234, &0x020A
274
        mov      &0x0208, &aEDE_TONY  ;# Move memory @0x208 (0xc16e) to memory @0x202
275
 
276
        mov      #0x8000, r15
277
 
278
 
279
 
280
        /* ---------------------- TEST WHEN SOURCE IS CONSTANT ------------- */
281
.set   CONST_EDE0,   (__data_start+0x0020)
282
.set   CONST_EDE1,   (__data_start+0x0022)
283
.set   CONST_EDE2,   (__data_start+0x0024)
284
.set   CONST_EDE4,   (__data_start+0x0026)
285
.set   CONST_EDE8,   (__data_start+0x0028)
286
.set   CONST_EDEm1,  (__data_start+0x002A)
287
 
288
.set   CONST_TONY0,  0x0230
289
.set   CONST_TONY1,  0x0232
290
.set   CONST_TONY2,  0x0234
291
.set   CONST_TONY4,  0x0236
292
.set   CONST_TONY8,  0x0238
293
.set   CONST_TONYm1, 0x023A
294
 
295
 
296
        mov      #0x4444, r4              ;# Initialize registers
297
        mov      #0x5555, r5
298
        mov      #0x6666, r6
299
        mov      #0x7777, r7
300
        mov      #0x8888, r8
301
        mov      #0x9999, r9
302
 
303
        mov      #0x0000, r4              ;# Write +0 to R4
304
        mov      #0x0001, r5              ;# Write +1 to R5
305
        mov      #0x0002, r6              ;# Write +2 to R6
306
        mov      #0x0004, r7              ;# Write +4 to R7
307
        mov      #0x0008, r8              ;# Write +8 to R8
308
        mov      #0xffff, r9              ;# Write -1 to R9
309
 
310
        mov      #0x0202, r10
311
        mov      #0x1234, r11
312
        mov      #0x0000, 14(r10)         ;# Move +0 to memory @0x210
313
        mov      #0x0001, 16(r10)         ;# Move +1 to memory @0x212
314
        mov      #0x0002, 18(r10)         ;# Move +2 to memory @0x214
315
        mov      #0x0004, 20(r10)         ;# Move +4 to memory @0x216
316
        mov      #0x0008, 22(r10)         ;# Move +8 to memory @0x218
317
        mov      #0xffff, 24(r10)         ;# Move -1 to memory @0x21A
318
 
319
        mov      #0x0000, CONST_EDE0      ;# Move +0 to memory @0x220
320
        mov      #0x0001, CONST_EDE1      ;# Move +1 to memory @0x222
321
        mov      #0x0002, CONST_EDE2      ;# Move +2 to memory @0x224
322
        mov      #0x0004, CONST_EDE4      ;# Move +4 to memory @0x226
323
        mov      #0x0008, CONST_EDE8      ;# Move +8 to memory @0x228
324
        mov      #0xffff, CONST_EDEm1     ;# Move -1 to memory @0x22A
325
 
326
        mov      #0x0000, &CONST_TONY0    ;# Move +0 to memory @0x230
327
        mov      #0x0001, &CONST_TONY1    ;# Move +1 to memory @0x232
328
        mov      #0x0002, &CONST_TONY2    ;# Move +2 to memory @0x234
329
        mov      #0x0004, &CONST_TONY4    ;# Move +4 to memory @0x236
330
        mov      #0x0008, &CONST_TONY8    ;# Move +8 to memory @0x238
331
        mov      #0xffff, &CONST_TONYm1   ;# Move -1 to memory @0x23A
332
 
333
        mov      #0x9000, r15
334
 
335
 
336
        /* ---------------- TEST WHEN SOURCE IS CONSTANT IN BYTE MODE ------ */
337
        #
338
        # NOTE: The following section would not fit in the smallest ROM
339
        #       configuration for the "two-op_mov-b.s43" pattern.
340
        #       It is therefore executed here.
341
        #
342
.set   CONSTL_TONY0,  0x0250
343
.set   CONSTL_TONY1,  0x0252
344
.set   CONSTL_TONY2,  0x0254
345
.set   CONSTL_TONY4,  0x0256
346
.set   CONSTL_TONY8,  0x0258
347
.set   CONSTL_TONYm1, 0x025A
348
.set   CONSTH_TONY0,  0x025D
349
.set   CONSTH_TONY1,  0x025F
350
.set   CONSTH_TONY2,  0x0261
351
.set   CONSTH_TONY4,  0x0263
352
.set   CONSTH_TONY8,  0x0265
353
.set   CONSTH_TONYm1, 0x0267
354
 
355
        mov      #0x4444, &0x0250         ;# Initialize Memory
356
        mov      #0x5555, &0x0252
357
        mov      #0x6666, &0x0254
358
        mov      #0x7777, &0x0256
359
        mov      #0x3535, &0x0258
360
        mov      #0x9999, &0x025A
361
        mov      #0xaaaa, &0x025C
362
        mov      #0xbbbb, &0x025E
363
        mov      #0xcccc, &0x0260
364
        mov      #0xdddd, &0x0262
365
        mov      #0xeeee, &0x0264
366
        mov      #0x3333, &0x0266
367
 
368
        mov.b    #0x0000, &CONSTL_TONY0    ;# Move +0 to memory @0x250
369
        mov.b    #0x0001, &CONSTL_TONY1    ;# Move +1 to memory @0x252
370
        mov.b    #0x0002, &CONSTL_TONY2    ;# Move +2 to memory @0x254
371
        mov.b    #0x0004, &CONSTL_TONY4    ;# Move +4 to memory @0x256
372
        mov.b    #0x0008, &CONSTL_TONY8    ;# Move +8 to memory @0x258
373
        mov.b    #0xffff, &CONSTL_TONYm1   ;# Move -1 to memory @0x25A
374
        mov.b    #0x0000, &CONSTH_TONY0    ;# Move +0 to memory @0x25D
375
        mov.b    #0x0001, &CONSTH_TONY1    ;# Move +1 to memory @0x25F
376
        mov.b    #0x0002, &CONSTH_TONY2    ;# Move +2 to memory @0x261
377
        mov.b    #0x0004, &CONSTH_TONY4    ;# Move +4 to memory @0x263
378
        mov.b    #0x0008, &CONSTH_TONY8    ;# Move +8 to memory @0x265
379
        mov.b    #0xffff, &CONSTH_TONYm1   ;# Move -1 to memory @0x267
380
 
381
 
382
        mov      #0xA000, r15
383
 
384
        /* ----------------------         END OF TEST        --------------- */
385
end_of_test:
386
        nop
387
        br #0xffff
388
 
389
 
390
        /* ----------------------         INTERRUPT VECTORS  --------------- */
391
 
392
.section .vectors, "a"
393
.word end_of_test  ; Interrupt  0 (lowest priority)    
394
.word end_of_test  ; Interrupt  1                      
395
.word end_of_test  ; Interrupt  2                      
396
.word end_of_test  ; Interrupt  3                      
397
.word end_of_test  ; Interrupt  4                      
398
.word end_of_test  ; Interrupt  5                      
399
.word end_of_test  ; Interrupt  6                      
400
.word end_of_test  ; Interrupt  7                      
401
.word end_of_test  ; Interrupt  8                      
402
.word end_of_test  ; Interrupt  9                      
403
.word end_of_test  ; Interrupt 10                      Watchdog timer
404
.word end_of_test  ; Interrupt 11                      
405
.word end_of_test  ; Interrupt 12                      
406
.word end_of_test  ; Interrupt 13                      
407
.word end_of_test  ; Interrupt 14                      NMI
408
.word main         ; Interrupt 15 (highest priority)   RESET

powered by: WebSVN 2.1.0

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