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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [testbench/] [cache_asm.S] - Blame information for rev 621

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

Line No. Rev Author Line
1 621 simons
#include "spr_defs.h"
2
 
3
#define IC_ENABLE 0
4
#define DC_ENABLE 0
5
 
6
        .global _ic_enable
7
        .global _ic_disable
8
        .global _dc_enable
9
        .global _dc_disable
10
        .global _dc_inv
11
        .global _ic_inv_test
12
        .global _dc_inv_test
13
 
14
_ic_enable:
15
        /* Disable IC */
16
        l.mfspr r13,r0,SPR_SR
17
        l.addi  r11,r0,-1
18
        l.xori  r11,r11,SPR_SR_ICE
19
        l.and   r11,r13,r11
20
        l.mtspr r0,r11,SPR_SR
21
 
22
        /* Invalidate IC */
23
        l.addi  r13,r0,0
24
        l.addi  r11,r0,8192
25
1:
26
        l.mtspr r0,r13,SPR_ICBIR
27
        l.sfne  r13,r11
28
        l.bf    1b
29
        l.addi  r13,r13,16
30
 
31
        /* Enable IC */
32
        l.mfspr r13,r0,SPR_SR
33
        l.ori   r13,r13,SPR_SR_ICE
34
        l.mtspr r0,r13,SPR_SR
35
        l.nop
36
        l.nop
37
        l.nop
38
        l.nop
39
        l.nop
40
 
41
        l.jr    r9
42
        l.nop
43
 
44
_ic_disable:
45
        /* Disable IC */
46
        l.mfspr r13,r0,SPR_SR
47
        l.addi  r11,r0,-1
48
        l.xori  r11,r11,SPR_SR_ICE
49
        l.and   r11,r13,r11
50
        l.mtspr r0,r11,SPR_SR
51
 
52
        l.jr    r9
53
        l.nop
54
 
55
_dc_enable:
56
        /* Disable DC */
57
        l.mfspr r13,r0,SPR_SR
58
        l.addi  r11,r0,-1
59
        l.xori  r11,r11,SPR_SR_DCE
60
        l.and   r11,r13,r11
61
        l.mtspr r0,r11,SPR_SR
62
 
63
        /* Flush DC */
64
        l.addi  r13,r0,0
65
        l.addi  r11,r0,8192
66
1:
67
        l.mtspr r0,r13,SPR_DCBIR
68
        l.sfne  r13,r11
69
        l.bf    1b
70
        l.addi  r13,r13,16
71
 
72
        /* Enable DC */
73
        l.mfspr r13,r0,SPR_SR
74
        l.ori   r13,r13,SPR_SR_DCE
75
        l.mtspr r0,r13,SPR_SR
76
 
77
        l.jr    r9
78
        l.nop
79
 
80
_dc_disable:
81
        /* Disable DC */
82
        l.mfspr r13,r0,SPR_SR
83
        l.addi  r11,r0,-1
84
        l.xori  r11,r11,SPR_SR_DCE
85
        l.and   r11,r13,r11
86
        l.mtspr r0,r11,SPR_SR
87
 
88
        l.jr    r9
89
        l.nop
90
 
91
_dc_inv:
92
        l.mfspr r4,r0,SPR_SR
93
        l.addi  r5,r0,-1
94
        l.xori  r5,r5,SPR_SR_DCE
95
        l.and   r5,r4,r5
96
        l.mtspr r0,r5,SPR_SR
97
        l.mtspr r0,r3,SPR_DCBIR
98
        l.mtspr r0,r4,SPR_SR
99
        l.jr    r9
100
        l.nop
101
 
102
        .align  0x10
103
_ic_inv_test:
104
        l.movhi r7,hi(_ic_test_1)
105
        l.ori   r7,r7,lo(_ic_test_1)
106
        l.addi  r3,r0,0
107
        l.addi  r4,r0,0
108
        l.addi  r5,r0,0
109
        l.nop
110
        l.nop
111
        l.nop
112
 
113
_ic_test_1:
114
3:      l.addi  r3,r3,1
115
 
116
        l.sfeqi r4,0x01
117
        l.bnf   1f
118
        l.nop
119
 
120
        l.mfspr r8,r0,SPR_SR
121
        l.addi  r11,r0,-1
122
        l.xori  r11,r11,SPR_SR_ICE
123
        l.and   r11,r8,r11
124
        l.mtspr r0,r11,SPR_SR
125
        l.mtspr r0,r7,SPR_ICBIR
126
        l.mtspr r0,r8,SPR_SR
127
        l.bf    2f
128
        l.nop
129
 
130
1:      l.lwz   r6,0(r7)
131
        l.addi  r6,r6,1
132
        l.sw    0(r7),r6
133
 
134
2:      l.addi  r5,r5,1
135
        l.sfeqi r5,10
136
        l.bnf   3b
137
        l.xori  r4,r4,0x01
138
 
139
        l.addi  r11,r3,0
140
        l.jr    r9
141
        l.nop
142
 
143
_dc_inv_test:
144
        l.movhi r4,hi(0x08040201)
145
        l.ori   r4,r4,lo(0x08040201)
146
        l.sw    0x00(r3),r4
147
        l.slli  r4,r4,1
148
        l.sw    0x14(r3),r4
149
        l.slli  r4,r4,1
150
        l.sw    0x28(r3),r4
151
 
152
        l.addi  r8,r9,0
153
        l.jal   _dc_enable
154
        l.nop
155
        l.addi  r9,r8,0
156
 
157
        l.lbz   r4,0x03(r3)
158
        l.lhz   r5,0x16(r3)
159
        l.add   r4,r4,r5
160
        l.lwz   r5,0x28(r3)
161
        l.add   r4,r4,r5
162
 
163
        l.mfspr r6,r0,SPR_SR
164
        l.addi  r5,r0,-1
165
        l.xori  r5,r5,SPR_SR_DCE
166
        l.and   r5,r6,r5
167
        l.mtspr r0,r5,SPR_SR
168
        l.addi  r7,r3,0x10
169
        l.mtspr r0,r7,SPR_DCBIR
170
 
171
        l.lwz   r5,0(r3)
172
        l.slli  r5,r5,3
173
        l.sw    0x00(r3),r5
174
        l.slli  r5,r5,1
175
        l.sw    0x14(r3),r5
176
        l.slli  r5,r5,1
177
        l.sw    0x28(r3),r5
178
 
179
        l.mtspr r0,r6,SPR_SR
180
 
181
        l.lbz   r5,0x03(r3)
182
        l.add   r4,r4,r5
183
        l.lhz   r5,0x16(r3)
184
        l.add   r4,r4,r5
185
        l.lwz   r5,0x28(r3)
186
        l.add   r4,r4,r5
187
 
188
        l.addi  r5,r0,-1
189
        l.xori  r5,r5,SPR_SR_DCE
190
        l.and   r5,r6,r5
191
        l.mtspr r0,r5,SPR_SR
192
 
193
        l.addi  r11,r4,0x0
194
1:
195
        l.jr  r9
196
        l.nop

powered by: WebSVN 2.1.0

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