• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

c4e_arch.h (Version 579)

Go to the documentation of this file.
00001 /****************************** -*- mode: C -*- ******************************/
00014 #ifndef C4E_ARCH_H
00015 #define C4E_ARCH_H
00016 
00017 
00018 /* INCLUDES ******************************************************************/
00019 
00020 #include "c4e_config.h"
00021 
00022 
00023 #ifdef HAVE_INTTYPES_H
00024 #include <inttypes.h>
00025 #endif
00026 
00027 #ifdef HAVE_STDINT_H
00028 #include <stdint.h>
00029 #endif
00030 
00031 #ifdef HAVE_STDLIB_H
00032 #include <stdlib.h>
00033 #endif
00034 
00035 #ifdef HAVE_STDBOOL_H
00036 #include <stdbool.h>
00037 #endif
00038 
00039 
00047 #ifdef  __cplusplus
00048 extern "C" {
00049 #endif
00050 
00051 
00052 /* DEFINES *******************************************************************/
00053 
00054 
00069 #define C4E_CONST               const 
00070 #define C4E_INLINE              inline 
00076 #if defined(_lint) || defined(__cplusplus)
00077 #define C4E_RESTRICT           /* C++ and lint doesn't know this C99 keyword */
00078 #else
00079 #define C4E_RESTRICT            restrict
00080 #endif
00081 
00082 
00083 
00084 
00085 #if (defined(__i386__) || defined(__i486__) || defined(__i586__) ||            \
00086      defined(__i686__) || defined(__pentium__) || defined(__pentiumpro__) ||   \
00087      defined(__pentium4__) ||                                                  \
00088      defined(__k6__) || defined(__k8__) || defined (__athlon__))
00089 
00090 
00094 #define C4E_ARCH_X86
00095 
00096 
00097 #if defined(__GNUC__) && (__GNUC__ > 3) && defined(__linux__) && !defined(_lint)
00098 
00106 #define C4E_ARCH_X86_ASM
00107 
00108 
00109 #if defined(__SSE2__) || defined(__SSSE3__)
00110 
00121 #define C4E_ARCH_X86_MMX
00122 #endif /* SSE2/3 */
00123 
00124 
00125 #if (C4E_ARCH_DIGIT_SIZE == 4U)
00126 
00130 #define C4E_ARCH_X86_DIGITS
00131 #endif /* C4E_ARCH_DIGIT_SIZE == 4U */
00132 
00133 #endif /* GNUC */
00134 #endif /* x86 */
00135 
00136 
00137 
00141 #ifdef __STRICT_ANSI__
00142 #define C4E_ARCH_ASM            __asm__ volatile
00143 #else  /* !__STRICT_ANSI__ */
00144 #define C4E_ARCH_ASM            asm volatile
00145 #endif /* __STRICT_ANSI__ */
00146 
00147 
00148 
00149 #if defined(UINT32_MAX) || defined(uint32_t)
00150 
00154 #define C4E_HAVE_UINT32         1
00155 
00156 
00157 /* TYPEDEFS ******************************************************************/
00158 
00159 
00170     typedef uint32_t C4eArchUint32;
00171 
00172 #endif  /* defined(UINT32_MAX) || defined (uint32_t) */
00173 
00174 
00186     typedef unsigned int C4eArchUint;
00187 
00188 
00207     typedef uint32_t C4eArchDigit;   /* customize to uint16_t, uint64_t, ... */
00208 
00209 
00221     typedef uint64_t C4eArchDigit2; /* customize to uint32_t, uint128_t, ... */
00222 
00223 
00228     typedef C4eArchUint C4eArchIdx;
00229 
00230 
00238     typedef size_t C4eArchSize;
00239 
00240 
00248     typedef uint8_t C4eArchUint8;
00249 
00250 
00251 
00252 #ifdef C4E_CONFIG_ENABLE_COMBA /* need a MAC unit? */
00253 
00259     typedef struct
00260     {
00261         C4eArchDigit2 acc;                                  
00262         C4eArchDigit cy;                                     
00263     } C4eArchMac;
00264 
00265 #endif /* C4E_CONFIG_ENABLE_COMBA */
00266 
00267 
00268 
00269 /* MACROS ********************************************************************/
00270 
00271 
00272 /* MACRO *********************************************************************/
00283 #define C4E_ARCH_ROM(type, name)   C4E_CONST type name
00284 
00285 
00286 /* MACRO *********************************************************************/
00300 #define C4E_ARCH_DIGIT2_MSD(digit2)                             \
00301     ((C4eArchDigit)((digit2) >> (8U * C4E_ARCH_DIGIT_SIZE)))
00302 
00303 
00304 
00305 /* MACRO *********************************************************************/
00318 #define C4E_ARCH_DIGIT2_LSD(digit2)     ((C4eArchDigit)(digit2))
00319 
00320 
00321 
00322 /* MACRO *********************************************************************/
00337 #define C4E_ARCH_DIGIT2_ASGN(digit2, msd, lsd)                                 \
00338     ((digit2) = ((((C4eArchDigit2)(msd)) << (8U * C4E_ARCH_DIGIT_SIZE)) | (lsd)))
00339 
00340 
00341 
00342 /* MACRO *********************************************************************/
00351 #define C4E_ARCH_DIGIT2_ADD(a, b, c)    (((C4eArchDigit2)(a)) + (b) + (c))
00352 
00353 
00354 
00355 /* MACRO *********************************************************************/
00364 #define C4E_ARCH_DIGIT2_MUL(a, b)       (((C4eArchDigit2)(a)) * (b))
00365 
00366 
00367 
00368 /* MACRO *********************************************************************/
00378 #define C4E_ARCH_DIGIT2_DIV(a, b)       (((C4eArchDigit2)(a)) / (b))
00379 
00380 
00381 
00382 #ifdef  __cplusplus
00383 }
00384 #endif
00385 
00386 
00392 #endif /* C4E_ARCH_H */
00393 
00394 
00395 /******************************************************************************/
00396 /* END OF FILE                                                                */
00397 /******************************************************************************/
00398 

Generated by Ralf Hoppe, Ginsterweg 49, 73230 Kirchheim unter Teck, Germany
on Sun Jun 7 14:10:49 2015 for CRY4E using doxygen 1.6.1