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

Subversion Repositories ft816float

[/] [ft816float/] [trunk/] [rtl/] [verilog2/] [DFPDecompose.sv] - Blame information for rev 53

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

Line No. Rev Author Line
1 50 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2020  Robert Finch, Waterloo
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch@finitron.ca
6
//       ||
7
//
8
//      DFPDecompose.sv
9
//
10
// BSD 3-Clause License
11
// Redistribution and use in source and binary forms, with or without
12
// modification, are permitted provided that the following conditions are met:
13
//
14
// 1. Redistributions of source code must retain the above copyright notice, this
15
//    list of conditions and the following disclaimer.
16
//
17
// 2. Redistributions in binary form must reproduce the above copyright notice,
18
//    this list of conditions and the following disclaimer in the documentation
19
//    and/or other materials provided with the distribution.
20
//
21
// 3. Neither the name of the copyright holder nor the names of its
22
//    contributors may be used to endorse or promote products derived from
23
//    this software without specific prior written permission.
24
//
25
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
//
36
// ============================================================================
37
 
38
module DFPDecompose(i, sgn, sx, exp, sig, xz, vz, inf, nan);
39
input [127:0] i;
40
output sgn;
41
output sx;
42
output [15:0] exp;
43 53 robfinch
output [107:0] sig;
44 50 robfinch
output xz;
45
output vz;
46
output inf;
47
output nan;
48
 
49 51 robfinch
assign nan = i[127];
50
assign sgn = i[126];
51
assign inf = i[125];
52
assign sx = i[124];
53
assign exp = i[123:108];
54
assign sig = i[107:0];
55 50 robfinch
assign xz = ~|exp;
56
assign vz = ~|{exp,sig};
57
 
58
endmodule
59
 
60
 
61
module DFPDecomposeReg(clk, ce, i, sgn, sx, exp, sig, xz, vz, inf, nan);
62
input clk;
63
input ce;
64
input [127:0] i;
65
output reg sgn;
66
output reg sx;
67
output reg [15:0] exp;
68 51 robfinch
output reg [107:0] sig;
69 50 robfinch
output reg xz;
70
output reg vz;
71
output reg inf;
72
output reg nan;
73
 
74
always @(posedge clk)
75
        if (ce) begin
76 51 robfinch
                nan <= i[127];
77
                sgn <= i[126];
78
                inf <= i[125];
79
                sx <= i[124];
80
                exp <= i[123:108];
81
                sig <= i[107:0];
82 50 robfinch
                xz <= ~|exp;
83
                vz <= ~|{exp,sig};
84
        end
85
 
86
endmodule

powered by: WebSVN 2.1.0

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