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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [cache/] [cache-asm.S] - Blame information for rev 593

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

Line No. Rev Author Line
1 90 jeremybenn
/* cache_asm.S. Machine code support for cache test of Or1ksim
2
 
3
   Copyright (C) 1999-2006 OpenCores
4
   Copyright (C) 2010 Embecosm Limited
5
 
6
   Contributors various OpenCores participants
7
   Contributor Jeremy Bennett 
8
 
9
   This file is part of OpenRISC 1000 Architectural Simulator.
10
 
11
   This program is free software; you can redistribute it and/or modify it
12
   under the terms of the GNU General Public License as published by the Free
13
   Software Foundation; either version 3 of the License, or (at your option)
14
   any later version.
15
 
16
   This program is distributed in the hope that it will be useful, but WITHOUT
17
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
19
   more details.
20
 
21
   You should have received a copy of the GNU General Public License along
22
   with this program.  If not, see .  */
23
 
24
/* ----------------------------------------------------------------------------
25
   This code is commented throughout for use with Doxygen.
26
   --------------------------------------------------------------------------*/
27
 
28
#include "spr-defs.h"
29
#include "board.h"
30
 
31
#define IC_ENABLE 0
32
#define DC_ENABLE 0
33
 
34 346 jeremybenn
        .extern main
35 90 jeremybenn
 
36 346 jeremybenn
        .global ic_enable
37
        .global ic_disable
38
        .global dc_enable
39
        .global dc_disable
40
        .global dc_inv
41
        .global ic_inv_test
42
        .global dc_inv_test
43 90 jeremybenn
 
44
        .section .stack
45
        .space 0x1000
46 346 jeremybenn
stack:
47 90 jeremybenn
 
48
        .section .reset, "ax"
49
 
50
        .org    0x100
51 346 jeremybenn
reset_vector:
52 90 jeremybenn
        l.addi  r2,r0,0x0
53
        l.addi  r3,r0,0x0
54
        l.addi  r4,r0,0x0
55
        l.addi  r5,r0,0x0
56
        l.addi  r6,r0,0x0
57
        l.addi  r7,r0,0x0
58
        l.addi  r8,r0,0x0
59
        l.addi  r9,r0,0x0
60
        l.addi  r10,r0,0x0
61
        l.addi  r11,r0,0x0
62
        l.addi  r12,r0,0x0
63
        l.addi  r13,r0,0x0
64
        l.addi  r14,r0,0x0
65
        l.addi  r15,r0,0x0
66
        l.addi  r16,r0,0x0
67
        l.addi  r17,r0,0x0
68
        l.addi  r18,r0,0x0
69
        l.addi  r19,r0,0x0
70
        l.addi  r20,r0,0x0
71
        l.addi  r21,r0,0x0
72
        l.addi  r22,r0,0x0
73
        l.addi  r23,r0,0x0
74
        l.addi  r24,r0,0x0
75
        l.addi  r25,r0,0x0
76
        l.addi  r26,r0,0x0
77
        l.addi  r27,r0,0x0
78
        l.addi  r28,r0,0x0
79
        l.addi  r29,r0,0x0
80
        l.addi  r30,r0,0x0
81
        l.addi  r31,r0,0x0
82
 
83
        l.movhi r3,hi(start)
84
        l.ori   r3,r3,lo(start)
85
        l.jr    r3
86
        l.nop
87
start:
88
 
89 346 jeremybenn
        l.movhi r1,hi(stack)
90
        l.ori   r1,r1,lo(stack)
91 458 julius
        l.ori   r2,r1, 0
92
 
93
        l.movhi r3,hi(main)
94
        l.ori   r3,r3,lo(main)
95
        l.jr    r3
96 90 jeremybenn
        l.nop
97
 
98
        .section .text
99
 
100 346 jeremybenn
ic_enable:
101 90 jeremybenn
        /* Disable IC */
102
        l.mfspr r13,r0,SPR_SR
103
        l.addi  r11,r0,-1
104
        l.xori  r11,r11,SPR_SR_ICE
105
        l.and   r11,r13,r11
106
        l.mtspr r0,r11,SPR_SR
107
 
108
        /* Invalidate IC */
109
        l.addi  r13,r0,0
110
        l.addi  r11,r0,8192
111
1:
112
        l.mtspr r0,r13,SPR_ICBIR
113
        l.sfne  r13,r11
114
        l.bf    1b
115
        l.addi  r13,r13,16
116
 
117
        /* Enable IC */
118
        l.mfspr r13,r0,SPR_SR
119
        l.ori   r13,r13,SPR_SR_ICE
120
        l.mtspr r0,r13,SPR_SR
121
        l.nop
122
        l.nop
123
        l.nop
124
        l.nop
125
        l.nop
126
 
127
        l.jr    r9
128
        l.nop
129
 
130 346 jeremybenn
ic_disable:
131 90 jeremybenn
        /* Disable IC */
132
        l.mfspr r13,r0,SPR_SR
133
        l.addi  r11,r0,-1
134
        l.xori  r11,r11,SPR_SR_ICE
135
        l.and   r11,r13,r11
136
        l.mtspr r0,r11,SPR_SR
137
 
138
        l.jr    r9
139
        l.nop
140
 
141 346 jeremybenn
dc_enable:
142 90 jeremybenn
        /* Disable DC */
143
        l.mfspr r13,r0,SPR_SR
144
        l.addi  r11,r0,-1
145
        l.xori  r11,r11,SPR_SR_DCE
146
        l.and   r11,r13,r11
147
        l.mtspr r0,r11,SPR_SR
148
 
149
        /* Flush DC */
150
        l.addi  r13,r0,0
151
        l.addi  r11,r0,8192
152
1:
153
        l.mtspr r0,r13,SPR_DCBIR
154
        l.sfne  r13,r11
155
        l.bf    1b
156
        l.addi  r13,r13,16
157
 
158
        /* Enable DC */
159
        l.mfspr r13,r0,SPR_SR
160
        l.ori   r13,r13,SPR_SR_DCE
161
        l.mtspr r0,r13,SPR_SR
162
 
163
        l.jr    r9
164
        l.nop
165
 
166 346 jeremybenn
dc_disable:
167 90 jeremybenn
        /* Disable DC */
168
        l.mfspr r13,r0,SPR_SR
169
        l.addi  r11,r0,-1
170
        l.xori  r11,r11,SPR_SR_DCE
171
        l.and   r11,r13,r11
172
        l.mtspr r0,r11,SPR_SR
173
 
174
        l.jr    r9
175
        l.nop
176
 
177 346 jeremybenn
dc_inv:
178 90 jeremybenn
        l.mfspr r4,r0,SPR_SR
179
        l.addi  r5,r0,-1
180
        l.xori  r5,r5,SPR_SR_DCE
181
        l.and   r5,r4,r5
182
        l.mtspr r0,r5,SPR_SR
183
        l.mtspr r0,r3,SPR_DCBIR
184
        l.mtspr r0,r4,SPR_SR
185
        l.jr    r9
186
        l.nop
187
 
188
        .align  0x10
189 346 jeremybenn
ic_inv_test:
190
        l.movhi r7,hi(ic_test_1)
191
        l.ori   r7,r7,lo(ic_test_1)
192 90 jeremybenn
        l.addi  r3,r0,0
193
        l.addi  r4,r0,0
194
        l.addi  r5,r0,0
195
        l.nop
196
        l.nop
197
        l.nop
198
 
199 346 jeremybenn
ic_test_1:
200 90 jeremybenn
3:      l.addi  r3,r3,1
201
 
202
        l.sfeqi r4,0x01
203
        l.bnf   1f
204
        l.nop
205
 
206
        l.mfspr r8,r0,SPR_SR
207
        l.addi  r11,r0,-1
208
        l.xori  r11,r11,SPR_SR_ICE
209
        l.and   r11,r8,r11
210
        l.mtspr r0,r11,SPR_SR
211
        l.mtspr r0,r7,SPR_ICBIR
212
        l.mtspr r0,r8,SPR_SR
213
        l.bf    2f
214
        l.nop
215
 
216
1:      l.lwz   r6,0(r7)
217
        l.addi  r6,r6,1
218
        l.sw    0(r7),r6
219
 
220
2:      l.addi  r5,r5,1
221
        l.sfeqi r5,10
222
        l.bnf   3b
223
        l.xori  r4,r4,0x01
224
 
225
        l.addi  r11,r3,0
226
        l.jr    r9
227
        l.nop
228
 
229 346 jeremybenn
dc_inv_test:
230 90 jeremybenn
        l.movhi r4,hi(0x08040201)
231
        l.ori   r4,r4,lo(0x08040201)
232
        l.sw    0x00(r3),r4
233
        l.slli  r4,r4,1
234
        l.sw    0x14(r3),r4
235
        l.slli  r4,r4,1
236
        l.sw    0x28(r3),r4
237
 
238
        l.addi  r8,r9,0
239 346 jeremybenn
        l.jal   dc_enable
240 90 jeremybenn
        l.nop
241
        l.addi  r9,r8,0
242
 
243
        l.lbz   r4,0x03(r3)
244
        l.lhz   r5,0x16(r3)
245
        l.add   r4,r4,r5
246
        l.lwz   r5,0x28(r3)
247
        l.add   r4,r4,r5
248
 
249
        l.mfspr r6,r0,SPR_SR
250
        l.addi  r5,r0,-1
251
        l.xori  r5,r5,SPR_SR_DCE
252
        l.and   r5,r6,r5
253
        l.mtspr r0,r5,SPR_SR
254
        l.addi  r7,r3,0x10
255
        l.mtspr r0,r7,SPR_DCBIR
256
 
257
        l.lwz   r5,0(r3)
258
        l.slli  r5,r5,3
259
        l.sw    0x00(r3),r5
260
        l.slli  r5,r5,1
261
        l.sw    0x14(r3),r5
262
        l.slli  r5,r5,1
263
        l.sw    0x28(r3),r5
264
 
265
        l.mtspr r0,r6,SPR_SR
266
 
267
        l.lbz   r5,0x03(r3)
268
        l.add   r4,r4,r5
269
        l.lhz   r5,0x16(r3)
270
        l.add   r4,r4,r5
271
        l.lwz   r5,0x28(r3)
272
        l.add   r4,r4,r5
273
 
274
        l.addi  r5,r0,-1
275
        l.xori  r5,r5,SPR_SR_DCE
276
        l.and   r5,r6,r5
277
        l.mtspr r0,r5,SPR_SR
278
 
279
        l.addi  r11,r4,0x0
280
1:
281
        l.jr  r9
282
        l.nop

powered by: WebSVN 2.1.0

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