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

Subversion Repositories ft816float

[/] [ft816float/] [trunk/] [rtl/] [verilog2/] [DFP32To96.sv] - Blame information for rev 88

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 88 robfinch
`timescale 1ns / 1ps
2
// ============================================================================
3
//        __
4
//   \\__/ o\    (C) 2006-2022  Robert Finch, Waterloo
5
//    \  __ /    All rights reserved.
6
//     \/_//     robfinch@finitron.ca
7
//       ||
8
//
9
//      DFP32To96.sv
10
//    - decimal floating convert single to triple
11
//
12
//
13
// BSD 3-Clause License
14
// Redistribution and use in source and binary forms, with or without
15
// modification, are permitted provided that the following conditions are met:
16
//
17
// 1. Redistributions of source code must retain the above copyright notice, this
18
//    list of conditions and the following disclaimer.
19
//
20
// 2. Redistributions in binary form must reproduce the above copyright notice,
21
//    this list of conditions and the following disclaimer in the documentation
22
//    and/or other materials provided with the distribution.
23
//
24
// 3. Neither the name of the copyright holder nor the names of its
25
//    contributors may be used to endorse or promote products derived from
26
//    this software without specific prior written permission.
27
//
28
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
32
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
34
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
//
39
// ============================================================================
40
 
41
import DFPPkg::*;
42
 
43
module DFP32To96(i, o);
44
input DFP32 i;
45
output DFP96 o;
46
 
47
wire [11:0] bias96 = 12'h5FF;
48
wire [ 7:0] bias32 = 8'h5F;
49
 
50
DFP32U iu;
51
DFP96U ou;
52
 
53
DFPUnpack32 u1 (i, iu);
54
 
55
always_comb
56
        ou.sign = iu.sign;
57
always_comb
58
        if (iu.infinity|iu.nan)
59
                ou.exp = 12'hBFF;
60
        else
61
                ou.exp = bias96 + (iu.exp - bias32);
62
always_comb
63
        ou.infinity = iu.infinity;
64
always_comb
65
        ou.nan = iu.nan;
66
always_comb
67
        ou.qnan = iu.qnan;
68
always_comb
69
        ou.snan = iu.snan;
70
always_comb]
71
        ou.sig = {iu.sig,72'd0};
72
 
73
DFPPack96 u2 (ou, o);
74
 
75
endmodule

powered by: WebSVN 2.1.0

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