Add config support for the size of the target address and OF cell.
[external/binutils.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 /* Basic type sizes for the PowerPC */
25
26 #ifndef _SIM_TYPES_H_
27 #define _SIM_TYPES_H_
28
29
30
31
32 /* INTEGER QUANTITIES:
33
34    TYPES:
35
36      natural*   sign determined by host
37      signed*    signed type of the given size
38      unsigned*  The corresponding insigned type
39
40    SIZES
41
42      *NN        Size based on the number of bits
43      *_NN       Size according to the number of bytes
44      *_word     Size based on the target architecture's word
45                 word size (32/64 bits)
46      *_cell     Size based on the target architecture's
47                 IEEE 1275 cell size (almost always 32 bits)
48
49 */
50
51
52 /* bit based */
53 typedef char natural8;
54 typedef short natural16;
55 typedef long natural32;
56
57 typedef signed char signed8;
58 typedef signed short signed16;
59 typedef signed long signed32;
60
61 typedef unsigned char unsigned8;
62 typedef unsigned short unsigned16;
63 typedef unsigned long unsigned32;
64
65 #if defined __GNUC__ || defined _MSC_VER
66 #ifdef __GNUC__
67
68 typedef long long natural64;
69 typedef signed long long signed64;
70 typedef unsigned long long unsigned64;
71
72 #define UNSIGNED64(X) (X##ULL)
73 #define SIGNED64(X) (X##LL)
74
75 #define UNSIGNED32(X) (X##UL)
76 #define SIGNED32(X) (X##L)
77
78 #else   /* _MSC_VER */
79
80 typedef __int64 natural64;
81 typedef signed __int64 signed64;
82 typedef unsigned __int64 unsigned64;
83
84 #define UNSIGNED64(X) (X##ui64)
85 #define SIGNED64(X) (X##i64)
86
87 #define SIGNED32(X) (X##ui32)
88 #define UNSIGNED32(X) (X##i32)
89
90 #endif /* _MSC_VER */
91
92 typedef struct { unsigned64 a[2]; } unsigned128;
93 typedef struct { signed64 a[2]; } signed128;
94
95 #else /* Not GNUC or _MSC_VER */
96 /* Not supported */
97 #endif
98
99 /* byte based */
100 typedef natural8 natural_1;
101 typedef natural16 natural_2;
102 typedef natural32 natural_4;
103 typedef natural64 natural_8;
104 /* typedef natural64 natural_8; */
105
106 typedef signed8 signed_1;
107 typedef signed16 signed_2;
108 typedef signed32 signed_4;
109 typedef signed64 signed_8;
110 typedef signed128 signed_16;
111
112 typedef unsigned8 unsigned_1;
113 typedef unsigned16 unsigned_2;
114 typedef unsigned32 unsigned_4;
115 typedef unsigned64 unsigned_8;
116 typedef unsigned128 unsigned_16;
117
118
119 /* for general work, the following are defined */
120 /* unsigned: >= 32 bits */
121 /* signed:   >= 32 bits */
122 /* long:     >= 32 bits, sign undefined */
123 /* int:      small indicator */
124
125 /* target architecture based */
126 #if (WITH_TARGET_WORD_BITSIZE == 64)
127 typedef natural64 natural_word;
128 typedef unsigned64 unsigned_word;
129 typedef signed64 signed_word;
130 #endif
131 #if (WITH_TARGET_WORD_BITSIZE == 32)
132 typedef natural32 natural_word;
133 typedef unsigned32 unsigned_word;
134 typedef signed32 signed_word;
135 #endif
136
137
138 /* Other instructions */
139 #if (WITH_TARGET_ADDRESS_BITSIZE == 64)
140 typedef unsigned64 address_word;
141 #endif
142 #if (WITH_TARGET_ADDRESS_BITSIZE == 32)
143 typedef unsigned32 address_word;
144 #endif
145
146 /* IEEE 1275 cell size */
147 #if (WITH_TARGET_CELL_BITSIZE == 64)
148 typedef natural64 natural_cell;
149 typedef unsigned64 unsigned_cell;
150 typedef signed64 signed_cell;
151 #endif
152 #if (WITH_TARGET_CELL_BITSIZE == 32)
153 typedef natural32 natural_cell;
154 typedef unsigned32 unsigned_cell;
155 typedef signed32 signed_cell;
156 #endif
157
158 #endif /* _SIM_TYPES_H_ */