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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [ldm1.S] - Blame information for rev 6

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 csantifort
/*****************************************************************
2
//                                                              //
3
//  Amber 2 Core Instruction Test                               //
4
//                                                              //
5
//  This file is part of the Amber project                      //
6
//  http://www.opencores.org/project,amber                      //
7
//                                                              //
8
//  Description                                                 //
9
//  Tests the standard form of ldm.                             //
10
//                                                              //
11
//  Author(s):                                                  //
12
//      - Conor Santifort, csantifort.amber@gmail.com           //
13
//                                                              //
14
//////////////////////////////////////////////////////////////////
15
//                                                              //
16
// Copyright (C) 2010 Authors and OPENCORES.ORG                 //
17
//                                                              //
18
// This source file may be used and distributed without         //
19
// restriction provided that this copyright statement is not    //
20
// removed from the file and that any derivative work contains  //
21
// the original copyright notice and the associated disclaimer. //
22
//                                                              //
23
// This source file is free software; you can redistribute it   //
24
// and/or modify it under the terms of the GNU Lesser General   //
25
// Public License as published by the Free Software Foundation; //
26
// either version 2.1 of the License, or (at your option) any   //
27
// later version.                                               //
28
//                                                              //
29
// This source is distributed in the hope that it will be       //
30
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
31
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
32
// PURPOSE.  See the GNU Lesser General Public License for more //
33
// details.                                                     //
34
//                                                              //
35
// You should have received a copy of the GNU Lesser General    //
36
// Public License along with this source; if not, download it   //
37
// from http://www.opencores.org/lgpl.shtml                     //
38
//                                                              //
39
*****************************************************************/
40
 
41
#include "amber_registers.h"
42
 
43
        .section .text
44
        .globl  main
45
main:
46
 
47
@ ------------------------------------------
48
@ 1. ldmda   r14!, {r0-r12}
49
@ ------------------------------------------
50
 
51
        ldr     r14, StaticEnd
52
        ldmda   r14!, {r0-r12}
53
 
54
        @ check that the base register, r14 was correctly updated
55
        ldr     r13, StaticEnd
56
        sub     r13, r13, #52 @ 13 x 4
57
        cmp     r13, r14
58
        movne   r10, #10
59
        bne     testfail
60
 
61
        @check the values loaded into r0 to r12
62
        @r0
63
        mov     r13, #0x05
64
        cmp     r13, r0
65
        movne   r10, #20
66
        bne     testfail
67
        @r1
68
        mov     r13, #0x06
69
        cmp     r13, r1
70
        movne   r10, #30
71
        bne     testfail
72
        @r2
73
        mov     r13, #0x07
74
        cmp     r13, r2
75
        movne   r10, #40
76
        bne     testfail
77
        @r3
78
        mov     r13, #0x08
79
        cmp     r13, r3
80
        movne   r10, #50
81
        bne     testfail
82
        @r4
83
        mov     r13, #0x09
84
        cmp     r13, r4
85
        movne   r10, #60
86
        bne     testfail
87
        @r5
88
        mov     r13, #0x0a
89
        cmp     r13, r5
90
        movne   r10, #70
91
        bne     testfail
92
        @r6
93
        mov     r13, #0x0b
94
        cmp     r13, r6
95
        movne   r10, #80
96
        bne     testfail
97
        @r7
98
        mov     r13, #0x0c
99
        cmp     r13, r7
100
        movne   r10, #90
101
        bne     testfail
102
        @r8
103
        mov     r13, #0x0d
104
        cmp     r13, r8
105
        movne   r10, #100
106
        bne     testfail
107
        @r9
108
        mov     r13, #0x0e
109
        cmp     r13, r9
110
        movne   r10, #110
111
        bne     testfail
112
        @r10
113
        mov     r13, #0x0f
114
        cmp     r13, r10
115
        movne   r10, #120
116
        bne     testfail
117
        @r11
118
        mov     r13, #0x10
119
        cmp     r13, r11
120
        movne   r10, #130
121
        bne     testfail
122
        @r12
123
        mov     r13, #0x11
124
        cmp     r13, r12
125
        movne   r10, #140
126
        bne     testfail
127
 
128
 
129
@ ------------------------------------------
130
@ 2. ldmia   r0, {pc}
131
@ Test loading the pc
132
@ ------------------------------------------
133
 
134
        ldr     r0, StoreBase
135
        ldr     r1, =jump2
136
        str     r1, [r0]
137
        ldmia   r0, {pc}    @ causes a jump to 'jump2'
138
 
139
        @ these should never be executed
140
        b       testfail
141
        b       testfail
142
        b       testfail
143
        b       testfail
144
 
145
jump2:  b       start3
146
 
147
 
148
@ ------------------------------------------
149
@ 2. ldmia   r0, {r5, pc}
150
@ Test loading the pc, as part of a group
151
@ ------------------------------------------
152
 
153
start3:
154
        ldr     r0, StoreBase
155
        mov     r1, #17
156
        str     r1, [r0], #4
157
        ldr     r1, =jump3
158
        str     r1, [r0]
159
 
160
        ldr     r0, StoreBase
161
        ldmia   r0, {r5, pc}    @ causes a jump to 'jump2'
162
 
163
        @ these should never be executed
164
        b       testfail
165
        b       testfail
166
        b       testfail
167
        b       testfail
168
 
169
        @ Check that r5 was loaded with the correct value
170
jump3:  mov     r7, #17
171
        cmp     r5, r7
172
        movne   r10, #200
173
        bne     testfail
174
 
175
 
176
@ ------------------------------------------
177
@ ------------------------------------------
178
 
179
        b       testpass
180
 
181
 
182
testfail:
183
        ldr     r11, AdrTestStatus
184
        str     r10, [r11]
185
        b       testfail
186
 
187
testpass:
188
        ldr     r11, AdrTestStatus
189
        mov     r10, #17
190
        str     r10, [r11]
191
        b       testpass
192
 
193
 
194
/* Write 17 to this address to generate a Test Passed message */
195
AdrTestStatus:  .word  ADR_AMBER_TEST_STATUS
196
StoreBase:      .word  0x800
197
StaticBase:     .word  Data1
198
StaticEnd:      .word  Data18
199
 
200
Data1:          .word  0x00
201
                .word  0x01
202
                .word  0x02
203
                .word  0x03
204
                .word  0x04
205
                .word  0x05
206
                .word  0x06
207
                .word  0x07
208
                .word  0x08
209
                .word  0x09
210
                .word  0x0a
211
                .word  0x0b
212
                .word  0x0c
213
                .word  0x0d
214
                .word  0x0e
215
                .word  0x0f
216
                .word  0x10
217
Data18:         .word  0x11
218
 
219
/* ========================================================================= */
220
/* ========================================================================= */
221
 
222
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.