1 /*============================================================================
2 PROMINENT NOTICE: THIS IS A DERIVATIVE WORK OF THE ORIGINAL SOFTFLOAT CODE
3 CHANGES:
4     Removed processors include
5     This file serves as a bridge to the streflop system
6 
7     Copyright 2006 Nicolas Brodu
8               2012 Mark Vejvoda
9 
10 =============================================================================*/
11 
12 /*============================================================================
13 
14 This C header file is part of the SoftFloat IEC/IEEE Floating-point Arithmetic
15 Package, Release 2b.
16 
17 Written by John R. Hauser.  This work was made possible in part by the
18 International Computer Science Institute, located at Suite 600, 1947 Center
19 Street, Berkeley, California 94704.  Funding was partially provided by the
20 National Science Foundation under grant MIP-9311980.  The original version
21 of this code was written as part of a project to build a fixed-point vector
22 processor in collaboration with the University of California at Berkeley,
23 overseen by Profs. Nelson Morgan and John Wawrzynek.  More information
24 is available through the Web page `http://www.cs.berkeley.edu/~jhauser/
25 arithmetic/SoftFloat.html'.
26 
27 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort has
28 been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
29 RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
30 AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES,
31 COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE
32 EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE
33 INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR
34 OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE.
35 
36 Derivative works are acceptable, even for commercial purposes, so long as
37 (1) the source code for the derivative work includes prominent notice that
38 the work is derivative, and (2) the source code includes prominent notice with
39 these four paragraphs for those parts of this code that are retained.
40 
41 =============================================================================*/
42 
43 /*----------------------------------------------------------------------------
44 | Include common integer types and flags.
45 *----------------------------------------------------------------------------*/
46 #ifdef STREFLOP_SOFT
47 
48 #include "../System.h"
49 
50 
51 namespace streflop {
52 namespace SoftFloat {
53 
54 // Use the types from System.h, some could be more "convenient"
55 typedef int8_t flag;
56 typedef uint8_t uint8;
57 typedef int8_t int8;
58 typedef uint16_t uint16;
59 typedef int16_t int16;
60 typedef uint32_t uint32;
61 typedef int32_t int32;
62 typedef uint64_t uint64;
63 typedef int64_t int64;
64 // And these are exact by construction
65 typedef uint8_t bits8;
66 typedef int8_t sbits8;
67 typedef uint16_t bits16;
68 typedef int16_t sbits16;
69 typedef uint32_t bits32;
70 typedef int32_t sbits32;
71 typedef uint64_t bits64;
72 typedef int64_t sbits64;
73 
74 
75 // softfloat needs boolean TRUE/FALSE
76 #undef TRUE
77 #undef FALSE
78 enum {
79     FALSE = 0,
80     TRUE  = 1
81 };
82 
83 // Streflop Bridge: Complete the missing defined that were in the processor files
84 #if __FLOAT_WORD_ORDER == 1234
85 #ifndef LITTLEENDIAN
86 #define LITTLEENDIAN
87 #endif
88 #elif __FLOAT_WORD_ORDER == 4321
89 #ifndef BIGENDIAN
90 #define BIGENDIAN
91 #endif
92 #endif
93 
94 // 64-bit int types are assumed to exist in other parts of streflop
95 #define BITS64
96 
97 // How to define a long long 64-bit constant
98 #define LIT64( a ) a##LL
99 
100 // From original comment: If a compiler does not support explicit inlining,
101 // this macro should be defined to be 'static'.
102 // However, with C++, this has become obsolete
103 #define INLINE extern inline
104 
105 }
106 }
107 
108 #endif
109