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 219

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