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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [src/] [sing-op_push.s43] - Blame information for rev 102

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
/*                 SINGLE-OPERAND ARITHMETIC: PUSH  INSTRUCTION              */
25
/*---------------------------------------------------------------------------*/
26
/* Test the PUSH  instruction.                                               */
27 18 olivier.gi
/*                                                                           */
28
/* Author(s):                                                                */
29
/*             - Olivier Girard,    olgirard@gmail.com                       */
30
/*                                                                           */
31
/*---------------------------------------------------------------------------*/
32 19 olivier.gi
/* $Rev: 102 $                                                                */
33
/* $LastChangedBy: olivier.girard $                                          */
34
/* $LastChangedDate: 2011-03-04 23:02:09 +0100 (Fri, 04 Mar 2011) $          */
35 2 olivier.gi
/*===========================================================================*/
36
 
37
 
38
.global main
39
 
40
main:
41
        /* -------------- TEST INSTRUCTION IN WORD MODE ------------------- */
42
 
43
        # Initialization
44
        #------------------------
45
 
46
        mov     #0x0050, r4        ;# Initialize RAM
47
        mov     #0x0200, r5
48
clear_mem_loop:
49
        clr    0(r5)
50
        incd     r5
51
        dec      r4
52
        jnz     clear_mem_loop
53
 
54
 
55
        mov     #0x0252, r1        ;# Initialize stack pointer
56
 
57
 
58
        mov     #0x1000, r15
59
 
60
 
61
        # Addressing mode: Rn
62
        #------------------------
63
 
64
        mov     #0x7524, r4
65
        mov     #0x5555, &0x0300
66
        push          r4           ;# PUSH (r4=0x7524  =>  @=0x0250)
67
 
68
        mov     #0x1cb6, r6
69
        mov     #0x5555, &0x0300
70
        push          r6           ;# PUSH (r6=0x1cb6  =>  @=0x024E)
71
 
72
        mov     #0x2000, r15
73
 
74
 
75
        # Addressing mode: @Rn
76
        #------------------------
77
 
78
        mov     #0x0212, r4
79
        mov     #0x1234, &0x0212
80
        mov     #0x5555, &0x0300
81
        push        @r4           ;# PUSH (0x1234  =>  @=0x024C)
82
 
83
        mov     #0x0214, r6
84
        mov     #0x5678, &0x0214
85
        mov     #0x5555, &0x0300
86
        push        @r6           ;# PUSH (0x5678  =>  @=0x024A)
87
 
88
        mov     #0x3000, r15
89
 
90
 
91
        # Addressing mode: @Rn+
92
        #------------------------
93
 
94
        mov     #0x0216, r4
95
        mov     #0x9abc, &0x0216
96
        mov     #0x5555, &0x0300
97
        push       @r4+           ;# PUSH (0x9abc  =>  @=0x0248)
98
 
99
        mov     #0xdef0, &0x0218
100
        mov     #0x5555, &0x0300
101
        push       @r4+           ;# PUSH (0xdef0  =>  @=0x0246)
102
 
103
        mov     #0x4000, r15
104
 
105
 
106
        # Addressing mode: X(Rn)
107
        #------------------------
108
 
109
        mov     #0x0200, r4
110
        mov     #0x0fed, &0x021A
111
        mov     #0x5555, &0x0300
112
        push      26(r4)           ;# PUSH (0x0fed  =>  @=0x0244)
113
 
114
        mov     #0xcba9, &0x021C
115
        mov     #0x5555, &0x0300
116
        push      28(r4)           ;# PUSH (0xcba9  =>  @=0x0242)
117
 
118
        mov     #0x5000, r15
119
 
120
 
121
        # Addressing mode: EDE
122
        #------------------------
123
.set   EDE_21E,  (__data_start+0x001E)
124
.set   EDE_220,  (__data_start+0x0020)
125
 
126
        mov     #0x0200, r4
127
        mov     #0x8765, &0x021E
128
        mov     #0x5555, &0x0300
129
        push    EDE_21E            ;# PUSH (0x8765  =>  @=0x0240)
130
 
131
        mov     #0x4321, &0x0220
132
        mov     #0x5555, &0x0300
133
        push    EDE_220            ;# PUSH (0x4321  =>  @=0x023E)
134
 
135
        mov     #0x6000, r15
136
 
137
 
138
        # Addressing mode: &EDE
139
        #------------------------
140
.set   aEDE_222,  0x0222
141
.set   aEDE_224,  0x0224
142
 
143
        mov     #0x0200, r4
144
        mov     #0x1f2e, &0x0222
145
        mov     #0x5555, &0x0300
146
        push  &aEDE_222            ;# PUSH (0x1f2e  =>  @=0x023C)
147
 
148
        mov     #0x3d4c, &0x0224
149
        mov     #0x5555, &0x0300
150
        push  &aEDE_224            ;# PUSH (0x3d4c  =>  @=0x023A)
151
 
152
        mov     #0x7000, r15
153
 
154
 
155
        # Addressing mode: #N
156
        #------------------------
157
 
158
        mov     #0x5555, &0x0300
159
        push    #0x71c8            ;# PUSH (0x71c8  =>  @=0x0238)
160
 
161
        mov     #0x5555, &0x0300
162
        push    #0x178c            ;# PUSH (0x178c  =>  @=0x0236)
163
 
164
        mov     #0x7001, r15
165
 
166
 
167
        /* -------------- TEST INSTRUCTION IN BYTE MODE ------------------- */
168
 
169
        # Initialization
170
        #------------------------
171
 
172
        mov     #0x0252, r1        ;# Initialize stack pointer
173
 
174
        mov     #0x8000, r15
175
 
176
 
177
        # Addressing mode: Rn
178
        #------------------------
179
 
180
        mov     #0x1fe2, r4
181
        mov     #0x5555, &0x0300
182
        push.b        r4           ;# PUSH (r4=0xe2  =>  @=0x0250)
183
 
184
        mov     #0x3dc4, r6
185
        mov     #0x5555, &0x0300
186
        push.b        r6           ;# PUSH (r6=0xc4  =>  @=0x024E)
187
 
188
        mov     #0x9000, r15
189
 
190
 
191
        # Addressing mode: @Rn
192
        #------------------------
193
 
194
        mov     #0x0212, r4
195
        mov     #0x5ba6, &0x0212
196
        mov     #0x5555, &0x0300
197
        push.b      @r4           ;# PUSH (0xa6    =>  @=0x024C)
198
 
199
        mov     #0x0215, r6
200
        mov     #0x7988, &0x0214
201
        mov     #0x5555, &0x0300
202
        push.b      @r6           ;# PUSH (0x79    =>  @=0x024A)
203
 
204
        mov     #0xA000, r15
205
 
206
 
207
        # Addressing mode: @Rn+
208
        #------------------------
209
 
210
        mov     #0x0216, r4
211
        mov     #0x976a, &0x0216
212
        mov     #0x5555, &0x0300
213
        push.b     @r4+           ;# PUSH (0x6a  =>  @=0x0248)
214
 
215
        mov     #0x5555, &0x0300
216
        push.b     @r4+           ;# PUSH (0x97  =>  @=0x0246)
217
 
218
        mov     #0xB000, r15
219
 
220
 
221
        # Addressing mode: X(Rn)
222
        #------------------------
223
 
224
        mov     #0x0200, r4
225
        mov     #0xb54c, &0x021A
226
        mov     #0x5555, &0x0300
227
        push.b    26(r4)           ;# PUSH (0x4c  =>  @=0x0244)
228
 
229
        mov     #0xc32d, &0x021C
230
        mov     #0x5555, &0x0300
231
        push.b    29(r4)           ;# PUSH (0xc3  =>  @=0x0242)
232
 
233
        mov     #0xC000, r15
234
 
235
 
236
        # Addressing mode: EDE
237
        #------------------------
238
.set   EDE_B_21E,  (__data_start+0x001E)
239
.set   EDE_B_221,  (__data_start+0x0021)
240
 
241
        mov     #0x0200, r4
242
        mov     #0xd10e, &0x021E
243
        mov     #0x5555, &0x0300
244
        push.b  EDE_B_21E          ;# PUSH (0x0e  =>  @=0x0240)
245
 
246
        mov     #0xfed0, &0x0220
247
        mov     #0x5555, &0x0300
248
        push.b  EDE_B_221          ;# PUSH (0xfe  =>  @=0x023E)
249
 
250
        mov     #0xD000, r15
251
 
252
 
253
        # Addressing mode: &EDE
254
        #------------------------
255
.set   aEDE_B_222,  0x0222
256
.set   aEDE_B_225,  0x0225
257
 
258
        mov     #0x0200, r4
259
        mov     #0x1bc2, &0x0222
260
        mov     #0x5555, &0x0300
261
        push.b &aEDE_B_222         ;# PUSH (0xc2  =>  @=0x023C)
262
 
263
        mov     #0x3ba4, &0x0224
264
        mov     #0x5555, &0x0300
265
        push.b &aEDE_B_225         ;# PUSH (0x3b  =>  @=0x023A)
266
 
267
        mov     #0xE000, r15
268
 
269
 
270
        # Addressing mode: #N
271
        #------------------------
272
 
273
        mov     #0x5555, &0x0300
274
        push.b  #0x82d9            ;# PUSH (0xd9  =>  @=0x0238)
275
 
276
        mov     #0x5555, &0x0300
277
        push.b  #0x288d            ;# PUSH (0x8d  =>  @=0x0236)
278
 
279
        mov     #0xF000, r15
280
 
281 102 olivier.gi
        /* -------------- TEST INSTRUCTION WITH SR AS ARGUMENT ------------------- */
282
 
283
        # Addressing mode: SR
284
        #------------------------
285 2 olivier.gi
 
286 102 olivier.gi
        nop
287
        push    r1                 ;# PUSH (r1=0x0234  =>  @=0x0234)
288
        push    r1                 ;# PUSH (r1=0x0232  =>  @=0x0232)
289
        nop
290
 
291
        mov     #0xF100, r15
292
 
293
 
294
        # Addressing mode: @SR
295
        #------------------------
296
 
297
        mov     #0x1234, &0x022E
298
        mov     #0x5678, &0x022C
299
        nop
300
        push    @r1                ;# PUSH (r1=0x0230  =>  @=0x0230) -> do nothing
301
        push    @r1                ;# PUSH (r1=0x022E  =>  @=0x022E) -> do nothing
302
        nop
303
 
304
        mov     #0xF200, r15
305
 
306
 
307
        # Addressing mode: @SR+
308
        #------------------------
309
 
310
        mov     #0x0000, &0x022A
311
        mov     #0x0000, &0x0228
312
        nop
313
        push    @r1+               ;# PUSH (r1=0x022C  =>  @=0x022C) -> do nothing
314
        push    @r1+               ;# PUSH (r1=0x022C  =>  @=0x022C) -> do nothing
315
        nop
316
 
317
        mov     #0xF300, r15
318
 
319
 
320
        # Addressing mode: x(SR)
321
        #------------------------
322
 
323
        nop
324
        push    12(r1)              ;# PUSH (r1=0x022C+12  =>  @=0x022C)
325
        push    12(r1)              ;# PUSH (r1=0x022A+12  =>  @=0x022A)
326
        nop
327
 
328
        mov     #0xF400, r15
329
 
330
        /* -------------- TEST POP INSTRUCTION WITH SR AS ARGUMENT ------------------- */
331
 
332
        # Addressing mode: x(SR)
333
        #------------------------
334
 
335
        nop
336
        pop     8(r1)              ;# POP (r1=0x022A  =>  @=0x022A+8)
337
        pop     8(r1)              ;# POP (r1=0x022C  =>  @=0x022C+8)
338
        nop
339
 
340
        mov     #0xF500, r15
341
 
342
 
343
        # Addressing mode: SR
344
        #------------------------
345
 
346
        nop
347
        pop     r1                 ;# POP (r1=@0x022E)
348
        nop
349
 
350
        mov     #0xF600, r15
351
 
352
 
353 2 olivier.gi
        /* ----------------------         END OF TEST        --------------- */
354
end_of_test:
355
        nop
356
        br #0xffff
357
 
358
 
359
 
360
        /* ----------------------         INTERRUPT VECTORS  --------------- */
361
 
362
.section .vectors, "a"
363
.word end_of_test  ; Interrupt  0 (lowest priority)    
364
.word end_of_test  ; Interrupt  1                      
365
.word end_of_test  ; Interrupt  2                      
366
.word end_of_test  ; Interrupt  3                      
367
.word end_of_test  ; Interrupt  4                      
368
.word end_of_test  ; Interrupt  5                      
369
.word end_of_test  ; Interrupt  6                      
370
.word end_of_test  ; Interrupt  7                      
371
.word end_of_test  ; Interrupt  8                      
372
.word end_of_test  ; Interrupt  9                      
373
.word end_of_test  ; Interrupt 10                      Watchdog timer
374
.word end_of_test  ; Interrupt 11                      
375
.word end_of_test  ; Interrupt 12                      
376
.word end_of_test  ; Interrupt 13                      
377
.word end_of_test  ; Interrupt 14                      NMI
378
.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.