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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [language/] [c/] [libm/] [current/] [include/] [sys/] [ieeefp.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_LIBM_SYS_IEEEFP_H
2
#define CYGONCE_LIBM_SYS_IEEEFP_H
3
//===========================================================================
4
//
5
//      ieeefp.h
6
//
7
//      Definitions specific to IEEE-754 floating-point format
8
//
9
//===========================================================================
10
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
11
// -------------------------------------------                              
12
// This file is part of eCos, the Embedded Configurable Operating System.   
13
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
14
//
15
// eCos is free software; you can redistribute it and/or modify it under    
16
// the terms of the GNU General Public License as published by the Free     
17
// Software Foundation; either version 2 or (at your option) any later      
18
// version.                                                                 
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT      
21
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
23
// for more details.                                                        
24
//
25
// You should have received a copy of the GNU General Public License        
26
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
27
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
28
//
29
// As a special exception, if other files instantiate templates or use      
30
// macros or inline functions from this file, or you compile this file      
31
// and link it with other works to produce a work based on this file,       
32
// this file does not by itself cause the resulting work to be covered by   
33
// the GNU General Public License. However the source code for this file    
34
// must still be made available in accordance with section (3) of the GNU   
35
// General Public License v2.                                               
36
//
37
// This exception does not invalidate any other reasons why a work based    
38
// on this file might be covered by the GNU General Public License.         
39
// -------------------------------------------                              
40
// ####ECOSGPLCOPYRIGHTEND####                                              
41
//===========================================================================
42
//#####DESCRIPTIONBEGIN####
43
//
44
// Author(s):   jlarmour
45
// Contributors:  jlarmour
46
// Date:        1998-02-13
47
// Purpose:     
48
// Description: Definitions specific to IEEE-754 floating-point format
49
// Usage:       #include <sys/ieeefp.h>
50
//
51
//####DESCRIPTIONEND####
52
//
53
//===========================================================================
54
 
55
// CONFIGURATION
56
 
57
#include <pkgconf/libm.h>   // Configuration header
58
 
59
// Include the Math library?
60
#ifdef CYGPKG_LIBM     
61
 
62
// INCLUDES
63
 
64
#include <cyg/infra/cyg_type.h>     // Common type definitions and support
65
                                    // including endian-ness
66
 
67
#if (CYG_BYTEORDER == CYG_MSBFIRST) // Big endian
68
 
69
// Note: there do not seem to be any current machines which are Big Endian but
70
// have a mixed up double layout. 
71
 
72
typedef union
73
{
74
    cyg_int32 asi32[2];
75
 
76
    cyg_int64 asi64;
77
 
78
    double value;
79
 
80
    struct
81
    {
82
        unsigned int sign : 1;
83
        unsigned int exponent: 11;
84
        unsigned int fraction0:4;
85
        unsigned int fraction1:16;
86
        unsigned int fraction2:16;
87
        unsigned int fraction3:16;
88
 
89
    } number;
90
 
91
    struct
92
    {
93
        unsigned int sign : 1;
94
        unsigned int exponent: 11;
95
        unsigned int quiet:1;
96
        unsigned int function0:3;
97
        unsigned int function1:16;
98
        unsigned int function2:16;
99
        unsigned int function3:16;
100
    } nan;
101
 
102
    struct
103
    {
104
        cyg_uint32 msw;
105
        cyg_uint32 lsw;
106
    } parts;
107
 
108
 
109
} Cyg_libm_ieee_double_shape_type;
110
 
111
 
112
typedef union
113
{
114
    cyg_int32 asi32;
115
 
116
    float value;
117
 
118
    struct
119
    {
120
        unsigned int sign : 1;
121
        unsigned int exponent: 8;
122
        unsigned int fraction0: 7;
123
        unsigned int fraction1: 16;
124
    } number;
125
 
126
    struct
127
    {
128
        unsigned int sign:1;
129
        unsigned int exponent:8;
130
        unsigned int quiet:1;
131
        unsigned int function0:6;
132
        unsigned int function1:16;
133
    } nan;
134
 
135
} Cyg_libm_ieee_float_shape_type;
136
 
137
 
138
#else // Little endian
139
 
140
typedef union
141
{
142
    cyg_int32 asi32[2];
143
 
144
    cyg_int64 asi64;
145
 
146
    double value;
147
 
148
    struct
149
    {
150
#if (CYG_DOUBLE_BYTEORDER == CYG_MSBFIRST) // Big endian
151
        unsigned int fraction1:16;
152
        unsigned int fraction0: 4;
153
        unsigned int exponent :11;
154
        unsigned int sign     : 1;
155
        unsigned int fraction3:16;
156
        unsigned int fraction2:16;
157
#else
158
        unsigned int fraction3:16;
159
        unsigned int fraction2:16;
160
        unsigned int fraction1:16;
161
        unsigned int fraction0: 4;
162
        unsigned int exponent :11;
163
        unsigned int sign     : 1;
164
#endif
165
    } number;
166
 
167
    struct
168
    {
169
#if (CYG_DOUBLE_BYTEORDER == CYG_MSBFIRST) // Big endian
170
        unsigned int function1:16;
171
        unsigned int function0:3;
172
        unsigned int quiet:1;
173
        unsigned int exponent: 11;
174
        unsigned int sign : 1;
175
        unsigned int function3:16;
176
        unsigned int function2:16;
177
#else
178
        unsigned int function3:16;
179
        unsigned int function2:16;
180
        unsigned int function1:16;
181
        unsigned int function0:3;
182
        unsigned int quiet:1;
183
        unsigned int exponent: 11;
184
        unsigned int sign : 1;
185
#endif
186
    } nan;
187
 
188
    struct
189
    {
190
#if (CYG_DOUBLE_BYTEORDER == CYG_MSBFIRST) // Big endian
191
        cyg_uint32 msw;
192
        cyg_uint32 lsw;
193
#else
194
        cyg_uint32 lsw;
195
        cyg_uint32 msw;
196
#endif
197
    } parts;
198
 
199
} Cyg_libm_ieee_double_shape_type;
200
 
201
 
202
typedef union
203
{
204
    cyg_int32 asi32;
205
 
206
    float value;
207
 
208
    struct
209
    {
210
        unsigned int fraction0: 7;
211
        unsigned int fraction1: 16;
212
        unsigned int exponent: 8;
213
        unsigned int sign : 1;
214
    } number;
215
 
216
    struct
217
    {
218
        unsigned int function1:16;
219
        unsigned int function0:6;
220
        unsigned int quiet:1;
221
        unsigned int exponent:8;
222
        unsigned int sign:1;
223
    } nan;
224
 
225
} Cyg_libm_ieee_float_shape_type;
226
 
227
#endif // little-endian
228
 
229
 
230
#endif // ifdef CYGPKG_LIBM     
231
 
232
#endif // CYGONCE_LIBM_SYS_IEEEFP_H multiple inclusion protection
233
 
234
// EOF ieeefp.h

powered by: WebSVN 2.1.0

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