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

Subversion Repositories ft816float

[/] [ft816float/] [trunk/] [rtl/] [verilog2/] [fp.sv] - Blame information for rev 79

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

Line No. Rev Author Line
1 48 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2020  Robert Finch, Waterloo
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch@finitron.ca
6
//       ||
7
//
8
//      fp.sv
9
//
10
// This source file is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published
12
// by the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
14
//
15
// This source file is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
// GNU General Public License for more details.
19
//
20
// You should have received a copy of the GNU General Public License
21
// along with this program.  If not, see .
22
//
23
// ============================================================================
24
//
25
package fp;
26
 
27 49 robfinch
`ifndef FPWID
28
`define FPWID   64
29
`endif
30
 
31 48 robfinch
`define QINFOS          23'h7FC000              // info
32
`define QSUBINF         4'd1
33
`define QINFDIV         4'd2
34
`define QZEROZERO       4'd3
35
`define QINFZERO        4'd4
36
`define QSQRTINF        4'd5
37
`define QSQRTNEG        4'd6
38
 
39
`define QSUBINFS        31'h7FC00001    // - infinity - infinity
40
`define QINFDIVS        31'h7FC00002    // - infinity / infinity
41
`define QZEROZEROS      31'h7FC00003    // - zero / zero
42
`define QINFZEROS       31'h7FC00004    // - infinity X zero
43
`define QSQRTINFS       31'h7FC00005    // - square root of infinity
44
`define QSQRTNEGS       31'h7FC00006    // - square root of negaitve number
45
 
46
`define QINFOD          52'hFF80000000000               // info
47
`define QSUBINFD        63'h7FF0000000000001    // - infinity - infinity
48
`define QINFDIVD        63'h7FF0000000000002    // - infinity / infinity
49
`define QZEROZEROD  63'h7FF0000000000003        // - zero / zero
50
`define QINFZEROD       63'h7FF0000000000004    // - infinity X zero
51
`define QSQRTINFD       63'h7FF0000000000005    // - square root of infinity
52
`define QSQRTNEGD       63'h7FF0000000000006    // - square root of negaitve number
53
 
54
`define QINFODX         64'hFF800000_00000000           // info
55
`define QSUBINFDX       79'h7FFF000000_0000000001       // - infinity - infinity
56
`define QINFDIVDX       79'h7FFF000000_0000000002       // - infinity / infinity
57
`define QZEROZERODX 79'h7FFF000000_0000000003   // - zero / zero
58
`define QINFZERODX      79'h7FFF000000_0000000004       // - infinity X zero
59
`define QSQRTINFDX      79'h7FFF000000_0000000005       // - square root of infinity
60
`define QSQRTNEGDX      79'h7FFF000000_0000000006       // - square root of negaitve number
61
 
62
`define QINFOQ          112'hFF800000_0000000000_0000000000             // info
63
`define QSUBINFQ        127'h7F_FF00000000_0000000000_0000000001        // - infinity - infinity
64
`define QINFDIVQ        127'h7F_FF00000000_0000000000_0000000002        // - infinity / infinity
65
`define QZEROZEROQ  127'h7F_FF00000000_0000000000_0000000003    // - zero / zero
66
`define QINFZEROQ       127'h7F_FF00000000_0000000000_0000000004        // - infinity X zero
67
`define QSQRTINFQ       127'h7F_FF00000000_0000000000_0000000005        // - square root of infinity
68
`define QSQRTNEGQ       127'h7F_FF00000000_0000000000_0000000006        // - square root of negaitve number
69
 
70
`define POINT5S         32'h3F000000
71
`define POINT5SX        40'h3F80000000
72
`define POINT5D         64'h3FE0000000000000
73
`define POINT5DX        80'h3FFE0000000000000000
74
`define ZEROS                   32'h00000000
75
`define ZEROSX          40'h0000000000
76
`define ZEROD                   64'h0000000000000000
77
`define ZERODX          80'h00000000000000000000
78
 
79
`define AIN                     3'd0
80
`define BIN                     3'd1
81
`define CIN                     3'd2
82
`define RES                     3'd3
83
`define POINT5  3'd4
84
`define ZERO            3'd5
85
 
86 49 robfinch
`define SUPPORT_DENORMALS   1'b1
87 48 robfinch
`define MIN_LATENCY             1'b1
88 49 robfinch
 
89
parameter FPWID = `FPWID;
90
 
91 48 robfinch
// This file contains defintions for fields to ease dealing with different fp
92
// widths. Some of the code still needs to be modified to support widths
93
// other than standard 32,64 or 80 bit.
94
localparam MSB = FPWID-1;
95
localparam EMSB = FPWID==128 ? 14 :
96
          FPWID==96 ? 14 :
97
          FPWID==80 ? 14 :
98
          FPWID==64 ? 10 :
99
                                  FPWID==52 ? 10 :
100
                                  FPWID==48 ? 10 :
101
                                  FPWID==44 ? 10 :
102
                                  FPWID==42 ? 10 :
103
                                  FPWID==40 ?  9 :
104
                                  FPWID==32 ?  7 :
105
                                  FPWID==24 ?  6 : 4;
106
localparam FMSB = FPWID==128 ? (111) :
107
          FPWID==96 ? (79) :
108
          FPWID==80 ? (63) :
109
          FPWID==64 ? (51) :
110
                                  FPWID==52 ? (39) :
111
                                  FPWID==48 ? (35) :
112
                                  FPWID==44 ? (31) :
113
                                  FPWID==42 ? (29) :
114
                                  FPWID==40 ? (28) :
115
                                  FPWID==32 ? (22) :
116
                                  FPWID==24 ? (15) : (9);
117
localparam FX = (FMSB+2)*2;     // the MSB of the expanded fraction
118
localparam EX = FX + 1 + EMSB + 1 + 1 - 1;
119
endpackage

powered by: WebSVN 2.1.0

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