Runnable CoreMark.

This commit is contained in:
imi415 2022-08-11 09:50:36 +08:00
parent 838ba91d1e
commit 8fdc7c316d
Signed by: imi415
GPG Key ID: 17F01E106F9F5E0A
5 changed files with 125 additions and 25 deletions

View File

@ -16,6 +16,7 @@ set(TARGET_SOURCES
"src/core_portme.c"
"src/stx7105_exc.c"
"src/stx7105_utils.c"
"src/syscalls.c"
"startup_stx7105.S"
)
@ -26,19 +27,21 @@ set(TARGET_INCLUDES
)
set(TARGET_DEFS
"ITERATIONS=2000UL"
"PERFORMANCE_RUN=1"
"ITERATIONS=20000UL"
"VALIDATION_RUN=1"
)
set(TARGET_FLAGS_HARDWARE "-m4-300 -ml")
set(CMAKE_C_FLAGS_DEBUG "-DDEBUG -g -O1")
set(CMAKE_CXX_FLAGS_DEBUG "-DDEBUG -g -O1")
set(TARGET_FLAGS_OPTS "-O3 -fomit-frame-pointer -funroll-all-loops -finline-limit=1000 -ftree-dominator-opts -fno-if-conversion2 -fselective-scheduling -fno-code-hoisting -freorder-blocks-and-partition")
set(CMAKE_C_FLAGS_DEBUG "-DDEBUG -g -O0")
set(CMAKE_CXX_FLAGS_DEBUG "-DDEBUG -g -O0")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "")
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2 -flto")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O2 -flto")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-flto")
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG ${TARGET_FLAGS_OPTS}")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${TARGET_FLAGS_OPTS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE " ")
set(CMAKE_C_FLAGS "${TARGET_FLAGS_HARDWARE} -Wall -ffunction-sections -fdata-sections")
set(CMAKE_CXX_FLAGS "${TARGET_FLAGS_HARDWARE} -Wall -ffunction-sections -fdata-sections")

37
README.md Normal file
View File

@ -0,0 +1,37 @@
# CoreMark benchmark for NextVOD
## Results
```
2K performance run parameters for coremark.
CoreMark Size : 666
Total ticks : 1457116
Total time (secs): 14.920868
Iterations/Sec : 1340.404607
Iterations : 20000
Compiler version : GCC12.1.0
Compiler flags : -O3 -fomit-frame-pointer -funroll-all-loops -finline-limit=1000 -ftree-dominator-opts -fno-if-conversion2 -fselective-scheduling -fno-code-hoisting -freorder-blocks-and-partition
Memory location : DDR2 LMI
seedcrc : 0xe9f5
[0]crclist : 0xe714
[0]crcmatrix : 0x1fd7
[0]crcstate : 0x8e3a
[0]crcfinal : 0x382f
Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 1340.404607 / GCC12.1.0 -O3 -fomit-frame-pointer -funroll-all-loops -finline-limit=1000 -ftree-dominator-opts -fno-if-conversion2 -fselective-scheduling -fno-code-hoisting -freorder-blocks-and-partition / DDR2 LMI
2K validation run parameters for coremark.
CoreMark Size : 666
Total ticks : 1463060
Total time (secs): 14.981734
Iterations/Sec : 1334.958922
Iterations : 20000
Compiler version : GCC12.1.0
Compiler flags : -O3 -fomit-frame-pointer -funroll-all-loops -finline-limit=1000 -ftree-dominator-opts -fno-if-conversion2 -fselective-scheduling -fno-code-hoisting -freorder-blocks-and-partition
Memory location : DDR2 LMI
seedcrc : 0x18f2
[0]crclist : 0xe3c1
[0]crcmatrix : 0x0747
[0]crcstate : 0x8d84
[0]crcfinal : 0xd304
Correct operation validated. See README.md for run and reporting rules.
```

View File

@ -16,7 +16,7 @@ limitations under the License.
Original Author: Shay Gal-on
*/
#include "printf.h"
#include <stdio.h>
/* Topic : Description
This file contains configuration constants required to execute on
@ -51,7 +51,7 @@ Original Author: Shay Gal-on
Define to 1 if the platform has stdio.h.
*/
#ifndef HAS_STDIO
#define HAS_STDIO 0
#define HAS_STDIO 1
#endif
/* Configuration : HAS_PRINTF
Define to 1 if the platform has stdio.h and implements the printf
@ -78,7 +78,7 @@ typedef uint32_t CORE_TICKS;
#endif
#endif
#ifndef COMPILER_FLAGS
#define COMPILER_FLAGS "-O0"
#define COMPILER_FLAGS "-O3 -fomit-frame-pointer -funroll-all-loops -finline-limit=1000 -ftree-dominator-opts -fno-if-conversion2 -fselective-scheduling -fno-code-hoisting -freorder-blocks-and-partition"
#endif
#ifndef MEM_LOCATION
#define MEM_LOCATION "DDR2 LMI"

View File

@ -20,7 +20,6 @@ Original Author: Shay Gal-on
#include <stdlib.h>
#include "coremark.h"
#include "printf.h"
#include "stx7105.h"
#define SYSTEM_CONFIG34 (0xFE001188U) /* PIO4 */
@ -154,17 +153,3 @@ void portable_init(core_portable *p, int *argc, char *argv[]) {
void portable_fini(core_portable *p) {
p->portable_id = 0;
}
void _putchar(char ch) {
if (ch == '\n') {
while (CONSOLE_ASC->STA & (1 << 9U)) {
/**/
}
CONSOLE_ASC->TX_BUF = '\r';
}
while (CONSOLE_ASC->STA & (1 << 9U)) {
// wait for TX FIFO slot.
}
CONSOLE_ASC->TX_BUF = ch;
}

75
src/syscalls.c Normal file
View File

@ -0,0 +1,75 @@
#include <sys/errno.h>
#include <sys/stat.h>
#include "stx7105.h"
#define CONSOLE_ASC ASC2
#define HEAP_SIZE 0x10000
extern char _end;
static uint32_t s_heap_size = 0U;
caddr_t _sbrk(int incr) {
char *heap_base = &_end;
caddr_t ret = heap_base + s_heap_size;
if (s_heap_size + incr >= HEAP_SIZE) {
return (void *)(-ENOMEM);
}
s_heap_size += incr;
return ret;
}
int _write(int file, char *ptr, int len) {
for (int i = 0; i < len; i++) {
if (ptr[i] == '\n') {
while (CONSOLE_ASC->STA & 1 << 9U) {
// wait for TX FIFO slot.
}
CONSOLE_ASC->TX_BUF = '\r';
}
while (CONSOLE_ASC->STA & 1 << 9U) {
// wait for TX FIFO slot.
}
CONSOLE_ASC->TX_BUF = ptr[i];
}
return len;
}
int _open(const char *name, int flags, int mode) {
return -1;
}
int _read(int file, char *ptr, int len) {
return 0;
}
int _lseek(int file, int ptr, int dir) {
return 0;
}
int _close(int file) {
return -1;
}
int _isatty(int file) {
return -1;
}
pid_t _getpid(void) {
return -1;
}
void _kill(int pid, int sig) {
return;
}
int _fstat(int file, struct stat *st) {
st->st_mode = S_IFCHR;
return 0;
}