forked from riscv-non-isa/riscv-arch-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
105 lines (87 loc) · 2.12 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#
# Ensure the compiler and necessary executables are on the search PATH
#
#
# Ensure you have set the following Variables
#
#
pipe:= |
empty:=
comma:= ,
space:= $(empty) $(empty)
export RISCV_TARGET ?= riscvOVPsim
export RISCV_DEVICE ?= rv32i
export RISCV_PREFIX ?= riscv64-unknown-elf-
export RISCV_TARGET_FLAGS ?=
export RISCV_ASSERT ?= 0
RISCV_ISA_ALL = $(shell ls $(ROOTDIR)/riscv-target/$(RISCV_TARGET)/device)
RISCV_ISA_OPT = $(subst $(space),$(pipe),$(RISCV_ISA_ALL))
ifeq ($(RISCV_ISA),)
RISCV_ISA = rv32i
DEFAULT_TARGET=all_variant
else
DEFAULT_TARGET=variant
endif
RVTEST_DEFINES =
ifeq ($(RISCV_ASSERT),1)
RVTEST_DEFINES += -DRVTEST_ASSERT
endif
export RVTEST_DEFINES
export ROOTDIR = $(shell pwd)
export WORK = $(ROOTDIR)/work
export SUITEDIR = $(ROOTDIR)/riscv-test-suite/$(RISCV_ISA)
export TARGETDIR ?= $(ROOTDIR)/riscv-target
VERBOSE ?= 0
ifeq ($(VERBOSE),1)
export V=
export REDIR=
else
export V=@
export REDIR=>/dev/null
endif
PARALLEL ?= 1
ifeq ($(RISCV_TARGET),spike)
PARALLEL = 0
endif
ifeq ($(PARALLEL),0)
JOBS =
else
ifeq ($(RISCV_TARGET),riscvOVPsim)
JOBS ?= -j8 --max-load=4
endif
endif
default: $(DEFAULT_TARGET)
variant: simulate verify
all_variant:
for isa in $(RISCV_ISA_ALL); do \
$(MAKE) $(JOBS) RISCV_TARGET=$(RISCV_TARGET) RISCV_TARGET_FLAGS="$(RISCV_TARGET_FLAGS)" RISCV_DEVICE=$$isa RISCV_ISA=$$isa variant; \
rc=$$?; \
if [ $$rc -ne 0 ]; then \
exit $$rc; \
fi \
done
simulate:
$(MAKE) $(JOBS) \
RISCV_TARGET=$(RISCV_TARGET) \
RISCV_DEVICE=$(RISCV_DEVICE) \
RISCV_PREFIX=$(RISCV_PREFIX) \
run -C $(SUITEDIR)
verify: simulate
riscv-test-env/verify.sh
cover:
riscv-test-env/cover.sh
clean:
$(MAKE) $(JOBS) \
RISCV_TARGET=$(RISCV_TARGET) \
RISCV_DEVICE=$(RISCV_DEVICE) \
RISCV_PREFIX=$(RISCV_PREFIX) \
clean -C $(SUITEDIR)
help:
@echo "eg, make"
@echo "RISCV_TARGET='riscvOVPsim|spike'"
@echo "RISCV_TARGET_FLAGS="
@echo "RISCV_DEVICE='rv32i|rv32im|...'"
@echo "RISCV_ISA='$(RISCV_ISA_OPT)'"
@echo "RISCV_TEST='I-ADD-01'"
@echo "RISCV_ASSERT=0|1"
@echo "make all_variant // all combinations"