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

Subversion Repositories openmsp430

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

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: SWPB  INSTRUCTION              */
25
/*---------------------------------------------------------------------------*/
26
/* Test the SWPB  instruction.                                               */
27 18 olivier.gi
/*                                                                           */
28
/* Author(s):                                                                */
29
/*             - Olivier Girard,    olgirard@gmail.com                       */
30
/*                                                                           */
31
/*---------------------------------------------------------------------------*/
32 19 olivier.gi
/* $Rev: 19 $                                                                */
33
/* $LastChangedBy: olivier.girard $                                          */
34
/* $LastChangedDate: 2009-08-04 23:47:15 +0200 (Tue, 04 Aug 2009) $          */
35 2 olivier.gi
/*===========================================================================*/
36
 
37
 
38
.global main
39
 
40
main:
41
        /* -------------- TEST INSTRUCTION IN WORD MODE ------------------- */
42
 
43
 
44
        # Addressing mode: Rn
45
        #------------------------
46
 
47
        mov     #0x0102, r2        ;# Test 1
48
        mov     #0x7524, r4
49
        swpb         r4            ;# SWPB (r4=0x7524  =>  r4=0x2475)
50
        mov          r2, r5
51
 
52
        mov     #0x0005, r2        ;# Test 2
53
        mov     #0x1cb6, r6
54
        swpb         r6            ;# SWPB (r6=0x1cb6  =>  r6=0xb61c)
55
        mov          r2, r7
56
 
57
        mov     #0x1000, r15
58
 
59
 
60
        # Addressing mode: @Rn
61
        #------------------------
62
 
63
        mov     #0x0102, r2        ;# Test 1
64
        mov     #0x7524, &0x0200
65
        mov     #0x0200, r4
66
        mov     #0xaaaa, &0x0202
67
        swpb        @r4            ;# SWPB (mem00=0x7524  => {mem00=0x2475)
68
        mov          r2, r5
69
 
70
        mov     #0x0005, r2        ;# Test 2
71
        mov     #0x1cb6, &0x0202
72
        mov     #0x0202, r6
73
        mov     #0xaaaa, &0x0204
74
        swpb        @r6            ;# SWPB (mem01=0x1cb6  => {mem01=0xb61c)
75
        mov          r2, r7
76
 
77
        mov     #0x2000, r15
78
 
79
 
80
        # Addressing mode: @Rn+
81
        #------------------------
82
 
83
        mov     #0x0102, r2        ;# Test 1
84
        mov     #0x7524, &0x0208
85
        mov     #0x0208, r4
86
        mov     #0xaaaa, &0x020A
87
        swpb       @r4+            ;# SWPB (mem04=0x7524  => {mem04=0x2475)
88
        mov          r2, r5
89
 
90
        mov     #0x0005, r2        ;# Test 2
91
        mov     #0x1cb6, &0x020A
92
        mov     #0x020A, r6
93
        mov     #0xaaaa, &0x020C
94
        swpb       @r6+            ;# SWPB (mem05=0x1cb6  => {mem05=0xb61c)
95
        mov          r2, r7
96
 
97
        mov     #0x3000, r15
98
 
99
 
100
        # Addressing mode: X(Rn)
101
        #------------------------
102
 
103
        mov     #0x0102, r2        ;# Test 1
104
        mov     #0x7524, &0x0210
105
        mov     #0x0200, r4
106
        mov     #0xaaaa, &0x0212
107
        swpb      16(r4)            ;# SWPB (mem08=0x7524  => {mem08=0x2475)
108
        mov          r2, r5
109
 
110
        mov     #0x0005, r2        ;# Test 2
111
        mov     #0x1cb6, &0x0212
112
        mov     #0x0200, r6
113
        mov     #0xaaaa, &0x0214
114
        swpb      18(r6)            ;# SWPB (mem09=0x1cb6  => {mem09=0xb61c)
115
        mov          r2, r7
116
 
117
        mov     #0x4000, r15
118
 
119
 
120
        # Addressing mode: EDE
121
        #------------------------
122
.set   EDE_218,  (__data_start+0x0018)
123
.set   EDE_21A,  (__data_start+0x001A)
124
.set   EDE_21C,  (__data_start+0x001C)
125
.set   EDE_21E,  (__data_start+0x001E)
126
 
127
        mov     #0x0102, r2        ;# Test 1
128
        mov     #0x7524, &0x0218
129
        mov     #0xaaaa, &0x021A
130
        swpb    EDE_218            ;# SWPB (mem0c=0x7524  => {mem0c=0x2475)
131
        mov          r2, r5
132
 
133
        mov     #0x0005, r2        ;# Test 2
134
        mov     #0x1cb6, &0x021A
135
        mov     #0xaaaa, &0x021C
136
        swpb    EDE_21A            ;# SWPB (mem0d=0x1cb6  => {mem0d=0xb61c)
137
        mov          r2, r7
138
 
139
        mov     #0x5000, r15
140
 
141
 
142
        # Addressing mode: &EDE
143
        #------------------------
144
.set   aEDE_220,  0x0220
145
.set   aEDE_222,  0x0222
146
.set   aEDE_224,  0x0224
147
.set   aEDE_226,  0x0226
148
 
149
        mov     #0x0102, r2        ;# Test 1
150
        mov     #0x7524, &0x0220
151
        mov     #0xaaaa, &0x0222
152
        swpb  &aEDE_220            ;# SWPB (mem10=0x7524  => {mem10=0x2475)
153
        mov          r2, r5
154
 
155
        mov     #0x0005, r2        ;# Test 2
156
        mov     #0x1cb6, &0x0222
157
        mov     #0xaaaa, &0x0224
158
        swpb  &aEDE_222            ;# SWPB (mem11=0x1cb6  => {mem11=0xb61c)
159
        mov          r2, r7
160
 
161
        mov     #0x6000, r15
162
 
163
 
164
        /* ----------------------         END OF TEST        --------------- */
165
end_of_test:
166
        nop
167
        br #0xffff
168
 
169
 
170
        /* ----------------------         INTERRUPT VECTORS  --------------- */
171
 
172
.section .vectors, "a"
173
.word end_of_test  ; Interrupt  0 (lowest priority)    
174
.word end_of_test  ; Interrupt  1                      
175
.word end_of_test  ; Interrupt  2                      
176
.word end_of_test  ; Interrupt  3                      
177
.word end_of_test  ; Interrupt  4                      
178
.word end_of_test  ; Interrupt  5                      
179
.word end_of_test  ; Interrupt  6                      
180
.word end_of_test  ; Interrupt  7                      
181
.word end_of_test  ; Interrupt  8                      
182
.word end_of_test  ; Interrupt  9                      
183
.word end_of_test  ; Interrupt 10                      Watchdog timer
184
.word end_of_test  ; Interrupt 11                      
185
.word end_of_test  ; Interrupt 12                      
186
.word end_of_test  ; Interrupt 13                      
187
.word end_of_test  ; Interrupt 14                      NMI
188
.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.