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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gdb/] [gdb-6.8/] [sim/] [testsuite/] [sim/] [mips/] [utils-dsp.inc] - Blame information for rev 26

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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