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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [bootloaders/] [orpmon/] [include/] [coremark.h] - Blame information for rev 852

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

Line No. Rev Author Line
1 355 julius
/*
2
Author : Shay Gal-On, EEMBC
3
 
4
This file is part of  EEMBC(R) and CoreMark(TM), which are Copyright (C) 2009
5
All rights reserved.
6
 
7
EEMBC CoreMark Software is a product of EEMBC and is provided under the terms
8
of the CoreMark License that is distributed with the official EEMBC COREMARK
9
Software release.  If you received this EEMBC CoreMark Software without the
10
accompanying CoreMark License, you must discontinue use and download the
11
official release from www.coremark.org.
12
 
13
Also, if you are publicly displaying scores generated from the EEMBC CoreMark
14
software, make sure that you are in compliance with Run and Reporting rules
15
specified in the accompanying readme.txt file.
16
 
17
EEMBC
18
4354 Town Center Blvd. Suite 114-200
19
El Dorado Hills, CA, 95762
20
*/
21
/* Topic: Description
22
        This file contains  declarations of the various benchmark functions.
23
*/
24
 
25
/* Configuration: TOTAL_DATA_SIZE
26
        Define total size for data algorithms will operate on
27
*/
28
#ifndef TOTAL_DATA_SIZE 
29
#define TOTAL_DATA_SIZE 2*1000
30
#endif
31
 
32
#define SEED_ARG 0
33
#define SEED_FUNC 1
34
#define SEED_VOLATILE 2
35
 
36
#define MEM_STATIC 0
37
#define MEM_MALLOC 1
38
#define MEM_STACK 2
39
 
40
#include "core_portme.h"
41
 
42
#if HAS_STDIO
43
#include <stdio.h>
44
#endif
45
#if HAS_PRINTF
46
#define ee_printf printf
47
#endif
48
 
49
/* Actual benchmark execution in iterate */
50
void *iterate(void *pres);
51
 
52
/* Typedef: secs_ret
53
        For machines that have floating point support, get number of seconds as a double.
54
        Otherwise an unsigned int.
55
*/
56
#if HAS_FLOAT
57
typedef double secs_ret;
58
#else
59
typedef ee_u32 secs_ret;
60
#endif
61
 
62
#if MAIN_HAS_NORETURN
63
#define MAIN_RETURN_VAL 
64
#define MAIN_RETURN_TYPE void
65
#else
66
#define MAIN_RETURN_VAL 0
67
#define MAIN_RETURN_TYPE int
68
#endif 
69
 
70
 
71
void start_time(void);
72
void stop_time(void);
73
CORE_TICKS get_time(void);
74
secs_ret time_in_secs(CORE_TICKS ticks);
75
 
76
/* Misc useful functions */
77
ee_u16 crcu8(ee_u8 data, ee_u16 crc);
78
ee_u16 crc16(ee_s16 newval, ee_u16 crc);
79
ee_u16 crcu16(ee_u16 newval, ee_u16 crc);
80
ee_u16 crcu32(ee_u32 newval, ee_u16 crc);
81
ee_u8 check_data_types(void);
82
void *portable_malloc(ee_size_t size);
83
void portable_free(void *p);
84
ee_s32 parseval(char *valstring);
85
 
86
/* Algorithm IDS */
87
#define ID_LIST         (1<<0)
88
#define ID_MATRIX       (1<<1)
89
#define ID_STATE        (1<<2)
90
#define ALL_ALGORITHMS_MASK (ID_LIST|ID_MATRIX|ID_STATE)
91
#define NUM_ALGORITHMS 3
92
 
93
/* list data structures */
94
typedef struct list_data_s {
95
        ee_s16 data16;
96
        ee_s16 idx;
97
} list_data;
98
 
99
typedef struct list_head_s {
100
        struct list_head_s *next;
101
        struct list_data_s *info;
102
} list_head;
103
 
104
 
105
/*matrix benchmark related stuff */
106
#define MATDAT_INT 1
107
#if MATDAT_INT
108
typedef ee_s16 MATDAT;
109
typedef ee_s32 MATRES;
110
#else
111
typedef ee_f16 MATDAT;
112
typedef ee_f32 MATRES;
113
#endif
114
 
115
typedef struct MAT_PARAMS_S {
116
        int N;
117
        MATDAT *A;
118
        MATDAT *B;
119
        MATRES *C;
120
} mat_params;
121
 
122
/* state machine related stuff */
123
/* List of all the possible states for the FSM */
124
typedef enum CORE_STATE {
125
        CORE_START=0,
126
        CORE_INVALID,
127
        CORE_S1,
128
        CORE_S2,
129
        CORE_INT,
130
        CORE_FLOAT,
131
        CORE_EXPONENT,
132
        CORE_SCIENTIFIC,
133
        NUM_CORE_STATES
134
} core_state_e ;
135
 
136
 
137
/* Helper structure to hold results */
138
typedef struct RESULTS_S {
139
        /* inputs */
140
        ee_s16  seed1;          /* Initializing seed */
141
        ee_s16  seed2;          /* Initializing seed */
142
        ee_s16  seed3;          /* Initializing seed */
143
        void    *memblock[4];   /* Pointer to safe memory location */
144
        ee_u32  size;           /* Size of the data */
145
        ee_u32 iterations;              /* Number of iterations to execute */
146
        ee_u32  execs;          /* Bitmask of operations to execute */
147
        struct list_head_s *list;
148
        mat_params mat;
149
        /* outputs */
150
        ee_u16  crc;
151
        ee_u16  crclist;
152
        ee_u16  crcmatrix;
153
        ee_u16  crcstate;
154
        ee_s16  err;
155
        /* ultithread specific */
156
        core_portable port;
157
} core_results;
158
 
159
/* Multicore execution handling */
160
#if (MULTITHREAD>1)
161
ee_u8 core_start_parallel(core_results *res);
162
ee_u8 core_stop_parallel(core_results *res);
163
#endif
164
 
165
/* list benchmark functions */
166
list_head *core_list_init(ee_u32 blksize, list_head *memblock, ee_s16 seed);
167
ee_u16 core_bench_list(core_results *res, ee_s16 finder_idx);
168
 
169
/* state benchmark functions */
170
void core_init_state(ee_u32 size, ee_s16 seed, ee_u8 *p);
171
ee_u16 core_bench_state(ee_u32 blksize, ee_u8 *memblock,
172
                ee_s16 seed1, ee_s16 seed2, ee_s16 step, ee_u16 crc);
173
 
174
/* matrix benchmark functions */
175
ee_u32 core_init_matrix(ee_u32 blksize, void *memblk, ee_s32 seed, mat_params *p);
176
ee_u16 core_bench_matrix(mat_params *p, ee_s16 seed, ee_u16 crc);
177
 

powered by: WebSVN 2.1.0

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