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 200

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