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

Subversion Repositories openmsp430

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

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: CALL  INSTRUCTION              */
25
/*---------------------------------------------------------------------------*/
26
/* Test the CALL  instruction.                                               */
27 18 olivier.gi
/*                                                                           */
28
/* Author(s):                                                                */
29
/*             - Olivier Girard,    olgirard@gmail.com                       */
30
/*                                                                           */
31
/*---------------------------------------------------------------------------*/
32 19 olivier.gi
/* $Rev: 128 $                                                                */
33
/* $LastChangedBy: olivier.girard $                                          */
34
/* $LastChangedDate: 2011-12-16 22:05:46 +0100 (Fri, 16 Dec 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_216,  (__data_start+0x16)
41
.set    DMEM_21A,  (__data_start+0x1A)
42
.set    DMEM_21E,  (__data_start+0x1E)
43
.set    DMEM_220,  (__data_start+0x20)
44
.set    DMEM_250,  (__data_start+0x50)
45
.set    DMEM_252,  (__data_start+0x52)
46
.set    DMEM_300,  (__data_start+0x100)
47 2 olivier.gi
 
48
.global main
49
 
50
main:
51 128 olivier.gi
        /* -------------- TEST INSTRUCTION WITH STANDARD REGISTERS AS ARGUMENT ------------------- */
52
 
53 2 olivier.gi
        # Initialization
54
        #------------------------
55
 
56 111 olivier.gi
        mov   #DMEM_252, r1        ;# Initialize stack pointer
57 2 olivier.gi
        mov     #0x0000, r5        ;# Initialize R5
58
 
59
 
60
        mov     #0x1000, r15
61
 
62
 
63
        # Addressing mode: Rn
64
        #------------------------
65
 
66
        mov     #0x0000, r5
67
        mov  #TEST_ROUTINE_RN, r4
68
        mov     #0x5555, &0x0300
69
        call         r4            ;# CALL TEST_ROUTINE_RN
70
 
71
        mov     #0x2000, r15
72
 
73
 
74
        # Addressing mode: @Rn
75
        #------------------------
76
 
77 111 olivier.gi
        mov   #DMEM_212, r4
78 2 olivier.gi
        mov     #0x0000, r5
79 111 olivier.gi
        mov   #TEST_ROUTINE_aRN, &DMEM_212
80
        mov     #0x5555, &DMEM_300
81 2 olivier.gi
        call        @r4           ;# CALL TEST_ROUTINE_aRN
82
 
83
        mov     #0x3000, r15
84
 
85
 
86
        # Addressing mode: @Rn+
87
        #------------------------
88
 
89 111 olivier.gi
        mov     #DMEM_216, r4
90 2 olivier.gi
        mov     #0x0000, r5
91 111 olivier.gi
        mov   #TEST_ROUTINE_aRNi, &DMEM_216
92
        mov     #0x5555, &DMEM_300
93 2 olivier.gi
        call       @r4+           ;# CALL TEST_ROUTINE_aRNi
94
 
95
        mov     #0x4000, r15
96
 
97
 
98
        # Addressing mode: #N
99
        #------------------------
100
 
101
        mov     #0x0000, r5
102 111 olivier.gi
        mov     #0x5555, &DMEM_300
103 2 olivier.gi
        call    #TEST_ROUTINE_N   ;# CALL TEST_ROUTINE_N
104
 
105
        mov     #0x5000, r15
106
 
107
 
108
        # Addressing mode: X(Rn)
109
        #------------------------
110
 
111 111 olivier.gi
        mov     #DMEM_200, r4
112 2 olivier.gi
        mov     #0x0000, r5
113 111 olivier.gi
        mov  #TEST_ROUTINE_xRN, &DMEM_21A
114
        mov     #0x5555, &DMEM_300
115 2 olivier.gi
        call      26(r4)           ;# CALL TEST_ROUTINE_xRN
116
 
117
        mov     #0x6000, r15
118
 
119
 
120
        # Addressing mode: EDE
121
        #------------------------
122 111 olivier.gi
.set   EDE_21E,  DMEM_21E
123 2 olivier.gi
 
124
        mov     #0x0000, r5
125 111 olivier.gi
        mov  #TEST_ROUTINE_EDE, &DMEM_21E
126
        mov     #0x5555, &DMEM_300
127 2 olivier.gi
        call    EDE_21E            ;# CALL TEST_ROUTINE_EDE
128
 
129
        mov     #0x7000, r15
130
 
131
 
132
        # Addressing mode: &EDE
133
        #------------------------
134 111 olivier.gi
.set   aEDE_220,  DMEM_220
135 2 olivier.gi
 
136
        mov     #0x0000, r5
137
        mov  #TEST_ROUTINE_aEDE, &aEDE_220
138 111 olivier.gi
        mov     #0x5555, &DMEM_300
139 2 olivier.gi
        call  &aEDE_220            ;# CALL TEST_ROUTINE_aEDE
140
 
141
        mov     #0x8000, r15
142
 
143
 
144 128 olivier.gi
        /* -------------- TEST INSTRUCTION WITH SR AS ARGUMENT ------------------- */
145
 
146
 
147
        # Addressing mode: SR
148
        #------------------------
149
 
150
        mov #0x0000, r5
151
        nop
152
        #call    r1                 ;# NOT VALID BECAUSE IT JUMPS IN THE DATA MEMORY
153
        nop                         ;# WHICH IS NOT EXECUTABLE
154
 
155
        mov     #0x9000, r15
156
 
157
 
158
        # Addressing mode: @SR
159
        #------------------------
160
 
161
        mov  #DMEM_252, r1        ;# Initialize stack pointer
162
        push #TEST_ROUTINE_RN
163
        push #TEST_ROUTINE_aRN
164
        push #TEST_ROUTINE_aRNi
165
        mov  r1, r13              ; backup stack for later
166
        push #TEST_ROUTINE_N
167
        push #TEST_ROUTINE_xRN
168
        push #TEST_ROUTINE_EDE
169
        push #TEST_ROUTINE_aEDE
170
 
171
        nop
172
        mov     r13, r1
173
        mov #0x0000, r5
174
        nop
175
        call    @r1                ;# CALL #TEST_ROUTINE_N (r5 = 0xabcd)
176
        nop
177
 
178
        mov     #0xa000, r15
179
 
180
 
181
        # Addressing mode: @SR+
182
        #------------------------
183
 
184
        mov  #DMEM_252, r1        ;# Initialize stack pointer
185
        push #TEST_ROUTINE_SPECIAL_aRNi
186
        push #TEST_ROUTINE_RN
187
        push #TEST_ROUTINE_aRN
188
        push #TEST_ROUTINE_aRNi
189
        mov  r1, r13              ; backup stack for later
190
        push #TEST_ROUTINE_N
191
        push #TEST_ROUTINE_xRN
192
        push #TEST_ROUTINE_EDE
193
        push #TEST_ROUTINE_aEDE
194
 
195
        nop
196
        mov     r13, r1
197
        mov #0x0000, r5
198
        nop
199
        call    @r1+               ;# CALL #TEST_ROUTINE_N (this has a funny behavior of nested call backward until SPECIAL_aRNi is reached)
200
        nop
201
 
202
        mov     #0xb000, r15
203
 
204
 
205
        # Addressing mode: x(SR)
206
        #------------------------
207
 
208
        mov  #DMEM_252, r1        ;# Initialize stack pointer
209
        push #TEST_ROUTINE_RN
210
        push #TEST_ROUTINE_aRN
211
        push #TEST_ROUTINE_aRNi
212
        push #TEST_ROUTINE_N
213
        push #TEST_ROUTINE_xRN
214
        push #TEST_ROUTINE_EDE
215
        push #TEST_ROUTINE_aEDE
216
        nop
217
        mov #0x0000, r5
218
        mov #0x0000, r6
219
        mov #0x0000, r7
220
        call   4(r1)            ;# CALL #TEST_ROUTINE_EDE  (r7 = 0x2345)
221
        mov      r5, r7
222
        mov #0x0000, r5
223
        call   6(r1)            ;# CALL #TEST_ROUTINE_xRN  (r6 = 0xef01)
224
        mov      r5, r6
225
        mov #0x0000, r5
226
        call  10(r1)            ;# CALL #TEST_ROUTINE_aRNi (r5 = 0x9abc)
227
        nop
228
 
229
        mov     #0xc000, r15
230
 
231
 
232
 
233 2 olivier.gi
        /* ----------------------         END OF TEST        --------------- */
234
end_of_test:
235
        nop
236
        br #0xffff
237
 
238
 
239
 
240
        /* ----------------------         TEST FUNCTIONS     --------------- */
241
 
242
TEST_ROUTINE_RN:
243
        mov #0x1234, r5
244
        ret
245
 
246
TEST_ROUTINE_aRN:
247
        mov #0x5678, r5
248
        ret
249
 
250
TEST_ROUTINE_aRNi:
251
        mov #0x9abc, r5
252
        ret
253
 
254
TEST_ROUTINE_N:
255
        mov #0xabcd, r5
256
        ret
257
 
258
TEST_ROUTINE_xRN:
259
        mov #0xef01, r5
260
        ret
261
 
262
TEST_ROUTINE_EDE:
263
        mov #0x2345, r5
264
        ret
265
 
266
TEST_ROUTINE_aEDE:
267
        mov #0x6789, r5
268
        ret
269
 
270 128 olivier.gi
TEST_ROUTINE_SPECIAL_aRNi:
271
        mov #0x159a, r5
272
        sub #0x000a, r1
273
        ret
274 2 olivier.gi
 
275
 
276 128 olivier.gi
 
277 2 olivier.gi
        /* ----------------------         INTERRUPT VECTORS  --------------- */
278
 
279
.section .vectors, "a"
280
.word end_of_test  ; Interrupt  0 (lowest priority)    
281
.word end_of_test  ; Interrupt  1                      
282
.word end_of_test  ; Interrupt  2                      
283
.word end_of_test  ; Interrupt  3                      
284
.word end_of_test  ; Interrupt  4                      
285
.word end_of_test  ; Interrupt  5                      
286
.word end_of_test  ; Interrupt  6                      
287
.word end_of_test  ; Interrupt  7                      
288
.word end_of_test  ; Interrupt  8                      
289
.word end_of_test  ; Interrupt  9                      
290
.word end_of_test  ; Interrupt 10                      Watchdog timer
291
.word end_of_test  ; Interrupt 11                      
292
.word end_of_test  ; Interrupt 12                      
293
.word end_of_test  ; Interrupt 13                      
294
.word end_of_test  ; Interrupt 14                      NMI
295
.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.