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 18

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