SAMV71 Xplained Ultra Software Package 1.3

coremark.h

00001 /*
00002 Author : Shay Gal-On, EEMBC
00003 
00004 This file is part of  EEMBC(R) and CoreMark(TM), which are Copyright (C) 2009 
00005 All rights reserved.                            
00006 
00007 EEMBC CoreMark Software is a product of EEMBC and is provided under the terms of the
00008 CoreMark License that is distributed with the official EEMBC COREMARK Software release. 
00009 If you received this EEMBC CoreMark Software without the accompanying CoreMark License, 
00010 you must discontinue use and download the official release from www.coremark.org.  
00011 
00012 Also, if you are publicly displaying scores generated from the EEMBC CoreMark software, 
00013 make sure that you are in compliance with Run and Reporting rules specified in the accompanying readme.txt file.
00014 
00015 EEMBC 
00016 4354 Town Center Blvd. Suite 114-200
00017 El Dorado Hills, CA, 95762 
00018 */ 
00019 /* Topic: Description
00020     This file contains  declarations of the various benchmark functions.
00021 */
00022 
00023 /* Configuration: TOTAL_DATA_SIZE
00024     Define total size for data algorithms will operate on
00025 */
00026 #ifndef TOTAL_DATA_SIZE 
00027 #define TOTAL_DATA_SIZE 2*1000
00028 #endif
00029 
00030 #define SEED_ARG 0
00031 #define SEED_FUNC 1
00032 #define SEED_VOLATILE 2
00033 
00034 #define MEM_STATIC 0
00035 #define MEM_MALLOC 1
00036 #define MEM_STACK 2
00037 
00038 #include "core_portme.h"
00039 
00040 #if HAS_STDIO
00041 #include <stdio.h>
00042 #endif
00043 #if HAS_PRINTF
00044 #define ee_printf printf
00045 #endif
00046 
00047 /* Actual benchmark execution in iterate */
00048 void *iterate(void *pres);
00049 
00050 /* Typedef: secs_ret
00051     For machines that have floating point support, get number of seconds as a double. 
00052     Otherwise an unsigned int.
00053 */
00054 #if HAS_FLOAT
00055 typedef double secs_ret;
00056 #else
00057 typedef ee_u32 secs_ret;
00058 #endif
00059 
00060 #if MAIN_HAS_NORETURN
00061 #define MAIN_RETURN_VAL 
00062 #define MAIN_RETURN_TYPE void
00063 #else
00064 #define MAIN_RETURN_VAL 0
00065 #define MAIN_RETURN_TYPE int
00066 #endif 
00067 
00068 void start_time(void);
00069 void stop_time(void);
00070 CORE_TICKS get_time(void);
00071 secs_ret time_in_secs(CORE_TICKS ticks);
00072 
00073 /* Misc useful functions */
00074 ee_u16 crcu8(ee_u8 data, ee_u16 crc);
00075 ee_u16 crc16(ee_s16 newval, ee_u16 crc);
00076 ee_u16 crcu16(ee_u16 newval, ee_u16 crc);
00077 ee_u16 crcu32(ee_u32 newval, ee_u16 crc);
00078 void *portable_malloc(size_t size);
00079 void portable_free(void *p);
00080 
00081 /* Algorithm IDS */
00082 #define ID_LIST     (1<<0)
00083 #define ID_MATRIX   (1<<1)
00084 #define ID_STATE    (1<<2)
00085 #define ALL_ALGORITHMS_MASK (ID_LIST|ID_MATRIX|ID_STATE)
00086 #define NUM_ALGORITHMS 3
00087 
00088 /* list data structures */
00089 typedef struct list_data_s {
00090     ee_s16 data16;
00091     ee_s16 idx;
00092 } list_data;
00093 
00094 typedef struct list_head_s {
00095     struct list_head_s *next;
00096     struct list_data_s *info;
00097 } list_head;
00098 
00099 
00100 /*matrix benchmark related stuff */
00101 #define MATDAT_INT 1
00102 #if MATDAT_INT
00103 typedef ee_s16 MATDAT;
00104 typedef ee_s32 MATRES;
00105 #else
00106 typedef ee_f16 MATDAT;
00107 typedef ee_f32 MATRES;
00108 #endif
00109 
00110 typedef struct MAT_PARAMS_S {
00111     int N;
00112     MATDAT *A;
00113     MATDAT *B;
00114     MATRES *C;
00115 } mat_params;
00116 
00117 /* state machine related stuff */
00118 /* List of all the possible states for the FSM */
00119 typedef enum CORE_STATE {
00120     CORE_START=0,
00121     CORE_INVALID,
00122     CORE_S1,
00123     CORE_S2,
00124     CORE_INT,
00125     CORE_FLOAT,
00126     CORE_EXPONENT,
00127     CORE_SCIENTIFIC,
00128     NUM_CORE_STATES
00129 } core_state_e ;
00130 
00131         
00132 /* Helper structure to hold results */
00133 typedef struct RESULTS_S {
00134     /* inputs */
00135     ee_s16  seed1;      /* Initializing seed */
00136     ee_s16  seed2;      /* Initializing seed */
00137     ee_s16  seed3;      /* Initializing seed */
00138     void    *memblock[4];   /* Pointer to safe memory location */
00139     ee_u32  size;       /* Size of the data */
00140     ee_u32 iterations;      /* Number of iterations to execute */
00141     ee_u32  execs;      /* Bitmask of operations to execute */
00142     struct list_head_s *list;
00143     mat_params mat;
00144     /* outputs */
00145     ee_u16  crc;
00146     ee_u16  crclist;
00147     ee_u16  crcmatrix;
00148     ee_u16  crcstate;
00149     ee_s16  err;
00150     /* ultithread specific */
00151     core_portable port;
00152 } core_results;
00153 
00154 /* Multicore execution handling */
00155 #if (MULTITHREAD>1)
00156 ee_u8 core_start_parallel(core_results *res);
00157 ee_u8 core_stop_parallel(core_results *res);
00158 #endif
00159 
00160 /* list benchmark functions */
00161 list_head *core_list_init(ee_u32 blksize, list_head *memblock, ee_s16 seed);
00162 ee_u16 core_bench_list(core_results *res, ee_s16 finder_idx);
00163 
00164 /* state benchmark functions */
00165 void core_init_state(ee_u32 size, ee_s16 seed, ee_u8 *p);
00166 ee_u16 core_bench_state(ee_u32 blksize, ee_u8 *memblock, 
00167         ee_s16 seed1, ee_s16 seed2, ee_s16 step, ee_u16 crc);
00168 
00169 /* matrix benchmark functions */
00170 ee_u32 core_init_matrix(ee_u32 blksize, void *memblk, ee_s32 seed, mat_params *p);
00171 ee_u16 core_bench_matrix(mat_params *p, ee_s16 seed, ee_u16 crc);
00172 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines