Line 12... |
Line 12... |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
limitations under the License.
|
limitations under the License.
|
|
|
Original Author: Shay Gal-on
|
Original Author: Shay Gal-on
|
|
|
Modified for NEORV32 by Stephan Nolting
|
|
*/
|
*/
|
|
|
|
/* Modified for the NEORV32 Processor - by Stephan Nolting */
|
|
|
/* Topic : Description
|
/* Topic : Description
|
This file contains configuration constants required to execute on different platforms
|
This file contains configuration constants required to execute on
|
|
different platforms
|
*/
|
*/
|
#ifndef CORE_PORTME_H
|
#ifndef CORE_PORTME_H
|
#define CORE_PORTME_H
|
#define CORE_PORTME_H
|
|
|
|
#include <stdlib.h>
|
// NEORV32 libraries
|
|
#include <stdint.h>
|
|
#include <neorv32.h>
|
#include <neorv32.h>
|
|
|
// Manual NEORV32 config:
|
/************************/
|
|
/* NEORV32-specific */
|
|
/************************/
|
#define BAUD_RATE (19200)
|
#define BAUD_RATE (19200)
|
#define ITERATIONS (2000)
|
#define ITERATIONS (2000)
|
#define FLAGS_STR "-> see makefile" // compiler optimization
|
#define FLAGS_STR "-> default, see makefile" // compiler optimization
|
|
|
// For debugging
|
|
#define xstr(a) str(a)
|
|
#define str(a) #a
|
|
|
|
|
|
/************************/
|
/************************/
|
/* Data types and settings */
|
/* Data types and settings */
|
/************************/
|
/************************/
|
/* Configuration : HAS_FLOAT
|
/* Configuration : HAS_FLOAT
|
Line 67... |
Line 63... |
*/
|
*/
|
#ifndef HAS_STDIO
|
#ifndef HAS_STDIO
|
#define HAS_STDIO 0
|
#define HAS_STDIO 0
|
#endif
|
#endif
|
/* Configuration : HAS_PRINTF
|
/* Configuration : HAS_PRINTF
|
Define to 1 if the platform has stdio.h and implements the printf function.
|
Define to 1 if the platform has stdio.h and implements the printf
|
|
function.
|
*/
|
*/
|
#ifndef HAS_PRINTF
|
#ifndef HAS_PRINTF
|
#define HAS_PRINTF 0
|
#define HAS_PRINTF 0
|
#endif
|
#endif
|
|
|
/* Configuration : CORE_TICKS
|
|
Define type of return from the timing functions.
|
|
*/
|
|
#include <time.h>
|
|
//typedef clock_t CORE_TICKS;
|
|
typedef uint64_t CORE_TICKS;
|
|
|
|
/* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION
|
/* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION
|
Initialize these strings per platform
|
Initialize these strings per platform
|
*/
|
*/
|
#ifndef COMPILER_VERSION
|
#ifndef COMPILER_VERSION
|
#ifdef __GNUC__
|
#ifdef __GNUC__
|
Line 91... |
Line 81... |
#else
|
#else
|
#define COMPILER_VERSION "Please put compiler version here (e.g. gcc 4.1)"
|
#define COMPILER_VERSION "Please put compiler version here (e.g. gcc 4.1)"
|
#endif
|
#endif
|
#endif
|
#endif
|
#ifndef COMPILER_FLAGS
|
#ifndef COMPILER_FLAGS
|
#define COMPILER_FLAGS FLAGS_STR /* "Please put compiler flags here (e.g. -o3)" */
|
#define COMPILER_FLAGS \
|
|
FLAGS_STR /* "Please put compiler flags here (e.g. -o3)" */
|
#endif
|
#endif
|
#ifndef MEM_LOCATION
|
#ifndef MEM_LOCATION
|
#define MEM_LOCATION "STACK"
|
#define MEM_LOCATION "STACK"
|
#endif
|
#endif
|
|
|
/* Data Types :
|
/* Data Types :
|
To avoid compiler issues, define the data types that need ot be used for 8b, 16b and 32b in <core_portme.h>.
|
To avoid compiler issues, define the data types that need ot be used for
|
|
8b, 16b and 32b in <core_portme.h>.
|
|
|
*Imprtant* :
|
*Imprtant* :
|
ee_ptr_int needs to be the data type used to hold pointers, otherwise coremark may fail!!!
|
ee_ptr_int needs to be the data type used to hold pointers, otherwise
|
|
coremark may fail!!!
|
*/
|
*/
|
typedef signed short ee_s16;
|
typedef signed short ee_s16;
|
typedef unsigned short ee_u16;
|
typedef unsigned short ee_u16;
|
typedef signed int ee_s32;
|
typedef signed int ee_s32;
|
typedef double ee_f32;
|
typedef double ee_f32;
|
typedef unsigned char ee_u8;
|
typedef unsigned char ee_u8;
|
typedef unsigned int ee_u32;
|
typedef unsigned int ee_u32;
|
|
typedef unsigned long ee_u64;
|
typedef ee_u32 ee_ptr_int;
|
typedef ee_u32 ee_ptr_int;
|
typedef size_t ee_size_t;
|
typedef size_t ee_size_t;
|
|
#define NULL ((void *)0)
|
/* align_mem :
|
/* align_mem :
|
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.
|
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.
|
*/
|
*/
|
#define align_mem(x) (void *)(4 + (((ee_ptr_int)(x) - 1) & ~3))
|
#define align_mem(x) (void *)(4 + (((ee_ptr_int)(x) - 1) & ~3))
|
|
|
|
/* Configuration : CORE_TICKS
|
|
Define type of return from the timing functions.
|
|
*/
|
|
#define CORETIMETYPE ee_u64
|
|
typedef ee_u64 CORE_TICKS;
|
|
|
/* Configuration : SEED_METHOD
|
/* Configuration : SEED_METHOD
|
Defines method to get seed values that cannot be computed at compile time.
|
Defines method to get seed values that cannot be computed at compile
|
|
time.
|
|
|
Valid values :
|
Valid values :
|
SEED_ARG - from command line.
|
SEED_ARG - from command line.
|
SEED_FUNC - from a system function.
|
SEED_FUNC - from a system function.
|
SEED_VOLATILE - from volatile variables.
|
SEED_VOLATILE - from volatile variables.
|
Line 148... |
Line 151... |
Valid values :
|
Valid values :
|
1 - only one context (default).
|
1 - only one context (default).
|
N>1 - will execute N copies in parallel.
|
N>1 - will execute N copies in parallel.
|
|
|
Note :
|
Note :
|
If this flag is defined to more then 1, an implementation for launching parallel contexts must be defined.
|
If this flag is defined to more then 1, an implementation for launching
|
|
parallel contexts must be defined.
|
|
|
Two sample implementations are provided. Use <USE_PTHREAD> or <USE_FORK> to enable them.
|
Two sample implementations are provided. Use <USE_PTHREAD> or <USE_FORK>
|
|
to enable them.
|
|
|
It is valid to have a different implementation of <core_start_parallel> and <core_end_parallel> in <core_portme.c>,
|
It is valid to have a different implementation of <core_start_parallel>
|
to fit a particular architecture.
|
and <core_end_parallel> in <core_portme.c>, to fit a particular architecture.
|
*/
|
*/
|
#ifndef MULTITHREAD
|
#ifndef MULTITHREAD
|
#define MULTITHREAD 1
|
#define MULTITHREAD 1
|
#define USE_PTHREAD 0
|
#define USE_PTHREAD 0
|
#define USE_FORK 0
|
#define USE_FORK 0
|
Line 170... |
Line 175... |
Valid values :
|
Valid values :
|
0 - argc/argv to main is supported
|
0 - argc/argv to main is supported
|
1 - argc/argv to main is not supported
|
1 - argc/argv to main is not supported
|
|
|
Note :
|
Note :
|
This flag only matters if MULTITHREAD has been defined to a value greater then 1.
|
This flag only matters if MULTITHREAD has been defined to a value
|
|
greater then 1.
|
*/
|
*/
|
#ifndef MAIN_HAS_NOARGC
|
#ifndef MAIN_HAS_NOARGC
|
#define MAIN_HAS_NOARGC 1
|
#define MAIN_HAS_NOARGC 0
|
#endif
|
#endif
|
|
|
/* Configuration : MAIN_HAS_NORETURN
|
/* Configuration : MAIN_HAS_NORETURN
|
Needed if platform does not support returning a value from main.
|
Needed if platform does not support returning a value from main.
|
|
|
Line 192... |
Line 198... |
/* Variable : default_num_contexts
|
/* Variable : default_num_contexts
|
Not used for this simple port, must cintain the value 1.
|
Not used for this simple port, must cintain the value 1.
|
*/
|
*/
|
extern ee_u32 default_num_contexts;
|
extern ee_u32 default_num_contexts;
|
|
|
typedef struct CORE_PORTABLE_S {
|
typedef struct CORE_PORTABLE_S
|
|
{
|
ee_u8 portable_id;
|
ee_u8 portable_id;
|
} core_portable;
|
} core_portable;
|
|
|
/* target specific init/fini */
|
/* target specific init/fini */
|
void portable_init(core_portable *p, int *argc, char *argv[]);
|
#ifndef RUN_COREMARK
|
|
void
|
|
__attribute__((__noreturn__))
|
|
portable_init(core_portable *p, int *argc, char *argv[]);
|
|
#else
|
|
void
|
|
portable_init(core_portable *p, int *argc, char *argv[]);
|
|
#endif
|
void portable_fini(core_portable *p);
|
void portable_fini(core_portable *p);
|
|
|
// special printf
|
#if !defined(PROFILE_RUN) && !defined(PERFORMANCE_RUN) \
|
int ee_printf(const char *fmt, ...);
|
&& !defined(VALIDATION_RUN)
|
|
|
#if !defined(PROFILE_RUN) && !defined(PERFORMANCE_RUN) && !defined(VALIDATION_RUN)
|
|
#if (TOTAL_DATA_SIZE==1200)
|
#if (TOTAL_DATA_SIZE==1200)
|
#define PROFILE_RUN 1
|
#define PROFILE_RUN 1
|
#elif (TOTAL_DATA_SIZE==2000)
|
#elif (TOTAL_DATA_SIZE==2000)
|
#define PERFORMANCE_RUN 1
|
#define PERFORMANCE_RUN 1
|
#else
|
#else
|
#define VALIDATION_RUN 1
|
#define VALIDATION_RUN 1
|
#endif
|
#endif
|
#endif
|
#endif
|
|
|
|
int ee_printf(const char *fmt, ...);
|
|
|
#endif /* CORE_PORTME_H */
|
#endif /* CORE_PORTME_H */
|
|
|
No newline at end of file
|
No newline at end of file
|