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 200

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