Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: fpsim_support.h | |
5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
7 | * | |
8 | * The above named program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public | |
10 | * License version 2 as published by the Free Software Foundation. | |
11 | * | |
12 | * The above named program is distributed in the hope that it will be | |
13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public | |
18 | * License along with this work; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | * | |
21 | * ========== Copyright Header End ============================================ | |
22 | */ | |
23 | #ifndef _INCLUDED_FPSIM_SUPPORT_H | |
24 | #define _INCLUDED_FPSIM_SUPPORT_H | |
25 | ||
26 | /*===================================================================* | |
27 | * fpsim_support.h : include file for FPSIM library source | |
28 | * | |
29 | * (c) Copyright 2006 Sun Microsystems, Inc. | |
30 | * | |
31 | *===================================================================*/ | |
32 | ||
33 | /********************************************************************* | |
34 | * ATTENTION: This code is part of a library shared by multiple | |
35 | * projects. DO NOT MAKE CHANGES TO THIS CODE WITHIN YOUR PROJECT. | |
36 | * Instead, contact the owner/maintainer of the library, currently: | |
37 | * Robert.Rethemeyer@Sun.COM +1-408-616-5717 (x45717) | |
38 | * Systems Group: TVT: FrontEnd Technologies | |
39 | * The CVS source code repository for the library is at: | |
40 | * /import/ftap-blimp1/cvs/fpsim | |
41 | * DO NOT COMMIT CHANGES TO THAT REPOSITORY: contact the maintainer. | |
42 | ********************************************************************/ | |
43 | ||
44 | /*tab length=4*/ | |
45 | ||
46 | typedef unsigned int uint; | |
47 | typedef long long int64; | |
48 | typedef unsigned long long uint64; | |
49 | ||
50 | ||
51 | #ifdef __cplusplus | |
52 | extern "C" { | |
53 | #endif | |
54 | ||
55 | extern int asm_faddd( const double* op1, const double* op2, double* rslt, | |
56 | int rnd, int* tmp ); | |
57 | extern int asm_fsubd( const double* op1, const double* op2, double* rslt, | |
58 | int rnd, int* tmp ); | |
59 | extern int asm_fmuld( const double* op1, const double* op2, double* rslt, | |
60 | int rnd, int* tmp ); | |
61 | extern int asm_fdivd( const double* op1, const double* op2, double* rslt, | |
62 | int rnd, int* tmp ); | |
63 | extern int asm_fsqrtd( const double* op2, double* rslt, int rnd, int* tmp ); | |
64 | extern int asm_fadds( const float* op1, const float* op2, float* rslt, | |
65 | int rnd, int* tmp ); | |
66 | extern int asm_fsubs( const float* op1, const float* op2, float* rslt, | |
67 | int rnd, int* tmp ); | |
68 | extern int asm_fmuls( const float* op1, const float* op2, float* rslt, | |
69 | int rnd, int* tmp ); | |
70 | extern int asm_fdivs( const float* op1, const float* op2, float* rslt, | |
71 | int rnd, int* tmp ); | |
72 | extern int asm_fsqrts( const float* op2, float* rslt, int rnd, int* tmp ); | |
73 | extern int asm_fsmuld( const float* op1, const float* op2, double* rslt, | |
74 | int* tmp ); | |
75 | extern int asm_fstod( const float* op2, double* rslt, int rnd, int* tmp ); | |
76 | extern int asm_fdtos( const double* op2, float* rslt, int rnd, int* tmp ); | |
77 | extern int asm_fstox( const float* op2, uint64* rslt, int rnd, int* tmp ); | |
78 | extern int asm_fdtox( const double* op2, uint64* rslt, int rnd, int* tmp ); | |
79 | extern int asm_fstoi( const float* op2, uint* rslt, int rnd, int* tmp ); | |
80 | extern int asm_fdtoi( const double* op2, uint* rslt, int rnd, int* tmp ); | |
81 | extern int asm_fxtos( const uint64* op2, float* rslt, int rnd, int* tmp ); | |
82 | extern int asm_fxtod( const uint64* op2, double* rslt, int rnd, int* tmp ); | |
83 | extern int asm_fitos( const uint* op2, float* rslt, int rnd, int* tmp ); | |
84 | extern void asm_fitod( const uint* op2, double* rslt ); | |
85 | extern int asm_addc( uint64 op1, uint64 op2, uint64* res ); | |
86 | extern int asm_subc( uint64 op1, uint64 op2, uint64* res ); | |
87 | #ifdef __cplusplus | |
88 | } | |
89 | #endif | |
90 | ||
91 | // FP number classes | |
92 | enum fp_classes { | |
93 | fp_zero=0, fp_subnormal, fp_normal, fp_infinity, fp_quiet, fp_signaling | |
94 | }; | |
95 | ||
96 | // FP rounding modes | |
97 | enum fp_round { | |
98 | FP_RN=0, FP_RZ, FP_RP, FP_RM | |
99 | }; | |
100 | ||
101 | ||
102 | // structures for easy examination of all parts of a FP number | |
103 | typedef struct fpdouble { | |
104 | union { | |
105 | double num; | |
106 | uint64 inte; | |
107 | } fp; | |
108 | uint64 frac; | |
109 | int exp; | |
110 | int sign; | |
111 | } fpdouble; | |
112 | ||
113 | typedef struct fpsingle { | |
114 | union { | |
115 | float num; | |
116 | uint inte; | |
117 | } fp; | |
118 | uint frac; | |
119 | int exp; | |
120 | int sign; | |
121 | } fpsingle; | |
122 | ||
123 | #define EBIAS_S 127 | |
124 | #define EBIAS_D 1023 | |
125 | ||
126 | #define TRAP_ILLEGAL_INST 0x10 | |
127 | #define TRAP_IEEE_754 0x21 | |
128 | #define TRAP_FPX_OTHER 0x22 | |
129 | ||
130 | #ifndef NULL | |
131 | #define NULL 0 | |
132 | #endif | |
133 | ||
134 | #endif /* _INCLUDED_FPSIM_SUPPORT_H */ |