Skip to content

Commit fdd11b9

Browse files
committed
Add ansibench/nbench
1 parent 86d4dd1 commit fdd11b9

29 files changed

+12913
-2
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ endif
4646

4747
all:
4848
$(Q)$(MAKE) -C src/asm-hello BUILD_DIR="$(BUILD_DIR)" RV32_EXT=$(RV32_EXT) OPT_LEVEL="$(OPT_LEVEL)" all
49+
$(Q)$(MAKE) -C src/ansibench/nbench BUILD_DIR="$(BUILD_DIR)" RV32_EXT=$(RV32_EXT) OPT_LEVEL="$(OPT_LEVEL)" all
4950

5051
include mk/common.mk
5152
include mk/toolchain.mk

mk/toolchain.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
RV32_PREFIX := riscv32-unknown-elf-
22

3-
RISCV_TOOLCHAIN_DIR := riscv-gnu-toolchain
3+
CURDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..)
4+
RISCV_TOOLCHAIN_DIR := $(CURDIR)/riscv-gnu-toolchain
45
SHELL_HACK := $(shell mkdir -p $(RISCV_TOOLCHAIN_DIR)/build/$(RV32_EXT))
56

67
CROSS_COMPILE := $(shell find $(RISCV_TOOLCHAIN_DIR)/build/$(RV32_EXT) -name $(RV32_PREFIX)gcc)
@@ -11,7 +12,7 @@ build-toolchain:
1112
ifeq ($(CROSS_COMPILE),)
1213
git submodule update --init $(RISCV_TOOLCHAIN_DIR)
1314
cd $(RISCV_TOOLCHAIN_DIR) && ./configure \
14-
--prefix=$(shell pwd)/$(RISCV_TOOLCHAIN_DIR)/build/$(RV32_EXT) \
15+
--prefix=$(RISCV_TOOLCHAIN_DIR)/build/$(RV32_EXT) \
1516
--with-arch=$(RV32_EXT) \
1617
--with-abi=ilp32 \
1718
--disable-gdb

src/ansibench/README.md

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

src/ansibench/nbench/Makefile

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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 := -c -std=c99 -I$(CURDIR)/include
8+
LDFLAGS := -lm
9+
10+
# prevent lazy set if not providing initial value
11+
ifeq ($(BUILD_DIR),)
12+
BUILD_DIR := $(CURDIR)/build
13+
endif
14+
15+
SRCS := \
16+
misc.c \
17+
sysspec.c \
18+
emfloat.c \
19+
nbench1.c \
20+
nbench0.c
21+
22+
OBJS := $(SRCS:%.c=%.o)
23+
24+
EXECUTABLES := nbench.elf
25+
26+
SHELL_HACK := $(shell mkdir -p $(foreach LEVEL,$(OPT_LEVEL),$(BUILD_DIR)/$(RV32_EXT)/O$(LEVEL)/nbench))
27+
28+
.PHONY: all clean build-O0 build-O1 build-O2
29+
30+
ifneq ($(filter $(OPT_LEVEL), 0),)
31+
all: build-O0
32+
endif
33+
34+
ifneq ($(filter $(OPT_LEVEL), 1),)
35+
all: build-O1
36+
endif
37+
38+
ifneq ($(filter $(OPT_LEVEL), 2),)
39+
all: build-O2
40+
endif
41+
42+
include ../../../mk/common.mk
43+
include ../../../mk/toolchain.mk
44+
45+
build-O0: $(addprefix $(BUILD_DIR)/$(RV32_EXT)/O0/nbench/,$(EXECUTABLES))
46+
47+
$(BUILD_DIR)/$(RV32_EXT)/O0/nbench/$(EXECUTABLES): $(addprefix $(BUILD_DIR)/$(RV32_EXT)/O0/nbench/,$(OBJS))
48+
$(VECHO) " RISCVLD\t$(patsubst $(abspath $(BUILD_DIR)/..)/%,%,$@)\n"
49+
$(Q)$(CROSS_COMPILE) -o $@ -O0 $^ $(LDFLAGS)
50+
51+
$(BUILD_DIR)/$(RV32_EXT)/O0/nbench/%.o: $(SRC_DIR)/%.c | build-toolchain
52+
$(VECHO) " RISCVCC\t$(patsubst $(abspath $(BUILD_DIR)/..)/%,%,$@)\n"
53+
$(Q)$(CROSS_COMPILE) -o $@ -O0 $(CFLAGS) $<
54+
55+
build-O1: $(addprefix $(BUILD_DIR)/$(RV32_EXT)/O1/nbench/,$(EXECUTABLES))
56+
57+
$(BUILD_DIR)/$(RV32_EXT)/O1/nbench/$(EXECUTABLES): $(addprefix $(BUILD_DIR)/$(RV32_EXT)/O1/nbench/,$(OBJS))
58+
$(VECHO) " RISCVLD\t$(patsubst $(abspath $(BUILD_DIR)/..)/%,%,$@)\n"
59+
$(Q)$(CROSS_COMPILE) -o $@ -O1 $^ $(LDFLAGS)
60+
61+
$(BUILD_DIR)/$(RV32_EXT)/O1/nbench/%.o: $(SRC_DIR)/%.c | build-toolchain
62+
$(VECHO) " RISCVCC\t$(patsubst $(abspath $(BUILD_DIR)/..)/%,%,$@)\n"
63+
$(Q)$(CROSS_COMPILE) -o $@ -O1 $(CFLAGS) $<
64+
65+
build-O2: $(addprefix $(BUILD_DIR)/$(RV32_EXT)/O2/nbench/,$(EXECUTABLES))
66+
67+
$(BUILD_DIR)/$(RV32_EXT)/O2/nbench/$(EXECUTABLES): $(addprefix $(BUILD_DIR)/$(RV32_EXT)/O2/nbench/,$(OBJS))
68+
$(VECHO) " RISCVLD\t$(patsubst $(abspath $(BUILD_DIR)/..)/%,%,$@)\n"
69+
$(Q)$(CROSS_COMPILE) -o $@ -O2 $^ $(LDFLAGS)
70+
71+
$(BUILD_DIR)/$(RV32_EXT)/O2/nbench/%.o: $(SRC_DIR)/%.c | build-toolchain
72+
$(VECHO) " RISCVCC\t$(patsubst $(abspath $(BUILD_DIR)/..)/%,%,$@)\n"
73+
$(Q)$(CROSS_COMPILE) -o $@ -O2 $(CFLAGS) $<
74+
75+
clean:
76+
$(RM) $(foreach LEVEL,$(OPT_LEVEL),$(BUILD_DIR)/$(RV32_EXT)/O$(LEVEL)/nbench/*)

src/ansibench/nbench/README

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
February 18, 2003
2+
-----------------
3+
Bug-fix release.
4+
5+
December 9, 1997
6+
----------------
7+
This release is based on beta release 2 of BYTE Magazine's BYTEmark
8+
benchmark program (previously known as BYTE's Native Mode
9+
Benchmarks). This document covers the Native Mode (a.k.a. Algorithm
10+
Level) tests; benchmarks designed to expose the capabilities of a
11+
system's CPU, FPU, and memory system.
12+
13+
Running a "make" will create the binary if all goes well. It is called
14+
"nbench" and performs a suite of 10 tests and compares the results to
15+
a Dell Pentium 90 with 16 MB RAM and 256 KB L2 cache running MSDOS and
16+
compiling with the Watcom 10.0 C/C++ compiler. If you define -DLINUX
17+
during compilation (the default) then you also get a comparison to an
18+
AMD K6/233 with 32 MB RAM and 512 KB L2-cache running Linux 2.0.32 and
19+
using a binary which was compiled with GNU gcc version 2.7.2.3 and GNU
20+
libc-5.4.38.
21+
22+
For more verbose output specify -v as an argument.
23+
24+
The primary web site is: http://www.tux.org/~mayer/linux/bmark.html
25+
26+
The port to Linux/Unix was done by Uwe F. Mayer <mayer@tux.org>.
27+
28+
The index-split was done by Andrew D. Balsa, and reflects the
29+
realization that memory management is important in CPU design. The
30+
original tests have been left alone, however, the tests NUMERIC SORT,
31+
FP EMULATION, IDEA, and HUFFMAN now constitute the integer-arithmetic
32+
focused benchmark index, while the tests STRING SORT, BITFIELD, and
33+
ASSIGNMENT make up the new memory index.
34+
35+
The algorithms were not changed from the source which was obtained
36+
from the BYTE web site at http://www.byte.com/bmark/bmark.htm on
37+
December 14, 1996. However, the source was modified to better work
38+
with 64-bit machines (in particular the random number generator was
39+
modified to always work with 32 bit, no matter what kind of hardware
40+
you run it on). Furthermore, for some of the algorithms additional
41+
resettings of the data was added to increase the consistency across
42+
different hardware. Some extra debugging code was added, which has no
43+
impact on normal runs.
44+
45+
In case there is uneven system load due to other processes while this
46+
benchmark suite executes, it might take longer to run than on an
47+
unloaded system. This is because the benchmark does some statistical
48+
analysis to make sure that the reported results are statistically
49+
significant, and an increased variation in individual runs requires
50+
more runs to achieve the required statistical confidence.
51+
52+
This is a single-threaded benchmark and is not designed to measure the
53+
performance gain on multi-processor machines.
54+
55+
For details and customization read bdoc.txt.
56+
57+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
58+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
59+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
60+
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
61+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
62+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
63+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
64+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
65+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
66+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

src/ansibench/nbench/data/NNET.DAT

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
5 7 8
2+
26
3+
0 0 1 0 0
4+
0 1 0 1 0
5+
1 0 0 0 1
6+
1 0 0 0 1
7+
1 1 1 1 1
8+
1 0 0 0 1
9+
1 0 0 0 1
10+
0 1 0 0 0 0 0 1
11+
1 1 1 1 0
12+
1 0 0 0 1
13+
1 0 0 0 1
14+
1 1 1 1 0
15+
1 0 0 0 1
16+
1 0 0 0 1
17+
1 1 1 1 0
18+
0 1 0 0 0 0 1 0
19+
0 1 1 1 0
20+
1 0 0 0 1
21+
1 0 0 0 0
22+
1 0 0 0 0
23+
1 0 0 0 0
24+
1 0 0 0 1
25+
0 1 1 1 0
26+
0 1 0 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1
101+
1 0 1 0 1
102+
1 0 1 0 1
103+
1 0 0 0 1
104+
1 0 0 0 1
105+
1 0 0 0 1
106+
0 1 0 0 1 1 0 1
107+
1 0 0 0 1
108+
1 1 0 0 1
109+
1 0 1 0 1
110+
1 0 1 0 1
111+
1 0 1 0 1
112+
1 0 0 1 1
113+
1 0 0 0 1
114+
0 1 0 0 1 1 1 0
115+
0 1 1 1 0
116+
1 0 0 0 1
117+
1 0 0 0 1
118+
1 0 0 0 1
119+
1 0 0 0 1
120+
1 0 0 0 1
121+
0 1 1 1 0
122+
0 1 0 0 1 1 1 1
123+
1 1 1 1 0
124+
1 0 0 0 1
125+
1 0 0 0 1
126+
1 1 1 1 0
127+
1 0 0 0 0
128+
1 0 0 0 0
129+
1 0 0 0 0
130+
0 1 0 1 0 0 0 0
131+
0 1 1 1 0
132+
1 0 0 0 1
133+
1 0 0 0 1
134+
1 0 0 0 1
135+
1 0 1 0 1
136+
1 0 0 1 1
137+
0 1 1 1 1
138+
0 1 0 1 0 0 0 1
139+
1 1 1 1 0
140+
1 0 0 0 1
141+
1 0 0 0 1
142+
1 1 1 1 0
143+
1 0 1 0 0
144+
1 0 0 1 0
145+
1 0 0 0 1
146+
0 1 0 1 0 0 1 0
147+
0 1 1 1 1
148+
1 0 0 0 0
149+
1 0 0 0 0
150+
0 1 1 1 0
151+
0 0 0 0 1
152+
0 0 0 0 1
153+
1 1 1 1 0
154+
0 1 0 1 0 0 1 1
155+
1 1 1 1 1
156+
0 0 1 0 0
157+
0 0 1 0 0
158+
0 0 1 0 0
159+
0 0 1 0 0
160+
0 0 1 0 0
161+
0 0 1 0 0
162+
0 1 0 1 0 1 0 0
163+
1 0 0 0 1
164+
1 0 0 0 1
165+
1 0 0 0 1
166+
1 0 0 0 1
167+
1 0 0 0 1
168+
1 0 0 0 1
169+
0 1 1 1 0
170+
0 1 0 1 0 1 0 1
171+
1 0 0 0 1
172+
1 0 0 0 1
173+
0 1 0 1 0
174+
0 1 0 1 0
175+
0 1 0 1 0
176+
0 1 0 1 0
177+
0 0 1 0 0
178+
0 1 0 1 0 1 1 0
179+
1 0 0 0 1
180+
1 0 0 0 1
181+
1 0 0 0 1
182+
1 0 1 0 1
183+
1 0 1 0 1
184+
1 0 1 0 1
185+
0 1 0 1 0
186+
0 1 0 1 0 1 1 1
187+
1 0 0 0 1
188+
0 1 0 1 0
189+
0 1 0 1 0
190+
0 0 1 0 0
191+
0 1 0 1 0
192+
0 1 0 1 0
193+
1 0 0 0 1
194+
0 1 0 1 1 0 0 0
195+
1 0 0 0 1
196+
0 1 0 1 0
197+
0 1 0 1 0
198+
0 0 1 0 0
199+
0 0 1 0 0
200+
0 0 1 0 0
201+
0 0 1 0 0
202+
0 1 0 1 1 0 0 1
203+
1 1 1 1 1
204+
0 0 0 1 0
205+
0 0 0 1 0
206+
0 0 1 0 0
207+
0 1 0 0 0
208+
0 1 0 0 0
209+
1 1 1 1 1
210+
0 1 0 1 1 0 1 0

0 commit comments

Comments
 (0)