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 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: 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: 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
        /* -------------- TEST INSTRUCTION IN WORD MODE ------------------- */
43
 
44
 
45
        # Addressing mode: Rn
46
        #------------------------
47
 
48
        mov     #0x0102, r2        ;# Test 1
49
        mov     #0x7524, r4
50
        swpb         r4            ;# SWPB (r4=0x7524  =>  r4=0x2475)
51
        mov          r2, r5
52
 
53
        mov     #0x0005, r2        ;# Test 2
54
        mov     #0x1cb6, r6
55
        swpb         r6            ;# SWPB (r6=0x1cb6  =>  r6=0xb61c)
56
        mov          r2, r7
57
 
58
        mov     #0x1000, r15
59
 
60
 
61
        # Addressing mode: @Rn
62
        #------------------------
63
 
64
        mov     #0x0102, r2        ;# Test 1
65 111 olivier.gi
        mov     #0x7524, &DMEM_200
66
        mov   #DMEM_200, r4
67
        mov     #0xaaaa, &DMEM_202
68 2 olivier.gi
        swpb        @r4            ;# SWPB (mem00=0x7524  => {mem00=0x2475)
69
        mov          r2, r5
70
 
71
        mov     #0x0005, r2        ;# Test 2
72 111 olivier.gi
        mov     #0x1cb6, &DMEM_202
73
        mov   #DMEM_202, r6
74
        mov     #0xaaaa, &DMEM_204
75 2 olivier.gi
        swpb        @r6            ;# SWPB (mem01=0x1cb6  => {mem01=0xb61c)
76
        mov          r2, r7
77
 
78
        mov     #0x2000, r15
79
 
80
 
81
        # Addressing mode: @Rn+
82
        #------------------------
83
 
84
        mov     #0x0102, r2        ;# Test 1
85 111 olivier.gi
        mov     #0x7524, &DMEM_208
86
        mov   #DMEM_208, r4
87
        mov     #0xaaaa, &DMEM_20A
88 2 olivier.gi
        swpb       @r4+            ;# SWPB (mem04=0x7524  => {mem04=0x2475)
89
        mov          r2, r5
90
 
91
        mov     #0x0005, r2        ;# Test 2
92 111 olivier.gi
        mov     #0x1cb6, &DMEM_20A
93
        mov   #DMEM_20A, r6
94
        mov     #0xaaaa, &DMEM_20C
95 2 olivier.gi
        swpb       @r6+            ;# SWPB (mem05=0x1cb6  => {mem05=0xb61c)
96
        mov          r2, r7
97
 
98
        mov     #0x3000, r15
99
 
100
 
101
        # Addressing mode: X(Rn)
102
        #------------------------
103
 
104
        mov     #0x0102, r2        ;# Test 1
105 111 olivier.gi
        mov     #0x7524, &DMEM_210
106
        mov   #DMEM_200, r4
107
        mov     #0xaaaa, &DMEM_212
108 2 olivier.gi
        swpb      16(r4)            ;# SWPB (mem08=0x7524  => {mem08=0x2475)
109
        mov          r2, r5
110
 
111
        mov     #0x0005, r2        ;# Test 2
112 111 olivier.gi
        mov     #0x1cb6, &DMEM_212
113
        mov   #DMEM_200, r6
114
        mov     #0xaaaa, &DMEM_214
115 2 olivier.gi
        swpb      18(r6)            ;# SWPB (mem09=0x1cb6  => {mem09=0xb61c)
116
        mov          r2, r7
117
 
118
        mov     #0x4000, r15
119
 
120
 
121
        # Addressing mode: EDE
122
        #------------------------
123 200 olivier.gi
.set   EDE_218,  DMEM_218+PMEM_EDE_LENGTH
124
.set   EDE_21A,  DMEM_21A+PMEM_EDE_LENGTH
125
.set   EDE_21C,  DMEM_21C+PMEM_EDE_LENGTH
126
.set   EDE_21E,  DMEM_21E+PMEM_EDE_LENGTH
127 2 olivier.gi
 
128
        mov     #0x0102, r2        ;# Test 1
129 111 olivier.gi
        mov     #0x7524, &DMEM_218
130
        mov     #0xaaaa, &DMEM_21A
131 200 olivier.gi
        swpb    EDE_218            ;# SWPB (mem0c=0x7524  => {mem0c=0x2475)
132 2 olivier.gi
        mov          r2, r5
133
 
134
        mov     #0x0005, r2        ;# Test 2
135 111 olivier.gi
        mov     #0x1cb6, &DMEM_21A
136
        mov     #0xaaaa, &DMEM_21C
137 200 olivier.gi
        swpb    EDE_21A            ;# SWPB (mem0d=0x1cb6  => {mem0d=0xb61c)
138 2 olivier.gi
        mov          r2, r7
139
 
140
        mov     #0x5000, r15
141
 
142
 
143
        # Addressing mode: &EDE
144
        #------------------------
145 111 olivier.gi
.set   aEDE_220,  DMEM_220
146
.set   aEDE_222,  DMEM_222
147
.set   aEDE_224,  DMEM_224
148
.set   aEDE_226,  DMEM_226
149 2 olivier.gi
 
150
        mov     #0x0102, r2        ;# Test 1
151 111 olivier.gi
        mov     #0x7524, &DMEM_220
152
        mov     #0xaaaa, &DMEM_222
153 2 olivier.gi
        swpb  &aEDE_220            ;# SWPB (mem10=0x7524  => {mem10=0x2475)
154
        mov          r2, r5
155
 
156
        mov     #0x0005, r2        ;# Test 2
157 111 olivier.gi
        mov     #0x1cb6, &DMEM_222
158
        mov     #0xaaaa, &DMEM_224
159 2 olivier.gi
        swpb  &aEDE_222            ;# SWPB (mem11=0x1cb6  => {mem11=0xb61c)
160
        mov          r2, r7
161
 
162
        mov     #0x6000, r15
163
 
164
 
165
        /* ----------------------         END OF TEST        --------------- */
166
end_of_test:
167
        nop
168
        br #0xffff
169
 
170
 
171
        /* ----------------------         INTERRUPT VECTORS  --------------- */
172
 
173
.section .vectors, "a"
174
.word end_of_test  ; Interrupt  0 (lowest priority)    
175
.word end_of_test  ; Interrupt  1                      
176
.word end_of_test  ; Interrupt  2                      
177
.word end_of_test  ; Interrupt  3                      
178
.word end_of_test  ; Interrupt  4                      
179
.word end_of_test  ; Interrupt  5                      
180
.word end_of_test  ; Interrupt  6                      
181
.word end_of_test  ; Interrupt  7                      
182
.word end_of_test  ; Interrupt  8                      
183
.word end_of_test  ; Interrupt  9                      
184
.word end_of_test  ; Interrupt 10                      Watchdog timer
185
.word end_of_test  ; Interrupt 11                      
186
.word end_of_test  ; Interrupt 12                      
187
.word end_of_test  ; Interrupt 13                      
188
.word end_of_test  ; Interrupt 14                      NMI
189
.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.