Skip to content

Commit 1dac9bb

Browse files
committed
Add coremark
1 parent 931c59d commit 1dac9bb

File tree

13 files changed

+3267
-0
lines changed

13 files changed

+3267
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ all:
4949
$(Q)$(MAKE) -C src/asm-hello BUILD_DIR="$(BUILD_DIR)" RV32_EXT=$(RV32_EXT) OPT_LEVEL="$(OPT_LEVEL)" all
5050
$(Q)$(MAKE) -C src/cc BUILD_DIR="$(BUILD_DIR)" RV32_EXT=$(RV32_EXT) OPT_LEVEL="$(OPT_LEVEL)" all
5151
$(Q)$(MAKE) -C src/ansibench/nbench BUILD_DIR="$(BUILD_DIR)" RV32_EXT=$(RV32_EXT) OPT_LEVEL="$(OPT_LEVEL)" all
52+
$(Q)$(MAKE) -C src/ansibench/coremark BUILD_DIR="$(BUILD_DIR)" RV32_EXT=$(RV32_EXT) OPT_LEVEL="$(OPT_LEVEL)" all
5253
$(Q)$(MAKE) -C src/rv8-bench BUILD_DIR="$(BUILD_DIR)" RV32_EXT=$(RV32_EXT) OPT_LEVEL="$(OPT_LEVEL)" all
5354

5455
include mk/common.mk

src/ansibench/coremark/LICENSE.md

Lines changed: 100 additions & 0 deletions
Large diffs are not rendered by default.

src/ansibench/coremark/Makefile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
RV32_EXT ?= rv32gc
2+
OPT_LEVEL ?= 0 1 2
3+
4+
CURDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
5+
SRC_DIR := $(CURDIR)/src
6+
7+
CFLAGS := -std=c99 -I$(CURDIR)/include
8+
CFLAGS += \
9+
-DCOMPILER_FLAGS="\"-std=c99\"" \
10+
-DMEM_LOCATION="\"Main memory (heap)\"" \
11+
-DPERFORMANCE_RUN=1 \
12+
-DITERATIONS=80000 \
13+
-DUINTPTR_TYPE \
14+
-DPRINT_CRC
15+
16+
# prevent lazy set
17+
ifeq ($(BUILD_DIR),)
18+
BUILD_DIR := $(CURDIR)/build
19+
endif
20+
21+
SRCS := \
22+
core_main.c \
23+
core_matrix.c \
24+
core_list_join.c \
25+
core_state.c \
26+
core_util.c \
27+
core_portme.c
28+
29+
EXECUTABLES := coremark.elf
30+
31+
SHELL_HACK := $(shell mkdir -p $(foreach LEVEL,$(OPT_LEVEL),$(BUILD_DIR)/$(RV32_EXT)/O$(LEVEL)/coremark))
32+
33+
.PHONY: all clean build-O0 build-O1 build-O2
34+
35+
ifneq ($(filter $(OPT_LEVEL), 0),)
36+
all: build-O0
37+
endif
38+
39+
ifneq ($(filter $(OPT_LEVEL), 1),)
40+
all: build-O1
41+
endif
42+
43+
ifneq ($(filter $(OPT_LEVEL), 2),)
44+
all: build-O2
45+
endif
46+
47+
include ../../../mk/common.mk
48+
include ../../../mk/toolchain.mk
49+
50+
build-O0: $(addprefix $(BUILD_DIR)/$(RV32_EXT)/O0/coremark/,$(EXECUTABLES))
51+
52+
$(BUILD_DIR)/$(RV32_EXT)/O0/coremark/$(EXECUTABLES): $(addprefix $(SRC_DIR)/,$(SRCS)) | build-toolchain
53+
$(VECHO) " RISCVCC\t$(patsubst $(abspath $(BUILD_DIR)/..)/%,%,$@)\n"
54+
$(Q)$(CROSS_COMPILE) -o $@ -O0 $(CFLAGS) $(addprefix $(SRC_DIR)/,$(SRCS))
55+
56+
build-O1: $(addprefix $(BUILD_DIR)/$(RV32_EXT)/O1/coremark/,$(EXECUTABLES))
57+
58+
$(BUILD_DIR)/$(RV32_EXT)/O1/coremark/$(EXECUTABLES): $(addprefix $(SRC_DIR)/,$(SRCS)) | build-toolchain
59+
$(VECHO) " RISCVCC\t$(patsubst $(abspath $(BUILD_DIR)/..)/%,%,$@)\n"
60+
$(Q)$(CROSS_COMPILE) -o $@ -O1 $(CFLAGS) $(addprefix $(SRC_DIR)/,$(SRCS))
61+
62+
build-O2: $(addprefix $(BUILD_DIR)/$(RV32_EXT)/O2/coremark/,$(EXECUTABLES))
63+
64+
$(BUILD_DIR)/$(RV32_EXT)/O2/coremark/$(EXECUTABLES): $(addprefix $(SRC_DIR)/,$(SRCS)) | build-toolchain
65+
$(VECHO) " RISCVCC\t$(patsubst $(abspath $(BUILD_DIR)/..)/%,%,$@)\n"
66+
$(Q)$(CROSS_COMPILE) -o $@ -O2 $(CFLAGS) $(addprefix $(SRC_DIR)/,$(SRCS))
67+
68+
clean:
69+
$(RM) $(foreach LEVEL,$(OPT_LEVEL),$(BUILD_DIR)/$(RV32_EXT)/O$(LEVEL)/coremark/*)

src/ansibench/coremark/README.md

Lines changed: 394 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
ANSIbench platform-specific definitions for CoreMark
3+
*/
4+
5+
#ifndef CORE_PLATFORM_H
6+
#define CORE_PLATFORM_H
7+
8+
/* Linux
9+
* - USE_CLOCK=1 causes multithreaded runs under ARM Linux to not account for
10+
* all cores and thus only show single-threaded rates
11+
*/
12+
#if defined(linux) || defined(LINUX) || defined(__linux) || \
13+
defined(__LINUX) || defined(__linux__) || defined(__LINUX__) || \
14+
defined(__gnu_linux__) || defined(__GNU_LINUX__)
15+
#ifndef USE_CLOCK
16+
#define USE_CLOCK 0
17+
#endif
18+
#endif
19+
20+
/* AIX
21+
* ANSIbench has only been tested with one system running AIX 4.3
22+
*/
23+
#ifdef _AIX
24+
#endif
25+
26+
#endif /* CORE_PLATFORM_H */

0 commit comments

Comments
 (0)