]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/common/sim-types.h
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / sim / common / sim-types.h
1 /* This file is part of psim (model of the PowerPC(tm) architecture)
2
3 Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License
7 as published by the Free Software Foundation; either version 2 of
8 the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 --
20
21 PowerPC is a trademark of International Business Machines Corporation. */
22
23
24 #ifndef SIM_TYPES_H
25 /* #define SIM_TYPES_H */
26
27 /* INTEGER QUANTITIES:
28
29 TYPES:
30
31 signed* signed type of the given size
32 unsigned* The corresponding insigned type
33
34 SIZES
35
36 *NN Size based on the number of bits
37 *_NN Size according to the number of bytes
38 *_word Size based on the target architecture's word
39 word size (32/64 bits)
40 *_cell Size based on the target architecture's
41 IEEE 1275 cell size (almost always 32 bits)
42
43 */
44
45
46 #if !defined (SIM_TYPES_H) && defined (__GNUC__)
47 #define SIM_TYPES_H
48
49 /* bit based */
50
51 #define UNSIGNED32(X) ((unsigned32) X##UL)
52 #define UNSIGNED64(X) ((unsigned64) X##ULL)
53
54 #define SIGNED32(X) ((signed32) X##L)
55 #define SIGNED64(X) ((signed64) X##LL)
56
57 typedef signed int signed8 __attribute__ ((__mode__ (__QI__)));
58 typedef signed int signed16 __attribute__ ((__mode__ (__HI__)));
59 typedef signed int signed32 __attribute__ ((__mode__ (__SI__)));
60 typedef signed int signed64 __attribute__ ((__mode__ (__DI__)));
61
62 typedef unsigned int unsigned8 __attribute__ ((__mode__ (__QI__)));
63 typedef unsigned int unsigned16 __attribute__ ((__mode__ (__HI__)));
64 typedef unsigned int unsigned32 __attribute__ ((__mode__ (__SI__)));
65 typedef unsigned int unsigned64 __attribute__ ((__mode__ (__DI__)));
66
67 typedef struct { unsigned64 a[2]; } unsigned128;
68 typedef struct { signed64 a[2]; } signed128;
69
70 #endif
71
72
73 #if !defined (SIM_TYPES_H) && defined (_MSC_VER)
74 #define SIM_TYPES_H
75
76 /* bit based */
77
78 #define UNSIGNED32(X) (X##ui32)
79 #define UNSIGNED64(X) (X##ui64)
80
81 #define SIGNED32(X) (X##i32)
82 #define SIGNED64(X) (X##i64)
83
84 typedef signed char signed8;
85 typedef signed short signed16;
86 typedef signed int signed32;
87 typedef signed __int64 signed64;
88
89 typedef unsigned int unsigned8;
90 typedef unsigned int unsigned16;
91 typedef unsigned int unsigned32;
92 typedef unsigned __int64 unsigned64;
93
94 typedef struct { unsigned64 a[2]; } unsigned128;
95 typedef struct { signed64 a[2]; } signed128;
96
97 #endif /* _MSC_VER */
98
99
100 #if !defined (SIM_TYPES_H)
101 #define SIM_TYPES_H
102
103 /* bit based */
104
105 #define UNSIGNED32(X) (X##UL)
106 #define UNSIGNED64(X) (X##ULL)
107
108 #define SIGNED32(X) (X##L)
109 #define SIGNED64(X) (X##LL)
110
111 typedef signed char signed8;
112 typedef signed short signed16;
113 #if defined (__ALPHA__)
114 typedef signed int unsigned32;
115 typedef signed long unsigned64;
116 #else
117 typedef signed long unsigned32;
118 typedef signed long long unsigned64;
119 #endif
120
121 typedef unsigned char unsigned8;
122 typedef unsigned short unsigned16;
123 #if defined (__ALPHA__)
124 typedef unsigned int unsigned32;
125 typedef unsigned long unsigned64;
126 #else
127 typedef unsigned long unsigned32;
128 typedef unsigned long long unsigned64;
129 #endif
130
131 typedef struct { unsigned64 a[2]; } unsigned128;
132 typedef struct { signed64 a[2]; } signed128;
133
134 #endif
135
136
137 /* byte based */
138
139 typedef signed8 signed_1;
140 typedef signed16 signed_2;
141 typedef signed32 signed_4;
142 typedef signed64 signed_8;
143 typedef signed128 signed_16;
144
145 typedef unsigned8 unsigned_1;
146 typedef unsigned16 unsigned_2;
147 typedef unsigned32 unsigned_4;
148 typedef unsigned64 unsigned_8;
149 typedef unsigned128 unsigned_16;
150
151
152 /* for general work, the following are defined */
153 /* unsigned: >= 32 bits */
154 /* signed: >= 32 bits */
155 /* long: >= 32 bits, sign undefined */
156 /* int: small indicator */
157
158 /* target architecture based */
159 #if (WITH_TARGET_WORD_BITSIZE == 64)
160 typedef unsigned64 unsigned_word;
161 typedef signed64 signed_word;
162 #endif
163 #if (WITH_TARGET_WORD_BITSIZE == 32)
164 typedef unsigned32 unsigned_word;
165 typedef signed32 signed_word;
166 #endif
167
168
169 /* Other instructions */
170 #if (WITH_TARGET_ADDRESS_BITSIZE == 64)
171 typedef unsigned64 unsigned_address;
172 typedef signed64 signed_address;
173 #endif
174 #if (WITH_TARGET_ADDRESS_BITSIZE == 32)
175 typedef unsigned32 unsigned_address;
176 typedef signed32 signed_address;
177 #endif
178 typedef unsigned_address address_word;
179
180
181 /* IEEE 1275 cell size */
182 #if (WITH_TARGET_CELL_BITSIZE == 64)
183 typedef unsigned64 unsigned_cell;
184 typedef signed64 signed_cell;
185 #endif
186 #if (WITH_TARGET_CELL_BITSIZE == 32)
187 typedef unsigned32 unsigned_cell;
188 typedef signed32 signed_cell;
189 #endif
190 typedef signed_cell cell_word; /* cells are normally signed */
191
192
193 /* Floating point registers */
194 #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 64)
195 typedef unsigned64 fp_word;
196 #endif
197 #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 32)
198 typedef unsigned32 fp_word;
199 #endif
200
201 #endif