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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [apps/] [testfloat/] [testFunction.c] - Blame information for rev 425

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 349 julius
 
2
/*
3
===============================================================================
4
 
5
This C source file is part of TestFloat, Release 2a, a package of programs
6
for testing the correctness of floating-point arithmetic complying to the
7
IEC/IEEE Standard for Floating-Point.
8
 
9
Written by John R. Hauser.  More information is available through the Web
10
page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
11
 
12
THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
13
has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
14
TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
15
PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
16
AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
17
 
18
Derivative works are acceptable, even for commercial purposes, so long as
19
(1) they include prominent notice that the work is derivative, and (2) they
20
include prominent notice akin to these four paragraphs for those parts of
21
this code that are retained.
22
 
23
Modified for use with or1ksim's testsuite.
24
 
25
Contributor Julius Baxter <julius.baxter@orsoc.se>
26
 
27
===============================================================================
28
*/
29 425 julius
#include "cpu-utils.h" // OR1k support C library
30 349 julius
#include "milieu.h"
31
#include "printf.h"
32
#include "softfloat.h"
33
#include "testCases.h"
34
#include "testLoops.h"
35
#include "systmodes.h"
36
#include "systflags.h"
37
#include "systfloat.h"
38
#include "testFunction.h"
39
 
40
const functionT functions[ NUM_FUNCTIONS ] = {
41
    { 0, 0, 0, 0 },
42
    { "int32_to_float32",                1, FALSE, TRUE  },
43
    { "int32_to_float64",                1, FALSE, FALSE },
44
    { "int32_to_floatx80",               1, FALSE, FALSE },
45
    { "int32_to_float128",               1, FALSE, FALSE },
46
    { "int64_to_float32",                1, FALSE, TRUE  },
47
    { "int64_to_float64",                1, FALSE, TRUE  },
48
    { "int64_to_floatx80",               1, FALSE, FALSE },
49
    { "int64_to_float128",               1, FALSE, FALSE },
50
    { "float32_to_int32",                1, FALSE, TRUE  },
51
    { "float32_to_int32_round_to_zero",  1, FALSE, FALSE },
52
    { "float32_to_int64",                1, FALSE, TRUE  },
53
    { "float32_to_int64_round_to_zero",  1, FALSE, FALSE },
54
    { "float32_to_float64",              1, FALSE, FALSE },
55
    { "float32_to_floatx80",             1, FALSE, FALSE },
56
    { "float32_to_float128",             1, FALSE, FALSE },
57
    { "float32_round_to_int",            1, FALSE, TRUE  },
58
    { "float32_add",                     2, FALSE, TRUE  },
59
    { "float32_sub",                     2, FALSE, TRUE  },
60
    { "float32_mul",                     2, FALSE, TRUE  },
61
    { "float32_div",                     2, FALSE, TRUE  },
62
    { "float32_rem",                     2, FALSE, FALSE },
63
    { "float32_sqrt",                    1, FALSE, TRUE  },
64
    { "float32_eq",                      2, FALSE, FALSE },
65
    { "float32_le",                      2, FALSE, FALSE },
66
    { "float32_lt",                      2, FALSE, FALSE },
67
    { "float32_eq_signaling",            2, FALSE, FALSE },
68
    { "float32_le_quiet",                2, FALSE, FALSE },
69
    { "float32_lt_quiet",                2, FALSE, FALSE },
70
    { "float64_to_int32",                1, FALSE, TRUE  },
71
    { "float64_to_int32_round_to_zero",  1, FALSE, FALSE },
72
    { "float64_to_int64",                1, FALSE, TRUE  },
73
    { "float64_to_int64_round_to_zero",  1, FALSE, FALSE },
74
    { "float64_to_float32",              1, FALSE, TRUE  },
75
    { "float64_to_floatx80",             1, FALSE, FALSE },
76
    { "float64_to_float128",             1, FALSE, FALSE },
77
    { "float64_round_to_int",            1, FALSE, TRUE  },
78
    { "float64_add",                     2, FALSE, TRUE  },
79
    { "float64_sub",                     2, FALSE, TRUE  },
80
    { "float64_mul",                     2, FALSE, TRUE  },
81
    { "float64_div",                     2, FALSE, TRUE  },
82
    { "float64_rem",                     2, FALSE, FALSE },
83
    { "float64_sqrt",                    1, FALSE, TRUE  },
84
    { "float64_eq",                      2, FALSE, FALSE },
85
    { "float64_le",                      2, FALSE, FALSE },
86
    { "float64_lt",                      2, FALSE, FALSE },
87
    { "float64_eq_signaling",            2, FALSE, FALSE },
88
    { "float64_le_quiet",                2, FALSE, FALSE },
89
    { "float64_lt_quiet",                2, FALSE, FALSE },
90
    { "floatx80_to_int32",               1, FALSE, TRUE  },
91
    { "floatx80_to_int32_round_to_zero", 1, FALSE, FALSE },
92
    { "floatx80_to_int64",               1, FALSE, TRUE  },
93
    { "floatx80_to_int64_round_to_zero", 1, FALSE, FALSE },
94
    { "floatx80_to_float32",             1, FALSE, TRUE  },
95
    { "floatx80_to_float64",             1, FALSE, TRUE  },
96
    { "floatx80_to_float128",            1, FALSE, FALSE },
97
    { "floatx80_round_to_int",           1, FALSE, TRUE  },
98
    { "floatx80_add",                    2, TRUE,  TRUE  },
99
    { "floatx80_sub",                    2, TRUE,  TRUE  },
100
    { "floatx80_mul",                    2, TRUE,  TRUE  },
101
    { "floatx80_div",                    2, TRUE,  TRUE  },
102
    { "floatx80_rem",                    2, FALSE, FALSE },
103
    { "floatx80_sqrt",                   1, TRUE,  TRUE  },
104
    { "floatx80_eq",                     2, FALSE, FALSE },
105
    { "floatx80_le",                     2, FALSE, FALSE },
106
    { "floatx80_lt",                     2, FALSE, FALSE },
107
    { "floatx80_eq_signaling",           2, FALSE, FALSE },
108
    { "floatx80_le_quiet",               2, FALSE, FALSE },
109
    { "floatx80_lt_quiet",               2, FALSE, FALSE },
110
    { "float128_to_int32",               1, FALSE, TRUE  },
111
    { "float128_to_int32_round_to_zero", 1, FALSE, FALSE },
112
    { "float128_to_int64",               1, FALSE, TRUE  },
113
    { "float128_to_int64_round_to_zero", 1, FALSE, FALSE },
114
    { "float128_to_float32",             1, FALSE, TRUE  },
115
    { "float128_to_float64",             1, FALSE, TRUE  },
116
    { "float128_to_floatx80",            1, FALSE, TRUE  },
117
    { "float128_round_to_int",           1, FALSE, TRUE  },
118
    { "float128_add",                    2, FALSE, TRUE  },
119
    { "float128_sub",                    2, FALSE, TRUE  },
120
    { "float128_mul",                    2, FALSE, TRUE  },
121
    { "float128_div",                    2, FALSE, TRUE  },
122
    { "float128_rem",                    2, FALSE, FALSE },
123
    { "float128_sqrt",                   1, FALSE, TRUE  },
124
    { "float128_eq",                     2, FALSE, FALSE },
125
    { "float128_le",                     2, FALSE, FALSE },
126
    { "float128_lt",                     2, FALSE, FALSE },
127
    { "float128_eq_signaling",           2, FALSE, FALSE },
128
    { "float128_le_quiet",               2, FALSE, FALSE },
129
    { "float128_lt_quiet",               2, FALSE, FALSE },
130
};
131
 
132
const flag functionExists[ NUM_FUNCTIONS ] = {
133
    0,
134
#ifdef SYST_INT32_TO_FLOAT32
135
    1,
136
#else
137
    0,
138
#endif
139
#ifdef SYST_INT32_TO_FLOAT64
140
    1,
141
#else
142
    0,
143
#endif
144
#ifdef SYST_INT32_TO_FLOATX80
145
    1,
146
#else
147
    0,
148
#endif
149
#ifdef SYST_INT32_TO_FLOAT128
150
    1,
151
#else
152
    0,
153
#endif
154
#ifdef SYST_INT64_TO_FLOAT32
155
    1,
156
#else
157
    0,
158
#endif
159
#ifdef SYST_INT64_TO_FLOAT64
160
    1,
161
#else
162
    0,
163
#endif
164
#ifdef SYST_INT64_TO_FLOATX80
165
    1,
166
#else
167
    0,
168
#endif
169
#ifdef SYST_INT64_TO_FLOAT128
170
    1,
171
#else
172
    0,
173
#endif
174
#ifdef SYST_FLOAT32_TO_INT32
175
    1,
176
#else
177
    0,
178
#endif
179
#ifdef SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
180
    1,
181
#else
182
    0,
183
#endif
184
#ifdef SYST_FLOAT32_TO_INT64
185
    1,
186
#else
187
    0,
188
#endif
189
#ifdef SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
190
    1,
191
#else
192
    0,
193
#endif
194
#ifdef SYST_FLOAT32_TO_FLOAT64
195
    1,
196
#else
197
    0,
198
#endif
199
#ifdef SYST_FLOAT32_TO_FLOATX80
200
    1,
201
#else
202
    0,
203
#endif
204
#ifdef SYST_FLOAT32_TO_FLOAT128
205
    1,
206
#else
207
    0,
208
#endif
209
#ifdef SYST_FLOAT32_ROUND_TO_INT
210
    1,
211
#else
212
    0,
213
#endif
214
#ifdef SYST_FLOAT32_ADD
215
    1,
216
#else
217
    0,
218
#endif
219
#ifdef SYST_FLOAT32_SUB
220
    1,
221
#else
222
    0,
223
#endif
224
#ifdef SYST_FLOAT32_MUL
225
    1,
226
#else
227
    0,
228
#endif
229
#ifdef SYST_FLOAT32_DIV
230
    1,
231
#else
232
    0,
233
#endif
234
#ifdef SYST_FLOAT32_REM
235
    1,
236
#else
237
    0,
238
#endif
239
#ifdef SYST_FLOAT32_SQRT
240
    1,
241
#else
242
    0,
243
#endif
244
#ifdef SYST_FLOAT32_EQ
245
    1,
246
#else
247
    0,
248
#endif
249
#ifdef SYST_FLOAT32_LE
250
    1,
251
#else
252
    0,
253
#endif
254
#ifdef SYST_FLOAT32_LT
255
    1,
256
#else
257
    0,
258
#endif
259
#ifdef SYST_FLOAT32_EQ_SIGNALING
260
    1,
261
#else
262
    0,
263
#endif
264
#ifdef SYST_FLOAT32_LE_QUIET
265
    1,
266
#else
267
    0,
268
#endif
269
#ifdef SYST_FLOAT32_LT_QUIET
270
    1,
271
#else
272
    0,
273
#endif
274
#ifdef SYST_FLOAT64_TO_INT32
275
    1,
276
#else
277
    0,
278
#endif
279
#ifdef SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
280
    1,
281
#else
282
    0,
283
#endif
284
#ifdef SYST_FLOAT64_TO_INT64
285
    1,
286
#else
287
    0,
288
#endif
289
#ifdef SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
290
    1,
291
#else
292
    0,
293
#endif
294
#ifdef SYST_FLOAT64_TO_FLOAT32
295
    1,
296
#else
297
    0,
298
#endif
299
#ifdef SYST_FLOAT64_TO_FLOATX80
300
    1,
301
#else
302
    0,
303
#endif
304
#ifdef SYST_FLOAT64_TO_FLOAT128
305
    1,
306
#else
307
    0,
308
#endif
309
#ifdef SYST_FLOAT64_ROUND_TO_INT
310
    1,
311
#else
312
    0,
313
#endif
314
#ifdef SYST_FLOAT64_ADD
315
    1,
316
#else
317
    0,
318
#endif
319
#ifdef SYST_FLOAT64_SUB
320
    1,
321
#else
322
    0,
323
#endif
324
#ifdef SYST_FLOAT64_MUL
325
    1,
326
#else
327
    0,
328
#endif
329
#ifdef SYST_FLOAT64_DIV
330
    1,
331
#else
332
    0,
333
#endif
334
#ifdef SYST_FLOAT64_REM
335
    1,
336
#else
337
    0,
338
#endif
339
#ifdef SYST_FLOAT64_SQRT
340
    1,
341
#else
342
    0,
343
#endif
344
#ifdef SYST_FLOAT64_EQ
345
    1,
346
#else
347
    0,
348
#endif
349
#ifdef SYST_FLOAT64_LE
350
    1,
351
#else
352
    0,
353
#endif
354
#ifdef SYST_FLOAT64_LT
355
    1,
356
#else
357
    0,
358
#endif
359
#ifdef SYST_FLOAT64_EQ_SIGNALING
360
    1,
361
#else
362
    0,
363
#endif
364
#ifdef SYST_FLOAT64_LE_QUIET
365
    1,
366
#else
367
    0,
368
#endif
369
#ifdef SYST_FLOAT64_LT_QUIET
370
    1,
371
#else
372
    0,
373
#endif
374
#ifdef SYST_FLOATX80_TO_INT32
375
    1,
376
#else
377
    0,
378
#endif
379
#ifdef SYST_FLOATX80_TO_INT32_ROUND_TO_ZERO
380
    1,
381
#else
382
    0,
383
#endif
384
#ifdef SYST_FLOATX80_TO_INT64
385
    1,
386
#else
387
    0,
388
#endif
389
#ifdef SYST_FLOATX80_TO_INT64_ROUND_TO_ZERO
390
    1,
391
#else
392
    0,
393
#endif
394
#ifdef SYST_FLOATX80_TO_FLOAT32
395
    1,
396
#else
397
    0,
398
#endif
399
#ifdef SYST_FLOATX80_TO_FLOAT64
400
    1,
401
#else
402
    0,
403
#endif
404
#ifdef SYST_FLOATX80_TO_FLOAT128
405
    1,
406
#else
407
    0,
408
#endif
409
#ifdef SYST_FLOATX80_ROUND_TO_INT
410
    1,
411
#else
412
    0,
413
#endif
414
#ifdef SYST_FLOATX80_ADD
415
    1,
416
#else
417
    0,
418
#endif
419
#ifdef SYST_FLOATX80_SUB
420
    1,
421
#else
422
    0,
423
#endif
424
#ifdef SYST_FLOATX80_MUL
425
    1,
426
#else
427
    0,
428
#endif
429
#ifdef SYST_FLOATX80_DIV
430
    1,
431
#else
432
    0,
433
#endif
434
#ifdef SYST_FLOATX80_REM
435
    1,
436
#else
437
    0,
438
#endif
439
#ifdef SYST_FLOATX80_SQRT
440
    1,
441
#else
442
    0,
443
#endif
444
#ifdef SYST_FLOATX80_EQ
445
    1,
446
#else
447
    0,
448
#endif
449
#ifdef SYST_FLOATX80_LE
450
    1,
451
#else
452
    0,
453
#endif
454
#ifdef SYST_FLOATX80_LT
455
    1,
456
#else
457
    0,
458
#endif
459
#ifdef SYST_FLOATX80_EQ_SIGNALING
460
    1,
461
#else
462
    0,
463
#endif
464
#ifdef SYST_FLOATX80_LE_QUIET
465
    1,
466
#else
467
    0,
468
#endif
469
#ifdef SYST_FLOATX80_LT_QUIET
470
    1,
471
#else
472
    0,
473
#endif
474
#ifdef SYST_FLOAT128_TO_INT32
475
    1,
476
#else
477
    0,
478
#endif
479
#ifdef SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
480
    1,
481
#else
482
    0,
483
#endif
484
#ifdef SYST_FLOAT128_TO_INT64
485
    1,
486
#else
487
    0,
488
#endif
489
#ifdef SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
490
    1,
491
#else
492
    0,
493
#endif
494
#ifdef SYST_FLOAT128_TO_FLOAT32
495
    1,
496
#else
497
    0,
498
#endif
499
#ifdef SYST_FLOAT128_TO_FLOAT64
500
    1,
501
#else
502
    0,
503
#endif
504
#ifdef SYST_FLOAT128_TO_FLOATX80
505
    1,
506
#else
507
    0,
508
#endif
509
#ifdef SYST_FLOAT128_ROUND_TO_INT
510
    1,
511
#else
512
    0,
513
#endif
514
#ifdef SYST_FLOAT128_ADD
515
    1,
516
#else
517
    0,
518
#endif
519
#ifdef SYST_FLOAT128_SUB
520
    1,
521
#else
522
    0,
523
#endif
524
#ifdef SYST_FLOAT128_MUL
525
    1,
526
#else
527
    0,
528
#endif
529
#ifdef SYST_FLOAT128_DIV
530
    1,
531
#else
532
    0,
533
#endif
534
#ifdef SYST_FLOAT128_REM
535
    1,
536
#else
537
    0,
538
#endif
539
#ifdef SYST_FLOAT128_SQRT
540
    1,
541
#else
542
    0,
543
#endif
544
#ifdef SYST_FLOAT128_EQ
545
    1,
546
#else
547
    0,
548
#endif
549
#ifdef SYST_FLOAT128_LE
550
    1,
551
#else
552
    0,
553
#endif
554
#ifdef SYST_FLOAT128_LT
555
    1,
556
#else
557
    0,
558
#endif
559
#ifdef SYST_FLOAT128_EQ_SIGNALING
560
    1,
561
#else
562
    0,
563
#endif
564
#ifdef SYST_FLOAT128_LE_QUIET
565
    1,
566
#else
567
    0,
568
#endif
569
#ifdef SYST_FLOAT128_LT_QUIET
570
    1,
571
#else
572
    0,
573
#endif
574
};
575
 
576
static void
577
 testFunctionVariety(
578
     uint8 functionCode, int8 roundingPrecision, int8 roundingMode )
579
{
580
    uint8 roundingCode;
581
 
582
    functionName = functions[ functionCode ].name;
583
#ifdef FLOATX80
584
    if ( roundingPrecision == 32 ) {
585
        roundingPrecisionName = "32";
586
    }
587
    else if ( roundingPrecision == 64 ) {
588
        roundingPrecisionName = "64";
589
    }
590
    else if ( roundingPrecision == 80 ) {
591
        roundingPrecisionName = "80";
592
    }
593
    else {
594
        roundingPrecision = 80;
595
        roundingPrecisionName = 0;
596
    }
597
    floatx80_rounding_precision = roundingPrecision;
598
    syst_float_set_rounding_precision( roundingPrecision );
599
#endif
600
    switch ( roundingMode ) {
601
     case ROUND_NEAREST_EVEN:
602
        roundingModeName = "nearest_even";
603
        roundingCode = float_round_nearest_even;
604
        break;
605
     case ROUND_TO_ZERO:
606
        roundingModeName = "to_zero";
607
        roundingCode = float_round_to_zero;
608
        break;
609
     case ROUND_DOWN:
610
        roundingModeName = "down";
611
        roundingCode = float_round_down;
612
        break;
613
     case ROUND_UP:
614
        roundingModeName = "up";
615
        roundingCode = float_round_up;
616
        break;
617
    default:
618
      roundingModeName = 0;
619
      roundingCode = float_round_nearest_even;
620
      break;
621
    }
622
    float_rounding_mode = roundingCode;
623
    syst_float_set_rounding_mode( roundingCode );
624
    printf( "Testing "/*, stderr*/ );
625
    writeFunctionName( /*stderr*/ );
626
    printf( ".\n" /*, stderr*/ );
627
    switch ( functionCode ) {
628
#ifdef SYST_INT32_TO_FLOAT32
629
     case INT32_TO_FLOAT32:
630
        test_a_int32_z_float32( int32_to_float32, syst_int32_to_float32 );
631
        break;
632
#endif
633
#ifdef SYST_INT32_TO_FLOAT64
634
     case INT32_TO_FLOAT64:
635
        test_a_int32_z_float64( int32_to_float64, syst_int32_to_float64 );
636
        break;
637
#endif
638
#ifdef SYST_INT32_TO_FLOATX80
639
     case INT32_TO_FLOATX80:
640
        test_a_int32_z_floatx80( int32_to_floatx80, syst_int32_to_floatx80 );
641
        break;
642
#endif
643
#ifdef SYST_INT32_TO_FLOAT128
644
     case INT32_TO_FLOAT128:
645
        test_a_int32_z_float128( int32_to_float128, syst_int32_to_float128 );
646
        break;
647
#endif
648
#ifdef SYST_INT64_TO_FLOAT32
649
     case INT64_TO_FLOAT32:
650
        test_a_int64_z_float32( int64_to_float32, syst_int64_to_float32 );
651
        break;
652
#endif
653
#ifdef SYST_INT64_TO_FLOAT64
654
     case INT64_TO_FLOAT64:
655
        test_a_int64_z_float64( int64_to_float64, syst_int64_to_float64 );
656
        break;
657
#endif
658
#ifdef SYST_INT64_TO_FLOATX80
659
     case INT64_TO_FLOATX80:
660
        test_a_int64_z_floatx80( int64_to_floatx80, syst_int64_to_floatx80 );
661
        break;
662
#endif
663
#ifdef SYST_INT64_TO_FLOAT128
664
     case INT64_TO_FLOAT128:
665
        test_a_int64_z_float128( int64_to_float128, syst_int64_to_float128 );
666
        break;
667
#endif
668
#ifdef SYST_FLOAT32_TO_INT32
669
     case FLOAT32_TO_INT32:
670
        test_a_float32_z_int32( float32_to_int32, syst_float32_to_int32 );
671
        break;
672
#endif
673
#ifdef SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
674
     case FLOAT32_TO_INT32_ROUND_TO_ZERO:
675
       syst_float_set_rounding_mode(float_round_to_zero);
676
        test_a_float32_z_int32(
677
            float32_to_int32_round_to_zero,
678
            syst_float32_to_int32_round_to_zero
679
        );
680
        break;
681
#endif
682
#ifdef SYST_FLOAT32_TO_INT64
683
     case FLOAT32_TO_INT64:
684
        test_a_float32_z_int64( float32_to_int64, syst_float32_to_int64 );
685
        break;
686
#endif
687
#ifdef SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
688
     case FLOAT32_TO_INT64_ROUND_TO_ZERO:
689
        test_a_float32_z_int64(
690
            float32_to_int64_round_to_zero,
691
            syst_float32_to_int64_round_to_zero
692
        );
693
        break;
694
#endif
695
#ifdef SYST_FLOAT32_TO_FLOAT64
696
     case FLOAT32_TO_FLOAT64:
697
        test_a_float32_z_float64(
698
            float32_to_float64, syst_float32_to_float64 );
699
        break;
700
#endif
701
#ifdef SYST_FLOAT32_TO_FLOATX80
702
     case FLOAT32_TO_FLOATX80:
703
        test_a_float32_z_floatx80(
704
            float32_to_floatx80, syst_float32_to_floatx80 );
705
        break;
706
#endif
707
#ifdef SYST_FLOAT32_TO_FLOAT128
708
     case FLOAT32_TO_FLOAT128:
709
        test_a_float32_z_float128(
710
            float32_to_float128, syst_float32_to_float128 );
711
        break;
712
#endif
713
#ifdef SYST_FLOAT32_ROUND_TO_INT
714
     case FLOAT32_ROUND_TO_INT:
715
        test_az_float32( float32_round_to_int, syst_float32_round_to_int );
716
        break;
717
#endif
718
#ifdef SYST_FLOAT32_ADD
719
     case FLOAT32_ADD:
720
        test_abz_float32( float32_add, syst_float32_add );
721
        break;
722
#endif
723
#ifdef SYST_FLOAT32_SUB
724
     case FLOAT32_SUB:
725
        test_abz_float32( float32_sub, syst_float32_sub );
726
        break;
727
#endif
728
#ifdef SYST_FLOAT32_MUL
729
     case FLOAT32_MUL:
730
        test_abz_float32( float32_mul, syst_float32_mul );
731
        break;
732
#endif
733
#ifdef SYST_FLOAT32_DIV
734
     case FLOAT32_DIV:
735
        test_abz_float32( float32_div, syst_float32_div );
736
        break;
737
#endif
738
#ifdef SYST_FLOAT32_REM
739
     case FLOAT32_REM:
740
        test_abz_float32( float32_rem, syst_float32_rem );
741
        break;
742
#endif
743
#ifdef SYST_FLOAT32_SQRT
744
     case FLOAT32_SQRT:
745
        test_az_float32( float32_sqrt, syst_float32_sqrt );
746
        break;
747
#endif
748
#ifdef SYST_FLOAT32_EQ
749
     case FLOAT32_EQ:
750
        test_ab_float32_z_flag( float32_eq, syst_float32_eq );
751
        break;
752
#endif
753
#ifdef SYST_FLOAT32_LE
754
     case FLOAT32_LE:
755
        test_ab_float32_z_flag( float32_le, syst_float32_le );
756
        break;
757
#endif
758
#ifdef SYST_FLOAT32_LT
759
     case FLOAT32_LT:
760
        test_ab_float32_z_flag( float32_lt, syst_float32_lt );
761
        break;
762
#endif
763
#ifdef SYST_FLOAT32_EQ_SIGNALING
764
     case FLOAT32_EQ_SIGNALING:
765
        test_ab_float32_z_flag(
766
            float32_eq_signaling, syst_float32_eq_signaling );
767
        break;
768
#endif
769
#ifdef SYST_FLOAT32_LE_QUIET
770
     case FLOAT32_LE_QUIET:
771
        test_ab_float32_z_flag( float32_le_quiet, syst_float32_le_quiet );
772
        break;
773
#endif
774
#ifdef SYST_FLOAT32_LT_QUIET
775
     case FLOAT32_LT_QUIET:
776
        test_ab_float32_z_flag( float32_lt_quiet, syst_float32_lt_quiet );
777
        break;
778
#endif
779
#ifdef SYST_FLOAT64_TO_INT32
780
     case FLOAT64_TO_INT32:
781
        test_a_float64_z_int32( float64_to_int32, syst_float64_to_int32 );
782
        break;
783
#endif
784
#ifdef SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
785
     case FLOAT64_TO_INT32_ROUND_TO_ZERO:
786
        test_a_float64_z_int32(
787
            float64_to_int32_round_to_zero,
788
            syst_float64_to_int32_round_to_zero
789
        );
790
        break;
791
#endif
792
#ifdef SYST_FLOAT64_TO_INT64
793
     case FLOAT64_TO_INT64:
794
        test_a_float64_z_int64( float64_to_int64, syst_float64_to_int64 );
795
        break;
796
#endif
797
#ifdef SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
798
     case FLOAT64_TO_INT64_ROUND_TO_ZERO:
799
        test_a_float64_z_int64(
800
            float64_to_int64_round_to_zero,
801
            syst_float64_to_int64_round_to_zero
802
        );
803
        break;
804
#endif
805
#ifdef SYST_FLOAT64_TO_FLOAT32
806
     case FLOAT64_TO_FLOAT32:
807
        test_a_float64_z_float32(
808
            float64_to_float32, syst_float64_to_float32 );
809
        break;
810
#endif
811
#ifdef SYST_FLOAT64_TO_FLOATX80
812
     case FLOAT64_TO_FLOATX80:
813
        test_a_float64_z_floatx80(
814
            float64_to_floatx80, syst_float64_to_floatx80 );
815
        break;
816
#endif
817
#ifdef SYST_FLOAT64_TO_FLOAT128
818
     case FLOAT64_TO_FLOAT128:
819
        test_a_float64_z_float128(
820
            float64_to_float128, syst_float64_to_float128 );
821
        break;
822
#endif
823
#ifdef SYST_FLOAT64_ROUND_TO_INT
824
     case FLOAT64_ROUND_TO_INT:
825
        test_az_float64( float64_round_to_int, syst_float64_round_to_int );
826
        break;
827
#endif
828
#ifdef SYST_FLOAT64_ADD
829
     case FLOAT64_ADD:
830
        test_abz_float64( float64_add, syst_float64_add );
831
        break;
832
#endif
833
#ifdef SYST_FLOAT64_SUB
834
     case FLOAT64_SUB:
835
        test_abz_float64( float64_sub, syst_float64_sub );
836
        break;
837
#endif
838
#ifdef SYST_FLOAT64_MUL
839
     case FLOAT64_MUL:
840
        test_abz_float64( float64_mul, syst_float64_mul );
841
        break;
842
#endif
843
#ifdef SYST_FLOAT64_DIV
844
     case FLOAT64_DIV:
845
        test_abz_float64( float64_div, syst_float64_div );
846
        break;
847
#endif
848
#ifdef SYST_FLOAT64_REM
849
     case FLOAT64_REM:
850
        test_abz_float64( float64_rem, syst_float64_rem );
851
        break;
852
#endif
853
#ifdef SYST_FLOAT64_SQRT
854
     case FLOAT64_SQRT:
855
        test_az_float64( float64_sqrt, syst_float64_sqrt );
856
        break;
857
#endif
858
#ifdef SYST_FLOAT64_EQ
859
     case FLOAT64_EQ:
860
        test_ab_float64_z_flag( float64_eq, syst_float64_eq );
861
        break;
862
#endif
863
#ifdef SYST_FLOAT64_LE
864
     case FLOAT64_LE:
865
        test_ab_float64_z_flag( float64_le, syst_float64_le );
866
        break;
867
#endif
868
#ifdef SYST_FLOAT64_LT
869
     case FLOAT64_LT:
870
        test_ab_float64_z_flag( float64_lt, syst_float64_lt );
871
        break;
872
#endif
873
#ifdef SYST_FLOAT64_EQ_SIGNALING
874
     case FLOAT64_EQ_SIGNALING:
875
        test_ab_float64_z_flag(
876
            float64_eq_signaling, syst_float64_eq_signaling );
877
        break;
878
#endif
879
#ifdef SYST_FLOAT64_LE_QUIET
880
     case FLOAT64_LE_QUIET:
881
        test_ab_float64_z_flag( float64_le_quiet, syst_float64_le_quiet );
882
        break;
883
#endif
884
#ifdef SYST_FLOAT64_LT_QUIET
885
     case FLOAT64_LT_QUIET:
886
        test_ab_float64_z_flag( float64_lt_quiet, syst_float64_lt_quiet );
887
        break;
888
#endif
889
#ifdef SYST_FLOATX80_TO_INT32
890
     case FLOATX80_TO_INT32:
891
        test_a_floatx80_z_int32( floatx80_to_int32, syst_floatx80_to_int32 );
892
        break;
893
#endif
894
#ifdef SYST_FLOATX80_TO_INT32_ROUND_TO_ZERO
895
     case FLOATX80_TO_INT32_ROUND_TO_ZERO:
896
        test_a_floatx80_z_int32(
897
            floatx80_to_int32_round_to_zero,
898
            syst_floatx80_to_int32_round_to_zero
899
        );
900
        break;
901
#endif
902
#ifdef SYST_FLOATX80_TO_INT64
903
     case FLOATX80_TO_INT64:
904
        test_a_floatx80_z_int64( floatx80_to_int64, syst_floatx80_to_int64 );
905
        break;
906
#endif
907
#ifdef SYST_FLOATX80_TO_INT64_ROUND_TO_ZERO
908
     case FLOATX80_TO_INT64_ROUND_TO_ZERO:
909
        test_a_floatx80_z_int64(
910
            floatx80_to_int64_round_to_zero,
911
            syst_floatx80_to_int64_round_to_zero
912
        );
913
        break;
914
#endif
915
#ifdef SYST_FLOATX80_TO_FLOAT32
916
     case FLOATX80_TO_FLOAT32:
917
        test_a_floatx80_z_float32(
918
            floatx80_to_float32, syst_floatx80_to_float32 );
919
        break;
920
#endif
921
#ifdef SYST_FLOATX80_TO_FLOAT64
922
     case FLOATX80_TO_FLOAT64:
923
        test_a_floatx80_z_float64(
924
            floatx80_to_float64, syst_floatx80_to_float64 );
925
        break;
926
#endif
927
#ifdef SYST_FLOATX80_TO_FLOAT128
928
     case FLOATX80_TO_FLOAT128:
929
        test_a_floatx80_z_float128(
930
            floatx80_to_float128, syst_floatx80_to_float128 );
931
        break;
932
#endif
933
#ifdef SYST_FLOATX80_ROUND_TO_INT
934
     case FLOATX80_ROUND_TO_INT:
935
        test_az_floatx80( floatx80_round_to_int, syst_floatx80_round_to_int );
936
        break;
937
#endif
938
#ifdef SYST_FLOATX80_ADD
939
     case FLOATX80_ADD:
940
        test_abz_floatx80( floatx80_add, syst_floatx80_add );
941
        break;
942
#endif
943
#ifdef SYST_FLOATX80_SUB
944
     case FLOATX80_SUB:
945
        test_abz_floatx80( floatx80_sub, syst_floatx80_sub );
946
        break;
947
#endif
948
#ifdef SYST_FLOATX80_MUL
949
     case FLOATX80_MUL:
950
        test_abz_floatx80( floatx80_mul, syst_floatx80_mul );
951
        break;
952
#endif
953
#ifdef SYST_FLOATX80_DIV
954
     case FLOATX80_DIV:
955
        test_abz_floatx80( floatx80_div, syst_floatx80_div );
956
        break;
957
#endif
958
#ifdef SYST_FLOATX80_REM
959
     case FLOATX80_REM:
960
        test_abz_floatx80( floatx80_rem, syst_floatx80_rem );
961
        break;
962
#endif
963
#ifdef SYST_FLOATX80_SQRT
964
     case FLOATX80_SQRT:
965
        test_az_floatx80( floatx80_sqrt, syst_floatx80_sqrt );
966
        break;
967
#endif
968
#ifdef SYST_FLOATX80_EQ
969
     case FLOATX80_EQ:
970
        test_ab_floatx80_z_flag( floatx80_eq, syst_floatx80_eq );
971
        break;
972
#endif
973
#ifdef SYST_FLOATX80_LE
974
     case FLOATX80_LE:
975
        test_ab_floatx80_z_flag( floatx80_le, syst_floatx80_le );
976
        break;
977
#endif
978
#ifdef SYST_FLOATX80_LT
979
     case FLOATX80_LT:
980
        test_ab_floatx80_z_flag( floatx80_lt, syst_floatx80_lt );
981
        break;
982
#endif
983
#ifdef SYST_FLOATX80_EQ_SIGNALING
984
     case FLOATX80_EQ_SIGNALING:
985
        test_ab_floatx80_z_flag(
986
            floatx80_eq_signaling, syst_floatx80_eq_signaling );
987
        break;
988
#endif
989
#ifdef SYST_FLOATX80_LE_QUIET
990
     case FLOATX80_LE_QUIET:
991
        test_ab_floatx80_z_flag( floatx80_le_quiet, syst_floatx80_le_quiet );
992
        break;
993
#endif
994
#ifdef SYST_FLOATX80_LT_QUIET
995
     case FLOATX80_LT_QUIET:
996
        test_ab_floatx80_z_flag( floatx80_lt_quiet, syst_floatx80_lt_quiet );
997
        break;
998
#endif
999
#ifdef SYST_FLOAT128_TO_INT32
1000
     case FLOAT128_TO_INT32:
1001
        test_a_float128_z_int32( float128_to_int32, syst_float128_to_int32 );
1002
        break;
1003
#endif
1004
#ifdef SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
1005
     case FLOAT128_TO_INT32_ROUND_TO_ZERO:
1006
        test_a_float128_z_int32(
1007
            float128_to_int32_round_to_zero,
1008
            syst_float128_to_int32_round_to_zero
1009
        );
1010
        break;
1011
#endif
1012
#ifdef SYST_FLOAT128_TO_INT64
1013
     case FLOAT128_TO_INT64:
1014
        test_a_float128_z_int64( float128_to_int64, syst_float128_to_int64 );
1015
        break;
1016
#endif
1017
#ifdef SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
1018
     case FLOAT128_TO_INT64_ROUND_TO_ZERO:
1019
        test_a_float128_z_int64(
1020
            float128_to_int64_round_to_zero,
1021
            syst_float128_to_int64_round_to_zero
1022
        );
1023
        break;
1024
#endif
1025
#ifdef SYST_FLOAT128_TO_FLOAT32
1026
     case FLOAT128_TO_FLOAT32:
1027
        test_a_float128_z_float32(
1028
            float128_to_float32, syst_float128_to_float32 );
1029
        break;
1030
#endif
1031
#ifdef SYST_FLOAT128_TO_FLOAT64
1032
     case FLOAT128_TO_FLOAT64:
1033
        test_a_float128_z_float64(
1034
            float128_to_float64, syst_float128_to_float64 );
1035
        break;
1036
#endif
1037
#ifdef SYST_FLOAT128_TO_FLOATX80
1038
     case FLOAT128_TO_FLOATX80:
1039
        test_a_float128_z_floatx80(
1040
            float128_to_floatx80, syst_float128_to_floatx80 );
1041
        break;
1042
#endif
1043
#ifdef SYST_FLOAT128_ROUND_TO_INT
1044
     case FLOAT128_ROUND_TO_INT:
1045
        test_az_float128( float128_round_to_int, syst_float128_round_to_int );
1046
        break;
1047
#endif
1048
#ifdef SYST_FLOAT128_ADD
1049
     case FLOAT128_ADD:
1050
        test_abz_float128( float128_add, syst_float128_add );
1051
        break;
1052
#endif
1053
#ifdef SYST_FLOAT128_SUB
1054
     case FLOAT128_SUB:
1055
        test_abz_float128( float128_sub, syst_float128_sub );
1056
        break;
1057
#endif
1058
#ifdef SYST_FLOAT128_MUL
1059
     case FLOAT128_MUL:
1060
        test_abz_float128( float128_mul, syst_float128_mul );
1061
        break;
1062
#endif
1063
#ifdef SYST_FLOAT128_DIV
1064
     case FLOAT128_DIV:
1065
        test_abz_float128( float128_div, syst_float128_div );
1066
        break;
1067
#endif
1068
#ifdef SYST_FLOAT128_REM
1069
     case FLOAT128_REM:
1070
        test_abz_float128( float128_rem, syst_float128_rem );
1071
        break;
1072
#endif
1073
#ifdef SYST_FLOAT128_SQRT
1074
     case FLOAT128_SQRT:
1075
        test_az_float128( float128_sqrt, syst_float128_sqrt );
1076
        break;
1077
#endif
1078
#ifdef SYST_FLOAT128_EQ
1079
     case FLOAT128_EQ:
1080
        test_ab_float128_z_flag( float128_eq, syst_float128_eq );
1081
        break;
1082
#endif
1083
#ifdef SYST_FLOAT128_LE
1084
     case FLOAT128_LE:
1085
        test_ab_float128_z_flag( float128_le, syst_float128_le );
1086
        break;
1087
#endif
1088
#ifdef SYST_FLOAT128_LT
1089
     case FLOAT128_LT:
1090
        test_ab_float128_z_flag( float128_lt, syst_float128_lt );
1091
        break;
1092
#endif
1093
#ifdef SYST_FLOAT128_EQ_SIGNALING
1094
     case FLOAT128_EQ_SIGNALING:
1095
        test_ab_float128_z_flag(
1096
            float128_eq_signaling, syst_float128_eq_signaling );
1097
        break;
1098
#endif
1099
#ifdef SYST_FLOAT128_LE_QUIET
1100
     case FLOAT128_LE_QUIET:
1101
        test_ab_float128_z_flag( float128_le_quiet, syst_float128_le_quiet );
1102
        break;
1103
#endif
1104
#ifdef SYST_FLOAT128_LT_QUIET
1105
     case FLOAT128_LT_QUIET:
1106
        test_ab_float128_z_flag( float128_lt_quiet, syst_float128_lt_quiet );
1107
        break;
1108
#endif
1109
    }
1110
    if ( ( errorStop && anyErrors ) || stop ) exitWithStatus();
1111
 
1112
}
1113
 
1114
void
1115
testFunction(
1116
             uint8 functionCode, int8 roundingPrecisionIn, int8 roundingModeIn )
1117
{
1118
  int8 roundingPrecision, roundingMode;
1119
 
1120
  roundingPrecision = 32;
1121
  for (;;) {
1122
 
1123
    if ( ! functions[ functionCode ].roundingPrecision ) {
1124
      roundingPrecision = 0;
1125
    }
1126
    else if ( roundingPrecisionIn ) {
1127
      roundingPrecision = roundingPrecisionIn;
1128
    }
1129
 
1130
    for ( roundingMode = 1;
1131
          roundingMode < NUM_ROUNDINGMODES;
1132
          ++roundingMode
1133
          )
1134
      {
1135
        if ( ! functions[ functionCode ].roundingMode ) {
1136
          roundingMode = 0;
1137
        }
1138
        else if ( roundingModeIn ) {
1139
          roundingMode = roundingModeIn;
1140
        }
1141
        testFunctionVariety(
1142
                            functionCode, roundingPrecision, roundingMode );
1143
 
1144
        if ( roundingModeIn || ! roundingMode )
1145
          break;
1146
      }
1147
 
1148
    if ( roundingPrecisionIn || ! roundingPrecision )
1149
      break;
1150
 
1151
    if ( roundingPrecision == 80 ) {
1152
      break;
1153
    }
1154
    else if ( roundingPrecision == 64 ) {
1155
      roundingPrecision = 80;
1156
    }
1157
    else if ( roundingPrecision == 32 ) {
1158
      roundingPrecision = 64;
1159
    }
1160
  }
1161
}
1162
 

powered by: WebSVN 2.1.0

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