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

Subversion Repositories ft816float

[/] [ft816float/] [trunk/] [rtl/] [verilog/] [fpMul_tb.v] - Blame information for rev 52

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

Line No. Rev Author Line
1 10 robfinch
`timescale 1ns / 1ps
2
// ============================================================================
3
//        __
4
//   \\__/ o\    (C) 2006-2018  Robert Finch, Waterloo
5
//    \  __ /    All rights reserved.
6
//     \/_//     robfinch<remove>@finitron.ca
7
//       ||
8
//
9
//      fpMul_tb.v
10
//              - floating point multiplier 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 fpMul_tb();
38
reg rst;
39
reg clk;
40
reg [12:0] adr;
41
reg [95:0] mem [0:8191];
42
reg [95:0] memo [0:9000];
43 11 robfinch
reg [191:0] memd [0:8191];
44
reg [191:0] memdo [0:9000];
45
reg [31:0] a,b;
46 10 robfinch
wire [31:0] a5,b5;
47
wire [31:0] o;
48 11 robfinch
reg [63:0] ad,bd;
49
wire [63:0] ad5,bd5;
50
wire [63:0] od;
51 10 robfinch
 
52
initial begin
53
        rst = 1'b0;
54
        clk = 1'b0;
55
        adr = 0;
56
        $readmemh("c:/cores5/ft64/trunk/rtl/fpUnit/fpMul_tv.txt", mem);
57 11 robfinch
        $readmemh("c:/cores5/ft64/trunk/rtl/fpUnit/fpMul_tvd.txt", memd);
58 10 robfinch
        #20 rst = 1;
59
        #50 rst = 0;
60
end
61
 
62
always #5
63
        clk = ~clk;
64
 
65
delay5 #(32) u2 (clk, 1'b1, a, a5);
66
delay5 #(32) u3 (clk, 1'b1, b, b5);
67 11 robfinch
delay5 #(64) u4 (clk, 1'b1, ad, ad5);
68
delay5 #(64) u5 (clk, 1'b1, bd, bd5);
69 10 robfinch
 
70
always @(posedge clk)
71
if (rst)
72
        adr = 0;
73
else
74
begin
75
        adr <= adr + 1;
76
        a <= mem[adr][31: 0];
77
        b <= mem[adr][63:32];
78 11 robfinch
        ad <= memd[adr][63: 0];
79
        bd <= memd[adr][127:64];
80
        if (adr > 5) begin
81 10 robfinch
                memo[adr-6] <= {o,b5,a5};
82 11 robfinch
                memdo[adr-6] <= {od,bd5,ad5};
83
        end
84 10 robfinch
        if (adr==8191) begin
85
                $writememh("c:/cores5/ft64/trunk/rtl/fpUnit/fpMul_tvo.txt", memo);
86 11 robfinch
                $writememh("c:/cores5/ft64/trunk/rtl/fpUnit/fpMul_tvdo.txt", memdo);
87 10 robfinch
                $finish;
88
        end
89
end
90
 
91
fpMulnr #(32) u1 (clk, 1'b1, a, b, o, 3'b000);//, sign_exe, inf, overflow, underflow);
92 11 robfinch
fpMulnr #(64) u6 (clk, 1'b1, ad, bd, od, 3'b000);//, sign_exe, inf, overflow, underflow);
93 10 robfinch
 
94
endmodule

powered by: WebSVN 2.1.0

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