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

Subversion Repositories neorv32

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

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

powered by: WebSVN 2.1.0

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