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 122

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