/*
|
/*
|
Author : Shay Gal-On, EEMBC
|
Author : Shay Gal-On, EEMBC
|
|
|
This file is part of EEMBC(R) and CoreMark(TM), which are Copyright (C) 2009
|
This file is part of EEMBC(R) and CoreMark(TM), which are Copyright (C) 2009
|
All rights reserved.
|
All rights reserved.
|
|
|
EEMBC CoreMark Software is a product of EEMBC and is provided under the terms
|
EEMBC CoreMark Software is a product of EEMBC and is provided under the terms
|
of the CoreMark License that is distributed with the official EEMBC COREMARK
|
of the CoreMark License that is distributed with the official EEMBC COREMARK
|
Software release. If you received this EEMBC CoreMark Software without the
|
Software release. If you received this EEMBC CoreMark Software without the
|
accompanying CoreMark License, you must discontinue use and download the
|
accompanying CoreMark License, you must discontinue use and download the
|
official release from www.coremark.org.
|
official release from www.coremark.org.
|
|
|
Also, if you are publicly displaying scores generated from the EEMBC CoreMark
|
Also, if you are publicly displaying scores generated from the EEMBC CoreMark
|
software, make sure that you are in compliance with Run and Reporting rules
|
software, make sure that you are in compliance with Run and Reporting rules
|
specified in the accompanying readme.txt file.
|
specified in the accompanying readme.txt file.
|
|
|
EEMBC
|
EEMBC
|
4354 Town Center Blvd. Suite 114-200
|
4354 Town Center Blvd. Suite 114-200
|
El Dorado Hills, CA, 95762
|
El Dorado Hills, CA, 95762
|
*/
|
*/
|
/* File: core_main.c
|
/* File: core_main.c
|
This file contains the framework to acquire a block of memory, seed initial
|
This file contains the framework to acquire a block of memory, seed initial
|
parameters, tun t he benchmark and report the results.
|
parameters, tun t he benchmark and report the results.
|
*/
|
*/
|
#include "common.h"
|
#include "common.h"
|
#include "support.h"
|
#include "support.h"
|
|
|
#include "coremark.h"
|
#include "coremark.h"
|
|
|
/* Function: iterate
|
/* Function: iterate
|
Run the benchmark for a specified number of iterations.
|
Run the benchmark for a specified number of iterations.
|
|
|
Operation:
|
Operation:
|
For each type of benchmarked algorithm:
|
For each type of benchmarked algorithm:
|
a - Initialize the data block for the algorithm.
|
a - Initialize the data block for the algorithm.
|
b - Execute the algorithm N times.
|
b - Execute the algorithm N times.
|
|
|
Returns:
|
Returns:
|
NULL.
|
NULL.
|
*/
|
*/
|
static ee_u16 list_known_crc[] =
|
static ee_u16 list_known_crc[] =
|
{ (ee_u16) 0xd4b0, (ee_u16) 0x3340, (ee_u16) 0x6a79, (ee_u16) 0xe714,
|
{ (ee_u16) 0xd4b0, (ee_u16) 0x3340, (ee_u16) 0x6a79, (ee_u16) 0xe714,
|
(ee_u16) 0xe3c1
|
(ee_u16) 0xe3c1
|
};
|
};
|
|
|
static ee_u16 matrix_known_crc[] =
|
static ee_u16 matrix_known_crc[] =
|
{ (ee_u16) 0xbe52, (ee_u16) 0x1199, (ee_u16) 0x5608, (ee_u16) 0x1fd7,
|
{ (ee_u16) 0xbe52, (ee_u16) 0x1199, (ee_u16) 0x5608, (ee_u16) 0x1fd7,
|
(ee_u16) 0x0747
|
(ee_u16) 0x0747
|
};
|
};
|
|
|
static ee_u16 state_known_crc[] =
|
static ee_u16 state_known_crc[] =
|
{ (ee_u16) 0x5e47, (ee_u16) 0x39bf, (ee_u16) 0xe5a4, (ee_u16) 0x8e3a,
|
{ (ee_u16) 0x5e47, (ee_u16) 0x39bf, (ee_u16) 0xe5a4, (ee_u16) 0x8e3a,
|
(ee_u16) 0x8d84
|
(ee_u16) 0x8d84
|
};
|
};
|
|
|
void *iterate(void *pres)
|
void *iterate(void *pres)
|
{
|
{
|
ee_u32 i;
|
ee_u32 i;
|
ee_u16 crc;
|
ee_u16 crc;
|
core_results *res = (core_results *) pres;
|
core_results *res = (core_results *) pres;
|
ee_u32 iterations = res->iterations;
|
ee_u32 iterations = res->iterations;
|
res->crc = 0;
|
res->crc = 0;
|
res->crclist = 0;
|
res->crclist = 0;
|
res->crcmatrix = 0;
|
res->crcmatrix = 0;
|
res->crcstate = 0;
|
res->crcstate = 0;
|
|
|
for (i = 0; i < iterations; i++) {
|
for (i = 0; i < iterations; i++) {
|
crc = core_bench_list(res, 1);
|
crc = core_bench_list(res, 1);
|
res->crc = crcu16(crc, res->crc);
|
res->crc = crcu16(crc, res->crc);
|
crc = core_bench_list(res, -1);
|
crc = core_bench_list(res, -1);
|
res->crc = crcu16(crc, res->crc);
|
res->crc = crcu16(crc, res->crc);
|
if (i == 0)
|
if (i == 0)
|
res->crclist = res->crc;
|
res->crclist = res->crc;
|
}
|
}
|
return NULL;
|
return NULL;
|
}
|
}
|
|
|
#if (SEED_METHOD==SEED_ARG)
|
#if (SEED_METHOD==SEED_ARG)
|
ee_s32 get_seed_args(int i, int argc, char *argv[]);
|
ee_s32 get_seed_args(int i, int argc, char *argv[]);
|
#define get_seed(x) (ee_s16)get_seed_args(x,argc,argv)
|
#define get_seed(x) (ee_s16)get_seed_args(x,argc,argv)
|
#define get_seed_32(x) get_seed_args(x,argc,argv)
|
#define get_seed_32(x) get_seed_args(x,argc,argv)
|
#else /* via function or volatile */
|
#else /* via function or volatile */
|
ee_s32 get_seed_32(int i);
|
ee_s32 get_seed_32(int i);
|
#define get_seed(x) (ee_s16)get_seed_32(x)
|
#define get_seed(x) (ee_s16)get_seed_32(x)
|
#endif
|
#endif
|
|
|
#if (MEM_METHOD==MEM_STATIC)
|
#if (MEM_METHOD==MEM_STATIC)
|
ee_u8 static_memblk[TOTAL_DATA_SIZE];
|
ee_u8 static_memblk[TOTAL_DATA_SIZE];
|
#endif
|
#endif
|
char *mem_name[3] = { "Static", "Heap", "Stack" };
|
char *mem_name[3] = { "Static", "Heap", "Stack" };
|
|
|
/* Function: main
|
/* Function: main
|
Main entry routine for the benchmark.
|
Main entry routine for the benchmark.
|
This function is responsible for the following steps:
|
This function is responsible for the following steps:
|
|
|
1 - Initialize input seeds from a source that cannot be determined at
|
1 - Initialize input seeds from a source that cannot be determined at
|
compile time.
|
compile time.
|
2 - Initialize memory block for use.
|
2 - Initialize memory block for use.
|
3 - Run and time the benchmark.
|
3 - Run and time the benchmark.
|
4 - Report results, testing the validity of the output if the seeds are
|
4 - Report results, testing the validity of the output if the seeds are
|
known.
|
known.
|
|
|
Arguments:
|
Arguments:
|
1 - first seed : Any value
|
1 - first seed : Any value
|
2 - second seed : Must be identical to first for iterations to be
|
2 - second seed : Must be identical to first for iterations to be
|
identical
|
identical
|
3 - third seed : Any value, should be at least an order of magnitude
|
3 - third seed : Any value, should be at least an order of magnitude
|
less then the input size, but bigger then 32.
|
less then the input size, but bigger then 32.
|
4 - Iterations : Special, if set to 0, iterations will be
|
4 - Iterations : Special, if set to 0, iterations will be
|
automatically determined such that the benchmark will
|
automatically determined such that the benchmark will
|
run between 10 to 100 secs
|
run between 10 to 100 secs
|
|
|
*/
|
*/
|
|
|
|
|
#if MAIN_HAS_NOARGC
|
#if MAIN_HAS_NOARGC
|
MAIN_RETURN_TYPE coremark_main(void)
|
MAIN_RETURN_TYPE coremark_main(void)
|
{
|
{
|
int argc = 0;
|
int argc = 0;
|
char *argv[1];
|
char *argv[1];
|
#else
|
#else
|
MAIN_RETURN_TYPE coremark_main(int argc, char *argv[])
|
MAIN_RETURN_TYPE coremark_main(int argc, char *argv[])
|
{
|
{
|
#endif
|
#endif
|
ee_u16 i, j = 0, num_algorithms = 0;
|
ee_u16 i, j = 0, num_algorithms = 0;
|
ee_s16 known_id = -1, total_errors = 0;
|
ee_s16 known_id = -1, total_errors = 0;
|
ee_u16 seedcrc = 0;
|
ee_u16 seedcrc = 0;
|
CORE_TICKS total_time;
|
CORE_TICKS total_time;
|
core_results results[MULTITHREAD];
|
core_results results[MULTITHREAD];
|
#if (MEM_METHOD==MEM_STACK)
|
#if (MEM_METHOD==MEM_STACK)
|
ee_u8 stack_memblock[TOTAL_DATA_SIZE * MULTITHREAD];
|
ee_u8 stack_memblock[TOTAL_DATA_SIZE * MULTITHREAD];
|
#endif
|
#endif
|
/* first call any initializations needed */
|
/* first call any initializations needed */
|
portable_init(&(results[0].port), &argc, argv);
|
portable_init(&(results[0].port), &argc, argv);
|
/* First some checks to make sure benchmark will run ok */
|
/* First some checks to make sure benchmark will run ok */
|
if (sizeof(struct list_head_s) > 128) {
|
if (sizeof(struct list_head_s) > 128) {
|
ee_printf("list_head structure too big for comparable data!\n");
|
ee_printf("list_head structure too big for comparable data!\n");
|
return MAIN_RETURN_VAL;
|
return MAIN_RETURN_VAL;
|
}
|
}
|
results[0].seed1 = get_seed(1);
|
results[0].seed1 = get_seed(1);
|
results[0].seed2 = get_seed(2);
|
results[0].seed2 = get_seed(2);
|
results[0].seed3 = get_seed(3);
|
results[0].seed3 = get_seed(3);
|
results[0].iterations = get_seed_32(4);
|
results[0].iterations = get_seed_32(4);
|
#if CORE_DEBUG
|
#if CORE_DEBUG
|
results[0].iterations = 1;
|
results[0].iterations = 1;
|
#endif
|
#endif
|
results[0].execs = get_seed_32(5);
|
results[0].execs = get_seed_32(5);
|
if (results[0].execs == 0) {
|
if (results[0].execs == 0) {
|
/* if not supplied, execute all algorithms */
|
/* if not supplied, execute all algorithms */
|
results[0].execs = ALL_ALGORITHMS_MASK;
|
results[0].execs = ALL_ALGORITHMS_MASK;
|
}
|
}
|
/* put in some default values based on one seed only for easy testing */
|
/* put in some default values based on one seed only for easy testing */
|
if ((results[0].seed1 == 0) && (results[0].seed2 == 0)
|
if ((results[0].seed1 == 0) && (results[0].seed2 == 0)
|
&& (results[0].seed3 == 0)) { /* validation run */
|
&& (results[0].seed3 == 0)) { /* validation run */
|
results[0].seed1 = 0;
|
results[0].seed1 = 0;
|
results[0].seed2 = 0;
|
results[0].seed2 = 0;
|
results[0].seed3 = 0x66;
|
results[0].seed3 = 0x66;
|
}
|
}
|
if ((results[0].seed1 == 1) && (results[0].seed2 == 0)
|
if ((results[0].seed1 == 1) && (results[0].seed2 == 0)
|
&& (results[0].seed3 == 0)) { /* perfromance run */
|
&& (results[0].seed3 == 0)) { /* perfromance run */
|
results[0].seed1 = 0x3415;
|
results[0].seed1 = 0x3415;
|
results[0].seed2 = 0x3415;
|
results[0].seed2 = 0x3415;
|
results[0].seed3 = 0x66;
|
results[0].seed3 = 0x66;
|
}
|
}
|
#if (MEM_METHOD==MEM_STATIC)
|
#if (MEM_METHOD==MEM_STATIC)
|
results[0].memblock[0] = (void *)static_memblk;
|
results[0].memblock[0] = (void *)static_memblk;
|
results[0].size = TOTAL_DATA_SIZE;
|
results[0].size = TOTAL_DATA_SIZE;
|
results[0].err = 0;
|
results[0].err = 0;
|
#if (MULTITHREAD>1)
|
#if (MULTITHREAD>1)
|
#error "Cannot use a static data area with multiple contexts!"
|
#error "Cannot use a static data area with multiple contexts!"
|
#endif
|
#endif
|
#elif (MEM_METHOD==MEM_MALLOC)
|
#elif (MEM_METHOD==MEM_MALLOC)
|
for (i = 0; i < MULTITHREAD; i++) {
|
for (i = 0; i < MULTITHREAD; i++) {
|
ee_s32 malloc_override = get_seed(7);
|
ee_s32 malloc_override = get_seed(7);
|
if (malloc_override != 0)
|
if (malloc_override != 0)
|
results[i].size = malloc_override;
|
results[i].size = malloc_override;
|
else
|
else
|
results[i].size = TOTAL_DATA_SIZE;
|
results[i].size = TOTAL_DATA_SIZE;
|
results[i].memblock[0] = portable_malloc(results[i].size);
|
results[i].memblock[0] = portable_malloc(results[i].size);
|
results[i].seed1 = results[0].seed1;
|
results[i].seed1 = results[0].seed1;
|
results[i].seed2 = results[0].seed2;
|
results[i].seed2 = results[0].seed2;
|
results[i].seed3 = results[0].seed3;
|
results[i].seed3 = results[0].seed3;
|
results[i].err = 0;
|
results[i].err = 0;
|
results[i].execs = results[0].execs;
|
results[i].execs = results[0].execs;
|
}
|
}
|
#elif (MEM_METHOD==MEM_STACK)
|
#elif (MEM_METHOD==MEM_STACK)
|
for (i = 0; i < MULTITHREAD; i++) {
|
for (i = 0; i < MULTITHREAD; i++) {
|
results[i].memblock[0] = stack_memblock + i * TOTAL_DATA_SIZE;
|
results[i].memblock[0] = stack_memblock + i * TOTAL_DATA_SIZE;
|
results[i].size = TOTAL_DATA_SIZE;
|
results[i].size = TOTAL_DATA_SIZE;
|
results[i].seed1 = results[0].seed1;
|
results[i].seed1 = results[0].seed1;
|
results[i].seed2 = results[0].seed2;
|
results[i].seed2 = results[0].seed2;
|
results[i].seed3 = results[0].seed3;
|
results[i].seed3 = results[0].seed3;
|
results[i].err = 0;
|
results[i].err = 0;
|
results[i].execs = results[0].execs;
|
results[i].execs = results[0].execs;
|
}
|
}
|
#else
|
#else
|
#error "Please define a way to initialize a memory block."
|
#error "Please define a way to initialize a memory block."
|
#endif
|
#endif
|
/* Data init */
|
/* Data init */
|
/* Find out how space much we have based on number of algorithms */
|
/* Find out how space much we have based on number of algorithms */
|
for (i = 0; i < NUM_ALGORITHMS; i++) {
|
for (i = 0; i < NUM_ALGORITHMS; i++) {
|
if ((1 << (ee_u32) i) & results[0].execs)
|
if ((1 << (ee_u32) i) & results[0].execs)
|
num_algorithms++;
|
num_algorithms++;
|
}
|
}
|
for (i = 0; i < MULTITHREAD; i++)
|
for (i = 0; i < MULTITHREAD; i++)
|
results[i].size = results[i].size / num_algorithms;
|
results[i].size = results[i].size / num_algorithms;
|
/* Assign pointers */
|
/* Assign pointers */
|
for (i = 0; i < NUM_ALGORITHMS; i++) {
|
for (i = 0; i < NUM_ALGORITHMS; i++) {
|
ee_u32 ctx;
|
ee_u32 ctx;
|
if ((1 << (ee_u32) i) & results[0].execs) {
|
if ((1 << (ee_u32) i) & results[0].execs) {
|
for (ctx = 0; ctx < MULTITHREAD; ctx++)
|
for (ctx = 0; ctx < MULTITHREAD; ctx++)
|
results[ctx].memblock[i + 1] =
|
results[ctx].memblock[i + 1] =
|
(char *)(results[ctx].memblock[0]) +
|
(char *)(results[ctx].memblock[0]) +
|
results[0].size * j;
|
results[0].size * j;
|
j++;
|
j++;
|
}
|
}
|
}
|
}
|
/* call inits */
|
/* call inits */
|
for (i = 0; i < MULTITHREAD; i++) {
|
for (i = 0; i < MULTITHREAD; i++) {
|
if (results[i].execs & ID_LIST) {
|
if (results[i].execs & ID_LIST) {
|
results[i].list =
|
results[i].list =
|
core_list_init(results[0].size,
|
core_list_init(results[0].size,
|
results[i].memblock[1],
|
results[i].memblock[1],
|
results[i].seed1);
|
results[i].seed1);
|
}
|
}
|
if (results[i].execs & ID_MATRIX) {
|
if (results[i].execs & ID_MATRIX) {
|
core_init_matrix(results[0].size,
|
core_init_matrix(results[0].size,
|
results[i].memblock[2],
|
results[i].memblock[2],
|
(ee_s32) results[i].seed1 |
|
(ee_s32) results[i].seed1 |
|
(((ee_s32) results[i].seed2) << 16),
|
(((ee_s32) results[i].seed2) << 16),
|
&(results[i].mat));
|
&(results[i].mat));
|
}
|
}
|
if (results[i].execs & ID_STATE) {
|
if (results[i].execs & ID_STATE) {
|
core_init_state(results[0].size, results[i].seed1,
|
core_init_state(results[0].size, results[i].seed1,
|
results[i].memblock[3]);
|
results[i].memblock[3]);
|
}
|
}
|
}
|
}
|
|
|
/* automatically determine number of iterations if not set */
|
/* automatically determine number of iterations if not set */
|
if (results[0].iterations == 0) {
|
if (results[0].iterations == 0) {
|
secs_ret secs_passed = 0;
|
secs_ret secs_passed = 0;
|
ee_u32 divisor;
|
ee_u32 divisor;
|
results[0].iterations = 1;
|
results[0].iterations = 1;
|
while (secs_passed < (secs_ret) 1) {
|
while (secs_passed < (secs_ret) 1) {
|
results[0].iterations *= 10;
|
results[0].iterations *= 10;
|
start_time();
|
start_time();
|
iterate(&results[0]);
|
iterate(&results[0]);
|
stop_time();
|
stop_time();
|
secs_passed = time_in_secs(get_time());
|
secs_passed = time_in_secs(get_time());
|
}
|
}
|
/* now we know it executes for at least 1 sec, set actual run
|
/* now we know it executes for at least 1 sec, set actual run
|
time at about 10 secs */
|
time at about 10 secs */
|
divisor = (ee_u32) secs_passed;
|
divisor = (ee_u32) secs_passed;
|
if (divisor == 0) /* some machines cast float to int as 0
|
if (divisor == 0) /* some machines cast float to int as 0
|
since this conversion is not defined
|
since this conversion is not defined
|
by ANSI, but we know at least one
|
by ANSI, but we know at least one
|
second passed */
|
second passed */
|
divisor = 1;
|
divisor = 1;
|
results[0].iterations *= 1 + 10 / divisor;
|
results[0].iterations *= 1 + 10 / divisor;
|
}
|
}
|
/* perform actual benchmark */
|
/* perform actual benchmark */
|
start_time();
|
start_time();
|
#if (MULTITHREAD>1)
|
#if (MULTITHREAD>1)
|
if (default_num_contexts > MULTITHREAD) {
|
if (default_num_contexts > MULTITHREAD) {
|
default_num_contexts = MULTITHREAD;
|
default_num_contexts = MULTITHREAD;
|
}
|
}
|
for (i = 0; i < default_num_contexts; i++) {
|
for (i = 0; i < default_num_contexts; i++) {
|
results[i].iterations = results[0].iterations;
|
results[i].iterations = results[0].iterations;
|
results[i].execs = results[0].execs;
|
results[i].execs = results[0].execs;
|
core_start_parallel(&results[i]);
|
core_start_parallel(&results[i]);
|
}
|
}
|
for (i = 0; i < default_num_contexts; i++) {
|
for (i = 0; i < default_num_contexts; i++) {
|
core_stop_parallel(&results[i]);
|
core_stop_parallel(&results[i]);
|
}
|
}
|
#else
|
#else
|
iterate(&results[0]);
|
iterate(&results[0]);
|
#endif
|
#endif
|
stop_time();
|
stop_time();
|
total_time = get_time();
|
total_time = get_time();
|
/* get a function of the input to report */
|
/* get a function of the input to report */
|
seedcrc = crc16(results[0].seed1, seedcrc);
|
seedcrc = crc16(results[0].seed1, seedcrc);
|
seedcrc = crc16(results[0].seed2, seedcrc);
|
seedcrc = crc16(results[0].seed2, seedcrc);
|
seedcrc = crc16(results[0].seed3, seedcrc);
|
seedcrc = crc16(results[0].seed3, seedcrc);
|
seedcrc = crc16(results[0].size, seedcrc);
|
seedcrc = crc16(results[0].size, seedcrc);
|
|
|
switch (seedcrc) { /* test known output for common seeds */
|
switch (seedcrc) { /* test known output for common seeds */
|
case 0x8a02: /* seed1=0, seed2=0, seed3=0x66, size 2000 per
|
case 0x8a02: /* seed1=0, seed2=0, seed3=0x66, size 2000 per
|
algorithm */
|
algorithm */
|
known_id = 0;
|
known_id = 0;
|
ee_printf("6k performance run parameters for coremark.\n");
|
ee_printf("6k performance run parameters for coremark.\n");
|
break;
|
break;
|
case 0x7b05: /* seed1=0x3415, seed2=0x3415, seed3=0x66,
|
case 0x7b05: /* seed1=0x3415, seed2=0x3415, seed3=0x66,
|
size 2000 per algorithm */
|
size 2000 per algorithm */
|
known_id = 1;
|
known_id = 1;
|
ee_printf("6k validation run parameters for coremark.\n");
|
ee_printf("6k validation run parameters for coremark.\n");
|
break;
|
break;
|
case 0x4eaf: /* seed1=0x8, seed2=0x8, seed3=0x8, size 400
|
case 0x4eaf: /* seed1=0x8, seed2=0x8, seed3=0x8, size 400
|
per algorithm */
|
per algorithm */
|
known_id = 2;
|
known_id = 2;
|
ee_printf("Profile generation run parameters for coremark.\n");
|
ee_printf("Profile generation run parameters for coremark.\n");
|
break;
|
break;
|
case 0xe9f5: /* seed1=0, seed2=0, seed3=0x66, size 666 per
|
case 0xe9f5: /* seed1=0, seed2=0, seed3=0x66, size 666 per
|
algorithm */
|
algorithm */
|
known_id = 3;
|
known_id = 3;
|
ee_printf("2K performance run parameters for coremark.\n");
|
ee_printf("2K performance run parameters for coremark.\n");
|
break;
|
break;
|
case 0x18f2: /* seed1=0x3415, seed2=0x3415, seed3=0x66,
|
case 0x18f2: /* seed1=0x3415, seed2=0x3415, seed3=0x66,
|
size 666 per algorithm */
|
size 666 per algorithm */
|
known_id = 4;
|
known_id = 4;
|
ee_printf("2K validation run parameters for coremark.\n");
|
ee_printf("2K validation run parameters for coremark.\n");
|
break;
|
break;
|
default:
|
default:
|
total_errors = -1;
|
total_errors = -1;
|
break;
|
break;
|
}
|
}
|
if (known_id >= 0) {
|
if (known_id >= 0) {
|
for (i = 0; i < default_num_contexts; i++) {
|
for (i = 0; i < default_num_contexts; i++) {
|
results[i].err = 0;
|
results[i].err = 0;
|
if ((results[i].execs & ID_LIST) &&
|
if ((results[i].execs & ID_LIST) &&
|
(results[i].crclist != list_known_crc[known_id])) {
|
(results[i].crclist != list_known_crc[known_id])) {
|
ee_printf
|
ee_printf
|
("[%u]ERROR! list crc 0x%04x - should be 0x%04x\n",
|
("[%u]ERROR! list crc 0x%04x - should be 0x%04x\n",
|
i, results[i].crclist,
|
i, results[i].crclist,
|
list_known_crc[known_id]);
|
list_known_crc[known_id]);
|
results[i].err++;
|
results[i].err++;
|
}
|
}
|
if ((results[i].execs & ID_MATRIX) &&
|
if ((results[i].execs & ID_MATRIX) &&
|
(results[i].crcmatrix !=
|
(results[i].crcmatrix !=
|
matrix_known_crc[known_id])) {
|
matrix_known_crc[known_id])) {
|
ee_printf
|
ee_printf
|
("[%u]ERROR! matrix crc 0x%04x - should be 0x%04x\n",
|
("[%u]ERROR! matrix crc 0x%04x - should be 0x%04x\n",
|
i, results[i].crcmatrix,
|
i, results[i].crcmatrix,
|
matrix_known_crc[known_id]);
|
matrix_known_crc[known_id]);
|
results[i].err++;
|
results[i].err++;
|
}
|
}
|
if ((results[i].execs & ID_STATE) &&
|
if ((results[i].execs & ID_STATE) &&
|
(results[i].crcstate != state_known_crc[known_id]))
|
(results[i].crcstate != state_known_crc[known_id]))
|
{
|
{
|
ee_printf
|
ee_printf
|
("[%u]ERROR! state crc 0x%04x - should be 0x%04x\n",
|
("[%u]ERROR! state crc 0x%04x - should be 0x%04x\n",
|
i, results[i].crcstate,
|
i, results[i].crcstate,
|
state_known_crc[known_id]);
|
state_known_crc[known_id]);
|
results[i].err++;
|
results[i].err++;
|
}
|
}
|
total_errors += results[i].err;
|
total_errors += results[i].err;
|
}
|
}
|
}
|
}
|
total_errors += check_data_types();
|
total_errors += check_data_types();
|
/* and report results */
|
/* and report results */
|
ee_printf("CoreMark Size : %lu\n", (ee_u32) results[0].size);
|
ee_printf("CoreMark Size : %lu\n", (ee_u32) results[0].size);
|
ee_printf("Total ticks : %lu\n", (ee_u32) total_time);
|
ee_printf("Total ticks : %lu\n", (ee_u32) total_time);
|
#if HAS_FLOAT
|
#if HAS_FLOAT
|
ee_printf("Total time (secs): %f\n", time_in_secs(total_time));
|
ee_printf("Total time (secs): %f\n", time_in_secs(total_time));
|
if (time_in_secs(total_time) > 0)
|
if (time_in_secs(total_time) > 0)
|
ee_printf("Iterations/Sec : %f\n",
|
ee_printf("Iterations/Sec : %f\n",
|
default_num_contexts * results[0].iterations /
|
default_num_contexts * results[0].iterations /
|
time_in_secs(total_time));
|
time_in_secs(total_time));
|
#else
|
#else
|
ee_printf("Total time (secs): %d\n", time_in_secs(total_time));
|
ee_printf("Total time (secs): %d\n", time_in_secs(total_time));
|
if (time_in_secs(total_time) > 0)
|
if (time_in_secs(total_time) > 0)
|
ee_printf("Iterations/Sec : %d\n",
|
ee_printf("Iterations/Sec : %d\n",
|
default_num_contexts * results[0].iterations /
|
default_num_contexts * results[0].iterations /
|
time_in_secs(total_time));
|
time_in_secs(total_time));
|
#endif
|
#endif
|
if (time_in_secs(total_time) < 10) {
|
if (time_in_secs(total_time) < 10) {
|
ee_printf
|
ee_printf
|
("ERROR! Must execute for at least 10 secs for a valid result!\n");
|
("ERROR! Must execute for at least 10 secs for a valid result!\n");
|
total_errors++;
|
total_errors++;
|
}
|
}
|
|
|
ee_printf("Iterations : %lu\n",
|
ee_printf("Iterations : %lu\n",
|
(ee_u32) default_num_contexts * results[0].iterations);
|
(ee_u32) default_num_contexts * results[0].iterations);
|
ee_printf("Compiler version : %s\n", COMPILER_VERSION);
|
ee_printf("Compiler version : %s\n", COMPILER_VERSION);
|
ee_printf("Compiler flags : %s\n", COMPILER_FLAGS);
|
ee_printf("Compiler flags : %s\n", COMPILER_FLAGS);
|
#if (MULTITHREAD>1)
|
#if (MULTITHREAD>1)
|
ee_printf("Parallel %s : %d\n", PARALLEL_METHOD, default_num_contexts);
|
ee_printf("Parallel %s : %d\n", PARALLEL_METHOD, default_num_contexts);
|
#endif
|
#endif
|
ee_printf("Memory location : %s\n", MEM_LOCATION);
|
ee_printf("Memory location : %s\n", MEM_LOCATION);
|
/* output for verification */
|
/* output for verification */
|
ee_printf("seedcrc : 0x%04x\n", seedcrc);
|
ee_printf("seedcrc : 0x%04x\n", seedcrc);
|
if (results[0].execs & ID_LIST)
|
if (results[0].execs & ID_LIST)
|
for (i = 0; i < default_num_contexts; i++)
|
for (i = 0; i < default_num_contexts; i++)
|
ee_printf("[%d]crclist : 0x%04x\n", i,
|
ee_printf("[%d]crclist : 0x%04x\n", i,
|
results[i].crclist);
|
results[i].crclist);
|
if (results[0].execs & ID_MATRIX)
|
if (results[0].execs & ID_MATRIX)
|
for (i = 0; i < default_num_contexts; i++)
|
for (i = 0; i < default_num_contexts; i++)
|
ee_printf("[%d]crcmatrix : 0x%04x\n", i,
|
ee_printf("[%d]crcmatrix : 0x%04x\n", i,
|
results[i].crcmatrix);
|
results[i].crcmatrix);
|
if (results[0].execs & ID_STATE)
|
if (results[0].execs & ID_STATE)
|
for (i = 0; i < default_num_contexts; i++)
|
for (i = 0; i < default_num_contexts; i++)
|
ee_printf("[%d]crcstate : 0x%04x\n", i,
|
ee_printf("[%d]crcstate : 0x%04x\n", i,
|
results[i].crcstate);
|
results[i].crcstate);
|
for (i = 0; i < default_num_contexts; i++)
|
for (i = 0; i < default_num_contexts; i++)
|
ee_printf("[%d]crcfinal : 0x%04x\n", i, results[i].crc);
|
ee_printf("[%d]crcfinal : 0x%04x\n", i, results[i].crc);
|
if (total_errors == 0) {
|
if (total_errors == 0) {
|
ee_printf
|
ee_printf
|
("Correct operation validated. See readme.txt for run and reporting rules.\n");
|
("Correct operation validated. See readme.txt for run and reporting rules.\n");
|
#if HAS_FLOAT
|
#if HAS_FLOAT
|
if (known_id == 3) {
|
if (known_id == 3) {
|
ee_printf("CoreMark 1.0 : %f / %s %s",
|
ee_printf("CoreMark 1.0 : %f / %s %s",
|
default_num_contexts * results[0].iterations /
|
default_num_contexts * results[0].iterations /
|
time_in_secs(total_time), COMPILER_VERSION,
|
time_in_secs(total_time), COMPILER_VERSION,
|
COMPILER_FLAGS);
|
COMPILER_FLAGS);
|
#if defined(MEM_LOCATION) && !defined(MEM_LOCATION_UNSPEC)
|
#if defined(MEM_LOCATION) && !defined(MEM_LOCATION_UNSPEC)
|
ee_printf(" / %s", MEM_LOCATION);
|
ee_printf(" / %s", MEM_LOCATION);
|
#else
|
#else
|
ee_printf(" / %s", mem_name[MEM_METHOD]);
|
ee_printf(" / %s", mem_name[MEM_METHOD]);
|
#endif
|
#endif
|
|
|
#if (MULTITHREAD>1)
|
#if (MULTITHREAD>1)
|
ee_printf(" / %d:%s", default_num_contexts,
|
ee_printf(" / %d:%s", default_num_contexts,
|
PARALLEL_METHOD);
|
PARALLEL_METHOD);
|
#endif
|
#endif
|
ee_printf("\n");
|
ee_printf("\n");
|
}
|
}
|
#endif
|
#endif
|
}
|
}
|
if (total_errors > 0)
|
if (total_errors > 0)
|
ee_printf("Errors detected\n");
|
ee_printf("Errors detected\n");
|
if (total_errors < 0)
|
if (total_errors < 0)
|
ee_printf
|
ee_printf
|
("Cannot validate operation for these seed values, please compare with results on a known platform.\n");
|
("Cannot validate operation for these seed values, please compare with results on a known platform.\n");
|
|
|
#if (MEM_METHOD==MEM_MALLOC)
|
#if (MEM_METHOD==MEM_MALLOC)
|
for (i = 0; i < MULTITHREAD; i++)
|
for (i = 0; i < MULTITHREAD; i++)
|
portable_free(results[i].memblock[0]);
|
portable_free(results[i].memblock[0]);
|
#endif
|
#endif
|
/* And last call any target specific code for finalizing */
|
/* And last call any target specific code for finalizing */
|
portable_fini(&(results[0].port));
|
portable_fini(&(results[0].port));
|
|
|
return MAIN_RETURN_VAL;
|
return MAIN_RETURN_VAL;
|
}
|
}
|
|
|
|
|
|
|
int coremark_cmd (int argc, char *argv[])
|
int coremark_cmd (int argc, char *argv[])
|
{
|
{
|
return coremark_main(argc, argv);
|
return coremark_main(argc, argv);
|
|
|
}
|
}
|
|
|
void module_coremark_init (void)
|
void module_coremark_init(void)
|
{
|
{
|
register_command ("coremark", "[<mode>] [<iterations>]",
|
register_command("coremark", "[<mode>] [<iterations>]",
|
"run coremark, mode: p - performance run, o - profile run, default - validation run",
|
"run coremark, mode: p - performance run, o - profile run, default - validation run",
|
coremark_cmd);
|
coremark_cmd);
|
}
|
}
|
|
|