words.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* This file is part of psim (model of the PowerPC(tm) architecture)
  2. Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License
  5. as published by the Free Software Foundation; either version 3 of
  6. the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful, but
  8. WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with this library; if not, see <http://www.gnu.org/licenses/>.
  13. --
  14. PowerPC is a trademark of International Business Machines Corporation. */
  15. /* Basic type sizes for the PowerPC */
  16. #ifndef _WORDS_H_
  17. #define _WORDS_H_
  18. /* TYPES:
  19. intNN_t Signed type of the given bit size
  20. uintNN_t The corresponding unsigned type
  21. SIZES
  22. *NN Size based on the number of bits
  23. *_NN Size according to the number of bytes
  24. *_word Size based on the target architecture's word
  25. word size (32/64 bits)
  26. *_cell Size based on the target architecture's
  27. IEEE 1275 cell size (almost always 32 bits)
  28. */
  29. /* This must come before any other includes. */
  30. #include "defs.h"
  31. #include <stdint.h>
  32. /* byte based */
  33. typedef int8_t signed_1;
  34. typedef int16_t signed_2;
  35. typedef int32_t signed_4;
  36. typedef int64_t signed_8;
  37. typedef uint8_t unsigned_1;
  38. typedef uint16_t unsigned_2;
  39. typedef uint32_t unsigned_4;
  40. typedef uint64_t unsigned_8;
  41. /* for general work, the following are defined */
  42. /* unsigned: >= 32 bits */
  43. /* signed: >= 32 bits */
  44. /* long: >= 32 bits, sign undefined */
  45. /* int: small indicator */
  46. /* target architecture based */
  47. #if (WITH_TARGET_WORD_BITSIZE == 64)
  48. typedef uint64_t unsigned_word;
  49. typedef int64_t signed_word;
  50. #else
  51. typedef uint32_t unsigned_word;
  52. typedef int32_t signed_word;
  53. #endif
  54. /* Other instructions */
  55. typedef uint32_t instruction_word;
  56. /* IEEE 1275 cell size - only support 32bit mode at present */
  57. typedef uint32_t unsigned_cell;
  58. typedef int32_t signed_cell;
  59. #endif /* _WORDS_H_ */