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

Subversion Repositories fpu100

[/] [fpu100/] [branches/] [avendor/] [test_bench/] [SoftFloat/] [softfloat/] [bits32/] [templates/] [softfloat.h] - Blame information for rev 6

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

Line No. Rev Author Line
1 6 jidan
 
2
/*============================================================================
3
 
4
This C header file is part of the SoftFloat IEC/IEEE Floating-point Arithmetic
5
Package, Release 2b.
6
 
7
Written by John R. Hauser.  This work was made possible in part by the
8
International Computer Science Institute, located at Suite 600, 1947 Center
9
Street, Berkeley, California 94704.  Funding was partially provided by the
10
National Science Foundation under grant MIP-9311980.  The original version
11
of this code was written as part of a project to build a fixed-point vector
12
processor in collaboration with the University of California at Berkeley,
13
overseen by Profs. Nelson Morgan and John Wawrzynek.  More information
14
is available through the Web page `http://www.cs.berkeley.edu/~jhauser/
15
arithmetic/SoftFloat.html'.
16
 
17
THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort has
18
been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
19
RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
20
AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES,
21
COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE
22
EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE
23
INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR
24
OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE.
25
 
26
Derivative works are acceptable, even for commercial purposes, so long as
27
(1) the source code for the derivative work includes prominent notice that
28
the work is derivative, and (2) the source code includes prominent notice with
29
these four paragraphs for those parts of this code that are retained.
30
 
31
=============================================================================*/
32
 
33
/*----------------------------------------------------------------------------
34
| Software IEC/IEEE floating-point types.
35
*----------------------------------------------------------------------------*/
36
typedef !!!bits32 float32;
37
typedef struct {
38
    !!!bits32 high, low;
39
} float64;
40
 
41
/*----------------------------------------------------------------------------
42
| Software IEC/IEEE floating-point underflow tininess-detection mode.
43
*----------------------------------------------------------------------------*/
44
extern !!!int8 float_detect_tininess;
45
enum {
46
    float_tininess_after_rounding  = 0,
47
    float_tininess_before_rounding = 1
48
};
49
 
50
/*----------------------------------------------------------------------------
51
| Software IEC/IEEE floating-point rounding mode.
52
*----------------------------------------------------------------------------*/
53
extern !!!int8 float_rounding_mode;
54
enum {
55
    float_round_nearest_even = 0,
56
    float_round_to_zero      = 1,
57
    float_round_down         = 2,
58
    float_round_up           = 3
59
};
60
 
61
/*----------------------------------------------------------------------------
62
| Software IEC/IEEE floating-point exception flags.
63
*----------------------------------------------------------------------------*/
64
extern !!!int8 float_exception_flags;
65
enum {
66
    float_flag_inexact   =  1,
67
    float_flag_underflow =  2,
68
    float_flag_overflow  =  4,
69
    float_flag_divbyzero =  8,
70
    float_flag_invalid   = 16
71
};
72
 
73
/*----------------------------------------------------------------------------
74
| Routine to raise any or all of the software IEC/IEEE floating-point
75
| exception flags.
76
*----------------------------------------------------------------------------*/
77
void float_raise( !!!int8 );
78
 
79
/*----------------------------------------------------------------------------
80
| Software IEC/IEEE integer-to-floating-point conversion routines.
81
*----------------------------------------------------------------------------*/
82
float32 int32_to_float32( !!!int32 );
83
float64 int32_to_float64( !!!int32 );
84
 
85
/*----------------------------------------------------------------------------
86
| Software IEC/IEEE single-precision conversion routines.
87
*----------------------------------------------------------------------------*/
88
!!!int32 float32_to_int32( float32 );
89
!!!int32 float32_to_int32_round_to_zero( float32 );
90
float64 float32_to_float64( float32 );
91
 
92
/*----------------------------------------------------------------------------
93
| Software IEC/IEEE single-precision operations.
94
*----------------------------------------------------------------------------*/
95
float32 float32_round_to_int( float32 );
96
float32 float32_add( float32, float32 );
97
float32 float32_sub( float32, float32 );
98
float32 float32_mul( float32, float32 );
99
float32 float32_div( float32, float32 );
100
float32 float32_rem( float32, float32 );
101
float32 float32_sqrt( float32 );
102
!!!flag float32_eq( float32, float32 );
103
!!!flag float32_le( float32, float32 );
104
!!!flag float32_lt( float32, float32 );
105
!!!flag float32_eq_signaling( float32, float32 );
106
!!!flag float32_le_quiet( float32, float32 );
107
!!!flag float32_lt_quiet( float32, float32 );
108
!!!flag float32_is_signaling_nan( float32 );
109
 
110
/*----------------------------------------------------------------------------
111
| Software IEC/IEEE double-precision conversion routines.
112
*----------------------------------------------------------------------------*/
113
!!!int32 float64_to_int32( float64 );
114
!!!int32 float64_to_int32_round_to_zero( float64 );
115
float32 float64_to_float32( float64 );
116
 
117
/*----------------------------------------------------------------------------
118
| Software IEC/IEEE double-precision operations.
119
*----------------------------------------------------------------------------*/
120
float64 float64_round_to_int( float64 );
121
float64 float64_add( float64, float64 );
122
float64 float64_sub( float64, float64 );
123
float64 float64_mul( float64, float64 );
124
float64 float64_div( float64, float64 );
125
float64 float64_rem( float64, float64 );
126
float64 float64_sqrt( float64 );
127
!!!flag float64_eq( float64, float64 );
128
!!!flag float64_le( float64, float64 );
129
!!!flag float64_lt( float64, float64 );
130
!!!flag float64_eq_signaling( float64, float64 );
131
!!!flag float64_le_quiet( float64, float64 );
132
!!!flag float64_lt_quiet( float64, float64 );
133
!!!flag float64_is_signaling_nan( float64 );
134
 

powered by: WebSVN 2.1.0

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