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

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sw/] [example/] [coremark/] [core_portme.h] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 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 NEORV32 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
// NEORV32 libraries
29
#include <stdint.h>
30
#include <neorv32.h>
31
 
32
// Manual NEORV32 config:
33
#define BAUD_RATE       (19200)
34
#define ITERATIONS      (2000)
35
#define FLAGS_STR        "-> see makefile" // compiler optimization
36
 
37
// For debugging
38
#define xstr(a) str(a)
39
#define str(a) #a
40
 
41
 
42
/************************/
43
/* Data types and settings */
44
/************************/
45
/* Configuration : HAS_FLOAT
46
        Define to 1 if the platform supports floating point.
47
*/
48
#ifndef HAS_FLOAT 
49
#define HAS_FLOAT 0
50
#endif
51
/* Configuration : HAS_TIME_H
52
        Define to 1 if platform has the time.h header file,
53
        and implementation of functions thereof.
54
*/
55
#ifndef HAS_TIME_H
56
#define HAS_TIME_H 0
57
#endif
58
/* Configuration : USE_CLOCK
59
        Define to 1 if platform has the time.h header file,
60
        and implementation of functions thereof.
61
*/
62
#ifndef USE_CLOCK
63
#define USE_CLOCK 0
64
#endif
65
/* Configuration : HAS_STDIO
66
        Define to 1 if the platform has stdio.h.
67
*/
68
#ifndef HAS_STDIO
69
#define HAS_STDIO 0
70
#endif
71
/* Configuration : HAS_PRINTF
72
        Define to 1 if the platform has stdio.h and implements the printf function.
73
*/
74
#ifndef HAS_PRINTF
75
#define HAS_PRINTF 0
76
#endif
77
 
78
/* Configuration : CORE_TICKS
79
        Define type of return from the timing functions.
80
 */
81
#include <time.h>
82
//typedef clock_t CORE_TICKS;
83
typedef uint64_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 short ee_s16;
109
typedef unsigned short ee_u16;
110
typedef signed int ee_s32;
111
typedef double ee_f32;
112
typedef unsigned char ee_u8;
113
typedef unsigned int ee_u32;
114
typedef ee_u32 ee_ptr_int;
115
typedef size_t ee_size_t;
116
/* align_mem :
117
        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.
118
*/
119
#define align_mem(x) (void *)(4 + (((ee_ptr_int)(x) - 1) & ~3))
120
 
121
/* Configuration : SEED_METHOD
122
        Defines method to get seed values that cannot be computed at compile time.
123
 
124
        Valid values :
125
        SEED_ARG - from command line.
126
        SEED_FUNC - from a system function.
127
        SEED_VOLATILE - from volatile variables.
128
*/
129
#ifndef SEED_METHOD
130
#define SEED_METHOD SEED_VOLATILE
131
#endif
132
 
133
/* Configuration : MEM_METHOD
134
        Defines method to get a block of memry.
135
 
136
        Valid values :
137
        MEM_MALLOC - for platforms that implement malloc and have malloc.h.
138
        MEM_STATIC - to use a static memory array.
139
        MEM_STACK - to allocate the data block on the stack (NYI).
140
*/
141
#ifndef MEM_METHOD
142
#define MEM_METHOD MEM_STACK
143
#endif
144
 
145
/* Configuration : MULTITHREAD
146
        Define for parallel execution
147
 
148
        Valid values :
149
        1 - only one context (default).
150
        N>1 - will execute N copies in parallel.
151
 
152
        Note :
153
        If this flag is defined to more then 1, an implementation for launching parallel contexts must be defined.
154
 
155
        Two sample implementations are provided. Use <USE_PTHREAD> or <USE_FORK> to enable them.
156
 
157
        It is valid to have a different implementation of <core_start_parallel> and <core_end_parallel> in <core_portme.c>,
158
        to fit a particular architecture.
159
*/
160
#ifndef MULTITHREAD
161
#define MULTITHREAD 1
162
#define USE_PTHREAD 0
163
#define USE_FORK 0
164
#define USE_SOCKET 0
165
#endif
166
 
167
/* Configuration : MAIN_HAS_NOARGC
168
        Needed if platform does not support getting arguments to main.
169
 
170
        Valid values :
171
 
172
        1 - argc/argv to main is not supported
173
 
174
        Note :
175
        This flag only matters if MULTITHREAD has been defined to a value greater then 1.
176
*/
177
#ifndef MAIN_HAS_NOARGC 
178
#define MAIN_HAS_NOARGC 1
179
#endif
180
 
181
/* Configuration : MAIN_HAS_NORETURN
182
        Needed if platform does not support returning a value from main.
183
 
184
        Valid values :
185
 
186
        1 - platform does not support returning a value from main
187
*/
188
#ifndef MAIN_HAS_NORETURN
189
#define MAIN_HAS_NORETURN 0
190
#endif
191
 
192
/* Variable : default_num_contexts
193
        Not used for this simple port, must cintain the value 1.
194
*/
195
extern ee_u32 default_num_contexts;
196
 
197
typedef struct CORE_PORTABLE_S {
198
        ee_u8   portable_id;
199
} core_portable;
200
 
201
/* target specific init/fini */
202
void portable_init(core_portable *p, int *argc, char *argv[]);
203
void portable_fini(core_portable *p);
204
 
205
// special printf
206
int ee_printf(const char *fmt, ...);
207
 
208
#if !defined(PROFILE_RUN) && !defined(PERFORMANCE_RUN) && !defined(VALIDATION_RUN)
209
#if (TOTAL_DATA_SIZE==1200)
210
#define PROFILE_RUN 1
211
#elif (TOTAL_DATA_SIZE==2000)
212
#define PERFORMANCE_RUN 1
213
#else
214
#define VALIDATION_RUN 1
215
#endif
216
#endif
217
 
218
#endif /* CORE_PORTME_H */

powered by: WebSVN 2.1.0

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