OpenCores
URL https://opencores.org/ocsvn/neo430/neo430/trunk

Subversion Repositories neo430

[/] [neo430/] [trunk/] [neo430/] [sw/] [example/] [coremark/] [core_portme.h] - Blame information for rev 198

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 198 zero_gravi
/*
2
Copyright 2018 Embedded Microprocessor Benchmark Consortium (EEMBC)
3
 
4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7
 
8
    http://www.apache.org/licenses/LICENSE-2.0
9
 
10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
 
16
Original Author: Shay Gal-on
17
 
18
Modified for neo430 by Stephan Nolting
19
*/
20
 
21
/* Topic : Description
22
        This file contains configuration constants required to execute on different platforms
23
*/
24
#ifndef CORE_PORTME_H
25
#define CORE_PORTME_H
26
 
27
 
28
// NEO430 libraries
29
#include <stdint.h>
30
#include <neo430.h>
31
 
32
// Manual NEO430 config:
33
#define BAUD_RATE       (19200)
34
#define ITERATIONS      (2000)
35
#define NEO430_TIMER_F  (10) // Hz
36
#define FLAGS_STR        "-> see makefile" // compiler optimization
37
 
38
// For debugging
39
#define xstr(a) str(a)
40
#define str(a) #a
41
 
42
 
43
/************************/
44
/* Data types and settings */
45
/************************/
46
/* Configuration : HAS_FLOAT
47
        Define to 1 if the platform supports floating point.
48
*/
49
#ifndef HAS_FLOAT 
50
#define HAS_FLOAT 0
51
#endif
52
/* Configuration : HAS_TIME_H
53
        Define to 1 if platform has the time.h header file,
54
        and implementation of functions thereof.
55
*/
56
#ifndef HAS_TIME_H
57
#define HAS_TIME_H 0
58
#endif
59
/* Configuration : USE_CLOCK
60
        Define to 1 if platform has the time.h header file,
61
        and implementation of functions thereof.
62
*/
63
#ifndef USE_CLOCK
64
#define USE_CLOCK 0
65
#endif
66
/* Configuration : HAS_STDIO
67
        Define to 1 if the platform has stdio.h.
68
*/
69
#ifndef HAS_STDIO
70
#define HAS_STDIO 0
71
#endif
72
/* Configuration : HAS_PRINTF
73
        Define to 1 if the platform has stdio.h and implements the printf function.
74
*/
75
#ifndef HAS_PRINTF
76
#define HAS_PRINTF 0
77
#endif
78
 
79
/* Configuration : CORE_TICKS
80
        Define type of return from the timing functions.
81
 */
82
#include <time.h>
83
typedef clock_t CORE_TICKS;
84
 
85
/* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION
86
        Initialize these strings per platform
87
*/
88
#ifndef COMPILER_VERSION 
89
 #ifdef __GNUC__
90
 #define COMPILER_VERSION "GCC"__VERSION__
91
 #else
92
 #define COMPILER_VERSION "Please put compiler version here (e.g. gcc 4.1)"
93
 #endif
94
#endif
95
#ifndef COMPILER_FLAGS 
96
 #define COMPILER_FLAGS FLAGS_STR /* "Please put compiler flags here (e.g. -o3)" */
97
#endif
98
#ifndef MEM_LOCATION 
99
 #define MEM_LOCATION "STACK"
100
#endif
101
 
102
/* Data Types :
103
        To avoid compiler issues, define the data types that need ot be used for 8b, 16b and 32b in <core_portme.h>.
104
 
105
        *Imprtant* :
106
        ee_ptr_int needs to be the data type used to hold pointers, otherwise coremark may fail!!!
107
*/
108
typedef signed int ee_s16;
109
typedef unsigned int ee_u16;
110
typedef signed long ee_s32;
111
typedef double  ee_f32;
112
typedef unsigned char ee_u8;
113
typedef unsigned long ee_u32;
114
typedef ee_u16 ee_ptr_int;
115
typedef size_t ee_size_t;
116
//typedef signed short ee_s16;
117
//typedef unsigned short ee_u16;
118
//typedef signed int ee_s32;
119
//typedef double ee_f32;
120
//typedef unsigned char ee_u8;
121
//typedef unsigned int ee_u32;
122
//typedef ee_u32 ee_ptr_int;
123
//typedef size_t ee_size_t;
124
/* align_mem :
125
        This macro is used to align an offset to point to a 32b value. It is used in the Matrix algorithm to initialize the input memory blocks.
126
*/
127
#define align_mem(x) (void *)(4 + (((ee_ptr_int)(x) - 1) & ~3))
128
 
129
/* Configuration : SEED_METHOD
130
        Defines method to get seed values that cannot be computed at compile time.
131
 
132
        Valid values :
133
        SEED_ARG - from command line.
134
        SEED_FUNC - from a system function.
135
        SEED_VOLATILE - from volatile variables.
136
*/
137
#ifndef SEED_METHOD
138
#define SEED_METHOD SEED_VOLATILE
139
#endif
140
 
141
/* Configuration : MEM_METHOD
142
        Defines method to get a block of memry.
143
 
144
        Valid values :
145
        MEM_MALLOC - for platforms that implement malloc and have malloc.h.
146
        MEM_STATIC - to use a static memory array.
147
        MEM_STACK - to allocate the data block on the stack (NYI).
148
*/
149
#ifndef MEM_METHOD
150
#define MEM_METHOD MEM_STACK
151
#endif
152
 
153
/* Configuration : MULTITHREAD
154
        Define for parallel execution
155
 
156
        Valid values :
157
        1 - only one context (default).
158
        N>1 - will execute N copies in parallel.
159
 
160
        Note :
161
        If this flag is defined to more then 1, an implementation for launching parallel contexts must be defined.
162
 
163
        Two sample implementations are provided. Use <USE_PTHREAD> or <USE_FORK> to enable them.
164
 
165
        It is valid to have a different implementation of <core_start_parallel> and <core_end_parallel> in <core_portme.c>,
166
        to fit a particular architecture.
167
*/
168
#ifndef MULTITHREAD
169
#define MULTITHREAD 1
170
#define USE_PTHREAD 0
171
#define USE_FORK 0
172
#define USE_SOCKET 0
173
#endif
174
 
175
/* Configuration : MAIN_HAS_NOARGC
176
        Needed if platform does not support getting arguments to main.
177
 
178
        Valid values :
179
 
180
        1 - argc/argv to main is not supported
181
 
182
        Note :
183
        This flag only matters if MULTITHREAD has been defined to a value greater then 1.
184
*/
185
#ifndef MAIN_HAS_NOARGC 
186
#define MAIN_HAS_NOARGC 1
187
#endif
188
 
189
/* Configuration : MAIN_HAS_NORETURN
190
        Needed if platform does not support returning a value from main.
191
 
192
        Valid values :
193
 
194
        1 - platform does not support returning a value from main
195
*/
196
#ifndef MAIN_HAS_NORETURN
197
#define MAIN_HAS_NORETURN 0
198
#endif
199
 
200
/* Variable : default_num_contexts
201
        Not used for this simple port, must cintain the value 1.
202
*/
203
extern ee_u32 default_num_contexts;
204
 
205
typedef struct CORE_PORTABLE_S {
206
        ee_u8   portable_id;
207
} core_portable;
208
 
209
/* target specific init/fini */
210
void portable_init(core_portable *p, int *argc, char *argv[]);
211
void portable_fini(core_portable *p);
212
 
213
// special printf
214
int ee_printf(const char *fmt, ...);
215
 
216
// timer IRQ for measurement
217
volatile uint16_t neo430_ticks;
218
void __attribute__((__interrupt__)) timer_irq_handler(void);
219
 
220
#if !defined(PROFILE_RUN) && !defined(PERFORMANCE_RUN) && !defined(VALIDATION_RUN)
221
#if (TOTAL_DATA_SIZE==1200)
222
#define PROFILE_RUN 1
223
#elif (TOTAL_DATA_SIZE==2000)
224
#define PERFORMANCE_RUN 1
225
#else
226
#define VALIDATION_RUN 1
227
#endif
228
#endif
229
 
230
#endif /* CORE_PORTME_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.