architecture.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Otto-von-Guericke-Universität Magdeburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
24 #ifndef ARCHITECTURE_H
25 #define ARCHITECTURE_H
26 
27 #include <stdint.h>
28 
29 #include "architecture_arch.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /* Provide doxygen doc centrally, instead of in every architecture_arch.h */
36 #ifdef DOXYGEN
37 
42 #define ARCHITECTURE_WORD_BITS <NUM>
43 
48 #define ARCHITECTURE_WORD_BYTES <NUM>
49 
55 typedef uint<num>_t uword_t;
62 typedef int<num>_t sword_t;
63 #elif (ARCHITECTURE_WORD_BITS == 8)
64 #define ARCHITECTURE_WORD_BYTES (1U)
65 typedef uint8_t uword_t;
66 typedef int8_t sword_t;
67 #elif (ARCHITECTURE_WORD_BITS == 16)
68 #define ARCHITECTURE_WORD_BYTES (2U)
69 typedef uint16_t uword_t;
70 typedef int16_t sword_t;
71 #elif (ARCHITECTURE_WORD_BITS == 32)
72 #define ARCHITECTURE_WORD_BYTES (4U)
73 typedef uint32_t uword_t;
74 typedef int32_t sword_t;
75 #else
76 #error "Unsupported word size (check ARCHITECTURE_WORD_BITS in architecture_arch.h)"
77 #endif
78 
88 #define WORD_ALIGNED __attribute__((aligned(ARCHITECTURE_WORD_BYTES)))
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* ARCHITECTURE_H */
95 
sword_t
int< num > _t sword_t
Word sized signed integer.
Definition: architecture.h:62
uword_t
uint< num > _t uword_t
Word sized unsigned integer.
Definition: architecture.h:55