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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [include/] [floatformat.h] - Blame information for rev 850

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

Line No. Rev Author Line
1 38 julius
/* IEEE floating point support declarations, for GDB, the GNU Debugger.
2
   Copyright 1991, 1994, 1995, 1997, 2000, 2003, 2005
3
   Free Software Foundation, Inc.
4
 
5
This file is part of GDB.
6
 
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or
10
(at your option) any later version.
11
 
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
20
 
21
#if !defined (FLOATFORMAT_H)
22
#define FLOATFORMAT_H 1
23
 
24
#include "ansidecl.h"
25
 
26
/* A floatformat consists of a sign bit, an exponent and a mantissa.  Once the
27
   bytes are concatenated according to the byteorder flag, then each of those
28
   fields is contiguous.  We number the bits with 0 being the most significant
29
   (i.e. BITS_BIG_ENDIAN type numbering), and specify which bits each field
30
   contains with the *_start and *_len fields.  */
31
 
32
/* What is the order of the bytes?  */
33
 
34
enum floatformat_byteorders {
35
  /* Standard little endian byte order.
36
     EX: 1.2345678e10 => 00 00 80 c5 e0 fe 06 42 */
37
  floatformat_little,
38
 
39
  /* Standard big endian byte order.
40
     EX: 1.2345678e10 => 42 06 fe e0 c5 80 00 00 */
41
  floatformat_big,
42
 
43
  /* Little endian byte order but big endian word order.
44
     EX: 1.2345678e10 => e0 fe 06 42 00 00 80 c5 */
45
  floatformat_littlebyte_bigword,
46
 
47
  /* VAX byte order.  Little endian byte order with 16-bit words.  The
48
     following example is an illustration of the byte order only; VAX
49
     doesn't have a fully IEEE compliant floating-point format.
50
     EX: 1.2345678e10 => 80 c5 00 00 06 42 e0 fe */
51
  floatformat_vax
52
};
53
 
54
enum floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no };
55
 
56
struct floatformat
57
{
58
  enum floatformat_byteorders byteorder;
59
  unsigned int totalsize;       /* Total size of number in bits */
60
 
61
  /* Sign bit is always one bit long.  1 means negative, 0 means positive.  */
62
  unsigned int sign_start;
63
 
64
  unsigned int exp_start;
65
  unsigned int exp_len;
66
  /* Bias added to a "true" exponent to form the biased exponent.  It
67
     is intentionally signed as, otherwize, -exp_bias can turn into a
68
     very large number (e.g., given the exp_bias of 0x3fff and a 64
69
     bit long, the equation (long)(1 - exp_bias) evaluates to
70
     4294950914) instead of -16382).  */
71
  int exp_bias;
72
  /* Exponent value which indicates NaN.  This is the actual value stored in
73
     the float, not adjusted by the exp_bias.  This usually consists of all
74
     one bits.  */
75
  unsigned int exp_nan;
76
 
77
  unsigned int man_start;
78
  unsigned int man_len;
79
 
80
  /* Is the integer bit explicit or implicit?  */
81
  enum floatformat_intbit intbit;
82
 
83
  /* Internal name for debugging. */
84
  const char *name;
85
 
86
  /* Validator method.  */
87
  int (*is_valid) (const struct floatformat *fmt, const void *from);
88
};
89
 
90
/* floatformats for IEEE single and double, big and little endian.  */
91
 
92
extern const struct floatformat floatformat_ieee_single_big;
93
extern const struct floatformat floatformat_ieee_single_little;
94
extern const struct floatformat floatformat_ieee_double_big;
95
extern const struct floatformat floatformat_ieee_double_little;
96
 
97
/* floatformat for ARM IEEE double, little endian bytes and big endian words */
98
 
99
extern const struct floatformat floatformat_ieee_double_littlebyte_bigword;
100
 
101
/* floatformats for VAX.  */
102
 
103
extern const struct floatformat floatformat_vax_f;
104
extern const struct floatformat floatformat_vax_d;
105
extern const struct floatformat floatformat_vax_g;
106
 
107
/* floatformats for various extendeds.  */
108
 
109
extern const struct floatformat floatformat_i387_ext;
110
extern const struct floatformat floatformat_m68881_ext;
111
extern const struct floatformat floatformat_i960_ext;
112
extern const struct floatformat floatformat_m88110_ext;
113
extern const struct floatformat floatformat_m88110_harris_ext;
114
extern const struct floatformat floatformat_arm_ext_big;
115
extern const struct floatformat floatformat_arm_ext_littlebyte_bigword;
116
/* IA-64 Floating Point register spilt into memory.  */
117
extern const struct floatformat floatformat_ia64_spill_big;
118
extern const struct floatformat floatformat_ia64_spill_little;
119
extern const struct floatformat floatformat_ia64_quad_big;
120
extern const struct floatformat floatformat_ia64_quad_little;
121
 
122
/* Convert from FMT to a double.
123
   FROM is the address of the extended float.
124
   Store the double in *TO.  */
125
 
126
extern void
127
floatformat_to_double (const struct floatformat *, const void *, double *);
128
 
129
/* The converse: convert the double *FROM to FMT
130
   and store where TO points.  */
131
 
132
extern void
133
floatformat_from_double (const struct floatformat *, const double *, void *);
134
 
135
/* Return non-zero iff the data at FROM is a valid number in format FMT.  */
136
 
137
extern int
138
floatformat_is_valid (const struct floatformat *fmt, const void *from);
139
 
140
#endif  /* defined (FLOATFORMAT_H) */

powered by: WebSVN 2.1.0

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