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

Subversion Repositories ft816float

[/] [ft816float/] [trunk/] [test_bench/] [fpFMA_tb.v] - Blame information for rev 23

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

Line No. Rev Author Line
1 22 robfinch
`timescale 1ns / 1ps
2
// ============================================================================
3
//        __
4
//   \\__/ o\    (C) 2019  Robert Finch, Waterloo
5
//    \  __ /    All rights reserved.
6
//     \/_//     robfinch<remove>@finitron.ca
7
//       ||
8
//
9
//      fpFMA_tb.v
10
//              - floating point multiplier - adder test bench
11
//
12
// This source file is free software: you can redistribute it and/or modify 
13
// it under the terms of the GNU Lesser General Public License as published 
14
// by the Free Software Foundation, either version 3 of the License, or     
15
// (at your option) any later version.                                      
16
//                                                                          
17
// This source file is distributed in the hope that it will be useful,      
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
20
// GNU General Public License for more details.                             
21
//                                                                          
22
// You should have received a copy of the GNU General Public License        
23
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
24
//                                                                          
25
//      Floating Point Multiplier / Divider
26
//
27
//      This multiplier/divider handles denormalized numbers.
28
//      The output format is of an internal expanded representation
29
//      in preparation to be fed into a normalization unit, then
30
//      rounding. Basically, it's the same as the regular format
31
//      except the mantissa is doubled in size, the leading two
32
//      bits of which are assumed to be whole bits.
33
//
34
//
35
// ============================================================================
36
 
37
module fpFMA_tb();
38
reg rst;
39
reg clk;
40
reg [12:0] adr;
41
reg [127:0] mem [0:8191];
42
reg [127:0] memo [0:9000];
43
reg [255:0] memd [0:8191];
44
reg [255:0] memdo [0:9000];
45
reg [31:0] a,b,c;
46
wire [31:0] a5,b5,c5;
47
wire [31:0] o;
48
reg [63:0] ad,bd,cd;
49
wire [63:0] ad5,bd5,cd5,ad17,bd17,cd17;
50
wire [63:0] od;
51
reg [4:0] cnt;
52
 
53
initial begin
54
        rst = 1'b0;
55
        clk = 1'b0;
56
        adr = 0;
57
        cnt = 0;
58
//      $readmemh("d:/cores6/rtfItanium/v1/rtl/fpUnit/test_bench/fpFMA_tv.txt", mem);
59
        $readmemh("d:/cores6/rtfItanium/v1/rtl/fpUnit/test_bench/fpFMA_tvd.txt", memd);
60
        #20 rst = 1;
61
        #50 rst = 0;
62
end
63
 
64
always #5
65
        clk = ~clk;
66
 
67
delay5 #(32) u2 (clk, 1'b1, a, a5);
68
delay5 #(32) u3 (clk, 1'b1, b, b5);
69
delay5 #(32) u4 (clk, 1'b1, c, c5);
70
delay5 #(64) u5 (clk, 1'b1, ad, ad5);
71
delay5 #(64) u6 (clk, 1'b1, bd, bd5);
72
delay5 #(64) u7 (clk, 1'b1, cd, cd5);
73
vtdl #(64,32) u8 (clk, 1'b1, 5'd16, ad, ad17);
74
vtdl #(64,32) u9 (clk, 1'b1, 5'd16, bd, bd17);
75
vtdl #(64,32) u10 (clk, 1'b1, 5'd16, cd, cd17);
76
 
77
always @(posedge clk)
78
        cnt <= cnt + 1;
79
 
80
always @(posedge clk)
81
if (rst)
82
        adr = 0;
83
else
84
begin
85
        if (cnt==1)
86
        begin
87
                a <= mem[adr][31: 0];
88
                b <= mem[adr][63:32];
89
                c <= mem[adr][95:64];
90
                ad <= memd[adr][63: 0];
91
                bd <= memd[adr][127:64];
92
                cd <= memd[adr][191:128];
93
        end
94
        if (cnt==31)
95
        begin
96
                adr <= adr + 1;
97
//              memo[adr] <= {o,c17,b17,a17};
98 23 robfinch
//              memdo[adr] <= {od,cd17,bd17,ad17};
99 22 robfinch
                memdo[adr] <= {od,cd,bd,ad};
100
                if (adr==8191) begin
101
                        //$writememh("d:/cores6/rtfItanium/v1/rtl/fpUnit/test_bench/fpFMA_tvo.txt", memo);
102
                        $writememh("d:/cores6/rtfItanium/v1/rtl/fpUnit/test_bench/fpFMA_tvdo.txt", memdo);
103
                        $finish;
104
                end
105
        end
106
end
107
 
108
//fpFMAnr #(32) u1 (clk, 1'b1, a, b, o, 3'b000);//, sign_exe, inf, overflow, underflow);
109
fpFMAnr #(64) u11 (clk, 1'b1, 1'b0, 3'b000, ad, bd, cd, od);//, sign_exe, inf, overflow, underflow);
110
 
111
endmodule

powered by: WebSVN 2.1.0

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