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 2

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
/*===========================================================================*/
28
 
29
 
30
.global main
31
 
32
main:
33
        /* -------------- TEST INSTRUCTION IN WORD MODE ------------------- */
34
 
35
        # Initialization
36
        #------------------------
37
 
38
        mov     #0x0050, r4        ;# Initialize RAM
39
        mov     #0x0200, r5
40
clear_mem_loop:
41
        clr    0(r5)
42
        incd     r5
43
        dec      r4
44
        jnz     clear_mem_loop
45
 
46
 
47
        mov     #0x0252, r1        ;# Initialize stack pointer
48
 
49
 
50
        mov     #0x1000, r15
51
 
52
 
53
        # Addressing mode: Rn
54
        #------------------------
55
 
56
        mov     #0x7524, r4
57
        mov     #0x5555, &0x0300
58
        push          r4           ;# PUSH (r4=0x7524  =>  @=0x0250)
59
 
60
        mov     #0x1cb6, r6
61
        mov     #0x5555, &0x0300
62
        push          r6           ;# PUSH (r6=0x1cb6  =>  @=0x024E)
63
 
64
        mov     #0x2000, r15
65
 
66
 
67
        # Addressing mode: @Rn
68
        #------------------------
69
 
70
        mov     #0x0212, r4
71
        mov     #0x1234, &0x0212
72
        mov     #0x5555, &0x0300
73
        push        @r4           ;# PUSH (0x1234  =>  @=0x024C)
74
 
75
        mov     #0x0214, r6
76
        mov     #0x5678, &0x0214
77
        mov     #0x5555, &0x0300
78
        push        @r6           ;# PUSH (0x5678  =>  @=0x024A)
79
 
80
        mov     #0x3000, r15
81
 
82
 
83
        # Addressing mode: @Rn+
84
        #------------------------
85
 
86
        mov     #0x0216, r4
87
        mov     #0x9abc, &0x0216
88
        mov     #0x5555, &0x0300
89
        push       @r4+           ;# PUSH (0x9abc  =>  @=0x0248)
90
 
91
        mov     #0xdef0, &0x0218
92
        mov     #0x5555, &0x0300
93
        push       @r4+           ;# PUSH (0xdef0  =>  @=0x0246)
94
 
95
        mov     #0x4000, r15
96
 
97
 
98
        # Addressing mode: X(Rn)
99
        #------------------------
100
 
101
        mov     #0x0200, r4
102
        mov     #0x0fed, &0x021A
103
        mov     #0x5555, &0x0300
104
        push      26(r4)           ;# PUSH (0x0fed  =>  @=0x0244)
105
 
106
        mov     #0xcba9, &0x021C
107
        mov     #0x5555, &0x0300
108
        push      28(r4)           ;# PUSH (0xcba9  =>  @=0x0242)
109
 
110
        mov     #0x5000, r15
111
 
112
 
113
        # Addressing mode: EDE
114
        #------------------------
115
.set   EDE_21E,  (__data_start+0x001E)
116
.set   EDE_220,  (__data_start+0x0020)
117
 
118
        mov     #0x0200, r4
119
        mov     #0x8765, &0x021E
120
        mov     #0x5555, &0x0300
121
        push    EDE_21E            ;# PUSH (0x8765  =>  @=0x0240)
122
 
123
        mov     #0x4321, &0x0220
124
        mov     #0x5555, &0x0300
125
        push    EDE_220            ;# PUSH (0x4321  =>  @=0x023E)
126
 
127
        mov     #0x6000, r15
128
 
129
 
130
        # Addressing mode: &EDE
131
        #------------------------
132
.set   aEDE_222,  0x0222
133
.set   aEDE_224,  0x0224
134
 
135
        mov     #0x0200, r4
136
        mov     #0x1f2e, &0x0222
137
        mov     #0x5555, &0x0300
138
        push  &aEDE_222            ;# PUSH (0x1f2e  =>  @=0x023C)
139
 
140
        mov     #0x3d4c, &0x0224
141
        mov     #0x5555, &0x0300
142
        push  &aEDE_224            ;# PUSH (0x3d4c  =>  @=0x023A)
143
 
144
        mov     #0x7000, r15
145
 
146
 
147
        # Addressing mode: #N
148
        #------------------------
149
 
150
        mov     #0x5555, &0x0300
151
        push    #0x71c8            ;# PUSH (0x71c8  =>  @=0x0238)
152
 
153
        mov     #0x5555, &0x0300
154
        push    #0x178c            ;# PUSH (0x178c  =>  @=0x0236)
155
 
156
        mov     #0x7001, r15
157
 
158
 
159
        /* -------------- TEST INSTRUCTION IN BYTE MODE ------------------- */
160
 
161
        # Initialization
162
        #------------------------
163
 
164
        mov     #0x0252, r1        ;# Initialize stack pointer
165
 
166
        mov     #0x8000, r15
167
 
168
 
169
        # Addressing mode: Rn
170
        #------------------------
171
 
172
        mov     #0x1fe2, r4
173
        mov     #0x5555, &0x0300
174
        push.b        r4           ;# PUSH (r4=0xe2  =>  @=0x0250)
175
 
176
        mov     #0x3dc4, r6
177
        mov     #0x5555, &0x0300
178
        push.b        r6           ;# PUSH (r6=0xc4  =>  @=0x024E)
179
 
180
        mov     #0x9000, r15
181
 
182
 
183
        # Addressing mode: @Rn
184
        #------------------------
185
 
186
        mov     #0x0212, r4
187
        mov     #0x5ba6, &0x0212
188
        mov     #0x5555, &0x0300
189
        push.b      @r4           ;# PUSH (0xa6    =>  @=0x024C)
190
 
191
        mov     #0x0215, r6
192
        mov     #0x7988, &0x0214
193
        mov     #0x5555, &0x0300
194
        push.b      @r6           ;# PUSH (0x79    =>  @=0x024A)
195
 
196
        mov     #0xA000, r15
197
 
198
 
199
        # Addressing mode: @Rn+
200
        #------------------------
201
 
202
        mov     #0x0216, r4
203
        mov     #0x976a, &0x0216
204
        mov     #0x5555, &0x0300
205
        push.b     @r4+           ;# PUSH (0x6a  =>  @=0x0248)
206
 
207
        mov     #0x5555, &0x0300
208
        push.b     @r4+           ;# PUSH (0x97  =>  @=0x0246)
209
 
210
        mov     #0xB000, r15
211
 
212
 
213
        # Addressing mode: X(Rn)
214
        #------------------------
215
 
216
        mov     #0x0200, r4
217
        mov     #0xb54c, &0x021A
218
        mov     #0x5555, &0x0300
219
        push.b    26(r4)           ;# PUSH (0x4c  =>  @=0x0244)
220
 
221
        mov     #0xc32d, &0x021C
222
        mov     #0x5555, &0x0300
223
        push.b    29(r4)           ;# PUSH (0xc3  =>  @=0x0242)
224
 
225
        mov     #0xC000, r15
226
 
227
 
228
        # Addressing mode: EDE
229
        #------------------------
230
.set   EDE_B_21E,  (__data_start+0x001E)
231
.set   EDE_B_221,  (__data_start+0x0021)
232
 
233
        mov     #0x0200, r4
234
        mov     #0xd10e, &0x021E
235
        mov     #0x5555, &0x0300
236
        push.b  EDE_B_21E          ;# PUSH (0x0e  =>  @=0x0240)
237
 
238
        mov     #0xfed0, &0x0220
239
        mov     #0x5555, &0x0300
240
        push.b  EDE_B_221          ;# PUSH (0xfe  =>  @=0x023E)
241
 
242
        mov     #0xD000, r15
243
 
244
 
245
        # Addressing mode: &EDE
246
        #------------------------
247
.set   aEDE_B_222,  0x0222
248
.set   aEDE_B_225,  0x0225
249
 
250
        mov     #0x0200, r4
251
        mov     #0x1bc2, &0x0222
252
        mov     #0x5555, &0x0300
253
        push.b &aEDE_B_222         ;# PUSH (0xc2  =>  @=0x023C)
254
 
255
        mov     #0x3ba4, &0x0224
256
        mov     #0x5555, &0x0300
257
        push.b &aEDE_B_225         ;# PUSH (0x3b  =>  @=0x023A)
258
 
259
        mov     #0xE000, r15
260
 
261
 
262
        # Addressing mode: #N
263
        #------------------------
264
 
265
        mov     #0x5555, &0x0300
266
        push.b  #0x82d9            ;# PUSH (0xd9  =>  @=0x0238)
267
 
268
        mov     #0x5555, &0x0300
269
        push.b  #0x288d            ;# PUSH (0x8d  =>  @=0x0236)
270
 
271
        mov     #0xF000, r15
272
 
273
 
274
        /* ----------------------         END OF TEST        --------------- */
275
end_of_test:
276
        nop
277
        br #0xffff
278
 
279
 
280
 
281
        /* ----------------------         INTERRUPT VECTORS  --------------- */
282
 
283
.section .vectors, "a"
284
.word end_of_test  ; Interrupt  0 (lowest priority)    
285
.word end_of_test  ; Interrupt  1                      
286
.word end_of_test  ; Interrupt  2                      
287
.word end_of_test  ; Interrupt  3                      
288
.word end_of_test  ; Interrupt  4                      
289
.word end_of_test  ; Interrupt  5                      
290
.word end_of_test  ; Interrupt  6                      
291
.word end_of_test  ; Interrupt  7                      
292
.word end_of_test  ; Interrupt  8                      
293
.word end_of_test  ; Interrupt  9                      
294
.word end_of_test  ; Interrupt 10                      Watchdog timer
295
.word end_of_test  ; Interrupt 11                      
296
.word end_of_test  ; Interrupt 12                      
297
.word end_of_test  ; Interrupt 13                      
298
.word end_of_test  ; Interrupt 14                      NMI
299
.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.