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

Subversion Repositories fpu

[/] [fpu/] [trunk/] [test_bench/] [sel_test.vh] - Blame information for rev 5

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

Line No. Rev Author Line
1 2 rudi
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  FPU                                                        ////
4
////  Floating Point Unit (Single precision)                     ////
5
////                                                             ////
6
////  TEST BENCH                                                 ////
7
////                                                             ////
8
////  Author: Rudolf Usselmann                                   ////
9
////          russelmann@hotmail.com                             ////
10
////                                                             ////
11
/////////////////////////////////////////////////////////////////////
12
////                                                             ////
13
//// Copyright (C) 2000 Rudolf Usselmann                         ////
14
////                    russelmann@hotmail.com                   ////
15
////                                                             ////
16
//// This source file may be used and distributed without        ////
17
//// restriction provided that this copyright statement is not   ////
18
//// removed from the file and that any derivative work contains ////
19
//// the original copyright notice and the associated disclaimer.////
20
////                                                             ////
21
//// THIS SOURCE FILE IS PROVIDED "AS IS" AND WITHOUT ANY        ////
22
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT           ////
23
//// LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND   ////
24
//// FITNESS FOR A PARTICULAR PURPOSE.                           ////
25
////                                                             ////
26
/////////////////////////////////////////////////////////////////////
27
 
28
 
29
 
30
        if(fp_combo)
31
           begin
32
                $display("\n\nTesting FPU \n");
33
 
34
                        $display("\nRunning Combo Test 1 ...\n");
35
                        $readmemh ("test_vectors/combo/fpu_combo1.hex", tmem);
36
                        run_test;
37
 
38
                        $display("\nRunning Combo Test 2 ...\n");
39
                        $readmemh ("test_vectors/combo/fpu_combo2.hex", tmem);
40
                        run_test;
41
 
42 5 rudi
                        $display("\nRunning Combo Test 3 ...\n");
43
                        $readmemh ("test_vectors/combo/fpu_combo3.hex", tmem);
44
                        run_test;
45
 
46
                        $display("\nRunning Combo Test 4 ...\n");
47
                        $readmemh ("test_vectors/combo/fpu_combo4.hex", tmem);
48
                        run_test;
49
 
50 2 rudi
           end
51
 
52
        if(fp_fasu)
53
        begin
54
        $display("\n\nTesting FP Add/Sub Unit\n");
55
        if(test_rmode[0])
56
           begin
57
                $display("\n+++++ ROUNDING MODE: Nearest Even\n\n");
58
 
59
                if(test_sel[0])
60
                   begin
61
                        $display("\nRunning Pat 0 Add Test ...\n");
62
                        $readmemh ("test_vectors/rtne/fasu_pat0a.hex", tmem);
63
                        run_test;
64
                   end
65
 
66
                if(test_sel[0])
67
                   begin
68
                        $display("\nRunning Pat 0 Sub Test ...\n");
69
                        $readmemh ("test_vectors/rtne/fasu_pat0b.hex", tmem);
70
                        run_test;
71
                   end
72
 
73
                if(test_sel[1])
74
                   begin
75
                        $display("\nRunning Pat 1 Add Test ...\n");
76
                        $readmemh ("test_vectors/rtne/fasu_pat1a.hex", tmem);
77
                        run_test;
78
                   end
79
 
80
                if(test_sel[1])
81
                   begin
82
                        $display("\nRunning Pat 1 Sub Test ...\n");
83
                        $readmemh ("test_vectors/rtne/fasu_pat1b.hex", tmem);
84
                        run_test;
85
                   end
86
 
87
                if(test_sel[2])
88
                   begin
89
                        $display("\nRunning Pat 2 Add Test ...\n");
90
                        $readmemh ("test_vectors/rtne/fasu_pat2a.hex", tmem);
91
                        run_test;
92
                   end
93
 
94
                if(test_sel[2])
95
                   begin
96
                        $display("\nRunning Pat 2 Sub Test ...\n");
97
                        $readmemh ("test_vectors/rtne/fasu_pat2b.hex", tmem);
98
                        run_test;
99
                   end
100
 
101
                if(test_sel[3])
102
                   begin
103
                        $display("\nRunning Random Lg. Num Add Test ...\n");
104
                        $readmemh ("test_vectors/rtne/fasu_lga.hex", tmem);
105
                        run_test;
106
                   end
107
 
108
                if(test_sel[3])
109
                   begin
110
                        $display("\nRunning Random Lg. Num Sub Test ...\n");
111
                        $readmemh ("test_vectors/rtne/fasu_lgb.hex", tmem);
112
                        run_test;
113
                   end
114
 
115
                if(test_sel[4])
116
                   begin
117
                        $display("\nRunning Random Sm. Num Add Test ...\n");
118
                        $readmemh ("test_vectors/rtne/fasu_sma.hex", tmem);
119
                        run_test;
120
                   end
121
 
122
                if(test_sel[4])
123
                   begin
124
                        $display("\nRunning Random Sm. Num Sub Test ...\n");
125
                        $readmemh ("test_vectors/rtne/fasu_smb.hex", tmem);
126
                        run_test;
127
                   end
128
           end
129
 
130
 
131
        if(test_rmode[1])
132
           begin
133
                $display("\n\n+++++ ROUNDING MODE: Towards Zero\n\n");
134
 
135
                if(test_sel[0])
136
                   begin
137
                        $display("\nRunning Pat 0 Add Test ...\n");
138
                        $readmemh ("test_vectors/rtzero/fasu_pat0a.hex", tmem);
139
                        run_test;
140
                   end
141
 
142
                if(test_sel[0])
143
                   begin
144
                        $display("\nRunning Pat 0 Sub Test ...\n");
145
                        $readmemh ("test_vectors/rtzero/fasu_pat0b.hex", tmem);
146
                        run_test;
147
                   end
148
 
149
                if(test_sel[1])
150
                   begin
151
                        $display("\nRunning Pat 1 Add Test ...\n");
152
                        $readmemh ("test_vectors/rtzero/fasu_pat1a.hex", tmem);
153
                        run_test;
154
                   end
155
 
156
                if(test_sel[1])
157
                   begin
158
                        $display("\nRunning Pat 1 Sub Test ...\n");
159
                        $readmemh ("test_vectors/rtzero/fasu_pat1b.hex", tmem);
160
                        run_test;
161
                   end
162
 
163
                if(test_sel[2])
164
                   begin
165
                        $display("\nRunning Pat 2 Add Test ...\n");
166
                        $readmemh ("test_vectors/rtzero/fasu_pat2a.hex", tmem);
167
                        run_test;
168
                   end
169
 
170
                if(test_sel[2])
171
                   begin
172
                        $display("\nRunning Pat 2 Sub Test ...\n");
173
                        $readmemh ("test_vectors/rtzero/fasu_pat2b.hex", tmem);
174
                        run_test;
175
                   end
176
 
177
                if(test_sel[3])
178
                   begin
179
                        $display("\nRunning Random Lg. Num Add Test ...\n");
180
                        $readmemh ("test_vectors/rtzero/fasu_lga.hex", tmem);
181
                        run_test;
182
                   end
183
 
184
                if(test_sel[3])
185
                   begin
186
                        $display("\nRunning Random Lg. Num Sub Test ...\n");
187
                        $readmemh ("test_vectors/rtzero/fasu_lgb.hex", tmem);
188
                        run_test;
189
                   end
190
 
191
                if(test_sel[4])
192
                   begin
193
                        $display("\nRunning Random Sm. Num Add Test ...\n");
194
                        $readmemh ("test_vectors/rtzero/fasu_sma.hex", tmem);
195
                        run_test;
196
                   end
197
 
198
                if(test_sel[4])
199
                   begin
200
                        $display("\nRunning Random Sm. Num Sub Test ...\n");
201
                        $readmemh ("test_vectors/rtzero/fasu_smb.hex", tmem);
202
                        run_test;
203
                   end
204
           end
205
 
206
        if(test_rmode[2])
207
           begin
208
                $display("\n\n+++++ ROUNDING MODE: Towards INF+ (UP)\n\n");
209
 
210
                if(test_sel[0])
211
                   begin
212
                        $display("\nRunning Pat 0 Add Test ...\n");
213
                        $readmemh ("test_vectors/rup/fasu_pat0a.hex", tmem);
214
                        run_test;
215
                   end
216
 
217
                if(test_sel[0])
218
                   begin
219
                        $display("\nRunning Pat 0 Sub Test ...\n");
220
                        $readmemh ("test_vectors/rup/fasu_pat0b.hex", tmem);
221
                        run_test;
222
                   end
223
 
224
                if(test_sel[1])
225
                   begin
226
                        $display("\nRunning Pat 1 Add Test ...\n");
227
                        $readmemh ("test_vectors/rup/fasu_pat1a.hex", tmem);
228
                        run_test;
229
                   end
230
 
231
                if(test_sel[1])
232
                   begin
233
                        $display("\nRunning Pat 1 Sub Test ...\n");
234
                        $readmemh ("test_vectors/rup/fasu_pat1b.hex", tmem);
235
                        run_test;
236
                   end
237
 
238
                if(test_sel[2])
239
                   begin
240
                        $display("\nRunning Pat 2 Add Test ...\n");
241
                        $readmemh ("test_vectors/rup/fasu_pat2a.hex", tmem);
242
                        run_test;
243
                   end
244
 
245
                if(test_sel[2])
246
                   begin
247
                        $display("\nRunning Pat 2 Sub Test ...\n");
248
                        $readmemh ("test_vectors/rup/fasu_pat2b.hex", tmem);
249
                        run_test;
250
                   end
251
 
252
                if(test_sel[3])
253
                   begin
254
                        $display("\nRunning Random Lg. Num Add Test ...\n");
255
                        $readmemh ("test_vectors/rup/fasu_lga.hex", tmem);
256
                        run_test;
257
                   end
258
 
259
                if(test_sel[3])
260
                   begin
261
                        $display("\nRunning Random Lg. Num Sub Test ...\n");
262
                        $readmemh ("test_vectors/rup/fasu_lgb.hex", tmem);
263
                        run_test;
264
                   end
265
 
266
                if(test_sel[4])
267
                   begin
268
                        $display("\nRunning Random Sm. Num Add Test ...\n");
269
                        $readmemh ("test_vectors/rup/fasu_sma.hex", tmem);
270
                        run_test;
271
                   end
272
 
273
                if(test_sel[4])
274
                   begin
275
                        $display("\nRunning Random Sm. Num Sub Test ...\n");
276
                        $readmemh ("test_vectors/rup/fasu_smb.hex", tmem);
277
                        run_test;
278
                   end
279
           end
280
 
281
        if(test_rmode[3])
282
           begin
283
                $display("\n\n+++++ ROUNDING MODE: Towards INF- (DOWN)\n\n");
284
 
285
                if(test_sel[0])
286
                   begin
287
                        $display("\nRunning Pat 0 Add Test ...\n");
288
                        $readmemh ("test_vectors/rdown/fasu_pat0a.hex", tmem);
289
                        run_test;
290
                   end
291
 
292
                if(test_sel[0])
293
                   begin
294
                        $display("\nRunning Pat 0 Sub Test ...\n");
295
                        $readmemh ("test_vectors/rdown/fasu_pat0b.hex", tmem);
296
                        run_test;
297
                   end
298
 
299
                if(test_sel[1])
300
                   begin
301
                        $display("\nRunning Pat 1 Add Test ...\n");
302
                        $readmemh ("test_vectors/rdown/fasu_pat1a.hex", tmem);
303
                        run_test;
304
                   end
305
 
306
                if(test_sel[1])
307
                   begin
308
                        $display("\nRunning Pat 1 Sub Test ...\n");
309
                        $readmemh ("test_vectors/rdown/fasu_pat1b.hex", tmem);
310
                        run_test;
311
                   end
312
 
313
                if(test_sel[2])
314
                   begin
315
                        $display("\nRunning Pat 2 Add Test ...\n");
316
                        $readmemh ("test_vectors/rdown/fasu_pat2a.hex", tmem);
317
                        run_test;
318
                   end
319
 
320
                if(test_sel[2])
321
                   begin
322
                        $display("\nRunning Pat 2 Sub Test ...\n");
323
                        $readmemh ("test_vectors/rdown/fasu_pat2b.hex", tmem);
324
                        run_test;
325
                   end
326
 
327
                if(test_sel[3])
328
                   begin
329
                        $display("\nRunning Random Lg. Num Add Test ...\n");
330
                        $readmemh ("test_vectors/rdown/fasu_lga.hex", tmem);
331
                        run_test;
332
                   end
333
 
334
                if(test_sel[3])
335
                   begin
336
                        $display("\nRunning Random Lg. Num Sub Test ...\n");
337
                        $readmemh ("test_vectors/rdown/fasu_lgb.hex", tmem);
338
                        run_test;
339
                   end
340
 
341
                if(test_sel[4])
342
                   begin
343
                        $display("\nRunning Random Sm. Num Add Test ...\n");
344
                        $readmemh ("test_vectors/rdown/fasu_sma.hex", tmem);
345
                        run_test;
346
                   end
347
 
348
                if(test_sel[4])
349
                   begin
350
                        $display("\nRunning Random Sm. Num Sub Test ...\n");
351
                        $readmemh ("test_vectors/rdown/fasu_smb.hex", tmem);
352
                        run_test;
353
                   end
354
           end
355
        end
356
 
357
        if(fp_mul)
358
        begin
359
 
360
        $display("\n\nTesting FP MUL Unit\n");
361
 
362
        if(test_rmode[0])
363
           begin
364
                $display("\n+++++ ROUNDING MODE: Nearest Even\n\n");
365
 
366
                if(test_sel[0])
367
                   begin
368
                        $display("\nRunning Pat 0 Test ...\n");
369
                        $readmemh ("test_vectors/rtne/fmul_pat0.hex", tmem);
370
                        run_test;
371
                   end
372
 
373
                if(test_sel[1])
374
                   begin
375
                        $display("\nRunning Pat 1 Test ...\n");
376
                        $readmemh ("test_vectors/rtne/fmul_pat1.hex", tmem);
377
                        run_test;
378
                   end
379
 
380
                if(test_sel[2])
381
                   begin
382
                        $display("\nRunning Pat 2 Test ...\n");
383
                        $readmemh ("test_vectors/rtne/fmul_pat2.hex", tmem);
384
                        run_test;
385
                   end
386
 
387
                if(test_sel[3])
388
                   begin
389
                        $display("\nRunning Random Lg. Num Test ...\n");
390
                        $readmemh ("test_vectors/rtne/fmul_lg.hex", tmem);
391
                        run_test;
392
                   end
393
 
394
                if(test_sel[4])
395
                   begin
396
                        $display("\nRunning Random Sm. Num Test ...\n");
397
                        $readmemh ("test_vectors/rtne/fmul_sm.hex", tmem);
398
                        run_test;
399
                   end
400
           end
401
 
402
        if(test_rmode[1])
403
           begin
404
                $display("\n\n+++++ ROUNDING MODE: Towards Zero\n\n");
405
 
406
                if(test_sel[0])
407
                   begin
408
                        $display("\nRunning Pat 0 Test ...\n");
409
                        $readmemh ("test_vectors/rtzero/fmul_pat0.hex", tmem);
410
                        run_test;
411
                   end
412
 
413
                if(test_sel[1])
414
                   begin
415
                        $display("\nRunning Pat 1 Test ...\n");
416
                        $readmemh ("test_vectors/rtzero/fmul_pat1.hex", tmem);
417
                        run_test;
418
                   end
419
 
420
                if(test_sel[2])
421
                   begin
422
                        $display("\nRunning Pat 2 Test ...\n");
423
                        $readmemh ("test_vectors/rtzero/fmul_pat2.hex", tmem);
424
                        run_test;
425
                   end
426
 
427
                if(test_sel[3])
428
                   begin
429
                        $display("\nRunning Random Lg. Num Test ...\n");
430
                        $readmemh ("test_vectors/rtzero/fmul_lg.hex", tmem);
431
                        run_test;
432
                   end
433
 
434
                if(test_sel[4])
435
                   begin
436
                        $display("\nRunning Random Sm. Num Test ...\n");
437
                        $readmemh ("test_vectors/rtzero/fmul_sm.hex", tmem);
438
                        run_test;
439
                   end
440
           end
441
 
442
        if(test_rmode[2])
443
           begin
444
                $display("\n\n+++++ ROUNDING MODE: Towards INF+ (UP)\n\n");
445
 
446
                if(test_sel[0])
447
                   begin
448
                        $display("\nRunning Pat 0 Test ...\n");
449
                        $readmemh ("test_vectors/rup/fmul_pat0.hex", tmem);
450
                        run_test;
451
                   end
452
 
453
                if(test_sel[1])
454
                   begin
455
                        $display("\nRunning Pat 1 Test ...\n");
456
                        $readmemh ("test_vectors/rup/fmul_pat1.hex", tmem);
457
                        run_test;
458
                   end
459
 
460
                if(test_sel[2])
461
                   begin
462
                        $display("\nRunning Pat 2 Test ...\n");
463
                        $readmemh ("test_vectors/rup/fmul_pat2.hex", tmem);
464
                        run_test;
465
                   end
466
 
467
                if(test_sel[3])
468
                   begin
469
                        $display("\nRunning Random Lg. Num Test ...\n");
470
                        $readmemh ("test_vectors/rup/fmul_lg.hex", tmem);
471
                        run_test;
472
                   end
473
 
474
                if(test_sel[4])
475
                   begin
476
                        $display("\nRunning Random Sm. Num Test ...\n");
477
                        $readmemh ("test_vectors/rup/fmul_sm.hex", tmem);
478
                        run_test;
479
                   end
480
 
481
           end
482
 
483
        if(test_rmode[3])
484
           begin
485
                $display("\n\n+++++ ROUNDING MODE: Towards INF- (DOWN)\n\n");
486
 
487
                if(test_sel[0])
488
                   begin
489
                        $display("\nRunning Pat 0 Test ...\n");
490
                        $readmemh ("test_vectors/rdown/fmul_pat0.hex", tmem);
491
                        run_test;
492
                   end
493
 
494
                if(test_sel[1])
495
                   begin
496
                        $display("\nRunning Pat 1 Test ...\n");
497
                        $readmemh ("test_vectors/rdown/fmul_pat1.hex", tmem);
498
                        run_test;
499
                   end
500
 
501
                if(test_sel[2])
502
                   begin
503
                        $display("\nRunning Pat 2 Test ...\n");
504
                        $readmemh ("test_vectors/rdown/fmul_pat2.hex", tmem);
505
                        run_test;
506
                   end
507
 
508
                if(test_sel[3])
509
                   begin
510
                        $display("\nRunning Random Lg. Num Test ...\n");
511
                        $readmemh ("test_vectors/rdown/fmul_lg.hex", tmem);
512
                        run_test;
513
                   end
514
 
515
                if(test_sel[4])
516
                   begin
517
                        $display("\nRunning Random Sm. Num Test ...\n");
518
                        $readmemh ("test_vectors/rdown/fmul_sm.hex", tmem);
519
                        run_test;
520
                   end
521
           end
522
        end
523
 
524
        if(fp_div)
525
        begin
526
 
527
        $display("\n\nTesting FP DIV Unit\n");
528
 
529
        if(test_rmode[0])
530
           begin
531
                $display("\n+++++ ROUNDING MODE: Nearest Even\n\n");
532
 
533
                if(test_sel[0])
534
                   begin
535
                        $display("\nRunning Pat 0 Test ...\n");
536
                        $readmemh ("test_vectors/rtne/fdiv_pat0.hex", tmem);
537
                        run_test;
538
                   end
539
 
540
                if(test_sel[1])
541
                   begin
542
                        $display("\nRunning Pat 1 Test ...\n");
543
                        $readmemh ("test_vectors/rtne/fdiv_pat1.hex", tmem);
544
                        run_test;
545
                   end
546
 
547
                if(test_sel[2])
548
                   begin
549
                        $display("\nRunning Pat 2 Test ...\n");
550
                        $readmemh ("test_vectors/rtne/fdiv_pat2.hex", tmem);
551
                        run_test;
552
                   end
553
 
554
                if(test_sel[3])
555
                   begin
556
                        $display("\nRunning Random Lg. Num Test ...\n");
557
                        $readmemh ("test_vectors/rtne/fdiv_lg.hex", tmem);
558
                        run_test;
559
                   end
560
 
561
                if(test_sel[4])
562
                   begin
563
                        $display("\nRunning Random Sm. Num Test ...\n");
564
                        $readmemh ("test_vectors/rtne/fdiv_sm.hex", tmem);
565
                        run_test;
566
                   end
567
           end
568
 
569
        if(test_rmode[1])
570
           begin
571
                $display("\n\n+++++ ROUNDING MODE: Towards Zero\n\n");
572
 
573
                if(test_sel[0])
574
                   begin
575
                        $display("\nRunning Pat 0 Test ...\n");
576
                        $readmemh ("test_vectors/rtzero/fdiv_pat0.hex", tmem);
577
                        run_test;
578
                   end
579
 
580
                if(test_sel[1])
581
                   begin
582
                        $display("\nRunning Pat 1 Test ...\n");
583
                        $readmemh ("test_vectors/rtzero/fdiv_pat1.hex", tmem);
584
                        run_test;
585
                   end
586
 
587
                if(test_sel[2])
588
                   begin
589
                        $display("\nRunning Pat 2 Test ...\n");
590
                        $readmemh ("test_vectors/rtzero/fdiv_pat2.hex", tmem);
591
                        run_test;
592
                   end
593
 
594
                if(test_sel[3])
595
                   begin
596
                        $display("\nRunning Random Lg. Num Test ...\n");
597
                        $readmemh ("test_vectors/rtzero/fdiv_lg.hex", tmem);
598
                        run_test;
599
                   end
600
 
601
                if(test_sel[4])
602
                   begin
603
                        $display("\nRunning Random Sm. Num Test ...\n");
604
                        $readmemh ("test_vectors/rtzero/fdiv_sm.hex", tmem);
605
                        run_test;
606
                   end
607
           end
608
 
609
        if(test_rmode[2])
610
           begin
611
                $display("\n\n+++++ ROUNDING MODE: Towards INF+ (UP)\n\n");
612
 
613
                if(test_sel[0])
614
                   begin
615
                        $display("\nRunning Pat 0 Test ...\n");
616
                        $readmemh ("test_vectors/rup/fdiv_pat0.hex", tmem);
617
                        run_test;
618
                   end
619
 
620
                if(test_sel[1])
621
                   begin
622
                        $display("\nRunning Pat 1 Test ...\n");
623
                        $readmemh ("test_vectors/rup/fdiv_pat1.hex", tmem);
624
                        run_test;
625
                   end
626
 
627
                if(test_sel[2])
628
                   begin
629
                        $display("\nRunning Pat 2 Test ...\n");
630
                        $readmemh ("test_vectors/rup/fdiv_pat2.hex", tmem);
631
                        run_test;
632
                   end
633
 
634
                if(test_sel[3])
635
                   begin
636
                        $display("\nRunning Random Lg. Num Test ...\n");
637
                        $readmemh ("test_vectors/rup/fdiv_lg.hex", tmem);
638
                        run_test;
639
                   end
640
 
641
                if(test_sel[4])
642
                   begin
643
                        $display("\nRunning Random Sm. Num Test ...\n");
644
                        $readmemh ("test_vectors/rup/fdiv_sm.hex", tmem);
645
                        run_test;
646
                   end
647
 
648
           end
649
 
650
        if(test_rmode[3])
651
           begin
652
                $display("\n\n+++++ ROUNDING MODE: Towards INF- (DOWN)\n\n");
653
 
654
                if(test_sel[0])
655
                   begin
656
                        $display("\nRunning Pat 0 Test ...\n");
657
                        $readmemh ("test_vectors/rdown/fdiv_pat0.hex", tmem);
658
                        run_test;
659
                   end
660
 
661
                if(test_sel[1])
662
                   begin
663
                        $display("\nRunning Pat 1 Test ...\n");
664
                        $readmemh ("test_vectors/rdown/fdiv_pat1.hex", tmem);
665
                        run_test;
666
                   end
667
 
668
                if(test_sel[2])
669
                   begin
670
                        $display("\nRunning Pat 2 Test ...\n");
671
                        $readmemh ("test_vectors/rdown/fdiv_pat2.hex", tmem);
672
                        run_test;
673
                   end
674
 
675
                if(test_sel[3])
676
                   begin
677
                        $display("\nRunning Random Lg. Num Test ...\n");
678
                        $readmemh ("test_vectors/rdown/fdiv_lg.hex", tmem);
679
                        run_test;
680
                   end
681
 
682
                if(test_sel[4])
683
                   begin
684
                        $display("\nRunning Random Sm. Num Test ...\n");
685
                        $readmemh ("test_vectors/rdown/fdiv_sm.hex", tmem);
686
                        run_test;
687
                   end
688
           end
689
        end
690 5 rudi
 
691
 
692
 
693
        if(fp_i2f)
694
        begin
695
 
696
        $display("\n\nTesting FP I2F Unit\n");
697
 
698
        if(test_rmode[0])
699
           begin
700
                $display("\n+++++ ROUNDING MODE: Nearest Even\n\n");
701
 
702
                if(test_sel[0])
703
                   begin
704
                        $display("\nRunning Pat 0 Test ...\n");
705
                        $readmemh ("test_vectors/rtne/i2f_pat0.hex", tmem);
706
                        run_test;
707
                   end
708
 
709
                if(test_sel[1])
710
                   begin
711
                        $display("\nRunning Pat 1 Test ...\n");
712
                        $readmemh ("test_vectors/rtne/i2f_pat1.hex", tmem);
713
                        run_test;
714
                   end
715
 
716
                if(test_sel[2])
717
                   begin
718
                        $display("\nRunning Pat 2 Test ...\n");
719
                        $readmemh ("test_vectors/rtne/i2f_pat2.hex", tmem);
720
                        run_test;
721
                   end
722
 
723
                if(test_sel[3])
724
                   begin
725
                        $display("\nRunning Random Lg. Num Test ...\n");
726
                        $readmemh ("test_vectors/rtne/i2f_lg.hex", tmem);
727
                        run_test;
728
                   end
729
 
730
                if(test_sel[4])
731
                   begin
732
                        $display("\nRunning Random Sm. Num Test ...\n");
733
                        $readmemh ("test_vectors/rtne/i2f_sm.hex", tmem);
734
                        run_test;
735
                   end
736
           end
737
 
738
        if(test_rmode[1])
739
           begin
740
                $display("\n\n+++++ ROUNDING MODE: Towards Zero\n\n");
741
 
742
                if(test_sel[0])
743
                   begin
744
                        $display("\nRunning Pat 0 Test ...\n");
745
                        $readmemh ("test_vectors/rtzero/i2f_pat0.hex", tmem);
746
                        run_test;
747
                   end
748
 
749
                if(test_sel[1])
750
                   begin
751
                        $display("\nRunning Pat 1 Test ...\n");
752
                        $readmemh ("test_vectors/rtzero/i2f_pat1.hex", tmem);
753
                        run_test;
754
                   end
755
 
756
                if(test_sel[2])
757
                   begin
758
                        $display("\nRunning Pat 2 Test ...\n");
759
                        $readmemh ("test_vectors/rtzero/i2f_pat2.hex", tmem);
760
                        run_test;
761
                   end
762
 
763
                if(test_sel[3])
764
                   begin
765
                        $display("\nRunning Random Lg. Num Test ...\n");
766
                        $readmemh ("test_vectors/rtzero/i2f_lg.hex", tmem);
767
                        run_test;
768
                   end
769
 
770
                if(test_sel[4])
771
                   begin
772
                        $display("\nRunning Random Sm. Num Test ...\n");
773
                        $readmemh ("test_vectors/rtzero/i2f_sm.hex", tmem);
774
                        run_test;
775
                   end
776
           end
777
 
778
        if(test_rmode[2])
779
           begin
780
                $display("\n\n+++++ ROUNDING MODE: Towards INF+ (UP)\n\n");
781
 
782
                if(test_sel[0])
783
                   begin
784
                        $display("\nRunning Pat 0 Test ...\n");
785
                        $readmemh ("test_vectors/rup/i2f_pat0.hex", tmem);
786
                        run_test;
787
                   end
788
 
789
                if(test_sel[1])
790
                   begin
791
                        $display("\nRunning Pat 1 Test ...\n");
792
                        $readmemh ("test_vectors/rup/i2f_pat1.hex", tmem);
793
                        run_test;
794
                   end
795
 
796
                if(test_sel[2])
797
                   begin
798
                        $display("\nRunning Pat 2 Test ...\n");
799
                        $readmemh ("test_vectors/rup/i2f_pat2.hex", tmem);
800
                        run_test;
801
                   end
802
 
803
                if(test_sel[3])
804
                   begin
805
                        $display("\nRunning Random Lg. Num Test ...\n");
806
                        $readmemh ("test_vectors/rup/i2f_lg.hex", tmem);
807
                        run_test;
808
                   end
809
 
810
                if(test_sel[4])
811
                   begin
812
                        $display("\nRunning Random Sm. Num Test ...\n");
813
                        $readmemh ("test_vectors/rup/i2f_sm.hex", tmem);
814
                        run_test;
815
                   end
816
 
817
           end
818
 
819
        if(test_rmode[3])
820
           begin
821
                $display("\n\n+++++ ROUNDING MODE: Towards INF- (DOWN)\n\n");
822
 
823
                if(test_sel[0])
824
                   begin
825
                        $display("\nRunning Pat 0 Test ...\n");
826
                        $readmemh ("test_vectors/rdown/i2f_pat0.hex", tmem);
827
                        run_test;
828
                   end
829
 
830
                if(test_sel[1])
831
                   begin
832
                        $display("\nRunning Pat 1 Test ...\n");
833
                        $readmemh ("test_vectors/rdown/i2f_pat1.hex", tmem);
834
                        run_test;
835
                   end
836
 
837
                if(test_sel[2])
838
                   begin
839
                        $display("\nRunning Pat 2 Test ...\n");
840
                        $readmemh ("test_vectors/rdown/i2f_pat2.hex", tmem);
841
                        run_test;
842
                   end
843
 
844
                if(test_sel[3])
845
                   begin
846
                        $display("\nRunning Random Lg. Num Test ...\n");
847
                        $readmemh ("test_vectors/rdown/i2f_lg.hex", tmem);
848
                        run_test;
849
                   end
850
 
851
                if(test_sel[4])
852
                   begin
853
                        $display("\nRunning Random Sm. Num Test ...\n");
854
                        $readmemh ("test_vectors/rdown/i2f_sm.hex", tmem);
855
                        run_test;
856
                   end
857
           end
858
        end
859
 
860
 
861
        if(fp_f2i)
862
        begin
863
 
864
        $display("\n\nTesting FP F2I Unit\n");
865
 
866
        if(test_rmode[0])
867
           begin
868
                $display("\n+++++ ROUNDING MODE: Nearest Even\n\n");
869
 
870
                if(test_sel[0])
871
                   begin
872
                        $display("\nRunning Pat 0 Test ...\n");
873
                        $readmemh ("test_vectors/rtne/f2i_pat0.hex", tmem);
874
                        run_test;
875
                   end
876
 
877
                if(test_sel[1])
878
                   begin
879
                        $display("\nRunning Pat 1 Test ...\n");
880
                        $readmemh ("test_vectors/rtne/f2i_pat1.hex", tmem);
881
                        run_test;
882
                   end
883
 
884
                if(test_sel[2])
885
                   begin
886
                        $display("\nRunning Pat 2 Test ...\n");
887
                        $readmemh ("test_vectors/rtne/f2i_pat2.hex", tmem);
888
                        run_test;
889
                   end
890
 
891
                if(test_sel[3])
892
                   begin
893
                        $display("\nRunning Random Lg. Num Test ...\n");
894
                        $readmemh ("test_vectors/rtne/f2i_lg.hex", tmem);
895
                        run_test;
896
                   end
897
 
898
                if(test_sel[4])
899
                   begin
900
                        $display("\nRunning Random Sm. Num Test ...\n");
901
                        $readmemh ("test_vectors/rtne/f2i_sm.hex", tmem);
902
                        run_test;
903
                   end
904
           end
905
 
906
        if(test_rmode[1])
907
           begin
908
                $display("\n\n+++++ ROUNDING MODE: Towards Zero\n\n");
909
 
910
                if(test_sel[0])
911
                   begin
912
                        $display("\nRunning Pat 0 Test ...\n");
913
                        $readmemh ("test_vectors/rtzero/f2i_pat0.hex", tmem);
914
                        run_test;
915
                   end
916
 
917
                if(test_sel[1])
918
                   begin
919
                        $display("\nRunning Pat 1 Test ...\n");
920
                        $readmemh ("test_vectors/rtzero/f2i_pat1.hex", tmem);
921
                        run_test;
922
                   end
923
 
924
                if(test_sel[2])
925
                   begin
926
                        $display("\nRunning Pat 2 Test ...\n");
927
                        $readmemh ("test_vectors/rtzero/f2i_pat2.hex", tmem);
928
                        run_test;
929
                   end
930
 
931
                if(test_sel[3])
932
                   begin
933
                        $display("\nRunning Random Lg. Num Test ...\n");
934
                        $readmemh ("test_vectors/rtzero/f2i_lg.hex", tmem);
935
                        run_test;
936
                   end
937
 
938
                if(test_sel[4])
939
                   begin
940
                        $display("\nRunning Random Sm. Num Test ...\n");
941
                        $readmemh ("test_vectors/rtzero/f2i_sm.hex", tmem);
942
                        run_test;
943
                   end
944
           end
945
 
946
        if(test_rmode[2])
947
           begin
948
                $display("\n\n+++++ ROUNDING MODE: Towards INF+ (UP)\n\n");
949
 
950
                if(test_sel[0])
951
                   begin
952
                        $display("\nRunning Pat 0 Test ...\n");
953
                        $readmemh ("test_vectors/rup/f2i_pat0.hex", tmem);
954
                        run_test;
955
                   end
956
 
957
                if(test_sel[1])
958
                   begin
959
                        $display("\nRunning Pat 1 Test ...\n");
960
                        $readmemh ("test_vectors/rup/f2i_pat1.hex", tmem);
961
                        run_test;
962
                   end
963
 
964
                if(test_sel[2])
965
                   begin
966
                        $display("\nRunning Pat 2 Test ...\n");
967
                        $readmemh ("test_vectors/rup/f2i_pat2.hex", tmem);
968
                        run_test;
969
                   end
970
 
971
                if(test_sel[3])
972
                   begin
973
                        $display("\nRunning Random Lg. Num Test ...\n");
974
                        $readmemh ("test_vectors/rup/f2i_lg.hex", tmem);
975
                        run_test;
976
                   end
977
 
978
                if(test_sel[4])
979
                   begin
980
                        $display("\nRunning Random Sm. Num Test ...\n");
981
                        $readmemh ("test_vectors/rup/f2i_sm.hex", tmem);
982
                        run_test;
983
                   end
984
 
985
           end
986
 
987
        if(test_rmode[3])
988
           begin
989
                $display("\n\n+++++ ROUNDING MODE: Towards INF- (DOWN)\n\n");
990
 
991
                if(test_sel[0])
992
                   begin
993
                        $display("\nRunning Pat 0 Test ...\n");
994
                        $readmemh ("test_vectors/rdown/f2i_pat0.hex", tmem);
995
                        run_test;
996
                   end
997
 
998
                if(test_sel[1])
999
                   begin
1000
                        $display("\nRunning Pat 1 Test ...\n");
1001
                        $readmemh ("test_vectors/rdown/f2i_pat1.hex", tmem);
1002
                        run_test;
1003
                   end
1004
 
1005
                if(test_sel[2])
1006
                   begin
1007
                        $display("\nRunning Pat 2 Test ...\n");
1008
                        $readmemh ("test_vectors/rdown/f2i_pat2.hex", tmem);
1009
                        run_test;
1010
                   end
1011
 
1012
                if(test_sel[3])
1013
                   begin
1014
                        $display("\nRunning Random Lg. Num Test ...\n");
1015
                        $readmemh ("test_vectors/rdown/f2i_lg.hex", tmem);
1016
                        run_test;
1017
                   end
1018
 
1019
                if(test_sel[4])
1020
                   begin
1021
                        $display("\nRunning Random Sm. Num Test ...\n");
1022
                        $readmemh ("test_vectors/rdown/f2i_sm.hex", tmem);
1023
                        run_test;
1024
                   end
1025
           end
1026
        end

powered by: WebSVN 2.1.0

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