aresample.s
7.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
/*************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
************************************************************************/
/* aresample.s */
#define rs_vstorem(x) vmadm x, vONE, vSHIFT[0]
#define rs_vstoren(x) vmadn x, vONE, vSHIFT[0]
#define SBASE 2
#define CBASE 3
#define PINC 4
#define PHCNT 5
#define SBASEb 4
#define CBASEb 6
#define PINCb 8
#define PHCNTb 10
########################################################################
#
# resample data in dmemin to dmemout using
.name OutPtr, $23
.name loopctl, $22
.name count, $3
.name state_addr, $2
.name dm_state_addr, $1
.name vONE, $v31
.name vSHIFT, $v30
.name vZEROFOUR, $v29
.name vONEFIVE, $v28
.name vTWOSIX, $v27
.name vTHREESEVEN, $v26
.name vMULINC, $v25
.name vfco, $v24
.name vico, $v23
.name vica, $v22
.name vchparmz, $v21
.name vphaddr, $v20
.name vdata0, $v19
.name vcoef0, $v18
.name vdata1, $v17
.name vcoef1, $v16
.name vdata2, $v15
.name vcoef2, $v14
.name vdata3, $v13
.name vcoef3, $v12
.name vout0, $v11
.name vout1, $v10
.name vout2, $v9
.name vout3, $v8
.name vout, $v7
.name flags, $21
.name inbuffbase, $20
.name temp, $4
case_A_RESAMPLE:
sll state_addr, aud0, 8
vxor vico, vico, vico
srl state_addr, state_addr, 8
addi state_addr, state_addr, 0
addi count, zero, RES_STATE_SIZE8
srl flags, aud1, 30
bgtz flags, res_dont_init_from_state
addi dm_state_addr, scrbase, RES_STATE_BASE
mfc0 temp, SP_RESERVED
resampleDMAreadwait:
bne temp, $0, resampleDMAreadwait
mfc0 temp, SP_RESERVED
mfc0 temp, DMA_FULL
resampleDRFull1:
bne temp, $0, resampleDRFull1
mfc0 temp, DMA_FULL
mtc0 dm_state_addr, DMA_CACHE
mtc0 state_addr, DMA_DRAM
mtc0 count, DMA_READ_LENGTH
srl inbuffbase, aud1, 2
andi inbuffbase, inbuffbase, 0x0fff
addi inbuffbase, inbuffbase, AL_RESAMPLER_BUFFER_OFFSET
lqv vONE[0], AL_CONST_C_ONE(zero)
lqv vMULINC[0], AL_CONST_C_MULINC(zero)
mfc0 $5, DMA_BUSY
RESAMPLEwait1:
bne $5, zero, RESAMPLEwait1
mfc0 $5, DMA_BUSY
mtc0 $0, SP_RESERVED
ldv vdata0[0], ZMEM_OFFSET(scrbase)
j res_after_load
lsv vfco[14], FCA_OFFSET(scrbase)
res_dont_init_from_state:
srl inbuffbase, aud1, 2
andi inbuffbase, inbuffbase, 0x0fff
addi inbuffbase, inbuffbase, AL_RESAMPLER_BUFFER_OFFSET
lqv vONE[0], AL_CONST_C_ONE(zero)
vxor vdata0, vdata0, vdata0
lqv vMULINC[0], AL_CONST_C_MULINC(zero)
vxor vfco, vfco, vfco
res_after_load:
mtc2 inbuffbase, vchparmz[SBASEb]
addi temp, zero, RES_TABLE_OFFSET
mtc2 temp, vchparmz[CBASEb]
vsub vMULINC, vMULINC, vONE
srl temp, aud1, 14
mtc2 temp, vchparmz[PINCb]
addi temp, zero, RES_PHASE_COUNT
mtc2 temp, vchparmz[PHCNTb]
vsub vMULINC, vMULINC, vONE
lqv vSHIFT[0], AL_CONST_C_SHIFT(zero)
lqv vZEROFOUR[0], AL_CONST_C_ZEROFOUR(zero)
lqv vONEFIVE[0], AL_CONST_C_ONEFIVE(zero)
vmudm vfco, vONE, vfco[7]
lqv vTWOSIX[0], AL_CONST_C_TWOSIX(zero)
vmadm vico, vMULINC, vchparmz[PINC]
lqv vTHREESEVEN[0], AL_CONST_C_THREESEVEN(zero)
rs_vstoren(vfco)
sdv vdata0[0], 0(inbuffbase)
lqv vMULINC[0], AL_CONST_C_MULINC(zero)
vmudn vica, vONE, vchparmz[SBASE]
addi loopctl, zero, AL_ALL_COUNTER
vmadn vica, vico, vSHIFT[2]
andi temp, aud1, 0x0003
vmudl vphaddr, vfco, vchparmz[PHCNT]
beq temp, zero, resample_swap
addi OutPtr, zero, AL_RESAMPLE_IN_0
addi OutPtr, zero, AL_RESAMPLE_IN_1
resample_swap:
ssv vfco[7], FCA_OFFSET(scrbase)
vmudn vphaddr, vphaddr, vSHIFT[4]
sqv vica[0], iCAptr0(zero)
vmadn vphaddr, vONE, vchparmz[CBASE]
sqv vphaddr[0], CPHptr0(zero)
.unname flags
.unname inbuffbase
.unname temp
.name CAptr0, $21
.name CAptr2, $20
.name CAptr4, $19
.name CAptr6, $18
.name CAptr8, $17
.name CAptr10, $16
.name CAptr12, $15
.name CAptr14, $14
.name PHptr0, $13
.name PHptr2, $12
.name PHptr4, $11
.name PHptr6, $10
.name PHptr8, $9
.name PHptr10, $8
.name PHptr12, $7
.name PHptr14, $6
lh CAptr0, iCAptr0(zero)
lh PHptr0, CPHptr0(zero)
lh CAptr8, iCAptr8(zero)
lh PHptr8, CPHptr8(zero)
lh CAptr2, iCAptr2(zero)
lh PHptr2, CPHptr2(zero)
lh CAptr10, iCAptr10(zero)
lh PHptr10, CPHptr10(zero)
lh CAptr4, iCAptr4(zero)
lh PHptr4, CPHptr4(zero)
lh CAptr12, iCAptr12(zero)
lh PHptr12, CPHptr12(zero)
lh CAptr6, iCAptr6(zero)
lh PHptr6, CPHptr6(zero)
lh CAptr14, iCAptr14(zero)
lh PHptr14, CPHptr14(zero)
loop: ldv vdata0[0], 0(CAptr0)
vmudm vfco, vONE, vfco[7]
ldv vcoef0[0], 0(PHptr0)
vmadh vfco, vONE, vico[7]
ldv vdata0[8], 0(CAptr8)
vmadm vico, vMULINC, vchparmz[PINC]
ldv vcoef0[8], 0(PHptr8)
rs_vstoren(vfco)
ldv vdata1[0], 0(CAptr2)
vmudn vica, vONE, vchparmz[SBASE]
ldv vcoef1[0], 0(PHptr2)
ldv vdata1[8], 0(CAptr10)
vmadn vica, vico, vSHIFT[2]
ldv vcoef1[8], 0(PHptr10)
vmudl vphaddr, vfco, vchparmz[PHCNT]
ldv vdata2[0], 0(CAptr4)
ldv vcoef2[0], 0(PHptr4)
ldv vdata2[8], 0(CAptr12)
ldv vcoef2[8], 0(PHptr12)
vmudn vphaddr, vphaddr, vSHIFT[4]
ldv vdata3[0], 0(CAptr6)
vmadn vphaddr, vONE, vchparmz[CBASE]
ldv vcoef3[0], 0(PHptr6)
ldv vdata3[8], 0(CAptr14)
vmulf vout0, vdata0, vcoef0
ldv vcoef3[8], 0(PHptr14)
vmulf vout1, vdata1, vcoef1
sqv vica[0], iCAptr0(zero)
vmulf vout2, vdata2, vcoef2
sqv vphaddr[0], CPHptr0(zero)
lh CAptr0, iCAptr0(zero)
lh PHptr0, CPHptr0(zero)
vmulf vout3, vdata3, vcoef3
lh CAptr8, iCAptr8(zero)
vadd vout0, vout0, vout0[1q]
lh PHptr8, CPHptr8(zero)
vadd vout1, vout1, vout1[1q]
lh CAptr2, iCAptr2(zero)
vadd vout2, vout2, vout2[1q]
lh PHptr2, CPHptr2(zero)
vadd vout3, vout3, vout3[1q]
lh CAptr10, iCAptr10(zero)
vadd vout0, vout0, vout0[2h]
lh PHptr10, CPHptr10(zero)
vadd vout1, vout1, vout1[2h]
lh CAptr4, iCAptr4(zero)
vadd vout2, vout2, vout2[2h]
lh PHptr4, CPHptr4(zero)
vadd vout3, vout3, vout3[2h]
lh CAptr12, iCAptr12(zero)
vmudn vout, vZEROFOUR, vout0[0h]
lh PHptr12, CPHptr12(zero)
vmadn vout, vONEFIVE, vout1[0h]
lh CAptr6, iCAptr6(zero)
vmadn vout, vTWOSIX, vout2[0h]
lh PHptr6, CPHptr6(zero)
vmadn vout, vTHREESEVEN, vout3[0h]
lh CAptr14, iCAptr14(zero)
lh PHptr14, CPHptr14(zero)
addi loopctl, loopctl, -16
blez loopctl, fini
sqv vout[0], 0(OutPtr)
j loop
addi OutPtr, OutPtr, 0x10
fini: ldv vdata0[0], 0(CAptr0)
ssv vfco[0], FCA_OFFSET(scrbase)
jal DMAwrite
sdv vdata0[0], ZMEM_OFFSET(scrbase)
addi dlcount, dlcount, -8
mfc0 $5, DMA_BUSY
RESAMPLEwait2:
bne $5, zero, RESAMPLEwait2
mfc0 $5, DMA_BUSY
j AudDone
mtc0 $0, SP_RESERVED
.unname OutPtr
.unname loopctl
.unname CAptr0
.unname CAptr2
.unname CAptr4
.unname CAptr6
.unname CAptr8
.unname CAptr10
.unname CAptr12
.unname CAptr14
.unname PHptr0
.unname PHptr2
.unname PHptr4
.unname PHptr6
.unname PHptr8
.unname PHptr10
.unname PHptr12
.unname PHptr14
.unname count
.unname state_addr
.unname dm_state_addr
.unname vONE
.unname vSHIFT
.unname vZEROFOUR
.unname vONEFIVE
.unname vTWOSIX
.unname vTHREESEVEN
.unname vMULINC
.unname vfco
.unname vico
.unname vica
.unname vchparmz
.unname vphaddr
.unname vdata0
.unname vcoef0
.unname vdata1
.unname vcoef1
.unname vdata2
.unname vcoef2
.unname vdata3
.unname vcoef3
.unname vout0
.unname vout1
.unname vout2
.unname vout3
.unname vout