Updated functions to deal with USB clocking. (PPL1) See http://www.nxp.com/documents/user_manual/UM10360.pdf Section 4.6 & 4.7.3
Fork of ClockControl by
CoreMark/core_main.c@0:b5d3bd64d2dc, 2010-01-24 (annotated)
- Committer:
- no2chem
- Date:
- Sun Jan 24 15:46:26 2010 +0000
- Revision:
- 0:b5d3bd64d2dc
- Child:
- 1:8b04bd33c7cd
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
no2chem | 0:b5d3bd64d2dc | 1 | /* |
no2chem | 0:b5d3bd64d2dc | 2 | Author : Shay Gal-On, EEMBC |
no2chem | 0:b5d3bd64d2dc | 3 | |
no2chem | 0:b5d3bd64d2dc | 4 | This file is part of EEMBC(R) and CoreMark(TM), which are Copyright (C) 2009 |
no2chem | 0:b5d3bd64d2dc | 5 | All rights reserved. |
no2chem | 0:b5d3bd64d2dc | 6 | |
no2chem | 0:b5d3bd64d2dc | 7 | EEMBC CoreMark Software is a product of EEMBC and is provided under the terms of the |
no2chem | 0:b5d3bd64d2dc | 8 | CoreMark License that is distributed with the official EEMBC COREMARK Software release. |
no2chem | 0:b5d3bd64d2dc | 9 | If you received this EEMBC CoreMark Software without the accompanying CoreMark License, |
no2chem | 0:b5d3bd64d2dc | 10 | you must discontinue use and download the official release from www.coremark.org. |
no2chem | 0:b5d3bd64d2dc | 11 | |
no2chem | 0:b5d3bd64d2dc | 12 | Also, if you are publicly displaying scores generated from the EEMBC CoreMark software, |
no2chem | 0:b5d3bd64d2dc | 13 | make sure that you are in compliance with Run and Reporting rules specified in the accompanying readme.txt file. |
no2chem | 0:b5d3bd64d2dc | 14 | |
no2chem | 0:b5d3bd64d2dc | 15 | EEMBC |
no2chem | 0:b5d3bd64d2dc | 16 | 4354 Town Center Blvd. Suite 114-200 |
no2chem | 0:b5d3bd64d2dc | 17 | El Dorado Hills, CA, 95762 |
no2chem | 0:b5d3bd64d2dc | 18 | */ |
no2chem | 0:b5d3bd64d2dc | 19 | /* File: core_main.c |
no2chem | 0:b5d3bd64d2dc | 20 | This file contains the framework to acquire a block of memory, seed initial parameters, tun t he benchmark and report the results. |
no2chem | 0:b5d3bd64d2dc | 21 | */ |
no2chem | 0:b5d3bd64d2dc | 22 | #include "coremark.h" |
no2chem | 0:b5d3bd64d2dc | 23 | |
no2chem | 0:b5d3bd64d2dc | 24 | /* Function: iterate |
no2chem | 0:b5d3bd64d2dc | 25 | Run the benchmark for a specified number of iterations. |
no2chem | 0:b5d3bd64d2dc | 26 | |
no2chem | 0:b5d3bd64d2dc | 27 | Operation: |
no2chem | 0:b5d3bd64d2dc | 28 | For each type of benchmarked algorithm: |
no2chem | 0:b5d3bd64d2dc | 29 | a - Initialize the data block for the algorithm. |
no2chem | 0:b5d3bd64d2dc | 30 | b - Execute the algorithm N times. |
no2chem | 0:b5d3bd64d2dc | 31 | |
no2chem | 0:b5d3bd64d2dc | 32 | Returns: |
no2chem | 0:b5d3bd64d2dc | 33 | NULL. |
no2chem | 0:b5d3bd64d2dc | 34 | */ |
no2chem | 0:b5d3bd64d2dc | 35 | static ee_u16 list_known_crc[] = {(ee_u16)0xd4b0,(ee_u16)0x3340,(ee_u16)0x6a79,(ee_u16)0xe714,(ee_u16)0xe3c1}; |
no2chem | 0:b5d3bd64d2dc | 36 | static ee_u16 matrix_known_crc[] = {(ee_u16)0xbe52,(ee_u16)0x1199,(ee_u16)0x5608,(ee_u16)0x1fd7,(ee_u16)0x0747}; |
no2chem | 0:b5d3bd64d2dc | 37 | static ee_u16 state_known_crc[] = {(ee_u16)0x5e47,(ee_u16)0x39bf,(ee_u16)0xe5a4,(ee_u16)0x8e3a,(ee_u16)0x8d84}; |
no2chem | 0:b5d3bd64d2dc | 38 | void *iterate(void *pres) { |
no2chem | 0:b5d3bd64d2dc | 39 | ee_u32 i; |
no2chem | 0:b5d3bd64d2dc | 40 | ee_u16 crc; |
no2chem | 0:b5d3bd64d2dc | 41 | core_results *res=(core_results *)pres; |
no2chem | 0:b5d3bd64d2dc | 42 | ee_u32 iterations=res->iterations; |
no2chem | 0:b5d3bd64d2dc | 43 | res->crc=0; |
no2chem | 0:b5d3bd64d2dc | 44 | res->crclist=0; |
no2chem | 0:b5d3bd64d2dc | 45 | res->crcmatrix=0; |
no2chem | 0:b5d3bd64d2dc | 46 | res->crcstate=0; |
no2chem | 0:b5d3bd64d2dc | 47 | |
no2chem | 0:b5d3bd64d2dc | 48 | for (i=0; i<iterations; i++) { |
no2chem | 0:b5d3bd64d2dc | 49 | crc=core_bench_list(res,1); |
no2chem | 0:b5d3bd64d2dc | 50 | res->crc=crcu16(crc,res->crc); |
no2chem | 0:b5d3bd64d2dc | 51 | crc=core_bench_list(res,-1); |
no2chem | 0:b5d3bd64d2dc | 52 | res->crc=crcu16(crc,res->crc); |
no2chem | 0:b5d3bd64d2dc | 53 | if (i==0) res->crclist=res->crc; |
no2chem | 0:b5d3bd64d2dc | 54 | } |
no2chem | 0:b5d3bd64d2dc | 55 | return NULL; |
no2chem | 0:b5d3bd64d2dc | 56 | } |
no2chem | 0:b5d3bd64d2dc | 57 | |
no2chem | 0:b5d3bd64d2dc | 58 | #if (SEED_METHOD==SEED_ARG) |
no2chem | 0:b5d3bd64d2dc | 59 | ee_s32 get_seed_args(int i, int argc, char *argv[]); |
no2chem | 0:b5d3bd64d2dc | 60 | #define get_seed(x) (ee_s16)get_seed_args(x,argc,argv) |
no2chem | 0:b5d3bd64d2dc | 61 | #define get_seed_32(x) get_seed_args(x,argc,argv) |
no2chem | 0:b5d3bd64d2dc | 62 | #else /* via function or volatile */ |
no2chem | 0:b5d3bd64d2dc | 63 | ee_s32 get_seed_32(int i); |
no2chem | 0:b5d3bd64d2dc | 64 | #define get_seed(x) (ee_s16)get_seed_32(x) |
no2chem | 0:b5d3bd64d2dc | 65 | #endif |
no2chem | 0:b5d3bd64d2dc | 66 | |
no2chem | 0:b5d3bd64d2dc | 67 | #if (MEM_METHOD==MEM_STATIC) |
no2chem | 0:b5d3bd64d2dc | 68 | ee_u8 static_memblk[TOTAL_DATA_SIZE]; |
no2chem | 0:b5d3bd64d2dc | 69 | #endif |
no2chem | 0:b5d3bd64d2dc | 70 | char *mem_name[3] = {"Static","Heap","Stack"}; |
no2chem | 0:b5d3bd64d2dc | 71 | /* Function: main |
no2chem | 0:b5d3bd64d2dc | 72 | Main entry routine for the benchmark. |
no2chem | 0:b5d3bd64d2dc | 73 | This function is responsible for the following steps: |
no2chem | 0:b5d3bd64d2dc | 74 | |
no2chem | 0:b5d3bd64d2dc | 75 | 1 - Initialize input seeds from a source that cannot be determined at compile time. |
no2chem | 0:b5d3bd64d2dc | 76 | 2 - Initialize memory block for use. |
no2chem | 0:b5d3bd64d2dc | 77 | 3 - Run and time the benchmark. |
no2chem | 0:b5d3bd64d2dc | 78 | 4 - Report results, testing the validity of the output if the seeds are known. |
no2chem | 0:b5d3bd64d2dc | 79 | |
no2chem | 0:b5d3bd64d2dc | 80 | Arguments: |
no2chem | 0:b5d3bd64d2dc | 81 | 1 - first seed : Any value |
no2chem | 0:b5d3bd64d2dc | 82 | 2 - second seed : Must be identical to first for iterations to be identical |
no2chem | 0:b5d3bd64d2dc | 83 | 3 - third seed : Any value, should be at least an order of magnitude less then the input size, but bigger then 32. |
no2chem | 0:b5d3bd64d2dc | 84 | 4 - Iterations : Special, if set to 0, iterations will be automatically determined such that the benchmark will run between 10 to 100 secs |
no2chem | 0:b5d3bd64d2dc | 85 | |
no2chem | 0:b5d3bd64d2dc | 86 | */ |
no2chem | 0:b5d3bd64d2dc | 87 | |
no2chem | 0:b5d3bd64d2dc | 88 | #if MAIN_HAS_NOARGC |
no2chem | 0:b5d3bd64d2dc | 89 | MAIN_RETURN_TYPE mainCoreMark(void) { |
no2chem | 0:b5d3bd64d2dc | 90 | int argc=0; |
no2chem | 0:b5d3bd64d2dc | 91 | char *argv[1]; |
no2chem | 0:b5d3bd64d2dc | 92 | #else |
no2chem | 0:b5d3bd64d2dc | 93 | MAIN_RETURN_TYPE mainCoreMark(int argc, char *argv[]) { |
no2chem | 0:b5d3bd64d2dc | 94 | #endif |
no2chem | 0:b5d3bd64d2dc | 95 | ee_u16 i,j=0,num_algorithms=0; |
no2chem | 0:b5d3bd64d2dc | 96 | ee_s16 known_id=-1,total_errors=0; |
no2chem | 0:b5d3bd64d2dc | 97 | ee_u16 seedcrc=0; |
no2chem | 0:b5d3bd64d2dc | 98 | CORE_TICKS total_time; |
no2chem | 0:b5d3bd64d2dc | 99 | core_results results[MULTITHREAD]; |
no2chem | 0:b5d3bd64d2dc | 100 | #if (MEM_METHOD==MEM_STACK) |
no2chem | 0:b5d3bd64d2dc | 101 | ee_u8 stack_memblock[TOTAL_DATA_SIZE*MULTITHREAD]; |
no2chem | 0:b5d3bd64d2dc | 102 | #endif |
no2chem | 0:b5d3bd64d2dc | 103 | /* first call any initializations needed */ |
no2chem | 0:b5d3bd64d2dc | 104 | portable_init(&(results[0].port), &argc, argv); |
no2chem | 0:b5d3bd64d2dc | 105 | /* First some checks to make sure benchmark will run ok */ |
no2chem | 0:b5d3bd64d2dc | 106 | if (sizeof(struct list_head_s)>128) { |
no2chem | 0:b5d3bd64d2dc | 107 | ee_printf("list_head structure too big for comparable data!\n"); |
no2chem | 0:b5d3bd64d2dc | 108 | return MAIN_RETURN_VAL; |
no2chem | 0:b5d3bd64d2dc | 109 | } |
no2chem | 0:b5d3bd64d2dc | 110 | results[0].seed1=get_seed(1); |
no2chem | 0:b5d3bd64d2dc | 111 | results[0].seed2=get_seed(2); |
no2chem | 0:b5d3bd64d2dc | 112 | results[0].seed3=get_seed(3); |
no2chem | 0:b5d3bd64d2dc | 113 | results[0].iterations=get_seed_32(4); |
no2chem | 0:b5d3bd64d2dc | 114 | #if CORE_DEBUG |
no2chem | 0:b5d3bd64d2dc | 115 | results[0].iterations=1; |
no2chem | 0:b5d3bd64d2dc | 116 | #endif |
no2chem | 0:b5d3bd64d2dc | 117 | results[0].execs=get_seed_32(5); |
no2chem | 0:b5d3bd64d2dc | 118 | if (results[0].execs==0) { /* if not supplied, execute all algorithms */ |
no2chem | 0:b5d3bd64d2dc | 119 | results[0].execs=ALL_ALGORITHMS_MASK; |
no2chem | 0:b5d3bd64d2dc | 120 | } |
no2chem | 0:b5d3bd64d2dc | 121 | /* put in some default values based on one seed only for easy testing */ |
no2chem | 0:b5d3bd64d2dc | 122 | if ((results[0].seed1==0) && (results[0].seed2==0) && (results[0].seed3==0)) { /* validation run */ |
no2chem | 0:b5d3bd64d2dc | 123 | results[0].seed1=0; |
no2chem | 0:b5d3bd64d2dc | 124 | results[0].seed2=0; |
no2chem | 0:b5d3bd64d2dc | 125 | results[0].seed3=0x66; |
no2chem | 0:b5d3bd64d2dc | 126 | } |
no2chem | 0:b5d3bd64d2dc | 127 | if ((results[0].seed1==1) && (results[0].seed2==0) && (results[0].seed3==0)) { /* perfromance run */ |
no2chem | 0:b5d3bd64d2dc | 128 | results[0].seed1=0x3415; |
no2chem | 0:b5d3bd64d2dc | 129 | results[0].seed2=0x3415; |
no2chem | 0:b5d3bd64d2dc | 130 | results[0].seed3=0x66; |
no2chem | 0:b5d3bd64d2dc | 131 | } |
no2chem | 0:b5d3bd64d2dc | 132 | #if (MEM_METHOD==MEM_STATIC) |
no2chem | 0:b5d3bd64d2dc | 133 | results[0].memblock[0]=(void *)static_memblk; |
no2chem | 0:b5d3bd64d2dc | 134 | results[0].size=TOTAL_DATA_SIZE; |
no2chem | 0:b5d3bd64d2dc | 135 | results[0].err=0; |
no2chem | 0:b5d3bd64d2dc | 136 | #if (MULTITHREAD>1) |
no2chem | 0:b5d3bd64d2dc | 137 | #error "Cannot use a static data area with multiple contexts!" |
no2chem | 0:b5d3bd64d2dc | 138 | #endif |
no2chem | 0:b5d3bd64d2dc | 139 | #elif (MEM_METHOD==MEM_MALLOC) |
no2chem | 0:b5d3bd64d2dc | 140 | for (i=0 ; i<MULTITHREAD; i++) { |
no2chem | 0:b5d3bd64d2dc | 141 | ee_s32 malloc_override=get_seed(7); |
no2chem | 0:b5d3bd64d2dc | 142 | if (malloc_override != 0) |
no2chem | 0:b5d3bd64d2dc | 143 | results[i].size=malloc_override; |
no2chem | 0:b5d3bd64d2dc | 144 | else |
no2chem | 0:b5d3bd64d2dc | 145 | results[i].size=TOTAL_DATA_SIZE; |
no2chem | 0:b5d3bd64d2dc | 146 | results[i].memblock[0]=portable_malloc(results[i].size); |
no2chem | 0:b5d3bd64d2dc | 147 | results[i].seed1=results[0].seed1; |
no2chem | 0:b5d3bd64d2dc | 148 | results[i].seed2=results[0].seed2; |
no2chem | 0:b5d3bd64d2dc | 149 | results[i].seed3=results[0].seed3; |
no2chem | 0:b5d3bd64d2dc | 150 | results[i].err=0; |
no2chem | 0:b5d3bd64d2dc | 151 | results[i].execs=results[0].execs; |
no2chem | 0:b5d3bd64d2dc | 152 | } |
no2chem | 0:b5d3bd64d2dc | 153 | #elif (MEM_METHOD==MEM_STACK) |
no2chem | 0:b5d3bd64d2dc | 154 | for (i=0 ; i<MULTITHREAD; i++) { |
no2chem | 0:b5d3bd64d2dc | 155 | results[i].memblock[0]=stack_memblock+i*TOTAL_DATA_SIZE; |
no2chem | 0:b5d3bd64d2dc | 156 | results[i].size=TOTAL_DATA_SIZE; |
no2chem | 0:b5d3bd64d2dc | 157 | results[i].seed1=results[0].seed1; |
no2chem | 0:b5d3bd64d2dc | 158 | results[i].seed2=results[0].seed2; |
no2chem | 0:b5d3bd64d2dc | 159 | results[i].seed3=results[0].seed3; |
no2chem | 0:b5d3bd64d2dc | 160 | results[i].err=0; |
no2chem | 0:b5d3bd64d2dc | 161 | results[i].execs=results[0].execs; |
no2chem | 0:b5d3bd64d2dc | 162 | } |
no2chem | 0:b5d3bd64d2dc | 163 | #else |
no2chem | 0:b5d3bd64d2dc | 164 | #error "Please define a way to initialize a memory block." |
no2chem | 0:b5d3bd64d2dc | 165 | #endif |
no2chem | 0:b5d3bd64d2dc | 166 | /* Data init */ |
no2chem | 0:b5d3bd64d2dc | 167 | /* Find out how space much we have based on number of algorithms */ |
no2chem | 0:b5d3bd64d2dc | 168 | for (i=0; i<NUM_ALGORITHMS; i++) { |
no2chem | 0:b5d3bd64d2dc | 169 | if ((1<<(ee_u32)i) & results[0].execs) |
no2chem | 0:b5d3bd64d2dc | 170 | num_algorithms++; |
no2chem | 0:b5d3bd64d2dc | 171 | } |
no2chem | 0:b5d3bd64d2dc | 172 | for (i=0 ; i<MULTITHREAD; i++) |
no2chem | 0:b5d3bd64d2dc | 173 | results[i].size=results[i].size/num_algorithms; |
no2chem | 0:b5d3bd64d2dc | 174 | /* Assign pointers */ |
no2chem | 0:b5d3bd64d2dc | 175 | for (i=0; i<NUM_ALGORITHMS; i++) { |
no2chem | 0:b5d3bd64d2dc | 176 | ee_u32 ctx; |
no2chem | 0:b5d3bd64d2dc | 177 | if ((1<<(ee_u32)i) & results[0].execs) { |
no2chem | 0:b5d3bd64d2dc | 178 | for (ctx=0 ; ctx<MULTITHREAD; ctx++) |
no2chem | 0:b5d3bd64d2dc | 179 | results[ctx].memblock[i+1]=(char *)(results[ctx].memblock[0])+results[0].size*j; |
no2chem | 0:b5d3bd64d2dc | 180 | j++; |
no2chem | 0:b5d3bd64d2dc | 181 | } |
no2chem | 0:b5d3bd64d2dc | 182 | } |
no2chem | 0:b5d3bd64d2dc | 183 | /* call inits */ |
no2chem | 0:b5d3bd64d2dc | 184 | for (i=0 ; i<MULTITHREAD; i++) { |
no2chem | 0:b5d3bd64d2dc | 185 | if (results[i].execs & ID_LIST) { |
no2chem | 0:b5d3bd64d2dc | 186 | results[i].list=core_list_init(results[0].size, (list_head*) results[i].memblock[1],results[i].seed1); |
no2chem | 0:b5d3bd64d2dc | 187 | } |
no2chem | 0:b5d3bd64d2dc | 188 | if (results[i].execs & ID_MATRIX) { |
no2chem | 0:b5d3bd64d2dc | 189 | core_init_matrix(results[0].size, results[i].memblock[2], (ee_s32)results[i].seed1 | (((ee_s32)results[i].seed2) << 16), &(results[i].mat) ); |
no2chem | 0:b5d3bd64d2dc | 190 | } |
no2chem | 0:b5d3bd64d2dc | 191 | if (results[i].execs & ID_STATE) { |
no2chem | 0:b5d3bd64d2dc | 192 | core_init_state(results[0].size,results[i].seed1, (ee_u8*) results[i].memblock[3]); |
no2chem | 0:b5d3bd64d2dc | 193 | } |
no2chem | 0:b5d3bd64d2dc | 194 | } |
no2chem | 0:b5d3bd64d2dc | 195 | |
no2chem | 0:b5d3bd64d2dc | 196 | /* automatically determine number of iterations if not set */ |
no2chem | 0:b5d3bd64d2dc | 197 | if (results[0].iterations==0) { |
no2chem | 0:b5d3bd64d2dc | 198 | secs_ret secs_passed=0; |
no2chem | 0:b5d3bd64d2dc | 199 | ee_u32 divisor; |
no2chem | 0:b5d3bd64d2dc | 200 | results[0].iterations=1; |
no2chem | 0:b5d3bd64d2dc | 201 | while (secs_passed < (secs_ret)1) { |
no2chem | 0:b5d3bd64d2dc | 202 | results[0].iterations*=10; |
no2chem | 0:b5d3bd64d2dc | 203 | start_time(); |
no2chem | 0:b5d3bd64d2dc | 204 | iterate(&results[0]); |
no2chem | 0:b5d3bd64d2dc | 205 | stop_time(); |
no2chem | 0:b5d3bd64d2dc | 206 | secs_passed=time_in_secs(get_time()); |
no2chem | 0:b5d3bd64d2dc | 207 | } |
no2chem | 0:b5d3bd64d2dc | 208 | /* now we know it executes for at least 1 sec, set actual run time at about 10 secs */ |
no2chem | 0:b5d3bd64d2dc | 209 | divisor=(ee_u32)secs_passed; |
no2chem | 0:b5d3bd64d2dc | 210 | if (divisor==0) /* some machines cast float to int as 0 since this conversion is not defined by ANSI, but we know at least one second passed */ |
no2chem | 0:b5d3bd64d2dc | 211 | divisor=1; |
no2chem | 0:b5d3bd64d2dc | 212 | results[0].iterations*=1+10/divisor; |
no2chem | 0:b5d3bd64d2dc | 213 | } |
no2chem | 0:b5d3bd64d2dc | 214 | /* perform actual benchmark */ |
no2chem | 0:b5d3bd64d2dc | 215 | start_time(); |
no2chem | 0:b5d3bd64d2dc | 216 | #if (MULTITHREAD>1) |
no2chem | 0:b5d3bd64d2dc | 217 | if (default_num_contexts>MULTITHREAD) { |
no2chem | 0:b5d3bd64d2dc | 218 | default_num_contexts=MULTITHREAD; |
no2chem | 0:b5d3bd64d2dc | 219 | } |
no2chem | 0:b5d3bd64d2dc | 220 | for (i=0 ; i<default_num_contexts; i++) { |
no2chem | 0:b5d3bd64d2dc | 221 | results[i].iterations=results[0].iterations; |
no2chem | 0:b5d3bd64d2dc | 222 | results[i].execs=results[0].execs; |
no2chem | 0:b5d3bd64d2dc | 223 | core_start_parallel(&results[i]); |
no2chem | 0:b5d3bd64d2dc | 224 | } |
no2chem | 0:b5d3bd64d2dc | 225 | for (i=0 ; i<default_num_contexts; i++) { |
no2chem | 0:b5d3bd64d2dc | 226 | core_stop_parallel(&results[i]); |
no2chem | 0:b5d3bd64d2dc | 227 | } |
no2chem | 0:b5d3bd64d2dc | 228 | #else |
no2chem | 0:b5d3bd64d2dc | 229 | iterate(&results[0]); |
no2chem | 0:b5d3bd64d2dc | 230 | #endif |
no2chem | 0:b5d3bd64d2dc | 231 | stop_time(); |
no2chem | 0:b5d3bd64d2dc | 232 | total_time=get_time(); |
no2chem | 0:b5d3bd64d2dc | 233 | /* get a function of the input to report */ |
no2chem | 0:b5d3bd64d2dc | 234 | seedcrc=crc16(results[0].seed1,seedcrc); |
no2chem | 0:b5d3bd64d2dc | 235 | seedcrc=crc16(results[0].seed2,seedcrc); |
no2chem | 0:b5d3bd64d2dc | 236 | seedcrc=crc16(results[0].seed3,seedcrc); |
no2chem | 0:b5d3bd64d2dc | 237 | seedcrc=crc16(results[0].size,seedcrc); |
no2chem | 0:b5d3bd64d2dc | 238 | |
no2chem | 0:b5d3bd64d2dc | 239 | switch (seedcrc) { /* test known output for common seeds */ |
no2chem | 0:b5d3bd64d2dc | 240 | case 0x8a02: /* seed1=0, seed2=0, seed3=0x66, size 2000 per algorithm */ |
no2chem | 0:b5d3bd64d2dc | 241 | known_id=0; |
no2chem | 0:b5d3bd64d2dc | 242 | ee_printf("6k performance run parameters for coremark.\n"); |
no2chem | 0:b5d3bd64d2dc | 243 | break; |
no2chem | 0:b5d3bd64d2dc | 244 | case 0x7b05: /* seed1=0x3415, seed2=0x3415, seed3=0x66, size 2000 per algorithm */ |
no2chem | 0:b5d3bd64d2dc | 245 | known_id=1; |
no2chem | 0:b5d3bd64d2dc | 246 | ee_printf("6k validation run parameters for coremark.\n"); |
no2chem | 0:b5d3bd64d2dc | 247 | break; |
no2chem | 0:b5d3bd64d2dc | 248 | case 0x4eaf: /* seed1=0x8, seed2=0x8, seed3=0x8, size 400 per algorithm */ |
no2chem | 0:b5d3bd64d2dc | 249 | known_id=2; |
no2chem | 0:b5d3bd64d2dc | 250 | ee_printf("Profile generation run parameters for coremark.\n"); |
no2chem | 0:b5d3bd64d2dc | 251 | break; |
no2chem | 0:b5d3bd64d2dc | 252 | case 0xe9f5: /* seed1=0, seed2=0, seed3=0x66, size 666 per algorithm */ |
no2chem | 0:b5d3bd64d2dc | 253 | known_id=3; |
no2chem | 0:b5d3bd64d2dc | 254 | ee_printf("2K performance run parameters for coremark.\n"); |
no2chem | 0:b5d3bd64d2dc | 255 | break; |
no2chem | 0:b5d3bd64d2dc | 256 | case 0x18f2: /* seed1=0x3415, seed2=0x3415, seed3=0x66, size 666 per algorithm */ |
no2chem | 0:b5d3bd64d2dc | 257 | known_id=4; |
no2chem | 0:b5d3bd64d2dc | 258 | ee_printf("2K validation run parameters for coremark.\n"); |
no2chem | 0:b5d3bd64d2dc | 259 | break; |
no2chem | 0:b5d3bd64d2dc | 260 | default: |
no2chem | 0:b5d3bd64d2dc | 261 | total_errors=-1; |
no2chem | 0:b5d3bd64d2dc | 262 | break; |
no2chem | 0:b5d3bd64d2dc | 263 | } |
no2chem | 0:b5d3bd64d2dc | 264 | if (known_id>=0) { |
no2chem | 0:b5d3bd64d2dc | 265 | for (i=0 ; i<default_num_contexts; i++) { |
no2chem | 0:b5d3bd64d2dc | 266 | results[i].err=0; |
no2chem | 0:b5d3bd64d2dc | 267 | if ((results[i].execs & ID_LIST) && |
no2chem | 0:b5d3bd64d2dc | 268 | (results[i].crclist!=list_known_crc[known_id])) { |
no2chem | 0:b5d3bd64d2dc | 269 | ee_printf("[%u]ERROR! list crc 0x%04x - should be 0x%04x\n",i,results[i].crclist,list_known_crc[known_id]); |
no2chem | 0:b5d3bd64d2dc | 270 | results[i].err++; |
no2chem | 0:b5d3bd64d2dc | 271 | } |
no2chem | 0:b5d3bd64d2dc | 272 | if ((results[i].execs & ID_MATRIX) && |
no2chem | 0:b5d3bd64d2dc | 273 | (results[i].crcmatrix!=matrix_known_crc[known_id])) { |
no2chem | 0:b5d3bd64d2dc | 274 | ee_printf("[%u]ERROR! matrix crc 0x%04x - should be 0x%04x\n",i,results[i].crcmatrix,matrix_known_crc[known_id]); |
no2chem | 0:b5d3bd64d2dc | 275 | results[i].err++; |
no2chem | 0:b5d3bd64d2dc | 276 | } |
no2chem | 0:b5d3bd64d2dc | 277 | if ((results[i].execs & ID_STATE) && |
no2chem | 0:b5d3bd64d2dc | 278 | (results[i].crcstate!=state_known_crc[known_id])) { |
no2chem | 0:b5d3bd64d2dc | 279 | ee_printf("[%u]ERROR! state crc 0x%04x - should be 0x%04x\n",i,results[i].crcstate,state_known_crc[known_id]); |
no2chem | 0:b5d3bd64d2dc | 280 | results[i].err++; |
no2chem | 0:b5d3bd64d2dc | 281 | } |
no2chem | 0:b5d3bd64d2dc | 282 | total_errors+=results[i].err; |
no2chem | 0:b5d3bd64d2dc | 283 | } |
no2chem | 0:b5d3bd64d2dc | 284 | } |
no2chem | 0:b5d3bd64d2dc | 285 | total_errors+=check_data_types(); |
no2chem | 0:b5d3bd64d2dc | 286 | /* and report results */ |
no2chem | 0:b5d3bd64d2dc | 287 | ee_printf("CoreMark Size : %lu\n",(ee_u32)results[0].size); |
no2chem | 0:b5d3bd64d2dc | 288 | ee_printf("Total ticks : %lu\n",(ee_u32)total_time); |
no2chem | 0:b5d3bd64d2dc | 289 | #if HAS_FLOAT |
no2chem | 0:b5d3bd64d2dc | 290 | ee_printf("Total time (secs): %f\n",time_in_secs(total_time)); |
no2chem | 0:b5d3bd64d2dc | 291 | if (time_in_secs(total_time) > 0) |
no2chem | 0:b5d3bd64d2dc | 292 | ee_printf("Iterations/Sec : %f\n",default_num_contexts*results[0].iterations/time_in_secs(total_time)); |
no2chem | 0:b5d3bd64d2dc | 293 | #else |
no2chem | 0:b5d3bd64d2dc | 294 | ee_printf("Total time (secs): %d\n",time_in_secs(total_time)); |
no2chem | 0:b5d3bd64d2dc | 295 | if (time_in_secs(total_time) > 0) |
no2chem | 0:b5d3bd64d2dc | 296 | ee_printf("Iterations/Sec : %d\n",default_num_contexts*results[0].iterations/time_in_secs(total_time)); |
no2chem | 0:b5d3bd64d2dc | 297 | #endif |
no2chem | 0:b5d3bd64d2dc | 298 | if (time_in_secs(total_time) < 10) { |
no2chem | 0:b5d3bd64d2dc | 299 | ee_printf("ERROR! Must execute for at least 10 secs for a valid result!\n"); |
no2chem | 0:b5d3bd64d2dc | 300 | total_errors++; |
no2chem | 0:b5d3bd64d2dc | 301 | } |
no2chem | 0:b5d3bd64d2dc | 302 | |
no2chem | 0:b5d3bd64d2dc | 303 | ee_printf("Iterations : %lu\n",(ee_u32)default_num_contexts*results[0].iterations); |
no2chem | 0:b5d3bd64d2dc | 304 | ee_printf("Compiler version : %s\n",COMPILER_VERSION); |
no2chem | 0:b5d3bd64d2dc | 305 | ee_printf("Compiler flags : %s\n",COMPILER_FLAGS); |
no2chem | 0:b5d3bd64d2dc | 306 | #if (MULTITHREAD>1) |
no2chem | 0:b5d3bd64d2dc | 307 | ee_printf("Parallel %s : %d\n",PARALLEL_METHOD,default_num_contexts); |
no2chem | 0:b5d3bd64d2dc | 308 | #endif |
no2chem | 0:b5d3bd64d2dc | 309 | ee_printf("Memory location : %s\n",MEM_LOCATION); |
no2chem | 0:b5d3bd64d2dc | 310 | /* output for verification */ |
no2chem | 0:b5d3bd64d2dc | 311 | ee_printf("seedcrc : 0x%04x\n",seedcrc); |
no2chem | 0:b5d3bd64d2dc | 312 | if (results[0].execs & ID_LIST) |
no2chem | 0:b5d3bd64d2dc | 313 | for (i=0 ; i<default_num_contexts; i++) |
no2chem | 0:b5d3bd64d2dc | 314 | ee_printf("[%d]crclist : 0x%04x\n",i,results[i].crclist); |
no2chem | 0:b5d3bd64d2dc | 315 | if (results[0].execs & ID_MATRIX) |
no2chem | 0:b5d3bd64d2dc | 316 | for (i=0 ; i<default_num_contexts; i++) |
no2chem | 0:b5d3bd64d2dc | 317 | ee_printf("[%d]crcmatrix : 0x%04x\n",i,results[i].crcmatrix); |
no2chem | 0:b5d3bd64d2dc | 318 | if (results[0].execs & ID_STATE) |
no2chem | 0:b5d3bd64d2dc | 319 | for (i=0 ; i<default_num_contexts; i++) |
no2chem | 0:b5d3bd64d2dc | 320 | ee_printf("[%d]crcstate : 0x%04x\n",i,results[i].crcstate); |
no2chem | 0:b5d3bd64d2dc | 321 | for (i=0 ; i<default_num_contexts; i++) |
no2chem | 0:b5d3bd64d2dc | 322 | ee_printf("[%d]crcfinal : 0x%04x\n",i,results[i].crc); |
no2chem | 0:b5d3bd64d2dc | 323 | if (total_errors==0) { |
no2chem | 0:b5d3bd64d2dc | 324 | ee_printf("Correct operation validated. See readme.txt for run and reporting rules.\n"); |
no2chem | 0:b5d3bd64d2dc | 325 | #if HAS_FLOAT |
no2chem | 0:b5d3bd64d2dc | 326 | if (known_id==3) { |
no2chem | 0:b5d3bd64d2dc | 327 | ee_printf("CoreMark 1.0 : %f / %s %s",default_num_contexts*results[0].iterations/time_in_secs(total_time),COMPILER_VERSION,COMPILER_FLAGS); |
no2chem | 0:b5d3bd64d2dc | 328 | #if defined(MEM_LOCATION) && !defined(MEM_LOCATION_UNSPEC) |
no2chem | 0:b5d3bd64d2dc | 329 | ee_printf(" / %s",MEM_LOCATION); |
no2chem | 0:b5d3bd64d2dc | 330 | #else |
no2chem | 0:b5d3bd64d2dc | 331 | ee_printf(" / %s",mem_name[MEM_METHOD]); |
no2chem | 0:b5d3bd64d2dc | 332 | #endif |
no2chem | 0:b5d3bd64d2dc | 333 | |
no2chem | 0:b5d3bd64d2dc | 334 | #if (MULTITHREAD>1) |
no2chem | 0:b5d3bd64d2dc | 335 | ee_printf(" / %d:%s",default_num_contexts,PARALLEL_METHOD); |
no2chem | 0:b5d3bd64d2dc | 336 | #endif |
no2chem | 0:b5d3bd64d2dc | 337 | ee_printf("\n"); |
no2chem | 0:b5d3bd64d2dc | 338 | } |
no2chem | 0:b5d3bd64d2dc | 339 | #endif |
no2chem | 0:b5d3bd64d2dc | 340 | } |
no2chem | 0:b5d3bd64d2dc | 341 | if (total_errors>0) |
no2chem | 0:b5d3bd64d2dc | 342 | ee_printf("Errors detected\n"); |
no2chem | 0:b5d3bd64d2dc | 343 | if (total_errors<0) |
no2chem | 0:b5d3bd64d2dc | 344 | ee_printf("Cannot validate operation for these seed values, please compare with results on a known platform.\n"); |
no2chem | 0:b5d3bd64d2dc | 345 | |
no2chem | 0:b5d3bd64d2dc | 346 | #if (MEM_METHOD==MEM_MALLOC) |
no2chem | 0:b5d3bd64d2dc | 347 | for (i=0 ; i<MULTITHREAD; i++) |
no2chem | 0:b5d3bd64d2dc | 348 | portable_free(results[i].memblock[0]); |
no2chem | 0:b5d3bd64d2dc | 349 | #endif |
no2chem | 0:b5d3bd64d2dc | 350 | /* And last call any target specific code for finalizing */ |
no2chem | 0:b5d3bd64d2dc | 351 | portable_fini(&(results[0].port)); |
no2chem | 0:b5d3bd64d2dc | 352 | |
no2chem | 0:b5d3bd64d2dc | 353 | return MAIN_RETURN_VAL; |
no2chem | 0:b5d3bd64d2dc | 354 | } |
no2chem | 0:b5d3bd64d2dc | 355 | |
no2chem | 0:b5d3bd64d2dc | 356 |