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

Subversion Repositories fpu100

[/] [fpu100/] [tags/] [arelease/] [test_bench/] [SoftFloat/] [softfloat/] [bits32/] [386-Win32-GCC/] [softfloat.h] - Blame information for rev 8

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 unsigned int float32;
37
typedef struct {
38
    unsigned int low, high;
39
} float64;
40
 
41
/*----------------------------------------------------------------------------
42
| Software IEC/IEEE floating-point underflow tininess-detection mode.
43
*----------------------------------------------------------------------------*/
44
extern signed char 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 signed char float_rounding_mode;
54
enum {
55
    float_round_nearest_even = 0,
56
    float_round_down         = 1,
57
    float_round_up           = 2,
58
    float_round_to_zero      = 3
59
};
60
 
61
/*----------------------------------------------------------------------------
62
| Software IEC/IEEE floating-point exception flags.
63
*----------------------------------------------------------------------------*/
64
extern signed char float_exception_flags;
65
enum {
66
    float_flag_invalid   =  1,
67
    float_flag_divbyzero =  4,
68
    float_flag_overflow  =  8,
69
    float_flag_underflow = 16,
70
    float_flag_inexact   = 32
71
};
72
 
73
// For the FPU core
74
struct {
75
unsigned int ine : 1;
76
unsigned int overflow : 1;
77
unsigned int underflow: 1;
78
unsigned int invalid: 1;
79
unsigned int div_zero: 1;
80
} exceptions;
81
 
82
 
83
/*----------------------------------------------------------------------------
84
| Routine to raise any or all of the software IEC/IEEE floating-point
85
| exception flags.
86
*----------------------------------------------------------------------------*/
87
void float_raise( signed char );
88
 
89
/*----------------------------------------------------------------------------
90
| Software IEC/IEEE integer-to-floating-point conversion routines.
91
*----------------------------------------------------------------------------*/
92
float32 int32_to_float32( int );
93
float64 int32_to_float64( int );
94
 
95
/*----------------------------------------------------------------------------
96
| Software IEC/IEEE single-precision conversion routines.
97
*----------------------------------------------------------------------------*/
98
int float32_to_int32( float32 );
99
int float32_to_int32_round_to_zero( float32 );
100
float64 float32_to_float64( float32 );
101
 
102
/*----------------------------------------------------------------------------
103
| Software IEC/IEEE single-precision operations.
104
*----------------------------------------------------------------------------*/
105
float32 float32_round_to_int( float32 );
106
float32 float32_add( float32, float32 );
107
float32 float32_sub( float32, float32 );
108
float32 float32_mul( float32, float32 );
109
float32 float32_div( float32, float32 );
110
float32 float32_rem( float32, float32 );
111
float32 float32_sqrt( float32 );
112
char float32_eq( float32, float32 );
113
char float32_le( float32, float32 );
114
char float32_lt( float32, float32 );
115
char float32_eq_signaling( float32, float32 );
116
char float32_le_quiet( float32, float32 );
117
char float32_lt_quiet( float32, float32 );
118
char float32_is_signaling_nan( float32 );
119
 
120
/*----------------------------------------------------------------------------
121
| Software IEC/IEEE double-precision conversion routines.
122
*----------------------------------------------------------------------------*/
123
int float64_to_int32( float64 );
124
int float64_to_int32_round_to_zero( float64 );
125
float32 float64_to_float32( float64 );
126
 
127
/*----------------------------------------------------------------------------
128
| Software IEC/IEEE double-precision operations.
129
*----------------------------------------------------------------------------*/
130
float64 float64_round_to_int( float64 );
131
float64 float64_add( float64, float64 );
132
float64 float64_sub( float64, float64 );
133
float64 float64_mul( float64, float64 );
134
float64 float64_div( float64, float64 );
135
float64 float64_rem( float64, float64 );
136
float64 float64_sqrt( float64 );
137
char float64_eq( float64, float64 );
138
char float64_le( float64, float64 );
139
char float64_lt( float64, float64 );
140
char float64_eq_signaling( float64, float64 );
141
char float64_le_quiet( float64, float64 );
142
char float64_lt_quiet( float64, float64 );
143
char float64_is_signaling_nan( float64 );
144
 
145
 

powered by: WebSVN 2.1.0

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