00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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
00048 void *iterate(void *pres);
00049
00050
00051
00052
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
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
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
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
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
00118
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
00133 typedef struct RESULTS_S {
00134
00135 ee_s16 seed1;
00136 ee_s16 seed2;
00137 ee_s16 seed3;
00138 void *memblock[4];
00139 ee_u32 size;
00140 ee_u32 iterations;
00141 ee_u32 execs;
00142 struct list_head_s *list;
00143 mat_params mat;
00144
00145 ee_u16 crc;
00146 ee_u16 crclist;
00147 ee_u16 crcmatrix;
00148 ee_u16 crcstate;
00149 ee_s16 err;
00150
00151 core_portable port;
00152 } core_results;
00153
00154
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
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
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
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