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

Subversion Repositories ft816float

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

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 55 robfinch
parameter N=33;
40
input [(N*4)+16+4-1:0] i;
41 50 robfinch
output sgn;
42
output sx;
43
output [15:0] exp;
44 55 robfinch
output [N*4-1:0] sig;
45 50 robfinch
output xz;
46
output vz;
47
output inf;
48
output nan;
49
 
50 55 robfinch
assign nan = i[N*4+19];
51
assign sgn = i[N*4+18];
52
assign inf = i[N*4+17];
53
assign sx = i[N*4+16];
54
assign exp = i[N*4+15:N*4];
55
assign sig = i[N*4-1:0];
56 50 robfinch
assign xz = ~|exp;
57
assign vz = ~|{exp,sig};
58
 
59
endmodule
60
 
61
 
62
module DFPDecomposeReg(clk, ce, i, sgn, sx, exp, sig, xz, vz, inf, nan);
63 55 robfinch
parameter N=33;
64 50 robfinch
input clk;
65
input ce;
66 55 robfinch
input [N*4+16+4-1:0] i;
67 50 robfinch
output reg sgn;
68
output reg sx;
69
output reg [15:0] exp;
70 55 robfinch
output reg [N*4-1:0] sig;
71 50 robfinch
output reg xz;
72
output reg vz;
73
output reg inf;
74
output reg nan;
75
 
76
always @(posedge clk)
77
        if (ce) begin
78 55 robfinch
                nan <= i[N*4+19];
79
                sgn <= i[N*4+18];
80
                inf <= i[N*4+17];
81
                sx <= i[N*4+16];
82
                exp <= i[N*4+15:N*4];
83
                sig <= i[N*4-1:0];
84 50 robfinch
                xz <= ~|exp;
85
                vz <= ~|{exp,sig};
86
        end
87
 
88
endmodule

powered by: WebSVN 2.1.0

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