]>
Commit | Line | Data |
---|---|---|
fcc392a3 | 1 | # MIPS DSP ASE simulator testsuite utility functions. |
6aba47ca | 2 | # Copyright (C) 2005, 2007 Free Software Foundation, Inc. |
fcc392a3 CF |
3 | # Contributed by MIPS Technologies, Inc. Written by Chao-ying Fu. |
4 | # | |
5 | # This file is part of the GNU simulators. | |
6 | # | |
7 | # This program is free software; you can redistribute it and/or modify | |
8 | # it under the terms of the GNU General Public License as published by | |
9 | # the Free Software Foundation; either version 2, or (at your option) | |
10 | # any later version. | |
11 | # | |
12 | # This program is distributed in the hope that it will be useful, | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | # GNU General Public License for more details. | |
16 | # | |
17 | # You should have received a copy of the GNU General Public License along | |
18 | # with this program; if not, write to the Free Software Foundation, Inc., | |
19 | # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | # $4, $5, $6, $7, $ac0, $ac1, $ac2, $ac3 are used as temps by the macros | |
22 | # defined here. | |
23 | ||
24 | # If a != b, jump to _fail. | |
25 | # Otherwise, fall through. | |
26 | .macro dsp_assert a, b | |
27 | beq \a, \b, 1f | |
28 | nop | |
29 | j _fail | |
30 | nop | |
31 | 1: | |
32 | .endm | |
33 | ||
34 | # Set dsp control register <= crin | |
35 | # Check if d == (inst ?, s, t) | |
36 | # Check if crout == dsp control register | |
37 | .macro dspck_dstio inst, d, s, t, crin, crout | |
38 | li $4, \crin | |
39 | wrdsp $4 | |
40 | li $4, \s | |
41 | li $5, \t | |
42 | \inst $6, $4, $5 | |
43 | li $7, \d | |
44 | dsp_assert $6, $7 | |
45 | li $4, \crout | |
46 | rddsp $5 | |
47 | dsp_assert $4, $5 | |
48 | .endm | |
49 | ||
50 | # Set dsp control register <= crin | |
51 | # (inst s, t) | |
52 | # Check if crout == dsp control register | |
53 | .macro dspck_stio inst, s, t, crin, crout | |
54 | li $4, \crin | |
55 | wrdsp $4 | |
56 | li $4, \s | |
57 | li $5, \t | |
58 | \inst $4, $5 | |
59 | li $4, \crout | |
60 | rddsp $5 | |
61 | dsp_assert $4, $5 | |
62 | .endm | |
63 | ||
64 | # Set dsp control register <= crin | |
65 | # Check if d == (inst ?, s, t) | |
66 | .macro dspck_dsti inst, d, s, t, crin | |
67 | li $4, \crin | |
68 | wrdsp $4 | |
69 | li $4, \s | |
70 | li $5, \t | |
71 | \inst $6, $4, $5 | |
72 | li $7, \d | |
73 | dsp_assert $6, $7 | |
74 | .endm | |
75 | ||
76 | # Set dsp control register <= crin | |
77 | # Check if tou == (inst tin, s) | |
78 | .macro dspck_tsi inst, tou, tin, s, crin | |
79 | li $4, \crin | |
80 | wrdsp $4 | |
81 | li $4, \s | |
82 | li $5, \tin | |
83 | \inst $5, $4 | |
84 | li $6, \tou | |
85 | dsp_assert $5, $6 | |
86 | .endm | |
87 | ||
88 | # Set dsp control register <= crin | |
89 | # Check if d == (inst ?, imm) | |
90 | # Check if crout == dsp control register | |
91 | .macro dspck_dIio inst, d, imm, crin, crout | |
92 | li $4, \crin | |
93 | wrdsp $4 | |
94 | \inst $5, \imm | |
95 | li $6, \d | |
96 | dsp_assert $5, $6 | |
97 | li $4, \crout | |
98 | rddsp $5 | |
99 | dsp_assert $4, $5 | |
100 | .endm | |
101 | ||
102 | # Set dsp control register <= crin | |
103 | # Check if d == (inst ?, s) | |
104 | # Check if crout == dsp control register | |
105 | .macro dspck_dsio inst, d, s, crin, crout | |
106 | li $4, \crin | |
107 | wrdsp $4 | |
108 | li $4, \s | |
109 | \inst $6, $4 | |
110 | li $7, \d | |
111 | dsp_assert $6, $7 | |
112 | li $4, \crout | |
113 | rddsp $5 | |
114 | dsp_assert $4, $5 | |
115 | .endm | |
116 | ||
117 | # Set dsp control register <= crin | |
118 | # Check if d == (inst ?, t, sa) | |
119 | # Check if crout == dsp control register | |
120 | .macro dspck_dtsaio inst, d, t, sa, crin, crout | |
121 | li $4, \crin | |
122 | wrdsp $4 | |
123 | li $4, \t | |
124 | \inst $6, $4, \sa | |
125 | li $7, \d | |
126 | dsp_assert $6, $7 | |
127 | li $4, \crout | |
128 | rddsp $5 | |
129 | dsp_assert $4, $5 | |
130 | .endm | |
131 | ||
132 | # Set dsp control register <= crin | |
133 | # Check if d == (inst ?, t, sa) | |
134 | .macro dspck_dtsai inst, d, t, sa, crin | |
135 | li $4, \crin | |
136 | wrdsp $4 | |
137 | li $4, \t | |
138 | \inst $6, $4, \sa | |
139 | li $7, \d | |
140 | dsp_assert $6, $7 | |
141 | .endm | |
142 | ||
143 | # Set dsp control register <= crin | |
144 | # Set $ac3 <= {hiin, loin} | |
145 | # (inst $ac3, s, t) | |
146 | # Check if {hiou, loou} == $ac3 | |
147 | # Check if (crout & 0x80000) == (dsp control register & 0x80000) | |
148 | .macro dspck_astio inst, hiin, loin, hiou, loou, s, t, crin, crout | |
149 | li $4, \crin | |
150 | wrdsp $4 | |
151 | li $4, \hiin | |
152 | mthi $4, $ac3 | |
153 | li $4, \loin | |
154 | mtlo $4, $ac3 | |
155 | li $4, \s | |
156 | li $5, \t | |
157 | \inst $ac3, $4, $5 | |
158 | li $4, \hiou | |
159 | mfhi $5, $ac3 | |
160 | dsp_assert $4, $5 | |
161 | li $4, \loou | |
162 | mflo $5, $ac3 | |
163 | dsp_assert $4, $5 | |
164 | li $4, \crout | |
165 | and $4, $4, 0x80000 | |
166 | rddsp $5 | |
167 | and $5, $5, 0x80000 | |
168 | dsp_assert $4, $5 | |
169 | .endm | |
170 | ||
171 | # Set dsp control register <= crin | |
172 | # Set $ac1 <= {hi, lo} | |
173 | # Check if t == (inst ? $ac1, sa) | |
174 | # Check if crout == dsp control register | |
175 | .macro dspck_atsaio inst, hi, lo, t, sa, crin, crout | |
176 | li $4, \crin | |
177 | wrdsp $4 | |
178 | li $4, \hi | |
179 | mthi $4, $ac1 | |
180 | li $4, \lo | |
181 | mtlo $4, $ac1 | |
182 | \inst $5, $ac1, \sa | |
183 | li $6, \t | |
184 | dsp_assert $5, $6 | |
185 | li $4, \crout | |
186 | rddsp $5 | |
187 | dsp_assert $4, $5 | |
188 | .endm | |
189 | ||
190 | # Set dsp control register <= crin | |
191 | # Set $ac1 <= {hi, lo} | |
192 | # Check if t == (inst ? $ac1, s) | |
193 | # Check if crout == dsp control register | |
194 | .macro dspck_atsio inst, hi, lo, t, s, crin, crout | |
195 | li $4, \crin | |
196 | wrdsp $4 | |
197 | li $4, \hi | |
198 | mthi $4, $ac1 | |
199 | li $4, \lo | |
200 | mtlo $4, $ac1 | |
201 | li $4, \s | |
202 | \inst $5, $ac1, $4 | |
203 | li $6, \t | |
204 | dsp_assert $5, $6 | |
205 | li $4, \crout | |
206 | rddsp $5 | |
207 | dsp_assert $4, $5 | |
208 | .endm | |
209 | ||
210 | # Set dsp control register <= (crin & crinmask) | |
211 | # Set $ac2 <= {hi, lo} | |
212 | # Check if t == (inst ? $ac2, size) | |
213 | # Check if (crout & croutmask) == (dsp control register & croutmask) | |
214 | .macro dspck_tasiimom inst, hi, lo, t, size, crin, crinmask, crout, croutmask | |
215 | li $4, \crin | |
216 | and $4, \crinmask | |
217 | wrdsp $4 | |
218 | li $4, \hi | |
219 | mthi $4, $ac2 | |
220 | li $4, \lo | |
221 | mtlo $4, $ac2 | |
222 | \inst $5, $ac2, \size | |
223 | li $6, \t | |
224 | dsp_assert $5, $6 | |
225 | li $4, \crout | |
226 | and $4, \croutmask | |
227 | rddsp $5 | |
228 | and $5, \croutmask | |
229 | dsp_assert $4, $5 | |
230 | .endm | |
231 | ||
232 | # Set dsp control register <= (crin & crinmask) | |
233 | # Set $ac2 <= {hi, lo} | |
234 | # Check if t == (inst ? $ac2, size) | |
235 | .macro dspck_tasiim inst, hi, lo, t, size, crin, crinmask | |
236 | li $4, \crin | |
237 | and $4, \crinmask | |
238 | wrdsp $4 | |
239 | li $4, \hi | |
240 | mthi $4, $ac2 | |
241 | li $4, \lo | |
242 | mtlo $4, $ac2 | |
243 | \inst $5, $ac2, \size | |
244 | li $6, \t | |
245 | dsp_assert $5, $6 | |
246 | .endm | |
247 | ||
248 | # Set dsp control register <= (crin & crinmask) | |
249 | # Set $ac2 <= {hi, lo} | |
250 | # Check if t == (inst ? $ac2, s) | |
251 | # Check if (crout & croutmask) == (dsp control register & croutmask) | |
252 | .macro dspck_tasimom inst, hi, lo, t, s, crin, crinmask, crout, croutmask | |
253 | li $4, \crin | |
254 | and $4, \crinmask | |
255 | wrdsp $4 | |
256 | li $4, \hi | |
257 | mthi $4, $ac2 | |
258 | li $4, \lo | |
259 | mtlo $4, $ac2 | |
260 | li $4, \s | |
261 | \inst $5, $ac2, $4 | |
262 | li $6, \t | |
263 | dsp_assert $5, $6 | |
264 | li $4, \crout | |
265 | and $4, \croutmask | |
266 | rddsp $5 | |
267 | and $5, \croutmask | |
268 | dsp_assert $4, $5 | |
269 | .endm | |
270 | ||
271 | # Set dsp control register <= (crin & crinmask) | |
272 | # Set $ac2 <= {hi, lo} | |
273 | # Check if t == (inst ? $ac2, s) | |
274 | .macro dspck_tasim inst, hi, lo, t, s, crin, crinmask | |
275 | li $4, \crin | |
276 | and $4, \crinmask | |
277 | wrdsp $4 | |
278 | li $4, \hi | |
279 | mthi $4, $ac2 | |
280 | li $4, \lo | |
281 | mtlo $4, $ac2 | |
282 | li $4, \s | |
283 | \inst $5, $ac2, $4 | |
284 | li $6, \t | |
285 | dsp_assert $5, $6 | |
286 | .endm | |
287 | ||
288 | # Set dsp control register <= crin | |
289 | # Set $ac0 <= {hi, lo} | |
290 | # (inst $ac0, shift) | |
291 | # Check if $ac0 == {hio, loo} | |
292 | # Check if crout == dsp control register | |
293 | .macro dspck_asaio inst, hi, lo, hio, loo, shift, crin, crout | |
294 | li $4, \crin | |
295 | wrdsp $4 | |
296 | li $4, \hi | |
297 | mthi $4, $ac0 | |
298 | li $4, \lo | |
299 | mtlo $4, $ac0 | |
300 | \inst $ac0, \shift | |
301 | mfhi $5, $ac0 | |
302 | li $6, \hio | |
303 | dsp_assert $5, $6 | |
304 | mflo $5, $ac0 | |
305 | li $6, \loo | |
306 | dsp_assert $5, $6 | |
307 | li $4, \crout | |
308 | rddsp $5 | |
309 | dsp_assert $4, $5 | |
310 | .endm | |
311 | ||
312 | # Set dsp control register <= crin | |
313 | # Set $ac0 <= {hi, lo} | |
314 | # (inst $ac0, s) | |
315 | # Check if $ac0 == {hio, loo} | |
316 | # Check if crout == dsp control register | |
317 | .macro dspck_asio inst, hi, lo, hio, loo, s, crin, crout | |
318 | li $4, \crin | |
319 | wrdsp $4 | |
320 | li $4, \hi | |
321 | mthi $4, $ac0 | |
322 | li $4, \lo | |
323 | mtlo $4, $ac0 | |
324 | li $4, \s | |
325 | \inst $ac0, $4 | |
326 | mfhi $5, $ac0 | |
327 | li $6, \hio | |
328 | dsp_assert $5, $6 | |
329 | mflo $5, $ac0 | |
330 | li $6, \loo | |
331 | dsp_assert $5, $6 | |
332 | li $4, \crout | |
333 | rddsp $5 | |
334 | dsp_assert $4, $5 | |
335 | .endm | |
336 | ||
337 | # Set dsp control register <= crin | |
338 | # Set $ac3 <= {hi, lo} | |
339 | # Check if s == (inst ? $ac3) | |
340 | # Check if $ac3 == {hio, loo} | |
341 | # Check if crout == dsp control register | |
342 | .macro dspck_saio inst, hi, lo, hio, loo, s, crin, crout | |
343 | li $4, \crin | |
344 | wrdsp $4 | |
345 | li $4, \hi | |
346 | mthi $4, $ac3 | |
347 | li $4, \lo | |
348 | mtlo $4, $ac3 | |
349 | li $5, \s | |
350 | \inst $5, $ac3 | |
351 | mfhi $5, $ac3 | |
352 | li $6, \hio | |
353 | dsp_assert $5, $6 | |
354 | mflo $5, $ac3 | |
355 | li $6, \loo | |
356 | dsp_assert $5, $6 | |
357 | li $4, \crout | |
358 | rddsp $5 | |
359 | dsp_assert $4, $5 | |
360 | .endm | |
361 | ||
362 | # Set dsp control register <= crin | |
363 | # (wrdsp s, m) | |
364 | # Check if crout == dsp control register | |
365 | .macro dspck_wrdsp s, m, crin, crout | |
366 | li $4, \crin | |
367 | wrdsp $4 | |
368 | li $5, \s | |
369 | wrdsp $5, \m | |
370 | li $6, \crout | |
371 | rddsp $7 | |
372 | dsp_assert $6, $7 | |
373 | .endm | |
374 | ||
375 | # Set dsp control register <= crin | |
376 | # Check if d == (rddsp ?, m) | |
377 | .macro dspck_rddsp d, m, crin | |
378 | li $4, \crin | |
379 | wrdsp $4 | |
380 | rddsp $5, \m | |
381 | li $6, \d | |
382 | dsp_assert $5, $6 | |
383 | .endm | |
384 | ||
385 | # Check if d == (inst i(b)) | |
386 | .macro dspck_load inst, d, i, b | |
387 | li $4, \i | |
388 | la $5, \b | |
389 | \inst $6, $4($5) | |
390 | li $7, \d | |
391 | dsp_assert $6, $7 | |
392 | .endm | |
393 | ||
394 | # Set dsp control register <= crin | |
395 | # Check if bposge32 is taken or not as expected in r | |
396 | # (1 => taken, 0 => not taken) | |
397 | .macro dspck_bposge32 crin, r | |
398 | li $4, \crin | |
399 | wrdsp $4 | |
400 | li $5, 1 | |
401 | bposge32 1f | |
402 | nop | |
403 | li $5, 0 | |
404 | 1: | |
405 | li $6, \r | |
406 | dsp_assert $5, $6 | |
407 | .endm |