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

Subversion Repositories ft816float

[/] [ft816float/] [trunk/] [rtl/] [verilog/] [fp_decomp.v] - Blame information for rev 60

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

Line No. Rev Author Line
1 8 robfinch
`timescale 1ns / 1ps
2
// ============================================================================
3
//        __
4
//   \\__/ o\    (C) 2006-2016  Robert Finch, Waterloo
5
//    \  __ /    All rights reserved.
6
//     \/_//     robfinch<remove>@finitron.ca
7
//       ||
8
//
9
//      fp_decomp.v
10
//    - decompose floating point value
11
//    - parameterized width
12
//
13
//
14
// This source file is free software: you can redistribute it and/or modify 
15
// it under the terms of the GNU Lesser General Public License as published 
16
// by the Free Software Foundation, either version 3 of the License, or     
17
// (at your option) any later version.                                      
18
//                                                                          
19
// This source file is distributed in the hope that it will be useful,      
20
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
21
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
22
// GNU General Public License for more details.                             
23
//                                                                          
24
// You should have received a copy of the GNU General Public License        
25
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
26
//                                                                          
27
// ============================================================================
28
 
29
module fp_decomp(i, sgn, exp, man, fract, xz, mz, vz, inf, xinf, qnan, snan, nan);
30
parameter WID=32;
31 26 robfinch
`include "fpSize.sv"
32 8 robfinch
 
33
input [MSB:0] i;
34
 
35
output sgn;
36
output [EMSB:0] exp;
37
output [FMSB:0] man;
38
output [FMSB+1:0] fract; // mantissa with hidden bit recovered
39
output xz;              // denormalized - exponent is zero
40
output mz;              // mantissa is zero
41
output vz;              // value is zero (both exponent and mantissa are zero)
42
output inf;             // all ones exponent, zero mantissa
43
output xinf;    // all ones exponent
44
output qnan;    // nan
45
output snan;    // signalling nan
46
output nan;
47
 
48
// Decompose input
49
assign sgn = i[MSB];
50
assign exp = i[MSB-1:FMSB+1];
51
assign man = i[FMSB:0];
52
assign xz = !(|exp);    // denormalized - exponent is zero
53
assign mz = !(|man);    // mantissa is zero
54
assign vz = xz & mz;    // value is zero (both exponent and mantissa are zero)
55
assign inf = &exp & mz; // all ones exponent, zero mantissa
56
assign xinf = &exp;
57
assign qnan = &exp &  man[FMSB];
58
assign snan = &exp & !man[FMSB] & !mz;
59
assign nan = &exp & !mz;
60
assign fract = {!xz,i[FMSB:0]};
61
 
62
endmodule
63
 
64
 

powered by: WebSVN 2.1.0

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